Skip to content

Commit

Permalink
Merge pull request dealii#17637 from peterrum/extract_constant_modes_…
Browse files Browse the repository at this point in the history
…cm_optional

DoFTools::extract_constant_modes() and extract_rigid_body_modes(): make ComponentMask optional
  • Loading branch information
tjhei authored Sep 2, 2024
2 parents 70dd868 + c9b7fbc commit 3580053
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/step-42/step-42.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ namespace Step42
TimerOutput::Scope t(computing_timer, "Solve: setup preconditioner");

const std::vector<std::vector<bool>> constant_modes =
DoFTools::extract_constant_modes(dof_handler, ComponentMask());
DoFTools::extract_constant_modes(dof_handler);

TrilinosWrappers::PreconditionAMG::AdditionalData additional_data;
additional_data.constant_modes = constant_modes;
Expand Down
2 changes: 1 addition & 1 deletion examples/step-90/step-90.cc
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ namespace Step90
const unsigned int max_iterations = 500;
SolverControl solver_control(max_iterations, relative_error);
const std::vector<std::vector<bool>> constant_modes =
DoFTools::extract_constant_modes(dof_handler, ComponentMask());
DoFTools::extract_constant_modes(dof_handler);
TrilinosWrappers::PreconditionAMG preconditioner_stiffness;
TrilinosWrappers::PreconditionAMG::AdditionalData Amg_data;
Amg_data.constant_modes = constant_modes;
Expand Down
8 changes: 4 additions & 4 deletions include/deal.II/dofs/dof_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ namespace DoFTools
template <int dim, int spacedim>
std::vector<std::vector<bool>>
extract_constant_modes(const DoFHandler<dim, spacedim> &dof_handler,
const ComponentMask &component_mask);
const ComponentMask &component_mask = {});

/**
* Same as above.
Expand All @@ -1394,7 +1394,7 @@ namespace DoFTools
std::vector<std::vector<bool>>
extract_level_constant_modes(const unsigned int level,
const DoFHandler<dim, spacedim> &dof_handler,
const ComponentMask &component_mask);
const ComponentMask &component_mask = {});

/**
* Same as above.
Expand All @@ -1419,7 +1419,7 @@ namespace DoFTools
std::vector<std::vector<double>>
extract_rigid_body_modes(const Mapping<dim, spacedim> &mapping,
const DoFHandler<dim, spacedim> &dof_handler,
const ComponentMask &component_mask);
const ComponentMask &component_mask = {});

/**
* Same as above but for multigrid levels.
Expand All @@ -1429,7 +1429,7 @@ namespace DoFTools
extract_level_rigid_body_modes(const unsigned int level,
const Mapping<dim, spacedim> &mapping,
const DoFHandler<dim, spacedim> &dof_handler,
const ComponentMask &component_mask);
const ComponentMask &component_mask = {});
/** @} */

/**
Expand Down
1 change: 0 additions & 1 deletion source/dofs/dof_tools.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,6 @@ namespace DoFTools
const unsigned int mg_level)
{
AssertDimension(dim, spacedim);
AssertDimension(component_mask.n_selected_components(), dim);

constexpr unsigned int n_modes = RigidBodyMotion<dim>::n_modes;

Expand Down
3 changes: 1 addition & 2 deletions tests/mpi/extract_rigid_body_modes_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ test()
deallog << "Total dofs=" << dofh.n_dofs() << std::endl;

// extract constant modes and print
ComponentMask mask(fe.n_components(), true);

std::vector<std::vector<double>> constant_modes =
DoFTools::extract_rigid_body_modes(mapping, dofh, mask);
DoFTools::extract_rigid_body_modes(mapping, dofh);

for (unsigned int i = 0; i < constant_modes.size(); ++i)
{
Expand Down

0 comments on commit 3580053

Please sign in to comment.