From 6c6edc2c3398c9de72aa9ab23863956ce84cc071 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Thu, 9 Jan 2020 17:53:25 -0500 Subject: [PATCH] Multigrid Transfer cleanup - rename mg_dof argument to dof_handler everywhere - deprecate build_matrices() in favor of build() in MGTransferSelect, MGTransferComponentBase, MGTransferPrebuilt, ... to be identical to MGTransferMatrixFree - remove redundant dof,mg_dof parameters --- examples/step-16/step-16.cc | 2 +- examples/step-16b/step-16b.cc | 2 +- examples/step-39/step-39.cc | 2 +- examples/step-56/step-56.cc | 2 +- examples/step-63/step-63.cc | 2 +- include/deal.II/multigrid/mg_transfer.h | 43 ++++--- .../deal.II/multigrid/mg_transfer.templates.h | 70 +++++----- include/deal.II/multigrid/mg_transfer_block.h | 74 ++++++++--- .../multigrid/mg_transfer_block.templates.h | 24 ++-- .../deal.II/multigrid/mg_transfer_component.h | 59 ++++++++- .../deal.II/multigrid/mg_transfer_internal.h | 4 +- .../multigrid/mg_transfer_matrix_free.h | 53 ++++---- include/deal.II/multigrid/multigrid.h | 6 +- source/multigrid/mg_transfer_block.cc | 121 +++++++++++------- source/multigrid/mg_transfer_block.inst.in | 16 +++ source/multigrid/mg_transfer_component.cc | 34 ++++- .../multigrid/mg_transfer_component.inst.in | 18 +++ source/multigrid/mg_transfer_internal.cc | 73 ++++++----- source/multigrid/mg_transfer_matrix_free.cc | 24 ++-- source/multigrid/mg_transfer_prebuilt.cc | 54 +++++--- source/multigrid/mg_transfer_prebuilt.inst.in | 3 + tests/bits/step-16.cc | 2 +- tests/examples/step-56.cc | 2 +- tests/fe/transfer.cc | 2 +- tests/matrix_free/multigrid_dg_periodic.cc | 2 +- tests/matrix_free/parallel_multigrid.cc | 2 +- .../parallel_multigrid_adaptive_01.cc | 2 +- tests/matrix_free/step-37.cc | 2 +- tests/meshworker/step-50-mesh_loop.cc | 2 +- tests/mpi/multigrid_adaptive.cc | 2 +- tests/mpi/multigrid_uniform.cc | 2 +- tests/mpi/step-39-block.cc | 2 +- tests/mpi/step-39.cc | 2 +- tests/multigrid/events_01.cc | 2 +- tests/multigrid/mg_coarse_01.cc | 2 +- tests/multigrid/mg_output_dirichlet.cc | 4 +- tests/multigrid/mg_output_neumann.cc | 4 +- tests/multigrid/mg_renumbered_01.cc | 4 +- tests/multigrid/mg_renumbered_03.cc | 4 +- tests/multigrid/step-16-02.cc | 2 +- tests/multigrid/step-16-03.cc | 2 +- tests/multigrid/step-16-04.cc | 2 +- tests/multigrid/step-16-05.cc | 2 +- tests/multigrid/step-16-06.cc | 2 +- tests/multigrid/step-16-07.cc | 2 +- .../step-16-50-mpi-linear-operator.cc | 2 +- tests/multigrid/step-16-50-mpi-smoother.cc | 2 +- tests/multigrid/step-16-50-mpi.cc | 2 +- tests/multigrid/step-16-50-serial.cc | 2 +- tests/multigrid/step-16-bdry1.cc | 2 +- tests/multigrid/step-16.cc | 2 +- tests/multigrid/step-39-02.cc | 2 +- tests/multigrid/step-39-02a.cc | 2 +- tests/multigrid/step-39-03.cc | 2 +- tests/multigrid/step-39.cc | 2 +- tests/multigrid/step-50_01.cc | 2 +- tests/multigrid/step-50_02.cc | 2 +- tests/multigrid/transfer_01.cc | 2 +- tests/multigrid/transfer_02.cc | 2 +- tests/multigrid/transfer_03.cc | 4 +- tests/multigrid/transfer_04.cc | 2 +- tests/multigrid/transfer_04a.cc | 2 +- tests/multigrid/transfer_04b.cc | 2 +- tests/multigrid/transfer_block.cc | 5 +- tests/multigrid/transfer_block_select.cc | 5 +- tests/multigrid/transfer_compare_01.cc | 13 +- tests/multigrid/transfer_matrix_free_01.cc | 2 +- tests/multigrid/transfer_matrix_free_02.cc | 2 +- tests/multigrid/transfer_matrix_free_03.cc | 2 +- tests/multigrid/transfer_matrix_free_04.cc | 2 +- tests/multigrid/transfer_matrix_free_05.cc | 2 +- tests/multigrid/transfer_matrix_free_06.cc | 2 +- tests/multigrid/transfer_matrix_free_07.cc | 2 +- tests/multigrid/transfer_matrix_free_11.cc | 2 +- tests/multigrid/transfer_prebuilt_01.cc | 2 +- tests/multigrid/transfer_prebuilt_02.cc | 2 +- tests/multigrid/transfer_prebuilt_03.cc | 2 +- tests/multigrid/transfer_prebuilt_04.cc | 2 +- tests/multigrid/transfer_select.cc | 9 +- tests/multigrid/transfer_system_01.cc | 2 +- tests/multigrid/transfer_system_02.cc | 11 +- tests/multigrid/transfer_system_03.cc | 2 +- tests/multigrid/transfer_system_04.cc | 3 +- tests/multigrid/transfer_system_05.cc | 11 +- .../multigrid/transfer_system_adaptive_01.cc | 2 +- .../multigrid/transfer_system_adaptive_02.cc | 2 +- .../multigrid/transfer_system_adaptive_03.cc | 3 +- .../multigrid/transfer_system_adaptive_04.cc | 9 +- .../multigrid/transfer_system_adaptive_05.cc | 3 +- .../multigrid/transfer_system_adaptive_06.cc | 9 +- .../multigrid/transfer_system_adaptive_07.cc | 3 +- .../multigrid/transfer_system_adaptive_08.cc | 9 +- .../multigrid/transfer_system_adaptive_09.cc | 11 +- tests/trilinos/mg_transfer_prebuilt_01.cc | 2 +- 94 files changed, 558 insertions(+), 360 deletions(-) diff --git a/examples/step-16/step-16.cc b/examples/step-16/step-16.cc index 55d2074d89..c5a850d500 100644 --- a/examples/step-16/step-16.cc +++ b/examples/step-16/step-16.cc @@ -523,7 +523,7 @@ namespace Step16 void LaplaceProblem::solve() { MGTransferPrebuilt> mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(dof_handler); + mg_transfer.build(dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrices[0]); diff --git a/examples/step-16b/step-16b.cc b/examples/step-16b/step-16b.cc index 3ce9c5d7d9..4c368a89ac 100644 --- a/examples/step-16b/step-16b.cc +++ b/examples/step-16b/step-16b.cc @@ -474,7 +474,7 @@ namespace Step16 void LaplaceProblem::solve() { MGTransferPrebuilt> mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(dof_handler); + mg_transfer.build(dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrices[0]); diff --git a/examples/step-39/step-39.cc b/examples/step-39/step-39.cc index 4cdb3b1887..762c95a114 100644 --- a/examples/step-39/step-39.cc +++ b/examples/step-39/step-39.cc @@ -722,7 +722,7 @@ namespace Step39 // preconditioner. First, we need transfer between grid levels. The object // we are using here generates sparse matrices for these transfers. MGTransferPrebuilt> mg_transfer; - mg_transfer.build_matrices(dof_handler); + mg_transfer.build(dof_handler); // Then, we need an exact solver for the matrix on the coarsest level. FullMatrix coarse_matrix; diff --git a/examples/step-56/step-56.cc b/examples/step-56/step-56.cc index 81126b1614..3073d1419c 100644 --- a/examples/step-56/step-56.cc +++ b/examples/step-56/step-56.cc @@ -880,7 +880,7 @@ namespace Step56 // Transfer operators between levels MGTransferPrebuilt> mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(velocity_dof_handler); + mg_transfer.build(velocity_dof_handler); // Setup coarse grid solver FullMatrix coarse_matrix; diff --git a/examples/step-63/step-63.cc b/examples/step-63/step-63.cc index fe35743432..e86dc5734d 100644 --- a/examples/step-63/step-63.cc +++ b/examples/step-63/step-63.cc @@ -1060,7 +1060,7 @@ namespace Step63 using Transfer = MGTransferPrebuilt>; Transfer mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(dof_handler); + mg_transfer.build(dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrices[0]); diff --git a/include/deal.II/multigrid/mg_transfer.h b/include/deal.II/multigrid/mg_transfer.h index 518d244145..c40553aac3 100644 --- a/include/deal.II/multigrid/mg_transfer.h +++ b/include/deal.II/multigrid/mg_transfer.h @@ -293,7 +293,7 @@ public: */ template void - copy_to_mg(const DoFHandler &mg_dof, + copy_to_mg(const DoFHandler &dof_handler, MGLevelObject & dst, const InVector & src) const; @@ -306,7 +306,7 @@ public: */ template void - copy_from_mg(const DoFHandler &mg_dof, + copy_from_mg(const DoFHandler &dof_handler, OutVector & dst, const MGLevelObject &src) const; @@ -317,7 +317,7 @@ public: */ template void - copy_from_mg_add(const DoFHandler &mg_dof, + copy_from_mg_add(const DoFHandler &dof_handler, OutVector & dst, const MGLevelObject &src) const; @@ -357,7 +357,8 @@ protected: */ template void - fill_and_communicate_copy_indices(const DoFHandler &mg_dof); + fill_and_communicate_copy_indices( + const DoFHandler &dof_handler); /** * Sizes of the multi-level vectors. @@ -450,7 +451,7 @@ public: */ template void - copy_to_mg(const DoFHandler & mg_dof, + copy_to_mg(const DoFHandler &dof_handler, MGLevelObject> &dst, const LinearAlgebra::distributed::Vector &src) const; @@ -464,8 +465,8 @@ public: template void copy_from_mg( - const DoFHandler & mg_dof, - LinearAlgebra::distributed::Vector & dst, + const DoFHandler & dof_handler, + LinearAlgebra::distributed::Vector &dst, const MGLevelObject> &src) const; /** @@ -476,8 +477,8 @@ public: template void copy_from_mg_add( - const DoFHandler & mg_dof, - LinearAlgebra::distributed::Vector & dst, + const DoFHandler & dof_handler, + LinearAlgebra::distributed::Vector &dst, const MGLevelObject> &src) const; /** @@ -517,7 +518,7 @@ protected: */ template void - copy_to_mg(const DoFHandler & mg_dof, + copy_to_mg(const DoFHandler &dof_handler, MGLevelObject> &dst, const LinearAlgebra::distributed::Vector & src, const bool solution_transfer) const; @@ -527,7 +528,8 @@ protected: */ template void - fill_and_communicate_copy_indices(const DoFHandler &mg_dof); + fill_and_communicate_copy_indices( + const DoFHandler &dof_handler); /** * Sizes of the multi-level vectors. @@ -681,13 +683,13 @@ public: virtual ~MGTransferPrebuilt() override = default; /** - * Initialize the constraints to be used in build_matrices(). + * Initialize the constraints to be used in build(). */ void initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs); /** - * Initialize the constraints to be used in build_matrices(). + * Initialize the constraints to be used in build(). * * @deprecated @p constraints is unused. */ @@ -702,12 +704,23 @@ public: void clear(); + /** + * Actually build the information required for the transfer operations. Needs + * to be called before prolongate() or restrict_and_add() can be used. + */ + template + void + build(const DoFHandler &dof_handler); + /** * Actually build the prolongation matrices for each level. + * + * @deprecated use build() instead. */ + DEAL_II_DEPRECATED template void - build_matrices(const DoFHandler &mg_dof); + build_matrices(const DoFHandler &dof_handler); /** * Prolongate a vector from level to_level-1 to level @@ -751,7 +764,7 @@ public: DeclException0(ExcNoProlongation); /** - * You have to call build_matrices() before using this object. + * You have to call build() before using this object. */ DeclException0(ExcMatricesNotBuilt); diff --git a/include/deal.II/multigrid/mg_transfer.templates.h b/include/deal.II/multigrid/mg_transfer.templates.h index a892118498..7ed36eef19 100644 --- a/include/deal.II/multigrid/mg_transfer.templates.h +++ b/include/deal.II/multigrid/mg_transfer.templates.h @@ -56,13 +56,13 @@ namespace internal */ template void - reinit_vector(const dealii::DoFHandler &mg_dof, + reinit_vector(const dealii::DoFHandler &dof_handler, const std::vector &, MGLevelObject> &v) { for (unsigned int level = v.min_level(); level <= v.max_level(); ++level) { - unsigned int n = mg_dof.n_dofs(level); + unsigned int n = dof_handler.n_dofs(level); v[level].reinit(n); } } @@ -75,11 +75,11 @@ namespace internal */ template void - reinit_vector(const dealii::DoFHandler &mg_dof, + reinit_vector(const dealii::DoFHandler &dof_handler, std::vector target_component, MGLevelObject> & v) { - const unsigned int n_blocks = mg_dof.get_fe().n_blocks(); + const unsigned int n_blocks = dof_handler.get_fe().n_blocks(); if (target_component.size() == 0) { target_component.resize(n_blocks); @@ -93,9 +93,9 @@ namespace internal const unsigned int n_target_blocks = max_block + 1; std::vector> ndofs( - mg_dof.get_triangulation().n_levels(), + dof_handler.get_triangulation().n_levels(), std::vector(n_target_blocks)); - MGTools::count_dofs_per_block(mg_dof, ndofs, target_component); + MGTools::count_dofs_per_block(dof_handler, ndofs, target_component); for (unsigned int level = v.min_level(); level <= v.max_level(); ++level) { @@ -115,13 +115,13 @@ namespace internal */ template void - reinit_vector(const dealii::DoFHandler &mg_dof, + reinit_vector(const dealii::DoFHandler &dof_handler, const std::vector &, MGLevelObject &v) { const dealii::parallel::TriangulationBase *tria = (dynamic_cast *>( - &mg_dof.get_triangulation())); + &dof_handler.get_triangulation())); AssertThrow( tria != nullptr, ExcMessage( @@ -129,7 +129,7 @@ namespace internal for (unsigned int level = v.min_level(); level <= v.max_level(); ++level) { - v[level].reinit(mg_dof.locally_owned_mg_dofs(level), + v[level].reinit(dof_handler.locally_owned_mg_dofs(level), tria->get_communicator()); } } @@ -143,13 +143,13 @@ namespace internal */ template void - reinit_vector(const dealii::DoFHandler &mg_dof, + reinit_vector(const dealii::DoFHandler &dof_handler, const std::vector &, MGLevelObject &v) { const dealii::parallel::TriangulationBase *tria = (dynamic_cast *>( - &mg_dof.get_triangulation())); + &dof_handler.get_triangulation())); AssertThrow( tria != nullptr, ExcMessage( @@ -157,7 +157,7 @@ namespace internal for (unsigned int level = v.min_level(); level <= v.max_level(); ++level) { - v[level].reinit(mg_dof.locally_owned_mg_dofs(level), + v[level].reinit(dof_handler.locally_owned_mg_dofs(level), tria->get_communicator()); } } @@ -206,16 +206,14 @@ template template void MGLevelGlobalTransfer::copy_to_mg( - const DoFHandler &mg_dof_handler, + const DoFHandler &dof_handler, MGLevelObject & dst, const InVector & src) const { AssertIndexRange(dst.max_level(), - mg_dof_handler.get_triangulation().n_global_levels()); + dof_handler.get_triangulation().n_global_levels()); AssertIndexRange(dst.min_level(), dst.max_level() + 1); - internal::MGTransfer::reinit_vector(mg_dof_handler, - component_to_block_map, - dst); + internal::MGTransfer::reinit_vector(dof_handler, component_to_block_map, dst); #ifdef DEBUG_OUTPUT std::cout << "copy_to_mg src " << src.l2_norm() << std::endl; int ierr = MPI_Barrier(MPI_COMM_WORLD); @@ -277,13 +275,13 @@ template template void MGLevelGlobalTransfer::copy_from_mg( - const DoFHandler &mg_dof_handler, + const DoFHandler &dof_handler, OutVector & dst, const MGLevelObject &src) const { - (void)mg_dof_handler; + (void)dof_handler; AssertIndexRange(src.max_level(), - mg_dof_handler.get_triangulation().n_global_levels()); + dof_handler.get_triangulation().n_global_levels()); AssertIndexRange(src.min_level(), src.max_level() + 1); if (perform_plain_copy) { @@ -351,7 +349,7 @@ template template void MGLevelGlobalTransfer::copy_from_mg_add( - const DoFHandler & /*mg_dof_handler*/, + const DoFHandler & /*dof_handler*/, OutVector & dst, const MGLevelObject &src) const { @@ -400,11 +398,11 @@ template template void MGLevelGlobalTransfer>::copy_to_mg( - const DoFHandler & mg_dof_handler, + const DoFHandler & dof_handler, MGLevelObject> &dst, const LinearAlgebra::distributed::Vector & src) const { - copy_to_mg(mg_dof_handler, dst, src, false); + copy_to_mg(dof_handler, dst, src, false); } @@ -412,7 +410,7 @@ template template void MGLevelGlobalTransfer>::copy_to_mg( - const DoFHandler & mg_dof_handler, + const DoFHandler & dof_handler, MGLevelObject> &dst, const LinearAlgebra::distributed::Vector & src, const bool solution_transfer) const @@ -425,29 +423,29 @@ MGLevelGlobalTransfer>::copy_to_mg( solution_transfer ? solution_copy_indices_level_mine : copy_indices_level_mine; - (void)mg_dof_handler; + (void)dof_handler; AssertIndexRange(dst.max_level(), - mg_dof_handler.get_triangulation().n_global_levels()); + dof_handler.get_triangulation().n_global_levels()); AssertIndexRange(dst.min_level(), dst.max_level() + 1); for (unsigned int level = dst.min_level(); level <= dst.max_level(); ++level) - if (dst[level].size() != mg_dof_handler.n_dofs(level) || + if (dst[level].size() != dof_handler.n_dofs(level) || dst[level].local_size() != - mg_dof_handler.locally_owned_mg_dofs(level).n_elements()) + dof_handler.locally_owned_mg_dofs(level).n_elements()) { // In case a ghosted level vector has been initialized, we can simply // use that as a template for the vector partitioning. If not, we // resort to the locally owned range of the dof handler. if (level <= ghosted_level_vector.max_level() && - ghosted_level_vector[level].size() == mg_dof_handler.n_dofs(level)) + ghosted_level_vector[level].size() == dof_handler.n_dofs(level)) dst[level].reinit(ghosted_level_vector[level], false); else { const parallel::TriangulationBase *tria = (dynamic_cast *>( - &mg_dof_handler.get_triangulation())); - dst[level].reinit(mg_dof_handler.locally_owned_mg_dofs(level), + &dof_handler.get_triangulation())); + dst[level].reinit(dof_handler.locally_owned_mg_dofs(level), tria != nullptr ? tria->get_communicator() : MPI_COMM_SELF); } @@ -518,13 +516,13 @@ template template void MGLevelGlobalTransfer>::copy_from_mg( - const DoFHandler & mg_dof_handler, - LinearAlgebra::distributed::Vector &dst, + const DoFHandler & dof_handler, + LinearAlgebra::distributed::Vector & dst, const MGLevelObject> &src) const { - (void)mg_dof_handler; + (void)dof_handler; AssertIndexRange(src.max_level(), - mg_dof_handler.get_triangulation().n_global_levels()); + dof_handler.get_triangulation().n_global_levels()); AssertIndexRange(src.min_level(), src.max_level() + 1); if (perform_plain_copy) { @@ -593,7 +591,7 @@ template void MGLevelGlobalTransfer>:: copy_from_mg_add( - const DoFHandler & /*mg_dof_handler*/, + const DoFHandler & /*dof_handler*/, LinearAlgebra::distributed::Vector & dst, const MGLevelObject> &src) const { diff --git a/include/deal.II/multigrid/mg_transfer_block.h b/include/deal.II/multigrid/mg_transfer_block.h index a601312367..9ebc8fea59 100644 --- a/include/deal.II/multigrid/mg_transfer_block.h +++ b/include/deal.II/multigrid/mg_transfer_block.h @@ -99,6 +99,20 @@ protected: */ template void + build(const DoFHandler &dof_handler); + + /** + * Actually build the prolongation matrices for each level. + * + * This function is only called by derived classes. These can also set the + * member variables #selected and others to restrict the transfer matrices + * to certain blocks. + * + * @deprecated Use build() instead. + */ + DEAL_II_DEPRECATED + template + void build_matrices(const DoFHandler &dof, const DoFHandler &mg_dof); @@ -143,7 +157,7 @@ protected: std::vector> mg_block_start; /** - * Call build_matrices() function first. + * Call build() function first. */ DeclException0(ExcMatricesNotBuilt); @@ -225,6 +239,20 @@ public: */ template void + build(const DoFHandler &dof_handler, + const std::vector & selected); + + /** + * Build the prolongation matrices for each level. + * + * This function is a front-end for the same function in + * MGTransferBlockBase. + * + * @deprecated Use the build() function instead. + */ + DEAL_II_DEPRECATED + template + void build_matrices(const DoFHandler &dof, const DoFHandler &mg_dof, const std::vector & selected); @@ -252,7 +280,7 @@ public: */ template void - copy_to_mg(const DoFHandler & mg_dof, + copy_to_mg(const DoFHandler & dof_handler, MGLevelObject> &dst, const BlockVector & src) const; @@ -264,7 +292,7 @@ public: */ template void - copy_from_mg(const DoFHandler & mg_dof, + copy_from_mg(const DoFHandler & dof_handler, BlockVector & dst, const MGLevelObject> &src) const; @@ -275,7 +303,7 @@ public: */ template void - copy_from_mg_add(const DoFHandler & mg_dof, + copy_from_mg_add(const DoFHandler & dof_handler, BlockVector & dst, const MGLevelObject> &src) const; @@ -346,12 +374,26 @@ public: * This function is a front-end for the same function in * MGTransferBlockBase. * - * @arg selected: Number of the block of the global vector to be copied from + * @param dof_handler The DoFHandler to use. + * @param selected Number of the block for which the transfer matrices + * should be built. + */ + template + void + build(const DoFHandler &dof_handler, unsigned int selected); + + /** + * Actually build the prolongation matrices for grouped blocks. + * + * This function is a front-end for the same function in + * MGTransferBlockBase. + * + * @param selected Number of the block of the global vector to be copied from * and to the multilevel vector. * - * @arg mg_selected: Number of the component for which the transfer matrices - * should be built. + * @deprecated Use build() instead. */ + DEAL_II_DEPRECATED template void build_matrices(const DoFHandler &dof, @@ -382,7 +424,7 @@ public: */ template void - copy_to_mg(const DoFHandler &mg_dof, + copy_to_mg(const DoFHandler &dof_handler, MGLevelObject> & dst, const Vector & src) const; @@ -394,7 +436,7 @@ public: */ template void - copy_from_mg(const DoFHandler & mg_dof, + copy_from_mg(const DoFHandler & dof_handler, Vector & dst, const MGLevelObject> &src) const; @@ -405,7 +447,7 @@ public: */ template void - copy_from_mg_add(const DoFHandler & mg_dof, + copy_from_mg_add(const DoFHandler & dof_handler, Vector & dst, const MGLevelObject> &src) const; @@ -418,7 +460,7 @@ public: */ template void - copy_to_mg(const DoFHandler &mg_dof, + copy_to_mg(const DoFHandler &dof_handler, MGLevelObject> & dst, const BlockVector & src) const; @@ -430,7 +472,7 @@ public: */ template void - copy_from_mg(const DoFHandler & mg_dof, + copy_from_mg(const DoFHandler & dof_handler, BlockVector & dst, const MGLevelObject> &src) const; @@ -441,7 +483,7 @@ public: */ template void - copy_from_mg_add(const DoFHandler & mg_dof, + copy_from_mg_add(const DoFHandler & dof_handler, BlockVector & dst, const MGLevelObject> &src) const; @@ -457,7 +499,7 @@ private: */ template void - do_copy_from_mg(const DoFHandler & mg_dof, + do_copy_from_mg(const DoFHandler & dof_handler, OutVector & dst, const MGLevelObject> &src, const unsigned int offset) const; @@ -467,7 +509,7 @@ private: */ template void - do_copy_from_mg_add(const DoFHandler & mg_dof, + do_copy_from_mg_add(const DoFHandler & dof_handler, OutVector & dst, const MGLevelObject> &src, const unsigned int offset) const; @@ -477,7 +519,7 @@ private: */ template void - do_copy_to_mg(const DoFHandler &mg_dof, + do_copy_to_mg(const DoFHandler &dof_handler, MGLevelObject> & dst, const InVector & src, const unsigned int offset) const; diff --git a/include/deal.II/multigrid/mg_transfer_block.templates.h b/include/deal.II/multigrid/mg_transfer_block.templates.h index 1a212459e3..3a0cb93086 100644 --- a/include/deal.II/multigrid/mg_transfer_block.templates.h +++ b/include/deal.II/multigrid/mg_transfer_block.templates.h @@ -46,12 +46,12 @@ template template void MGTransferBlockSelect::copy_from_mg( - const DoFHandler & mg_dof_handler, + const DoFHandler & dof_handler, BlockVector & dst, const MGLevelObject> &src) const { for (unsigned int level = 0; - level < mg_dof_handler.get_triangulation().n_levels(); + level < dof_handler.get_triangulation().n_levels(); ++level) for (IT i = copy_indices[selected_block][level].begin(); i != copy_indices[selected_block][level].end(); @@ -65,12 +65,12 @@ template template void MGTransferBlockSelect::copy_from_mg( - const DoFHandler & mg_dof_handler, + const DoFHandler & dof_handler, Vector & dst, const MGLevelObject> &src) const { for (unsigned int level = 0; - level < mg_dof_handler.get_triangulation().n_levels(); + level < dof_handler.get_triangulation().n_levels(); ++level) for (IT i = copy_indices[selected_block][level].begin(); i != copy_indices[selected_block][level].end(); @@ -84,12 +84,12 @@ template template void MGTransferBlockSelect::copy_from_mg_add( - const DoFHandler & mg_dof_handler, + const DoFHandler & dof_handler, BlockVector & dst, const MGLevelObject> &src) const { for (unsigned int level = 0; - level < mg_dof_handler.get_triangulation().n_levels(); + level < dof_handler.get_triangulation().n_levels(); ++level) for (IT i = copy_indices[selected_block][level].begin(); i != copy_indices[selected_block][level].end(); @@ -103,12 +103,12 @@ template template void MGTransferBlockSelect::copy_from_mg_add( - const DoFHandler & mg_dof_handler, + const DoFHandler & dof_handler, Vector & dst, const MGLevelObject> &src) const { for (unsigned int level = 0; - level < mg_dof_handler.get_triangulation().n_levels(); + level < dof_handler.get_triangulation().n_levels(); ++level) for (IT i = copy_indices[selected_block][level].begin(); i != copy_indices[selected_block][level].end(); @@ -134,14 +134,14 @@ template template void MGTransferBlock::copy_from_mg( - const DoFHandler & mg_dof_handler, + const DoFHandler & dof_handler, BlockVector & dst, const MGLevelObject> &src) const { for (unsigned int block = 0; block < selected.size(); ++block) if (selected[block]) for (unsigned int level = 0; - level < mg_dof_handler.get_triangulation().n_levels(); + level < dof_handler.get_triangulation().n_levels(); ++level) for (IT i = copy_indices[block][level].begin(); i != copy_indices[block][level].end(); @@ -156,14 +156,14 @@ template template void MGTransferBlock::copy_from_mg_add( - const DoFHandler & mg_dof_handler, + const DoFHandler & dof_handler, BlockVector & dst, const MGLevelObject> &src) const { for (unsigned int block = 0; block < selected.size(); ++block) if (selected[block]) for (unsigned int level = 0; - level < mg_dof_handler.get_triangulation().n_levels(); + level < dof_handler.get_triangulation().n_levels(); ++level) for (IT i = copy_indices[block][level].begin(); i != copy_indices[block][level].end(); diff --git a/include/deal.II/multigrid/mg_transfer_component.h b/include/deal.II/multigrid/mg_transfer_component.h index 82dbe7f1ac..6e1f390fc8 100644 --- a/include/deal.II/multigrid/mg_transfer_component.h +++ b/include/deal.II/multigrid/mg_transfer_component.h @@ -83,6 +83,23 @@ protected: */ template void + build(const DoFHandler &dof_handler); + + /** + * Actually build the prolongation matrices for each level. + * + * This function is only called by derived classes. These can also set the + * member variables selected_component and + * mg_selected_component member variables to restrict the + * transfer matrices to certain components. Furthermore, they use + * target_component and mg_target_component for + * re-ordering and grouping of components. + * + * @deprecated Use build() instead. + */ + DEAL_II_DEPRECATED + template + void build_matrices(const DoFHandler &dof, const DoFHandler &mg_dof); @@ -130,7 +147,7 @@ protected: std::vector> mg_component_start; /** - * Call build_matrices() function first. + * Call build() function first. */ DeclException0(ExcMatricesNotBuilt); @@ -220,7 +237,10 @@ public: * It also affects the behavior of the selected argument * * @arg boundary_indices: holds the boundary indices on each level. + * + * @deprecated Use build() instead. */ + DEAL_II_DEPRECATED template void build_matrices( @@ -235,6 +255,43 @@ public: const std::vector> &boundary_indices = std::vector>()); + /** + * Actually build the prolongation matrices for grouped components. + * + * This function is a front-end for the same function in + * MGTransferComponentBase. + * + * @arg selected Number of the block of the global vector to be copied from + * and to the multilevel vector. This number refers to the renumbering by + * target_component. + * + * @arg mg_selected Number of the block for which the transfer matrices + * should be built. + * + * If mg_target_component is present, this refers to the renumbered + * components. + * + * @arg target_component this argument allows grouping and renumbering of + * components in the fine-level vector (see DoFRenumbering::component_wise). + * + * @arg mg_target_component this argument allows grouping and renumbering + * of components in the level vectors (see DoFRenumbering::component_wise). + * It also affects the behavior of the selected argument + * + * @arg boundary_indices holds the boundary indices on each level. + */ + template + void + build(const DoFHandler &dof, + unsigned int selected, + unsigned int mg_selected, + const std::vector &target_component = + std::vector(), + const std::vector &mg_target_component = + std::vector(), + const std::vector> &boundary_indices = + std::vector>()); + /** * Change selected component. Handle with care! */ diff --git a/include/deal.II/multigrid/mg_transfer_internal.h b/include/deal.II/multigrid/mg_transfer_internal.h index b196d2d53e..9aa52089c6 100644 --- a/include/deal.II/multigrid/mg_transfer_internal.h +++ b/include/deal.II/multigrid/mg_transfer_internal.h @@ -44,7 +44,7 @@ namespace internal template void fill_copy_indices( - const DoFHandler &mg_dof, + const DoFHandler &dof_handler, const MGConstrainedDoFs * mg_constrained_dofs, std::vector>> @@ -122,7 +122,7 @@ namespace internal template void setup_transfer( - const DoFHandler & mg_dof, + const DoFHandler & dof_handler, const MGConstrainedDoFs *mg_constrained_dofs, const std::vector> & external_partitioners, diff --git a/include/deal.II/multigrid/mg_transfer_matrix_free.h b/include/deal.II/multigrid/mg_transfer_matrix_free.h index a3d02ee30c..a44ce2e600 100644 --- a/include/deal.II/multigrid/mg_transfer_matrix_free.h +++ b/include/deal.II/multigrid/mg_transfer_matrix_free.h @@ -103,7 +103,7 @@ public: * ignored and internal variants are used instead. */ void - build(const DoFHandler &mg_dof, + build(const DoFHandler &dof_handler, const std::vector> &external_partitioners = std::vector>()); @@ -153,7 +153,7 @@ public: const LinearAlgebra::distributed::Vector &src) const override; /** - * Restrict fine-mesh field @p src to each multigrid level in @p mg_dof and + * Restrict fine-mesh field @p src to each multigrid level in @p dof_handler and * store the result in @p dst. * * If @p dst is empty or has incorrect locally owned size, it will be @@ -162,7 +162,7 @@ public: template void interpolate_to_mg( - const DoFHandler & mg_dof, + const DoFHandler & dof_handler, MGLevelObject> &dst, const LinearAlgebra::distributed::Vector & src) const; @@ -357,13 +357,13 @@ public: * Actually build the information for the prolongation for each level. */ void - build(const DoFHandler &mg_dof); + build(const DoFHandler &dof_handler); /** * Same as above for the case that each block has its own DoFHandler. */ void - build(const std::vector *> &mg_dof); + build(const std::vector *> &dof_handler); /** * Prolongate a vector from level to_level-1 to level @@ -422,7 +422,7 @@ public: template void copy_to_mg( - const DoFHandler & mg_dof, + const DoFHandler & dof_handler, MGLevelObject> &dst, const LinearAlgebra::distributed::BlockVector & src) const; @@ -432,7 +432,7 @@ public: template void copy_to_mg( - const std::vector *> & mg_dof, + const std::vector *> & dof_handler, MGLevelObject> &dst, const LinearAlgebra::distributed::BlockVector & src) const; @@ -442,7 +442,7 @@ public: template void copy_from_mg( - const DoFHandler & mg_dof, + const DoFHandler & dof_handler, LinearAlgebra::distributed::BlockVector &dst, const MGLevelObject> &src) const; @@ -453,7 +453,7 @@ public: template void copy_from_mg( - const std::vector *> &mg_dof, + const std::vector *> &dof_handler, LinearAlgebra::distributed::BlockVector & dst, const MGLevelObject> &src) const; @@ -594,7 +594,7 @@ template template void MGTransferBlockMatrixFree::copy_to_mg( - const DoFHandler & mg_dof, + const DoFHandler & dof_handler, MGLevelObject> &dst, const LinearAlgebra::distributed::BlockVector & src) const { @@ -605,7 +605,7 @@ MGTransferBlockMatrixFree::copy_to_mg( "DoFHandler for each block, but this method assumes that " "the same DoFHandler is used for all the blocks!")); const std::vector *> mg_dofs(src.n_blocks(), - &mg_dof); + &dof_handler); copy_to_mg(mg_dofs, dst, src); } @@ -614,12 +614,12 @@ template template void MGTransferBlockMatrixFree::copy_to_mg( - const std::vector *> & mg_dof, + const std::vector *> & dof_handler, MGLevelObject> &dst, const LinearAlgebra::distributed::BlockVector & src) const { const unsigned int n_blocks = src.n_blocks(); - AssertDimension(mg_dof.size(), n_blocks); + AssertDimension(dof_handler.size(), n_blocks); if (n_blocks == 0) return; @@ -633,11 +633,11 @@ MGTransferBlockMatrixFree::copy_to_mg( { const parallel::TriangulationBase *tria = (dynamic_cast *>( - &(mg_dof[0]->get_triangulation()))); + &(dof_handler[0]->get_triangulation()))); for (unsigned int i = 1; i < n_blocks; ++i) AssertThrow( (dynamic_cast *>( - &(mg_dof[0]->get_triangulation())) == tria), + &(dof_handler[0]->get_triangulation())) == tria), ExcMessage("The DoFHandler use different Triangulations!")); MGLevelObject do_reinit; @@ -653,9 +653,10 @@ MGTransferBlockMatrixFree::copy_to_mg( for (unsigned int b = 0; b < n_blocks; ++b) { LinearAlgebra::distributed::Vector &v = dst[level].block(b); - if (v.size() != mg_dof[b]->locally_owned_mg_dofs(level).size() || + if (v.size() != + dof_handler[b]->locally_owned_mg_dofs(level).size() || v.local_size() != - mg_dof[b]->locally_owned_mg_dofs(level).n_elements()) + dof_handler[b]->locally_owned_mg_dofs(level).n_elements()) { do_reinit[level] = true; break; // b @@ -672,7 +673,7 @@ MGTransferBlockMatrixFree::copy_to_mg( { LinearAlgebra::distributed::Vector &v = dst[level].block(b); - v.reinit(mg_dof[b]->locally_owned_mg_dofs(level), + v.reinit(dof_handler[b]->locally_owned_mg_dofs(level), tria != nullptr ? tria->get_communicator() : MPI_COMM_SELF); } @@ -692,7 +693,7 @@ MGTransferBlockMatrixFree::copy_to_mg( for (unsigned int l = min_level; l <= max_level; ++l) dst_non_block[l].reinit(dst[l].block(b)); const unsigned int data_block = same_for_all ? 0 : b; - matrix_free_transfer_vector[data_block].copy_to_mg(*mg_dof[b], + matrix_free_transfer_vector[data_block].copy_to_mg(*dof_handler[b], dst_non_block, src.block(b)); @@ -705,14 +706,14 @@ template template void MGTransferBlockMatrixFree::copy_from_mg( - const DoFHandler & mg_dof, - LinearAlgebra::distributed::BlockVector & dst, + const DoFHandler & dof_handler, + LinearAlgebra::distributed::BlockVector &dst, const MGLevelObject> &src) const { AssertDimension(matrix_free_transfer_vector.size(), 1); const std::vector *> mg_dofs(dst.n_blocks(), - &mg_dof); + &dof_handler); copy_from_mg(mg_dofs, dst, src); } @@ -721,13 +722,13 @@ template template void MGTransferBlockMatrixFree::copy_from_mg( - const std::vector *> & mg_dof, - LinearAlgebra::distributed::BlockVector & dst, + const std::vector *> &dof_handler, + LinearAlgebra::distributed::BlockVector & dst, const MGLevelObject> &src) const { const unsigned int n_blocks = dst.n_blocks(); - AssertDimension(mg_dof.size(), n_blocks); + AssertDimension(dof_handler.size(), n_blocks); if (n_blocks == 0) return; @@ -750,7 +751,7 @@ MGTransferBlockMatrixFree::copy_from_mg( src_non_block[l] = src[l].block(b); } const unsigned int data_block = same_for_all ? 0 : b; - matrix_free_transfer_vector[data_block].copy_from_mg(*mg_dof[b], + matrix_free_transfer_vector[data_block].copy_from_mg(*dof_handler[b], dst.block(b), src_non_block); } diff --git a/include/deal.II/multigrid/multigrid.h b/include/deal.II/multigrid/multigrid.h index 7c738ea95d..0a9d3984dc 100644 --- a/include/deal.II/multigrid/multigrid.h +++ b/include/deal.II/multigrid/multigrid.h @@ -172,7 +172,7 @@ public: #ifndef _MSC_VER DEAL_II_DEPRECATED #endif - Multigrid(const DoFHandler & mg_dof_handler, + Multigrid(const DoFHandler & dof_handler, const MGMatrixBase & matrix, const MGCoarseGridBase &coarse, const MGTransferBase & transfer, @@ -638,7 +638,7 @@ private: template template -Multigrid::Multigrid(const DoFHandler & mg_dof_handler, +Multigrid::Multigrid(const DoFHandler & dof_handler, const MGMatrixBase &matrix, const MGCoarseGridBase &coarse, const MGTransferBase & transfer, @@ -659,7 +659,7 @@ Multigrid::Multigrid(const DoFHandler & mg_dof_handler, , debug(0) { const unsigned int dof_handler_max_level = - mg_dof_handler.get_triangulation().n_global_levels() - 1; + dof_handler.get_triangulation().n_global_levels() - 1; if (max_level == numbers::invalid_unsigned_int) maxlevel = dof_handler_max_level; else diff --git a/source/multigrid/mg_transfer_block.cc b/source/multigrid/mg_transfer_block.cc index 8680f9cd1c..388718b0bc 100644 --- a/source/multigrid/mg_transfer_block.cc +++ b/source/multigrid/mg_transfer_block.cc @@ -52,7 +52,7 @@ namespace template void reinit_vector_by_blocks( - const dealii::DoFHandler & mg_dof, + const dealii::DoFHandler & dof_handler, MGLevelObject> & v, const std::vector & sel, std::vector> &ndofs) @@ -65,10 +65,10 @@ namespace if (ndofs.size() == 0) { std::vector> new_dofs( - mg_dof.get_triangulation().n_levels(), + dof_handler.get_triangulation().n_levels(), std::vector(selected.size())); std::swap(ndofs, new_dofs); - MGTools::count_dofs_per_block(mg_dof, ndofs); + MGTools::count_dofs_per_block(dof_handler, ndofs); } for (unsigned int level = v.min_level(); level <= v.max_level(); ++level) @@ -98,12 +98,12 @@ namespace template void reinit_vector_by_blocks( - const dealii::DoFHandler & mg_dof, + const dealii::DoFHandler & dof_handler, MGLevelObject> & v, const unsigned int selected_block, std::vector> &ndofs) { - const unsigned int n_blocks = mg_dof.get_fe().n_blocks(); + const unsigned int n_blocks = dof_handler.get_fe().n_blocks(); AssertIndexRange(selected_block, n_blocks); std::vector selected(n_blocks, false); @@ -112,10 +112,10 @@ namespace if (ndofs.size() == 0) { std::vector> new_dofs( - mg_dof.get_triangulation().n_levels(), + dof_handler.get_triangulation().n_levels(), std::vector(selected.size())); std::swap(ndofs, new_dofs); - MGTools::count_dofs_per_block(mg_dof, ndofs); + MGTools::count_dofs_per_block(dof_handler, ndofs); } for (unsigned int level = v.min_level(); level <= v.max_level(); ++level) @@ -130,16 +130,16 @@ template template void MGTransferBlockSelect::copy_to_mg( - const DoFHandler &mg_dof_handler, + const DoFHandler &dof_handler, MGLevelObject> & dst, const BlockVector & src) const { - reinit_vector_by_blocks(mg_dof_handler, dst, selected_block, sizes); + reinit_vector_by_blocks(dof_handler, dst, selected_block, sizes); // For MGTransferBlockSelect, the // multilevel block is always the // first, since only one block is // selected. - for (unsigned int level = mg_dof_handler.get_triangulation().n_levels(); + for (unsigned int level = dof_handler.get_triangulation().n_levels(); level != 0;) { --level; @@ -156,15 +156,15 @@ template template void MGTransferBlockSelect::copy_to_mg( - const DoFHandler &mg_dof_handler, + const DoFHandler &dof_handler, MGLevelObject> & dst, const Vector & src) const { - reinit_vector_by_blocks(mg_dof_handler, dst, selected_block, sizes); + reinit_vector_by_blocks(dof_handler, dst, selected_block, sizes); // For MGTransferBlockSelect, the // multilevel block is always the // first, since only one block is selected. - for (unsigned int level = mg_dof_handler.get_triangulation().n_levels(); + for (unsigned int level = dof_handler.get_triangulation().n_levels(); level != 0;) { --level; @@ -181,12 +181,12 @@ template template void MGTransferBlock::copy_to_mg( - const DoFHandler & mg_dof_handler, + const DoFHandler & dof_handler, MGLevelObject> &dst, const BlockVector & src) const { - reinit_vector_by_blocks(mg_dof_handler, dst, selected, sizes); - for (unsigned int level = mg_dof_handler.get_triangulation().n_levels(); + reinit_vector_by_blocks(dof_handler, dst, selected, sizes); + for (unsigned int level = dof_handler.get_triangulation().n_levels(); level != 0;) { --level; @@ -204,13 +204,23 @@ MGTransferBlock::copy_to_mg( template void -MGTransferBlockBase::build_matrices(const DoFHandler &, - const DoFHandler &mg_dof) +MGTransferBlockBase::build_matrices( + const DoFHandler &dof, + const DoFHandler &mg_dof_handler) +{ + build(mg_dof_handler); +} + + + +template +void +MGTransferBlockBase::build(const DoFHandler &dof_handler) { - const FiniteElement &fe = mg_dof.get_fe(); + const FiniteElement &fe = dof_handler.get_fe(); const unsigned int n_blocks = fe.n_blocks(); const unsigned int dofs_per_cell = fe.dofs_per_cell; - const unsigned int n_levels = mg_dof.get_triangulation().n_levels(); + const unsigned int n_levels = dof_handler.get_triangulation().n_levels(); Assert(selected.size() == n_blocks, ExcDimensionMismatch(selected.size(), n_blocks)); @@ -229,7 +239,7 @@ MGTransferBlockBase::build_matrices(const DoFHandler &, // Compute the lengths of all blocks sizes.clear(); sizes.resize(n_levels, std::vector(fe.n_blocks())); - MGTools::count_dofs_per_block(mg_dof, sizes); + MGTools::count_dofs_per_block(dof_handler, sizes); // Fill some index vectors // for later use. @@ -248,7 +258,7 @@ MGTransferBlockBase::build_matrices(const DoFHandler &, block_start.resize(n_blocks); DoFTools::count_dofs_per_block( - static_cast &>(mg_dof), block_start); + static_cast &>(dof_handler), block_start); types::global_dof_index k = 0; for (types::global_dof_index &first_index : block_start) @@ -328,8 +338,8 @@ MGTransferBlockBase::build_matrices(const DoFHandler &, prolongation_sparsities[level]->collect_sizes(); for (typename DoFHandler::cell_iterator cell = - mg_dof.begin(level); - cell != mg_dof.end(level); + dof_handler.begin(level); + cell != dof_handler.end(level); ++cell) if (cell->has_children()) { @@ -344,7 +354,7 @@ MGTransferBlockBase::build_matrices(const DoFHandler &, // prolongation matrix for // this child const FullMatrix &prolongation = - mg_dof.get_fe().get_prolongation_matrix( + dof_handler.get_fe().get_prolongation_matrix( child, cell->refinement_case()); cell->child(child)->get_mg_dof_indices(dof_indices_child); @@ -371,8 +381,8 @@ MGTransferBlockBase::build_matrices(const DoFHandler &, prolongation_matrices[level]->reinit(*prolongation_sparsities[level]); // now actually build the matrices for (typename DoFHandler::cell_iterator cell = - mg_dof.begin(level); - cell != mg_dof.end(level); + dof_handler.begin(level); + cell != dof_handler.end(level); ++cell) if (cell->has_children()) { @@ -387,7 +397,7 @@ MGTransferBlockBase::build_matrices(const DoFHandler &, // prolongation matrix for // this child const FullMatrix &prolongation = - mg_dof.get_fe().get_prolongation_matrix( + dof_handler.get_fe().get_prolongation_matrix( child, cell->refinement_case()); cell->child(child)->get_mg_dof_indices(dof_indices_child); @@ -468,35 +478,44 @@ MGTransferBlockBase::build_matrices(const DoFHandler &, } } - - template template void MGTransferBlockSelect::build_matrices( - const DoFHandler &dof, + const DoFHandler & /*dof*/, const DoFHandler &mg_dof, unsigned int select) { - const FiniteElement &fe = mg_dof.get_fe(); - unsigned int n_blocks = mg_dof.get_fe().n_blocks(); + build(mg_dof, select); +} + +template +template +void +MGTransferBlockSelect::build( + const DoFHandler &dof_handler, + unsigned int select) +{ + const FiniteElement &fe = dof_handler.get_fe(); + unsigned int n_blocks = dof_handler.get_fe().n_blocks(); selected_block = select; selected.resize(n_blocks, false); selected[select] = true; - MGTransferBlockBase::build_matrices(dof, mg_dof); + MGTransferBlockBase::build(dof_handler); std::vector temp_copy_indices; std::vector global_dof_indices(fe.dofs_per_cell); std::vector level_dof_indices(fe.dofs_per_cell); - for (int level = dof.get_triangulation().n_levels() - 1; level >= 0; --level) + for (int level = dof_handler.get_triangulation().n_levels() - 1; level >= 0; + --level) { typename DoFHandler::active_cell_iterator level_cell = - mg_dof.begin_active(level); + dof_handler.begin_active(level); const typename DoFHandler::active_cell_iterator level_end = - mg_dof.end_active(level); + dof_handler.end_active(level); temp_copy_indices.resize(0); temp_copy_indices.resize(sizes[level][selected_block], @@ -558,16 +577,25 @@ MGTransferBlockSelect::build_matrices( } +template +template +void +MGTransferBlock::build_matrices( + const DoFHandler & /*dof*/, + const DoFHandler &mg_dof, + const std::vector & sel) +{ + build(mg_dof, sel); +} template template void -MGTransferBlock::build_matrices(const DoFHandler &dof, - const DoFHandler &mg_dof, - const std::vector & sel) +MGTransferBlock::build(const DoFHandler &dof_handler, + const std::vector & sel) { - const FiniteElement &fe = mg_dof.get_fe(); - unsigned int n_blocks = mg_dof.get_fe().n_blocks(); + const FiniteElement &fe = dof_handler.get_fe(); + unsigned int n_blocks = dof_handler.get_fe().n_blocks(); if (sel.size() != 0) { @@ -578,17 +606,18 @@ MGTransferBlock::build_matrices(const DoFHandler &dof, if (selected.size() == 0) selected = std::vector(n_blocks, true); - MGTransferBlockBase::build_matrices(dof, mg_dof); + MGTransferBlockBase::build(dof_handler); std::vector> temp_copy_indices(n_blocks); std::vector global_dof_indices(fe.dofs_per_cell); std::vector level_dof_indices(fe.dofs_per_cell); - for (int level = dof.get_triangulation().n_levels() - 1; level >= 0; --level) + for (int level = dof_handler.get_triangulation().n_levels() - 1; level >= 0; + --level) { typename DoFHandler::active_cell_iterator level_cell = - mg_dof.begin_active(level); + dof_handler.begin_active(level); const typename DoFHandler::active_cell_iterator level_end = - mg_dof.end_active(level); + dof_handler.end_active(level); for (unsigned int block = 0; block < n_blocks; ++block) if (selected[block]) diff --git a/source/multigrid/mg_transfer_block.inst.in b/source/multigrid/mg_transfer_block.inst.in index c6637bb728..9d14e8adb6 100644 --- a/source/multigrid/mg_transfer_block.inst.in +++ b/source/multigrid/mg_transfer_block.inst.in @@ -17,21 +17,37 @@ for (deal_II_dimension : DIMENSIONS) { + template void MGTransferBlock::build( + const DoFHandler &, const std::vector &); + + template void MGTransferBlock::build( + const DoFHandler &, const std::vector &); + + template void MGTransferBlockSelect::build( + const DoFHandler &, const unsigned int); + + template void MGTransferBlockSelect::build( + const DoFHandler &, const unsigned int); + + // deprecated: template void MGTransferBlock::build_matrices( const DoFHandler &, const DoFHandler &, const std::vector &); + // deprecated: template void MGTransferBlock::build_matrices( const DoFHandler &, const DoFHandler &, const std::vector &); + // deprecated: template void MGTransferBlockSelect::build_matrices< deal_II_dimension>(const DoFHandler &, const DoFHandler &, const unsigned int); + // deprecated: template void MGTransferBlockSelect::build_matrices< deal_II_dimension>(const DoFHandler &, const DoFHandler &, diff --git a/source/multigrid/mg_transfer_component.cc b/source/multigrid/mg_transfer_component.cc index cdca7e47a6..6bfe926ffd 100644 --- a/source/multigrid/mg_transfer_component.cc +++ b/source/multigrid/mg_transfer_component.cc @@ -253,10 +253,20 @@ MGTransferSelect::do_copy_to_mg( } + template void MGTransferComponentBase::build_matrices(const DoFHandler &, const DoFHandler &mg_dof) +{ + build(mg_dof); +} + + + +template +void +MGTransferComponentBase::build(const DoFHandler &mg_dof) { // Fill target component with // standard values (identity) if it @@ -561,11 +571,28 @@ MGTransferComponentBase::build_matrices(const DoFHandler &, } + template template void MGTransferSelect::build_matrices( - const DoFHandler & dof, + const DoFHandler & /*dof*/, + const DoFHandler & mg_dof, + unsigned int select, + unsigned int mg_select, + const std::vector & t_component, + const std::vector & mg_t_component, + const std::vector> &bdry_indices) +{ + build(mg_dof, select, mg_select, t_component, mg_t_component, bdry_indices); +} + + + +template +template +void +MGTransferSelect::build( const DoFHandler & mg_dof, unsigned int select, unsigned int mg_select, @@ -621,7 +648,7 @@ MGTransferSelect::build_matrices( } } - MGTransferComponentBase::build_matrices(dof, mg_dof); + MGTransferComponentBase::build(mg_dof); interface_dofs.resize(mg_dof.get_triangulation().n_levels()); for (unsigned int l = 0; l < mg_dof.get_triangulation().n_levels(); ++l) @@ -636,7 +663,8 @@ MGTransferSelect::build_matrices( std::vector temp_copy_indices; std::vector global_dof_indices(fe.dofs_per_cell); std::vector level_dof_indices(fe.dofs_per_cell); - for (int level = dof.get_triangulation().n_levels() - 1; level >= 0; --level) + for (int level = mg_dof.get_triangulation().n_levels() - 1; level >= 0; + --level) { copy_to_and_from_indices[level].clear(); typename DoFHandler::active_cell_iterator level_cell = diff --git a/source/multigrid/mg_transfer_component.inst.in b/source/multigrid/mg_transfer_component.inst.in index c52392b83f..156b170073 100644 --- a/source/multigrid/mg_transfer_component.inst.in +++ b/source/multigrid/mg_transfer_component.inst.in @@ -17,6 +17,23 @@ for (deal_II_dimension : DIMENSIONS) { + template void MGTransferSelect::build( + const DoFHandler &, + unsigned int, + unsigned int, + const std::vector &, + const std::vector &, + const std::vector> &); + + template void MGTransferSelect::build( + const DoFHandler &, + unsigned int, + unsigned int, + const std::vector &, + const std::vector &, + const std::vector> &); + + // deprecated: template void MGTransferSelect::build_matrices( const DoFHandler &d, const DoFHandler &, @@ -26,6 +43,7 @@ for (deal_II_dimension : DIMENSIONS) const std::vector &, const std::vector> &); + // deprecated: template void MGTransferSelect::build_matrices( const DoFHandler &d, const DoFHandler &, diff --git a/source/multigrid/mg_transfer_internal.cc b/source/multigrid/mg_transfer_internal.cc index 604b346d9b..cf947df52b 100644 --- a/source/multigrid/mg_transfer_internal.cc +++ b/source/multigrid/mg_transfer_internal.cc @@ -57,7 +57,7 @@ namespace internal template void fill_copy_indices( - const dealii::DoFHandler &mg_dof, + const dealii::DoFHandler &dof_handler, const MGConstrainedDoFs * mg_constrained_dofs, std::vector>> @@ -84,14 +84,14 @@ namespace internal std::vector send_data_temp; const unsigned int n_levels = - mg_dof.get_triangulation().n_global_levels(); + dof_handler.get_triangulation().n_global_levels(); copy_indices.resize(n_levels); copy_indices_global_mine.resize(n_levels); copy_indices_level_mine.resize(n_levels); IndexSet globally_relevant; - DoFTools::extract_locally_relevant_dofs(mg_dof, globally_relevant); + DoFTools::extract_locally_relevant_dofs(dof_handler, globally_relevant); - const unsigned int dofs_per_cell = mg_dof.get_fe().dofs_per_cell; + const unsigned int dofs_per_cell = dof_handler.get_fe().dofs_per_cell; std::vector global_dof_indices(dofs_per_cell); std::vector level_dof_indices(dofs_per_cell); @@ -109,9 +109,9 @@ namespace internal copy_indices_global_mine[level].clear(); for (const auto &level_cell : - mg_dof.active_cell_iterators_on_level(level)) + dof_handler.active_cell_iterators_on_level(level)) { - if (mg_dof.get_triangulation().locally_owned_subdomain() != + if (dof_handler.get_triangulation().locally_owned_subdomain() != numbers::invalid_subdomain_id && (level_cell->level_subdomain_id() == numbers::artificial_subdomain_id || @@ -120,7 +120,7 @@ namespace internal continue; unrolled_copy_indices.resize( - mg_dof.locally_owned_dofs().n_elements(), + dof_handler.locally_owned_dofs().n_elements(), numbers::invalid_dof_index); // get the dof numbers of this cell for the global and the @@ -141,10 +141,11 @@ namespace internal // and the level one. This check involves locally owned // indices which often consist only of a single range, so // they are cheap to look up. - bool global_mine = mg_dof.locally_owned_dofs().is_element( - global_dof_indices[i]); + bool global_mine = + dof_handler.locally_owned_dofs().is_element( + global_dof_indices[i]); bool level_mine = - mg_dof.locally_owned_mg_dofs(level).is_element( + dof_handler.locally_owned_mg_dofs(level).is_element( level_dof_indices[i]); if (global_mine && level_mine) @@ -152,7 +153,7 @@ namespace internal // we own both the active dof index and the level one -> // set them into the vector, indexed by the local index // range of the active dof - unrolled_copy_indices[mg_dof.locally_owned_dofs() + unrolled_copy_indices[dof_handler.locally_owned_dofs() .index_within_set( global_dof_indices[i])] = level_dof_indices[i]; @@ -204,18 +205,18 @@ namespace internal // locally_owned_dofs().nth_index_in_set(i) in this query is // usually cheap to look up as there are few ranges in - // mg_dof.locally_owned_dofs() + // dof_handler.locally_owned_dofs() for (unsigned int i = 0; i < unrolled_copy_indices.size(); ++i) if (unrolled_copy_indices[i] != numbers::invalid_dof_index) copy_indices[level].emplace_back( - mg_dof.locally_owned_dofs().nth_index_in_set(i), + dof_handler.locally_owned_dofs().nth_index_in_set(i), unrolled_copy_indices[i]); } } const dealii::parallel::TriangulationBase *tria = (dynamic_cast *>( - &mg_dof.get_triangulation())); + &dof_handler.get_triangulation())); AssertThrow( send_data_temp.size() == 0 || tria != nullptr, ExcMessage( @@ -259,7 +260,8 @@ namespace internal for (unsigned int level = 0; level < n_levels; ++level) { - const IndexSet &is_local = mg_dof.locally_owned_mg_dofs(level); + const IndexSet &is_local = + dof_handler.locally_owned_mg_dofs(level); std::vector level_dof_indices; std::vector global_dof_indices; @@ -581,14 +583,14 @@ namespace internal void setup_element_info(ElementInfo & elem_info, const FiniteElement<1> & fe, - const dealii::DoFHandler &mg_dof) + const dealii::DoFHandler &dof_handler) { // currently, we have only FE_Q and FE_DGQ type elements implemented - elem_info.n_components = mg_dof.get_fe().element_multiplicity(0); + elem_info.n_components = dof_handler.get_fe().element_multiplicity(0); AssertDimension(Utilities::fixed_power(fe.dofs_per_cell) * elem_info.n_components, - mg_dof.get_fe().dofs_per_cell); - AssertDimension(fe.degree, mg_dof.get_fe().degree); + dof_handler.get_fe().dofs_per_cell); + AssertDimension(fe.degree, dof_handler.get_fe().degree); elem_info.fe_degree = fe.degree; elem_info.element_is_continuous = fe.dofs_per_vertex > 0; Assert(fe.dofs_per_vertex < 2, ExcNotImplemented()); @@ -622,7 +624,7 @@ namespace internal const Quadrature<1> dummy_quadrature( std::vector>(1, Point<1>())); internal::MatrixFreeFunctions::ShapeInfo shape_info; - shape_info.reinit(dummy_quadrature, mg_dof.get_fe(), 0); + shape_info.reinit(dummy_quadrature, dof_handler.get_fe(), 0); elem_info.lexicographic_numbering = shape_info.lexicographic_numbering; // step 1.4: get the 1d prolongation matrix and combine from both children @@ -677,7 +679,7 @@ namespace internal template void setup_transfer( - const dealii::DoFHandler &mg_dof, + const dealii::DoFHandler &dof_handler, const MGConstrainedDoFs * mg_constrained_dofs, const std::vector> & external_partitioners, @@ -702,13 +704,13 @@ namespace internal // tensorized operations, we align the degrees of freedom // lexicographically. We distinguish FE_Q elements and FE_DGQ elements - const dealii::Triangulation &tria = mg_dof.get_triangulation(); + const dealii::Triangulation &tria = dof_handler.get_triangulation(); // ---------------------------- 1. Extract 1D info about the finite // element step 1.1: create a 1D copy of the finite element from FETools // where we substitute the template argument - AssertDimension(mg_dof.get_fe().n_base_elements(), 1); - std::string fe_name = mg_dof.get_fe().base_element(0).get_name(); + AssertDimension(dof_handler.get_fe().n_base_elements(), 1); + std::string fe_name = dof_handler.get_fe().base_element(0).get_name(); { const std::size_t template_starts = fe_name.find_first_of('<'); Assert(fe_name[template_starts + 1] == @@ -719,7 +721,7 @@ namespace internal const std::unique_ptr> fe( FETools::get_fe_by_name<1, 1>(fe_name)); - setup_element_info(elem_info, *fe, mg_dof); + setup_element_info(elem_info, *fe, dof_handler); // -------------- 2. Extract and match dof indices between child and @@ -735,7 +737,7 @@ namespace internal coarse_level_indices[level].resize(tria.n_raw_cells(level), numbers::invalid_unsigned_int); std::vector local_dof_indices( - mg_dof.get_fe().dofs_per_cell); + dof_handler.get_fe().dofs_per_cell); dirichlet_indices.resize(n_levels - 1); AssertDimension(target_partitioners.max_level(), n_levels - 1); @@ -754,8 +756,8 @@ namespace internal // step 2.1: loop over the cells on the coarse side typename dealii::DoFHandler::cell_iterator cell, - endc = mg_dof.end(level - 1); - for (cell = mg_dof.begin(level - 1); cell != endc; ++cell) + endc = dof_handler.end(level - 1); + for (cell = dof_handler.begin(level - 1); cell != endc; ++cell) { // need to look into a cell if it has children and it is locally // owned @@ -811,7 +813,7 @@ namespace internal replace(mg_constrained_dofs, level, local_dof_indices); const IndexSet &owned_level_dofs = - mg_dof.locally_owned_mg_dofs(level); + dof_handler.locally_owned_mg_dofs(level); for (const auto local_dof_index : local_dof_indices) if (!owned_level_dofs.is_element(local_dof_index)) ghosted_level_dofs.push_back(local_dof_index); @@ -848,14 +850,14 @@ namespace internal tria.n_cells(level); parent_child_connect[level][child_index] = std::make_pair(parent_index, c); - AssertIndexRange(mg_dof.get_fe().dofs_per_cell, + AssertIndexRange(dof_handler.get_fe().dofs_per_cell, static_cast(-1)); // set Dirichlet boundary conditions (as a list of // constrained DoFs) for the child if (mg_constrained_dofs != nullptr) for (unsigned int i = 0; - i < mg_dof.get_fe().dofs_per_cell; + i < dof_handler.get_fe().dofs_per_cell; ++i) if (mg_constrained_dofs->is_boundary_index( level, @@ -882,7 +884,7 @@ namespace internal replace(mg_constrained_dofs, level - 1, local_dof_indices); const IndexSet &owned_level_dofs_l0 = - mg_dof.locally_owned_mg_dofs(0); + dof_handler.locally_owned_mg_dofs(0); for (const auto local_dof_index : local_dof_indices) if (!owned_level_dofs_l0.is_element(local_dof_index)) ghosted_level_dofs_l0.push_back(local_dof_index); @@ -902,7 +904,8 @@ namespace internal dirichlet_indices[0].emplace_back(); if (mg_constrained_dofs != nullptr) - for (unsigned int i = 0; i < mg_dof.get_fe().dofs_per_cell; + for (unsigned int i = 0; + i < dof_handler.get_fe().dofs_per_cell; ++i) if (mg_constrained_dofs->is_boundary_index( 0, @@ -950,7 +953,7 @@ namespace internal const MPI_Comm communicator = ptria != nullptr ? ptria->get_communicator() : MPI_COMM_SELF; - reinit_level_partitioner(mg_dof.locally_owned_mg_dofs(level), + reinit_level_partitioner(dof_handler.locally_owned_mg_dofs(level), ghosted_level_dofs, external_partitioners.empty() ? nullptr : @@ -969,7 +972,7 @@ namespace internal for (unsigned int i = 0; i < parent_child_connect[0].size(); ++i) parent_child_connect[0][i] = std::make_pair(i, 0U); - reinit_level_partitioner(mg_dof.locally_owned_mg_dofs(0), + reinit_level_partitioner(dof_handler.locally_owned_mg_dofs(0), ghosted_level_dofs_l0, external_partitioners.empty() ? nullptr : diff --git a/source/multigrid/mg_transfer_matrix_free.cc b/source/multigrid/mg_transfer_matrix_free.cc index e7e087e2b1..894b4c7a4a 100644 --- a/source/multigrid/mg_transfer_matrix_free.cc +++ b/source/multigrid/mg_transfer_matrix_free.cc @@ -95,14 +95,15 @@ MGTransferMatrixFree::clear() template void MGTransferMatrixFree::build( - const DoFHandler &mg_dof, + const DoFHandler &dof_handler, const std::vector> &external_partitioners) { - this->fill_and_communicate_copy_indices(mg_dof); + this->fill_and_communicate_copy_indices(dof_handler); vector_partitioners.resize(0, - mg_dof.get_triangulation().n_global_levels() - 1); + dof_handler.get_triangulation().n_global_levels() - + 1); for (unsigned int level = 0; level <= this->ghosted_level_vector.max_level(); ++level) vector_partitioners[level] = @@ -113,7 +114,7 @@ MGTransferMatrixFree::build( internal::MGTransfer::ElementInfo elem_info; internal::MGTransfer::setup_transfer( - mg_dof, + dof_handler, this->mg_constrained_dofs, external_partitioners, elem_info, @@ -149,7 +150,8 @@ MGTransferMatrixFree::build( // reshuffle into aligned vector of vectorized arrays const unsigned int vec_size = VectorizedArray::n_array_elements; - const unsigned int n_levels = mg_dof.get_triangulation().n_global_levels(); + const unsigned int n_levels = + dof_handler.get_triangulation().n_global_levels(); const unsigned int n_weights_per_cell = Utilities::fixed_power(3); weights_on_refined.resize(n_levels - 1); @@ -717,10 +719,10 @@ MGTransferBlockMatrixFree::clear() template void MGTransferBlockMatrixFree::build( - const DoFHandler &mg_dof) + const DoFHandler &dof_handler) { AssertDimension(matrix_free_transfer_vector.size(), 1); - matrix_free_transfer_vector[0].build(mg_dof); + matrix_free_transfer_vector[0].build(dof_handler); } @@ -728,11 +730,11 @@ MGTransferBlockMatrixFree::build( template void MGTransferBlockMatrixFree::build( - const std::vector *> &mg_dof) + const std::vector *> &dof_handler) { - AssertDimension(matrix_free_transfer_vector.size(), mg_dof.size()); - for (unsigned int i = 0; i < mg_dof.size(); ++i) - matrix_free_transfer_vector[i].build(*mg_dof[i]); + AssertDimension(matrix_free_transfer_vector.size(), dof_handler.size()); + for (unsigned int i = 0; i < dof_handler.size(); ++i) + matrix_free_transfer_vector[i].build(*dof_handler[i]); } diff --git a/source/multigrid/mg_transfer_prebuilt.cc b/source/multigrid/mg_transfer_prebuilt.cc index 0eceb6b356..e4bb863167 100644 --- a/source/multigrid/mg_transfer_prebuilt.cc +++ b/source/multigrid/mg_transfer_prebuilt.cc @@ -136,7 +136,7 @@ MGTransferPrebuilt::restrict_and_add(const unsigned int from_level, namespace { /** - * Helper function for build_matrices. Checks for identity constrained dofs + * Helper function for build. Checks for identity constrained dofs * and replace with the indices of the dofs to which they are constrained */ void @@ -165,15 +165,16 @@ namespace template template void -MGTransferPrebuilt::build_matrices( - const DoFHandler &mg_dof) +MGTransferPrebuilt::build( + const DoFHandler &dof_handler) { - const unsigned int n_levels = mg_dof.get_triangulation().n_global_levels(); - const unsigned int dofs_per_cell = mg_dof.get_fe().dofs_per_cell; + const unsigned int n_levels = + dof_handler.get_triangulation().n_global_levels(); + const unsigned int dofs_per_cell = dof_handler.get_fe().dofs_per_cell; this->sizes.resize(n_levels); for (unsigned int l = 0; l < n_levels; ++l) - this->sizes[l] = mg_dof.n_dofs(l); + this->sizes[l] = dof_handler.n_dofs(l); // reset the size of the array of // matrices. call resize(0) first, @@ -220,19 +221,20 @@ MGTransferPrebuilt::build_matrices( // increment dofs_per_cell since a useless diagonal element will be // stored IndexSet level_p1_relevant_dofs; - DoFTools::extract_locally_relevant_level_dofs(mg_dof, + DoFTools::extract_locally_relevant_level_dofs(dof_handler, level + 1, level_p1_relevant_dofs); DynamicSparsityPattern dsp(this->sizes[level + 1], this->sizes[level], level_p1_relevant_dofs); - typename DoFHandler::cell_iterator cell, endc = mg_dof.end(level); - for (cell = mg_dof.begin(level); cell != endc; ++cell) + typename DoFHandler::cell_iterator cell, + endc = dof_handler.end(level); + for (cell = dof_handler.begin(level); cell != endc; ++cell) if (cell->has_children() && - (mg_dof.get_triangulation().locally_owned_subdomain() == + (dof_handler.get_triangulation().locally_owned_subdomain() == numbers::invalid_subdomain_id || cell->level_subdomain_id() == - mg_dof.get_triangulation().locally_owned_subdomain())) + dof_handler.get_triangulation().locally_owned_subdomain())) { cell->get_mg_dof_indices(dof_indices_parent); @@ -245,7 +247,7 @@ MGTransferPrebuilt::build_matrices( { // set an alias to the prolongation matrix for this child const FullMatrix &prolongation = - mg_dof.get_fe().get_prolongation_matrix( + dof_handler.get_fe().get_prolongation_matrix( child, cell->refinement_case()); Assert(prolongation.n() != 0, ExcNoProlongation()); @@ -283,7 +285,7 @@ MGTransferPrebuilt::build_matrices( // Retrieve communicator from triangulation if it is parallel const parallel::TriangulationBase *dist_tria = dynamic_cast *>( - &(mg_dof.get_triangulation())); + &(dof_handler.get_triangulation())); MPI_Comm communicator = dist_tria != nullptr ? dist_tria->get_communicator() : @@ -292,7 +294,8 @@ MGTransferPrebuilt::build_matrices( // Compute # of locally owned MG dofs / processor for distribution const std::vector<::dealii::IndexSet> locally_owned_mg_dofs_per_processor = - mg_dof.compute_locally_owned_mg_dofs_per_processor(level + 1); + dof_handler.compute_locally_owned_mg_dofs_per_processor(level + + 1); std::vector<::dealii::types::global_dof_index> n_locally_owned_mg_dofs_per_processor( locally_owned_mg_dofs_per_processor.size(), 0); @@ -319,7 +322,7 @@ MGTransferPrebuilt::build_matrices( *prolongation_sparsities[level], level, dsp, - mg_dof); + dof_handler); dsp.reinit(0, 0); // In the end, the entries in this object will only be real valued. @@ -333,12 +336,12 @@ MGTransferPrebuilt::build_matrices( FullMatrix prolongation; // now actually build the matrices - for (cell = mg_dof.begin(level); cell != endc; ++cell) + for (cell = dof_handler.begin(level); cell != endc; ++cell) if (cell->has_children() && - (mg_dof.get_triangulation().locally_owned_subdomain() == + (dof_handler.get_triangulation().locally_owned_subdomain() == numbers::invalid_subdomain_id || cell->level_subdomain_id() == - mg_dof.get_triangulation().locally_owned_subdomain())) + dof_handler.get_triangulation().locally_owned_subdomain())) { cell->get_mg_dof_indices(dof_indices_parent); @@ -350,7 +353,7 @@ MGTransferPrebuilt::build_matrices( for (unsigned int child = 0; child < cell->n_children(); ++child) { // set an alias to the prolongation matrix for this child - prolongation = mg_dof.get_fe().get_prolongation_matrix( + prolongation = dof_handler.get_fe().get_prolongation_matrix( child, cell->refinement_case()); if (this->mg_constrained_dofs != nullptr && @@ -379,7 +382,18 @@ MGTransferPrebuilt::build_matrices( prolongation_matrices[level]->compress(VectorOperation::insert); } - this->fill_and_communicate_copy_indices(mg_dof); + this->fill_and_communicate_copy_indices(dof_handler); +} + + + +template +template +void +MGTransferPrebuilt::build_matrices( + const DoFHandler &dof_handler) +{ + build(dof_handler); } diff --git a/source/multigrid/mg_transfer_prebuilt.inst.in b/source/multigrid/mg_transfer_prebuilt.inst.in index 959e4ede92..cafcc608a0 100644 --- a/source/multigrid/mg_transfer_prebuilt.inst.in +++ b/source/multigrid/mg_transfer_prebuilt.inst.in @@ -22,6 +22,9 @@ for (V1 : VECTORS_WITH_MATRIX) for (deal_II_dimension : DIMENSIONS; V1 : VECTORS_WITH_MATRIX) { + template void MGTransferPrebuilt::build( + const DoFHandler &mg_dof); + template void MGTransferPrebuilt::build_matrices( const DoFHandler &mg_dof); } diff --git a/tests/bits/step-16.cc b/tests/bits/step-16.cc index be1e62be88..6a9a0a6274 100644 --- a/tests/bits/step-16.cc +++ b/tests/bits/step-16.cc @@ -255,7 +255,7 @@ void LaplaceProblem::solve() { MGTransferPrebuilt> mg_transfer; - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrices[0]); diff --git a/tests/examples/step-56.cc b/tests/examples/step-56.cc index a5eee5fc99..1af69b445c 100644 --- a/tests/examples/step-56.cc +++ b/tests/examples/step-56.cc @@ -900,7 +900,7 @@ namespace Step56 // Transfer operators between levels MGTransferPrebuilt> mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(velocity_dof_handler); + mg_transfer.build(velocity_dof_handler); // Setup coarse grid solver FullMatrix coarse_matrix; diff --git a/tests/fe/transfer.cc b/tests/fe/transfer.cc index 71f77eb5c6..5bc6fcc9be 100644 --- a/tests/fe/transfer.cc +++ b/tests/fe/transfer.cc @@ -57,7 +57,7 @@ print_matrix(Triangulation & tr, dof.distribute_mg_dofs(); MGTransferPrebuilt> transfer; - transfer.build_matrices(dof); + transfer.build(dof); unsigned int n_coarse = dof.n_dofs(level - 1); unsigned int n_fine = dof.n_dofs(level); diff --git a/tests/matrix_free/multigrid_dg_periodic.cc b/tests/matrix_free/multigrid_dg_periodic.cc index 2009ce4c56..a7c846b086 100644 --- a/tests/matrix_free/multigrid_dg_periodic.cc +++ b/tests/matrix_free/multigrid_dg_periodic.cc @@ -580,7 +580,7 @@ do_test(const DoFHandler &dof) mg_smoother.initialize(mg_matrices, smoother_data); MGTransferMF mg_transfer(mg_matrices); - mg_transfer.build_matrices(dof); + mg_transfer.build(dof); mg::Matrix> mg_matrix(mg_matrices); diff --git a/tests/matrix_free/parallel_multigrid.cc b/tests/matrix_free/parallel_multigrid.cc index a574a58661..a9b9a57744 100644 --- a/tests/matrix_free/parallel_multigrid.cc +++ b/tests/matrix_free/parallel_multigrid.cc @@ -379,7 +379,7 @@ do_test(const DoFHandler &dof) } MGTransferPrebuiltMF mg_transfer(mg_matrices); - mg_transfer.build_matrices(dof); + mg_transfer.build(dof); MGCoarseIterative mg_coarse; mg_coarse.initialize(mg_matrices[0]); diff --git a/tests/matrix_free/parallel_multigrid_adaptive_01.cc b/tests/matrix_free/parallel_multigrid_adaptive_01.cc index bc981df7d6..554b5ab6c0 100644 --- a/tests/matrix_free/parallel_multigrid_adaptive_01.cc +++ b/tests/matrix_free/parallel_multigrid_adaptive_01.cc @@ -560,7 +560,7 @@ do_test(const DoFHandler &dof) mg_interface_matrices[level].initialize(mg_matrices[level]); MGTransferMF mg_transfer(mg_matrices, mg_constrained_dofs); - mg_transfer.build_matrices(dof); + mg_transfer.build(dof); MGCoarseIterative mg_coarse; mg_coarse.initialize(mg_matrices[0]); diff --git a/tests/matrix_free/step-37.cc b/tests/matrix_free/step-37.cc index a3b445ae16..257f667904 100644 --- a/tests/matrix_free/step-37.cc +++ b/tests/matrix_free/step-37.cc @@ -575,7 +575,7 @@ namespace Step37 LaplaceProblem::solve() { MGTransferPrebuilt> mg_transfer; - mg_transfer.build_matrices(dof_handler); + mg_transfer.build(dof_handler); MGCoarseGridHouseholder> mg_coarse; mg_coarse.initialize(coarse_matrix); diff --git a/tests/meshworker/step-50-mesh_loop.cc b/tests/meshworker/step-50-mesh_loop.cc index 061d3844f0..11a43b574c 100644 --- a/tests/meshworker/step-50-mesh_loop.cc +++ b/tests/meshworker/step-50-mesh_loop.cc @@ -452,7 +452,7 @@ namespace Step50 LaplaceProblem::solve() { MGTransferPrebuilt mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); matrix_t &coarse_matrix = mg_matrices[0]; diff --git a/tests/mpi/multigrid_adaptive.cc b/tests/mpi/multigrid_adaptive.cc index f3b4765260..cc30e4fd53 100644 --- a/tests/mpi/multigrid_adaptive.cc +++ b/tests/mpi/multigrid_adaptive.cc @@ -404,7 +404,7 @@ namespace Step50 LaplaceProblem::solve() { MGTransferPrebuilt mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); matrix_t coarse_matrix; coarse_matrix.copy_from(mg_matrices[0]); diff --git a/tests/mpi/multigrid_uniform.cc b/tests/mpi/multigrid_uniform.cc index c59f656bd8..53ec77da8e 100644 --- a/tests/mpi/multigrid_uniform.cc +++ b/tests/mpi/multigrid_uniform.cc @@ -391,7 +391,7 @@ namespace Step50 LaplaceProblem::solve() { MGTransferPrebuilt mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); matrix_t coarse_matrix; coarse_matrix.copy_from(mg_matrices[0]); diff --git a/tests/mpi/step-39-block.cc b/tests/mpi/step-39-block.cc index fdd195ceed..85e27dc7ee 100644 --- a/tests/mpi/step-39-block.cc +++ b/tests/mpi/step-39-block.cc @@ -630,7 +630,7 @@ namespace Step39 SolverCG solver(control); MGTransferPrebuilt mg_transfer; - mg_transfer.build_matrices(dof_handler); + mg_transfer.build(dof_handler); SolverControl coarse_solver_control(1000, 1e-10, false, false); SolverCG coarse_solver( diff --git a/tests/mpi/step-39.cc b/tests/mpi/step-39.cc index cb94a8471e..c491433962 100644 --- a/tests/mpi/step-39.cc +++ b/tests/mpi/step-39.cc @@ -631,7 +631,7 @@ namespace Step39 SolverCG solver(control); MGTransferPrebuilt mg_transfer; - mg_transfer.build_matrices(dof_handler); + mg_transfer.build(dof_handler); SolverControl coarse_solver_control(1000, 1e-10, false, false); SolverCG coarse_solver( diff --git a/tests/multigrid/events_01.cc b/tests/multigrid/events_01.cc index 54b977e940..ae1e7aa619 100644 --- a/tests/multigrid/events_01.cc +++ b/tests/multigrid/events_01.cc @@ -390,7 +390,7 @@ namespace Step50 const MGCoarseGridBase &coarse_grid_solver) { MGTransferPrebuilt mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); typedef LA::MPI::PreconditionJacobi Smoother; MGSmootherPrecondition mg_smoother; diff --git a/tests/multigrid/mg_coarse_01.cc b/tests/multigrid/mg_coarse_01.cc index 4d7ec9fca4..f5b126d3f4 100644 --- a/tests/multigrid/mg_coarse_01.cc +++ b/tests/multigrid/mg_coarse_01.cc @@ -461,7 +461,7 @@ namespace Step50 const MGCoarseGridBase &coarse_grid_solver) { MGTransferPrebuilt mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); typedef LA::MPI::PreconditionJacobi Smoother; MGSmootherPrecondition mg_smoother; diff --git a/tests/multigrid/mg_output_dirichlet.cc b/tests/multigrid/mg_output_dirichlet.cc index 188a534a52..0f64d717f8 100644 --- a/tests/multigrid/mg_output_dirichlet.cc +++ b/tests/multigrid/mg_output_dirichlet.cc @@ -243,11 +243,11 @@ check_simple(const FiniteElement &fe) dirichlet_boundary_functions); MGTransferPrebuilt> transfer(mg_constrained_dofs); - transfer.build_matrices(mgdof); + transfer.build(mgdof); MGTransferPrebuilt> transfer_renumbered( mg_constrained_dofs_renumbered); - transfer_renumbered.build_matrices(mgdof_renumbered); + transfer_renumbered.build(mgdof_renumbered); Vector u(mgdof.n_dofs()); initialize(mgdof, u); diff --git a/tests/multigrid/mg_output_neumann.cc b/tests/multigrid/mg_output_neumann.cc index 703a7f0768..66016f252a 100644 --- a/tests/multigrid/mg_output_neumann.cc +++ b/tests/multigrid/mg_output_neumann.cc @@ -241,11 +241,11 @@ check_simple(const FiniteElement &fe) dirichlet_boundary_functions); MGTransferPrebuilt> transfer(mg_constrained_dofs); - transfer.build_matrices(mgdof); + transfer.build(mgdof); MGTransferPrebuilt> transfer_renumbered( mg_constrained_dofs_renumbered); - transfer_renumbered.build_matrices(mgdof_renumbered); + transfer_renumbered.build(mgdof_renumbered); // Fill vector u with some cell based numbering Vector u(mgdof.n_dofs()); diff --git a/tests/multigrid/mg_renumbered_01.cc b/tests/multigrid/mg_renumbered_01.cc index e79ea0d620..02a1568a76 100644 --- a/tests/multigrid/mg_renumbered_01.cc +++ b/tests/multigrid/mg_renumbered_01.cc @@ -359,10 +359,10 @@ LaplaceProblem::test() dirichlet_boundary); MGTransferPrebuilt> mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); MGTransferPrebuilt> mg_transfer_renumbered( mg_constrained_dofs_renumbered); - mg_transfer_renumbered.build_matrices(mg_dof_handler_renumbered); + mg_transfer_renumbered.build(mg_dof_handler_renumbered); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrices[0]); diff --git a/tests/multigrid/mg_renumbered_03.cc b/tests/multigrid/mg_renumbered_03.cc index 703f21efd7..15925d54fb 100644 --- a/tests/multigrid/mg_renumbered_03.cc +++ b/tests/multigrid/mg_renumbered_03.cc @@ -360,10 +360,10 @@ LaplaceProblem::test() dirichlet_boundary); MGTransferPrebuilt> mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); MGTransferPrebuilt> mg_transfer_renumbered( mg_constrained_dofs_renumbered); - mg_transfer_renumbered.build_matrices(mg_dof_handler_renumbered); + mg_transfer_renumbered.build(mg_dof_handler_renumbered); Vector test; test.reinit(mg_dof_handler.n_dofs()); diff --git a/tests/multigrid/step-16-02.cc b/tests/multigrid/step-16-02.cc index a0ec9e6599..8f05645759 100644 --- a/tests/multigrid/step-16-02.cc +++ b/tests/multigrid/step-16-02.cc @@ -474,7 +474,7 @@ void LaplaceProblem::solve() { MGTransferPrebuilt> mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrices[0]); diff --git a/tests/multigrid/step-16-03.cc b/tests/multigrid/step-16-03.cc index 8b17190ce7..f3d2e9d343 100644 --- a/tests/multigrid/step-16-03.cc +++ b/tests/multigrid/step-16-03.cc @@ -365,7 +365,7 @@ void LaplaceProblem::solve() { MGTransferPrebuilt> mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrices[min_level]); diff --git a/tests/multigrid/step-16-04.cc b/tests/multigrid/step-16-04.cc index ae8257bf1a..03fe52a520 100644 --- a/tests/multigrid/step-16-04.cc +++ b/tests/multigrid/step-16-04.cc @@ -375,7 +375,7 @@ LaplaceProblem::solve() { MGTransferPrebuilt> mg_transfer( mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); SolverControl coarse_solver_control(1000, 1e-10, false, false); SolverCG> coarse_solver( diff --git a/tests/multigrid/step-16-05.cc b/tests/multigrid/step-16-05.cc index e0ccc78200..d9ae93ef1f 100644 --- a/tests/multigrid/step-16-05.cc +++ b/tests/multigrid/step-16-05.cc @@ -376,7 +376,7 @@ LaplaceProblem::solve() { MGTransferPrebuilt> mg_transfer( hanging_node_constraints, mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); SolverControl coarse_solver_control(1000, 1e-10, false, false); SolverCG> coarse_solver( diff --git a/tests/multigrid/step-16-06.cc b/tests/multigrid/step-16-06.cc index b0748e26f7..d0ce88b1e6 100644 --- a/tests/multigrid/step-16-06.cc +++ b/tests/multigrid/step-16-06.cc @@ -376,7 +376,7 @@ LaplaceProblem::solve() { MGTransferPrebuilt> mg_transfer( hanging_node_constraints, mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); SolverControl coarse_solver_control(1000, 1e-10, false, false); SolverCG> coarse_solver( diff --git a/tests/multigrid/step-16-07.cc b/tests/multigrid/step-16-07.cc index 7369f58437..dfbba09983 100644 --- a/tests/multigrid/step-16-07.cc +++ b/tests/multigrid/step-16-07.cc @@ -448,7 +448,7 @@ void LaplaceProblem::solve() { MGTransferPrebuilt> mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrices[0]); diff --git a/tests/multigrid/step-16-50-mpi-linear-operator.cc b/tests/multigrid/step-16-50-mpi-linear-operator.cc index ed87691193..9435e93d78 100644 --- a/tests/multigrid/step-16-50-mpi-linear-operator.cc +++ b/tests/multigrid/step-16-50-mpi-linear-operator.cc @@ -439,7 +439,7 @@ namespace Step50 LaplaceProblem::solve() { MGTransferPrebuilt mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); matrix_t &coarse_matrix = mg_matrices[0]; diff --git a/tests/multigrid/step-16-50-mpi-smoother.cc b/tests/multigrid/step-16-50-mpi-smoother.cc index f8365f1dd6..38210156f9 100644 --- a/tests/multigrid/step-16-50-mpi-smoother.cc +++ b/tests/multigrid/step-16-50-mpi-smoother.cc @@ -439,7 +439,7 @@ namespace Step50 LaplaceProblem::solve() { MGTransferPrebuilt mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); // pre and post smoothers: typedef LA::MPI::PreconditionJacobi Smoother; diff --git a/tests/multigrid/step-16-50-mpi.cc b/tests/multigrid/step-16-50-mpi.cc index 4a369c65e8..d58ace5769 100644 --- a/tests/multigrid/step-16-50-mpi.cc +++ b/tests/multigrid/step-16-50-mpi.cc @@ -439,7 +439,7 @@ namespace Step50 LaplaceProblem::solve() { MGTransferPrebuilt mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); matrix_t &coarse_matrix = mg_matrices[0]; diff --git a/tests/multigrid/step-16-50-serial.cc b/tests/multigrid/step-16-50-serial.cc index 733fb1034d..93de6399b1 100644 --- a/tests/multigrid/step-16-50-serial.cc +++ b/tests/multigrid/step-16-50-serial.cc @@ -369,7 +369,7 @@ LaplaceProblem::solve() typedef Vector vector_t; MGTransferPrebuilt mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); matrix_t &coarse_matrix = mg_matrices[0]; diff --git a/tests/multigrid/step-16-bdry1.cc b/tests/multigrid/step-16-bdry1.cc index 8e39e8031a..4973316f65 100644 --- a/tests/multigrid/step-16-bdry1.cc +++ b/tests/multigrid/step-16-bdry1.cc @@ -491,7 +491,7 @@ void LaplaceProblem::solve(bool use_mw) { MGTransferPrebuilt> mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrices[0]); diff --git a/tests/multigrid/step-16.cc b/tests/multigrid/step-16.cc index 6a27dc0893..c3f3cf02b5 100644 --- a/tests/multigrid/step-16.cc +++ b/tests/multigrid/step-16.cc @@ -448,7 +448,7 @@ void LaplaceProblem::solve() { MGTransferPrebuilt> mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrices[0]); diff --git a/tests/multigrid/step-39-02.cc b/tests/multigrid/step-39-02.cc index 8f7d862dda..e9a2e9b005 100644 --- a/tests/multigrid/step-39-02.cc +++ b/tests/multigrid/step-39-02.cc @@ -591,7 +591,7 @@ namespace Step39 SolverCG> solver(control); MGTransferPrebuilt> mg_transfer; - mg_transfer.build_matrices(dof_handler); + mg_transfer.build(dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrix[0]); diff --git a/tests/multigrid/step-39-02a.cc b/tests/multigrid/step-39-02a.cc index 4d6a3ec3d4..e32ba9087f 100644 --- a/tests/multigrid/step-39-02a.cc +++ b/tests/multigrid/step-39-02a.cc @@ -598,7 +598,7 @@ namespace Step39 SolverCG> solver(control); MGTransferPrebuilt> mg_transfer; - mg_transfer.build_matrices(dof_handler); + mg_transfer.build(dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrix[0]); diff --git a/tests/multigrid/step-39-03.cc b/tests/multigrid/step-39-03.cc index 439c841c53..e7263ddf36 100644 --- a/tests/multigrid/step-39-03.cc +++ b/tests/multigrid/step-39-03.cc @@ -597,7 +597,7 @@ namespace Step39 SolverGMRES> solver(control); MGTransferPrebuilt> mg_transfer; - mg_transfer.build_matrices(dof_handler); + mg_transfer.build(dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrix[0]); diff --git a/tests/multigrid/step-39.cc b/tests/multigrid/step-39.cc index 9160fc1c8c..5abdc14c01 100644 --- a/tests/multigrid/step-39.cc +++ b/tests/multigrid/step-39.cc @@ -581,7 +581,7 @@ namespace Step39 SolverCG> solver(control); MGTransferPrebuilt> mg_transfer; - mg_transfer.build_matrices(dof_handler); + mg_transfer.build(dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from(mg_matrix[0]); diff --git a/tests/multigrid/step-50_01.cc b/tests/multigrid/step-50_01.cc index 0daaf3d4fe..260a7dd26a 100644 --- a/tests/multigrid/step-50_01.cc +++ b/tests/multigrid/step-50_01.cc @@ -438,7 +438,7 @@ namespace Step50 LaplaceProblem::solve() { MGTransferPrebuilt mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); matrix_t &coarse_matrix = mg_matrices[0]; diff --git a/tests/multigrid/step-50_02.cc b/tests/multigrid/step-50_02.cc index 58e1c3b951..d3d693ed3a 100644 --- a/tests/multigrid/step-50_02.cc +++ b/tests/multigrid/step-50_02.cc @@ -448,7 +448,7 @@ namespace Step50 LaplaceProblem::solve() { MGTransferPrebuilt mg_transfer(mg_constrained_dofs); - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build(mg_dof_handler); matrix_t &coarse_matrix = mg_matrices[0]; diff --git a/tests/multigrid/transfer_01.cc b/tests/multigrid/transfer_01.cc index b25d222143..f6b4047c7a 100644 --- a/tests/multigrid/transfer_01.cc +++ b/tests/multigrid/transfer_01.cc @@ -70,7 +70,7 @@ check_simple(const FiniteElement &fe) mgdof.distribute_mg_dofs(); MGTransferPrebuilt> transfer; - transfer.build_matrices(mgdof); + transfer.build(mgdof); MGLevelObject> u(0, tr.n_levels() - 1); reinit_vector(mgdof, u); diff --git a/tests/multigrid/transfer_02.cc b/tests/multigrid/transfer_02.cc index 02e33a3e0f..0f96af7013 100644 --- a/tests/multigrid/transfer_02.cc +++ b/tests/multigrid/transfer_02.cc @@ -103,7 +103,7 @@ check_simple(const FiniteElement &fe) mgdof.distribute_mg_dofs(); MGTransferPrebuilt> transfer; - transfer.build_matrices(mgdof); + transfer.build(mgdof); MGLevelObject> u(0, tr.n_levels() - 1); reinit_vector(mgdof, u); diff --git a/tests/multigrid/transfer_03.cc b/tests/multigrid/transfer_03.cc index 0d9c03c685..554adbd9d5 100644 --- a/tests/multigrid/transfer_03.cc +++ b/tests/multigrid/transfer_03.cc @@ -208,10 +208,10 @@ check_simple(const FiniteElement &fe) DoFRenumbering::component_wise(mgdof_renumbered, level, block_component); MGTransferPrebuilt> transfer; - transfer.build_matrices(mgdof); + transfer.build(mgdof); MGTransferPrebuilt> transfer_renumbered; - transfer_renumbered.build_matrices(mgdof_renumbered); + transfer_renumbered.build(mgdof_renumbered); Vector u(mgdof.n_dofs()); initialize(mgdof, u); diff --git a/tests/multigrid/transfer_04.cc b/tests/multigrid/transfer_04.cc index 326e597f40..f777882ffe 100644 --- a/tests/multigrid/transfer_04.cc +++ b/tests/multigrid/transfer_04.cc @@ -136,7 +136,7 @@ check_fe(FiniteElement &fe) hanging_node_constraints.close(); MGTransferPrebuilt transfer(mg_constrained_dofs); - transfer.build_matrices(dofh); + transfer.build(dofh); // transfer.print_indices(deallog.get_file_stream()); MGLevelObject u(0, tr.n_global_levels() - 1); diff --git a/tests/multigrid/transfer_04a.cc b/tests/multigrid/transfer_04a.cc index ed71663c24..118b19d641 100644 --- a/tests/multigrid/transfer_04a.cc +++ b/tests/multigrid/transfer_04a.cc @@ -130,7 +130,7 @@ check_fe(FiniteElement &fe) typedef TrilinosWrappers::MPI::Vector vector_t; {} MGTransferPrebuilt transfer; - transfer.build_matrices(dofh); + transfer.build(dofh); transfer.print_indices(deallog.get_file_stream()); MGLevelObject u(0, tr.n_global_levels() - 1); diff --git a/tests/multigrid/transfer_04b.cc b/tests/multigrid/transfer_04b.cc index 42994dbdfb..eb6a1366bf 100644 --- a/tests/multigrid/transfer_04b.cc +++ b/tests/multigrid/transfer_04b.cc @@ -130,7 +130,7 @@ check_fe(FiniteElement &fe) typedef PETScWrappers::MPI::Vector vector_t; {} MGTransferPrebuilt transfer; - transfer.build_matrices(dofh); + transfer.build(dofh); transfer.print_indices(deallog.get_file_stream()); MGLevelObject u(0, tr.n_global_levels() - 1); diff --git a/tests/multigrid/transfer_block.cc b/tests/multigrid/transfer_block.cc index abb10618d1..8fdaa259bb 100644 --- a/tests/multigrid/transfer_block.cc +++ b/tests/multigrid/transfer_block.cc @@ -96,8 +96,7 @@ check_block(const FiniteElement &fe, GridGenerator::hyper_cube(tr); tr.refine_global(2); - DoFHandler mgdof(tr); - DoFHandler &dof = mgdof; + DoFHandler mgdof(tr); mgdof.distribute_dofs(fe); mgdof.distribute_mg_dofs(); DoFRenumbering::component_wise(mgdof); @@ -125,7 +124,7 @@ check_block(const FiniteElement &fe, PrimitiveVectorMemory> mem; MGTransferBlock transfer; - transfer.build_matrices(dof, mgdof, selected); + transfer.build(mgdof, selected); if (factors.size() > 0) transfer.initialize(factors, mem); diff --git a/tests/multigrid/transfer_block_select.cc b/tests/multigrid/transfer_block_select.cc index a1d0f4e0ad..55ad85dc32 100644 --- a/tests/multigrid/transfer_block_select.cc +++ b/tests/multigrid/transfer_block_select.cc @@ -82,8 +82,7 @@ check_select(const FiniteElement &fe, unsigned int selected) GridGenerator::hyper_cube(tr); tr.refine_global(2); - DoFHandler mgdof(tr); - DoFHandler &dof = mgdof; + DoFHandler mgdof(tr); mgdof.distribute_dofs(fe); mgdof.distribute_mg_dofs(); DoFRenumbering::component_wise(mgdof); @@ -110,7 +109,7 @@ check_select(const FiniteElement &fe, unsigned int selected) } MGTransferBlockSelect transfer; - transfer.build_matrices(dof, mgdof, selected); + transfer.build(mgdof, selected); // First, prolongate the constant // function from the coarsest mesh diff --git a/tests/multigrid/transfer_compare_01.cc b/tests/multigrid/transfer_compare_01.cc index 4e97c2223e..a1f1003a75 100644 --- a/tests/multigrid/transfer_compare_01.cc +++ b/tests/multigrid/transfer_compare_01.cc @@ -126,8 +126,7 @@ check_block(const FiniteElement &fe) GridGenerator::hyper_cube(tr); tr.refine_global(2); - DoFHandler mgdof(tr); - DoFHandler &dof = mgdof; + DoFHandler mgdof(tr); mgdof.distribute_dofs(fe); mgdof.distribute_mg_dofs(); @@ -136,8 +135,8 @@ check_block(const FiniteElement &fe) Tensor<1, dim> direction; for (unsigned int d = 0; d < dim; ++d) direction[d] = d * d * d; - DoFRenumbering::downstream(dof, direction); - DoFRenumbering::component_wise(dof); + DoFRenumbering::downstream(mgdof, direction); + DoFRenumbering::component_wise(mgdof); for (unsigned int l = 0; l < tr.n_levels(); ++l) { DoFRenumbering::downstream(mgdof, l, direction); @@ -155,9 +154,9 @@ check_block(const FiniteElement &fe) MGTransferPrebuilt> transfer; MGTransferBlock transfer_block; MGTransferBlockSelect transfer_select; - transfer.build_matrices(mgdof); - transfer_block.build_matrices(dof, mgdof, selected); - transfer_select.build_matrices(dof, mgdof, 0); + transfer.build(mgdof); + transfer_block.build(mgdof, selected); + transfer_select.build(mgdof, 0); BlockVector u2(mg_ndofs[2]); BlockVector u1(mg_ndofs[1]); diff --git a/tests/multigrid/transfer_matrix_free_01.cc b/tests/multigrid/transfer_matrix_free_01.cc index 3345e52d99..d0fdc7ae4d 100644 --- a/tests/multigrid/transfer_matrix_free_01.cc +++ b/tests/multigrid/transfer_matrix_free_01.cc @@ -76,7 +76,7 @@ check(const unsigned int fe_degree) // build reference MGTransferPrebuilt> transfer_ref(mg_constrained_dofs); - transfer_ref.build_matrices(mgdof); + transfer_ref.build(mgdof); // build matrix-free transfer MGTransferMatrixFree transfer(mg_constrained_dofs); diff --git a/tests/multigrid/transfer_matrix_free_02.cc b/tests/multigrid/transfer_matrix_free_02.cc index 94413aa6f3..6cf3843aaf 100644 --- a/tests/multigrid/transfer_matrix_free_02.cc +++ b/tests/multigrid/transfer_matrix_free_02.cc @@ -105,7 +105,7 @@ check(const unsigned int fe_degree) // build reference MGTransferPrebuilt> transfer_ref(mg_constrained_dofs); - transfer_ref.build_matrices(mgdof); + transfer_ref.build(mgdof); // build matrix-free transfer MGTransferMatrixFree transfer(mg_constrained_dofs); diff --git a/tests/multigrid/transfer_matrix_free_03.cc b/tests/multigrid/transfer_matrix_free_03.cc index 9ffb085351..2c8369395f 100644 --- a/tests/multigrid/transfer_matrix_free_03.cc +++ b/tests/multigrid/transfer_matrix_free_03.cc @@ -74,7 +74,7 @@ check(const unsigned int fe_degree) // build reference MGTransferPrebuilt> transfer_ref(mg_constrained_dofs); - transfer_ref.build_matrices(mgdof); + transfer_ref.build(mgdof); // build matrix-free transfer MGTransferMatrixFree transfer(mg_constrained_dofs); diff --git a/tests/multigrid/transfer_matrix_free_04.cc b/tests/multigrid/transfer_matrix_free_04.cc index 4143160858..4ec1f7e504 100644 --- a/tests/multigrid/transfer_matrix_free_04.cc +++ b/tests/multigrid/transfer_matrix_free_04.cc @@ -71,7 +71,7 @@ check(const unsigned int fe_degree) // build reference MGTransferPrebuilt> transfer_ref; - transfer_ref.build_matrices(mgdof); + transfer_ref.build(mgdof); // build matrix-free transfer MGTransferMatrixFree transfer; diff --git a/tests/multigrid/transfer_matrix_free_05.cc b/tests/multigrid/transfer_matrix_free_05.cc index 73b429074e..344a1aee68 100644 --- a/tests/multigrid/transfer_matrix_free_05.cc +++ b/tests/multigrid/transfer_matrix_free_05.cc @@ -98,7 +98,7 @@ check(const unsigned int fe_degree) // build reference MGTransferPrebuilt> transfer_ref; - transfer_ref.build_matrices(mgdof); + transfer_ref.build(mgdof); // build matrix-free transfer MGTransferMatrixFree transfer; diff --git a/tests/multigrid/transfer_matrix_free_06.cc b/tests/multigrid/transfer_matrix_free_06.cc index e3206fa262..4410881eb3 100644 --- a/tests/multigrid/transfer_matrix_free_06.cc +++ b/tests/multigrid/transfer_matrix_free_06.cc @@ -107,7 +107,7 @@ check(const unsigned int fe_degree) // build reference MGTransferPrebuilt> transfer_ref(mg_constrained_dofs); - transfer_ref.build_matrices(mgdof); + transfer_ref.build(mgdof); // build matrix-free transfer MGTransferMatrixFree transfer(mg_constrained_dofs); diff --git a/tests/multigrid/transfer_matrix_free_07.cc b/tests/multigrid/transfer_matrix_free_07.cc index f6b118bb46..9859db1e63 100644 --- a/tests/multigrid/transfer_matrix_free_07.cc +++ b/tests/multigrid/transfer_matrix_free_07.cc @@ -98,7 +98,7 @@ check(const unsigned int fe_degree) // build reference MGTransferPrebuilt> transfer_ref; - transfer_ref.build_matrices(mgdof); + transfer_ref.build(mgdof); // build matrix-free transfer MGTransferMatrixFree transfer; diff --git a/tests/multigrid/transfer_matrix_free_11.cc b/tests/multigrid/transfer_matrix_free_11.cc index 2d618d1bda..c459db1fb4 100644 --- a/tests/multigrid/transfer_matrix_free_11.cc +++ b/tests/multigrid/transfer_matrix_free_11.cc @@ -63,7 +63,7 @@ check(const unsigned int fe_degree) // build reference MGTransferPrebuilt> transfer_ref( mg_constrained_dofs); - transfer_ref.build_matrices(mgdof); + transfer_ref.build(mgdof); deallog << "Transfer matrices: " << std::endl; transfer_ref.print_matrices(deallog.get_file_stream()); deallog << std::endl; diff --git a/tests/multigrid/transfer_prebuilt_01.cc b/tests/multigrid/transfer_prebuilt_01.cc index b5432676c8..e428f0dfeb 100644 --- a/tests/multigrid/transfer_prebuilt_01.cc +++ b/tests/multigrid/transfer_prebuilt_01.cc @@ -61,7 +61,7 @@ check_simple(const FiniteElement &fe) mgdof.distribute_mg_dofs(); MGTransferPrebuilt> transfer; - transfer.build_matrices(mgdof); + transfer.build(mgdof); transfer.print_matrices(deallog.get_file_stream()); transfer.print_indices(deallog.get_file_stream()); diff --git a/tests/multigrid/transfer_prebuilt_02.cc b/tests/multigrid/transfer_prebuilt_02.cc index 9c6df50768..f0c0f46572 100644 --- a/tests/multigrid/transfer_prebuilt_02.cc +++ b/tests/multigrid/transfer_prebuilt_02.cc @@ -66,7 +66,7 @@ check_simple(const FiniteElement &fe) mg_constrained_dofs.initialize(mgdof); MGTransferPrebuilt> transfer(mg_constrained_dofs); - transfer.build_matrices(mgdof); + transfer.build(mgdof); transfer.print_matrices(deallog.get_file_stream()); transfer.print_indices(deallog.get_file_stream()); diff --git a/tests/multigrid/transfer_prebuilt_03.cc b/tests/multigrid/transfer_prebuilt_03.cc index 0c4806b130..bc05a0ebe0 100644 --- a/tests/multigrid/transfer_prebuilt_03.cc +++ b/tests/multigrid/transfer_prebuilt_03.cc @@ -71,7 +71,7 @@ check_simple(const FiniteElement &fe) mg_constrained_dofs.initialize(mgdof, dirichlet_boundary); MGTransferPrebuilt> transfer(mg_constrained_dofs); - transfer.build_matrices(mgdof); + transfer.build(mgdof); transfer.print_matrices(deallog.get_file_stream()); transfer.print_indices(deallog.get_file_stream()); diff --git a/tests/multigrid/transfer_prebuilt_04.cc b/tests/multigrid/transfer_prebuilt_04.cc index 074ff7f503..0e18187c87 100644 --- a/tests/multigrid/transfer_prebuilt_04.cc +++ b/tests/multigrid/transfer_prebuilt_04.cc @@ -92,7 +92,7 @@ check() // create this if we have Trilinos MGTransferPrebuilt> transfer_ref(mg_constrained_dofs); - transfer_ref.build_matrices(mgdof); + transfer_ref.build(mgdof); } #endif { diff --git a/tests/multigrid/transfer_select.cc b/tests/multigrid/transfer_select.cc index 8fc70872f2..426c816710 100644 --- a/tests/multigrid/transfer_select.cc +++ b/tests/multigrid/transfer_select.cc @@ -55,14 +55,13 @@ check_select(const FiniteElement &fe, GridGenerator::hyper_cube(tr); tr.refine_global(2); - DoFHandler mgdof(tr); - DoFHandler &dof = mgdof; + DoFHandler mgdof(tr); mgdof.distribute_dofs(fe); mgdof.distribute_mg_dofs(); DoFRenumbering::component_wise(mgdof, target_component); vector ndofs( *std::max_element(target_component.begin(), target_component.end()) + 1); - DoFTools::count_dofs_per_component(dof, ndofs, true, target_component); + DoFTools::count_dofs_per_component(mgdof, ndofs, true, target_component); for (unsigned int l = 0; l < tr.n_levels(); ++l) DoFRenumbering::component_wise(mgdof, l, mg_target_component); @@ -85,8 +84,8 @@ check_select(const FiniteElement &fe, MGTransferSelect transfer; - transfer.build_matrices( - dof, mgdof, selected, mg_selected, target_component, mg_target_component); + transfer.build( + mgdof, selected, mg_selected, target_component, mg_target_component); Vector u2(mg_ndofs[2][mg_selected]); Vector u1(mg_ndofs[1][mg_selected]); diff --git a/tests/multigrid/transfer_system_01.cc b/tests/multigrid/transfer_system_01.cc index 6835847470..dbf3144115 100644 --- a/tests/multigrid/transfer_system_01.cc +++ b/tests/multigrid/transfer_system_01.cc @@ -104,7 +104,7 @@ check(const FiniteElement &fe) DoFRenumbering::component_wise(mg_dof_handler, level); MGTransferPrebuilt> transfer; - transfer.build_matrices(mg_dof_handler); + transfer.build(mg_dof_handler); FullMatrix prolong_0_1(mg_dof_handler.n_dofs(1), mg_dof_handler.n_dofs(0)); diff --git a/tests/multigrid/transfer_system_02.cc b/tests/multigrid/transfer_system_02.cc index 8a82dec489..948c1028ff 100644 --- a/tests/multigrid/transfer_system_02.cc +++ b/tests/multigrid/transfer_system_02.cc @@ -109,12 +109,11 @@ check(const FiniteElement &fe) // group all components into one // block, and do the transfer // matrices on this block - transfer.build_matrices(mg_dof_handler, - mg_dof_handler, - 0, - 0, - std::vector(2, 0U), - std::vector(2, 0U)); + transfer.build(mg_dof_handler, + 0, + 0, + std::vector(2, 0U), + std::vector(2, 0U)); FullMatrix prolong_0_1(mg_dof_handler.n_dofs(1), mg_dof_handler.n_dofs(0)); diff --git a/tests/multigrid/transfer_system_03.cc b/tests/multigrid/transfer_system_03.cc index 00eee4d5ce..c77556fa2e 100644 --- a/tests/multigrid/transfer_system_03.cc +++ b/tests/multigrid/transfer_system_03.cc @@ -110,7 +110,7 @@ check(const FiniteElement &fe) std::vector mask(2); mask[0] = 0; mask[1] = 1; - transfer.build_matrices(mg_dof_handler, mg_dof_handler, 0, 0, mask, mask); + transfer.build(mg_dof_handler, 0, 0, mask, mask); // use only the first half of all // components diff --git a/tests/multigrid/transfer_system_04.cc b/tests/multigrid/transfer_system_04.cc index 9d6c8f7fa9..7e8b361c97 100644 --- a/tests/multigrid/transfer_system_04.cc +++ b/tests/multigrid/transfer_system_04.cc @@ -110,8 +110,7 @@ check(const FiniteElement &fe) MGTransferSelect transfer; - transfer.build_matrices( - mg_dof_handler, mg_dof_handler, 0, 0, block_component, block_component); + transfer.build(mg_dof_handler, 0, 0, block_component, block_component); std::vector> dofs_per_block( tr.n_levels(), std::vector(2)); diff --git a/tests/multigrid/transfer_system_05.cc b/tests/multigrid/transfer_system_05.cc index cc9a6e7264..fd5c45e38b 100644 --- a/tests/multigrid/transfer_system_05.cc +++ b/tests/multigrid/transfer_system_05.cc @@ -67,12 +67,11 @@ check(const FiniteElement &fe, const unsigned int selected_block) MGTransferSelect transfer; - transfer.build_matrices(mg_dof_handler, - mg_dof_handler, - selected_block, - selected_block, - block_component, - block_component); + transfer.build(mg_dof_handler, + selected_block, + selected_block, + block_component, + block_component); std::vector dofs_per_block(3); DoFTools::count_dofs_per_block(mg_dof_handler, diff --git a/tests/multigrid/transfer_system_adaptive_01.cc b/tests/multigrid/transfer_system_adaptive_01.cc index c908ae1b62..f05ff2c70b 100644 --- a/tests/multigrid/transfer_system_adaptive_01.cc +++ b/tests/multigrid/transfer_system_adaptive_01.cc @@ -152,7 +152,7 @@ check(const FiniteElement &fe) DoFRenumbering::component_wise(mg_dof_handler, level); MGTransferPrebuilt> transfer; - transfer.build_matrices(mg_dof_handler); + transfer.build(mg_dof_handler); FullMatrix prolong_0_1(mg_dof_handler.n_dofs(1), mg_dof_handler.n_dofs(0)); diff --git a/tests/multigrid/transfer_system_adaptive_02.cc b/tests/multigrid/transfer_system_adaptive_02.cc index fd6b86cea1..66c16704fc 100644 --- a/tests/multigrid/transfer_system_adaptive_02.cc +++ b/tests/multigrid/transfer_system_adaptive_02.cc @@ -160,7 +160,7 @@ check(const FiniteElement &fe) mg_constrained_dofs.initialize(mg_dof_handler, dirichlet_boundary); MGTransferPrebuilt> transfer(mg_constrained_dofs); - transfer.build_matrices(mg_dof_handler); + transfer.build(mg_dof_handler); FullMatrix prolong_0_1(mg_dof_handler.n_dofs(1), mg_dof_handler.n_dofs(0)); diff --git a/tests/multigrid/transfer_system_adaptive_03.cc b/tests/multigrid/transfer_system_adaptive_03.cc index 700ee7d784..28dc238c5a 100644 --- a/tests/multigrid/transfer_system_adaptive_03.cc +++ b/tests/multigrid/transfer_system_adaptive_03.cc @@ -154,8 +154,7 @@ check(const FiniteElement &fe) std::vector block_selected(2, 0U); MGTransferSelect transfer; - transfer.build_matrices( - mg_dof_handler, mg_dof_handler, 0, 0, block_selected, block_selected); + transfer.build(mg_dof_handler, 0, 0, block_selected, block_selected); FullMatrix prolong_0_1(mg_dof_handler.n_dofs(1), mg_dof_handler.n_dofs(0)); diff --git a/tests/multigrid/transfer_system_adaptive_04.cc b/tests/multigrid/transfer_system_adaptive_04.cc index a504d45934..2f2767a1c3 100644 --- a/tests/multigrid/transfer_system_adaptive_04.cc +++ b/tests/multigrid/transfer_system_adaptive_04.cc @@ -163,13 +163,8 @@ check(const FiniteElement &fe) std::vector block_selected(2, 0U); MGTransferSelect transfer; - transfer.build_matrices(mg_dof_handler, - mg_dof_handler, - 0, - 0, - block_selected, - block_selected, - boundary_indices); + transfer.build( + mg_dof_handler, 0, 0, block_selected, block_selected, boundary_indices); FullMatrix prolong_0_1(mg_dof_handler.n_dofs(1), mg_dof_handler.n_dofs(0)); diff --git a/tests/multigrid/transfer_system_adaptive_05.cc b/tests/multigrid/transfer_system_adaptive_05.cc index 8318af82bd..e7d4573585 100644 --- a/tests/multigrid/transfer_system_adaptive_05.cc +++ b/tests/multigrid/transfer_system_adaptive_05.cc @@ -157,8 +157,7 @@ check(const FiniteElement &fe) block_selected[0] = 0; block_selected[1] = 1; MGTransferSelect transfer; - transfer.build_matrices( - mg_dof_handler, mg_dof_handler, 0, 0, block_selected, block_selected); + transfer.build(mg_dof_handler, 0, 0, block_selected, block_selected); // use only the first half of all // components diff --git a/tests/multigrid/transfer_system_adaptive_06.cc b/tests/multigrid/transfer_system_adaptive_06.cc index c9804a34e2..82ec612805 100644 --- a/tests/multigrid/transfer_system_adaptive_06.cc +++ b/tests/multigrid/transfer_system_adaptive_06.cc @@ -165,13 +165,8 @@ check(const FiniteElement &fe) block_selected[0] = 0; block_selected[1] = 1; MGTransferSelect transfer; - transfer.build_matrices(mg_dof_handler, - mg_dof_handler, - 0, - 0, - block_selected, - block_selected, - boundary_indices); + transfer.build( + mg_dof_handler, 0, 0, block_selected, block_selected, boundary_indices); // use only the first half of all // components diff --git a/tests/multigrid/transfer_system_adaptive_07.cc b/tests/multigrid/transfer_system_adaptive_07.cc index da5d56403a..89681a91fc 100644 --- a/tests/multigrid/transfer_system_adaptive_07.cc +++ b/tests/multigrid/transfer_system_adaptive_07.cc @@ -157,8 +157,7 @@ check(const FiniteElement &fe) DoFRenumbering::component_wise(mg_dof_handler, level, block_selected); MGTransferSelect transfer; - transfer.build_matrices( - mg_dof_handler, mg_dof_handler, 0, 0, block_selected, block_selected); + transfer.build(mg_dof_handler, 0, 0, block_selected, block_selected); std::vector> dofs_per_block( tr.n_levels(), std::vector(2)); diff --git a/tests/multigrid/transfer_system_adaptive_08.cc b/tests/multigrid/transfer_system_adaptive_08.cc index 179b12a858..6221788444 100644 --- a/tests/multigrid/transfer_system_adaptive_08.cc +++ b/tests/multigrid/transfer_system_adaptive_08.cc @@ -166,13 +166,8 @@ check(const FiniteElement &fe) boundary_indices); MGTransferSelect transfer; - transfer.build_matrices(mg_dof_handler, - mg_dof_handler, - 0, - 0, - block_selected, - block_selected, - boundary_indices); + transfer.build( + mg_dof_handler, 0, 0, block_selected, block_selected, boundary_indices); std::vector> dofs_per_block( tr.n_levels(), std::vector(2)); diff --git a/tests/multigrid/transfer_system_adaptive_09.cc b/tests/multigrid/transfer_system_adaptive_09.cc index 9954b618b6..b8b338406a 100644 --- a/tests/multigrid/transfer_system_adaptive_09.cc +++ b/tests/multigrid/transfer_system_adaptive_09.cc @@ -113,12 +113,11 @@ check(const FiniteElement &fe, const unsigned int selected_block) MGTransferSelect transfer; - transfer.build_matrices(mg_dof_handler, - mg_dof_handler, - selected_block, - selected_block, - block_component, - block_component); + transfer.build(mg_dof_handler, + selected_block, + selected_block, + block_component, + block_component); std::vector dofs_per_block(3); DoFTools::count_dofs_per_block(mg_dof_handler, diff --git a/tests/trilinos/mg_transfer_prebuilt_01.cc b/tests/trilinos/mg_transfer_prebuilt_01.cc index 54a8357b2a..c41afe3eec 100644 --- a/tests/trilinos/mg_transfer_prebuilt_01.cc +++ b/tests/trilinos/mg_transfer_prebuilt_01.cc @@ -81,7 +81,7 @@ check_simple(const FiniteElement &fe) mgdof.distribute_mg_dofs(); MGTransferPrebuilt transfer; - transfer.build_matrices(mgdof); + transfer.build(mgdof); MGLevelObject u(0, tr.n_levels() - 1); reinit_vector(mgdof, u); -- 2.39.5