From: Peter Munch Date: Fri, 30 Aug 2024 15:43:36 +0000 (+0200) Subject: DoFTools::extract_constant_modes() and extract_rigid_body_modes(): make ComponentMask... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F17637%2Fhead;p=dealii.git DoFTools::extract_constant_modes() and extract_rigid_body_modes(): make ComponentMask optional --- diff --git a/examples/step-42/step-42.cc b/examples/step-42/step-42.cc index c4ef650a1a..f601e1baf8 100644 --- a/examples/step-42/step-42.cc +++ b/examples/step-42/step-42.cc @@ -1623,7 +1623,7 @@ namespace Step42 TimerOutput::Scope t(computing_timer, "Solve: setup preconditioner"); const std::vector> 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; diff --git a/examples/step-90/step-90.cc b/examples/step-90/step-90.cc index c14ae9b331..d09a3b0a57 100644 --- a/examples/step-90/step-90.cc +++ b/examples/step-90/step-90.cc @@ -947,7 +947,7 @@ namespace Step90 const unsigned int max_iterations = 500; SolverControl solver_control(max_iterations, relative_error); const std::vector> 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; diff --git a/include/deal.II/dofs/dof_tools.h b/include/deal.II/dofs/dof_tools.h index 0c25937c1d..422136e0ad 100644 --- a/include/deal.II/dofs/dof_tools.h +++ b/include/deal.II/dofs/dof_tools.h @@ -1373,7 +1373,7 @@ namespace DoFTools template std::vector> extract_constant_modes(const DoFHandler &dof_handler, - const ComponentMask &component_mask); + const ComponentMask &component_mask = {}); /** * Same as above. @@ -1394,7 +1394,7 @@ namespace DoFTools std::vector> extract_level_constant_modes(const unsigned int level, const DoFHandler &dof_handler, - const ComponentMask &component_mask); + const ComponentMask &component_mask = {}); /** * Same as above. @@ -1419,7 +1419,7 @@ namespace DoFTools std::vector> extract_rigid_body_modes(const Mapping &mapping, const DoFHandler &dof_handler, - const ComponentMask &component_mask); + const ComponentMask &component_mask = {}); /** * Same as above but for multigrid levels. @@ -1429,7 +1429,7 @@ namespace DoFTools extract_level_rigid_body_modes(const unsigned int level, const Mapping &mapping, const DoFHandler &dof_handler, - const ComponentMask &component_mask); + const ComponentMask &component_mask = {}); /** @} */ /** diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 497dc3bcc8..4178e69159 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -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::n_modes; diff --git a/tests/mpi/extract_rigid_body_modes_01.cc b/tests/mpi/extract_rigid_body_modes_01.cc index 78e247c5cb..e9288a19f0 100644 --- a/tests/mpi/extract_rigid_body_modes_01.cc +++ b/tests/mpi/extract_rigid_body_modes_01.cc @@ -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> 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) {