From e80655aff5b0cf35601b43e967630ed91684c17e Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Tue, 1 Jun 2021 18:41:08 +0200 Subject: [PATCH] Remove MeshType from mg_transfer_global_coarsening.templates.h --- .../mg_transfer_global_coarsening.templates.h | 104 +++++++++--------- .../multigrid_p_02.cc | 2 +- 2 files changed, 52 insertions(+), 54 deletions(-) diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index 50ea241a27..a5ce5b6007 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -533,13 +533,13 @@ namespace internal std::vector tree_sizes; }; - template + template class FineDoFHandlerView { public: - FineDoFHandlerView(const MeshType & mesh_fine, - const MeshType & mesh_coarse, - const unsigned int mg_level_fine) + FineDoFHandlerView(const DoFHandler &mesh_fine, + const DoFHandler &mesh_coarse, + const unsigned int mg_level_fine) : mesh_fine(mesh_fine) , mesh_coarse(mesh_coarse) , mg_level_fine(mg_level_fine) @@ -657,7 +657,7 @@ namespace internal for (auto cell_id : i.second) { - typename MeshType::cell_iterator cell( + typename DoFHandler::cell_iterator cell( *tria_dst.create_cell_iterator( cell_id_translator.to_cell_id(cell_id)), &dof_handler_dst); @@ -697,7 +697,7 @@ namespace internal { const auto cell_id = cell_id_translator.to_cell_id(id); - typename MeshType::cell_iterator cell_( + typename DoFHandler::cell_iterator cell_( *tria_dst.create_cell_iterator(cell_id), &dof_handler_dst); indices.resize(cell_->get_fe().n_dofs_per_cell()); @@ -810,7 +810,7 @@ namespace internal } FineDoFHandlerViewCell - get_cell(const typename MeshType::cell_iterator &cell) const + get_cell(const typename DoFHandler::cell_iterator &cell) const { const auto id = this->cell_id_translator.translate(cell); @@ -819,8 +819,7 @@ namespace internal const bool is_cell_remotly_owned = this->is_dst_remote.is_element(id); const bool has_cell_any_children = [&]() { - for (unsigned int i = 0; - i < GeometryInfo::max_children_per_cell; + for (unsigned int i = 0; i < GeometryInfo::max_children_per_cell; ++i) { const auto j = this->cell_id_translator.translate(cell, i); @@ -841,7 +840,7 @@ namespace internal auto &dof_indices) { if (is_cell_locally_owned) { - typename MeshType::cell_iterator cell_fine( + typename DoFHandler::cell_iterator cell_fine( *mesh_fine.get_triangulation().create_cell_iterator(cell->id()), &mesh_fine); if (mg_level_fine == numbers::invalid_unsigned_int) @@ -862,7 +861,7 @@ namespace internal -> unsigned int { if (is_cell_locally_owned) { - return (typename MeshType::cell_iterator( + return (typename DoFHandler::cell_iterator( *mesh_fine.get_triangulation().create_cell_iterator( cell->id()), &mesh_fine)) @@ -881,8 +880,8 @@ namespace internal } FineDoFHandlerViewCell - get_cell(const typename MeshType::cell_iterator &cell, - const unsigned int c) const + get_cell(const typename DoFHandler::cell_iterator &cell, + const unsigned int c) const { const auto id = this->cell_id_translator.translate(cell, c); @@ -902,7 +901,7 @@ namespace internal if (is_cell_locally_owned) { const auto cell_fine = - (typename MeshType::cell_iterator( + (typename DoFHandler::cell_iterator( *mesh_fine.get_triangulation().create_cell_iterator( cell->id()), &mesh_fine)) @@ -944,13 +943,13 @@ namespace internal } private: - const MeshType & mesh_fine; - const MeshType & mesh_coarse; - const unsigned int mg_level_fine; - const MPI_Comm communicator; + const DoFHandler &mesh_fine; + const DoFHandler &mesh_coarse; + const unsigned int mg_level_fine; + const MPI_Comm communicator; protected: - const CellIDTranslator cell_id_translator; + const CellIDTranslator cell_id_translator; private: IndexSet is_dst_locally_owned; @@ -966,7 +965,7 @@ namespace internal map; static unsigned int - n_coarse_cells(const MeshType &mesh) + n_coarse_cells(const DoFHandler &mesh) { types::coarse_cell_id n_coarse_cells = 0; @@ -979,20 +978,20 @@ namespace internal } static unsigned int - n_global_levels(const MeshType &mesh) + n_global_levels(const DoFHandler &mesh) { return mesh.get_triangulation().n_global_levels(); } }; - template - class GlobalCoarseningFineDoFHandlerView : public FineDoFHandlerView + template + class GlobalCoarseningFineDoFHandlerView : public FineDoFHandlerView { public: - GlobalCoarseningFineDoFHandlerView(const MeshType &dof_handler_dst, - const MeshType &dof_handler_src) + GlobalCoarseningFineDoFHandlerView(const DoFHandler &dof_handler_dst, + const DoFHandler &dof_handler_src) : FineDoFHandlerView< - MeshType>(dof_handler_dst, dof_handler_src, numbers::invalid_unsigned_int /*global coarsening only possible on active levels*/) + dim>(dof_handler_dst, dof_handler_src, numbers::invalid_unsigned_int /*global coarsening only possible on active levels*/) { // get reference to triangulations const auto &tria_dst = dof_handler_dst.get_triangulation(); @@ -1020,7 +1019,7 @@ namespace internal continue; for (unsigned int i = 0; - i < GeometryInfo::max_children_per_cell; + i < GeometryInfo::max_children_per_cell; ++i) is_dst_remote.add_index( this->cell_id_translator.translate(cell, i)); @@ -1033,18 +1032,17 @@ namespace internal } }; - template - class PermutationFineDoFHandlerView - : public internal::FineDoFHandlerView + template + class PermutationFineDoFHandlerView : public internal::FineDoFHandlerView { public: - PermutationFineDoFHandlerView(const MeshType & dof_handler_dst, - const MeshType & dof_handler_src, - const unsigned int mg_level_fine, - const unsigned int mg_level_coarse) - : internal::FineDoFHandlerView(dof_handler_dst, - dof_handler_src, - mg_level_fine) + PermutationFineDoFHandlerView(const DoFHandler &dof_handler_dst, + const DoFHandler &dof_handler_src, + const unsigned int mg_level_fine, + const unsigned int mg_level_coarse) + : internal::FineDoFHandlerView(dof_handler_dst, + dof_handler_src, + mg_level_fine) { // get reference to triangulations const auto &tria_dst = dof_handler_dst.get_triangulation(); @@ -1095,10 +1093,10 @@ namespace internal class MGTwoLevelTransferImplementation { - template + template static void precompute_constraints( - const MeshType & dof_handler_coarse, + const DoFHandler & dof_handler_coarse, const dealii::AffineConstraints &constraint_coarse, MGTwoLevelTransfer> &transfer) @@ -1220,10 +1218,10 @@ namespace internal - template + template static void compute_weights( - const MeshType & dof_handler_fine, + const DoFHandler & dof_handler_fine, const unsigned int mg_level_fine, const dealii::AffineConstraints &constraint_fine, const MGTwoLevelTransfer> @@ -1310,18 +1308,18 @@ namespace internal public: - template + template static void reinit_geometric_transfer( - const MeshType & dof_handler_fine, - const MeshType & dof_handler_coarse, + const DoFHandler & dof_handler_fine, + const DoFHandler & dof_handler_coarse, const dealii::AffineConstraints &constraint_fine, const dealii::AffineConstraints &constraint_coarse, MGTwoLevelTransfer> &transfer) { - const GlobalCoarseningFineDoFHandlerView view( - dof_handler_fine, dof_handler_coarse); + const GlobalCoarseningFineDoFHandlerView view(dof_handler_fine, + dof_handler_coarse); // copy constrain matrix; TODO: why only for the coarse level? precompute_constraints(dof_handler_coarse, constraint_coarse, transfer); @@ -1763,11 +1761,11 @@ namespace internal - template + template static void reinit_polynomial_transfer( - const MeshType & dof_handler_fine, - const MeshType & dof_handler_coarse, + const DoFHandler & dof_handler_fine, + const DoFHandler & dof_handler_coarse, const dealii::AffineConstraints &constraint_fine, const dealii::AffineConstraints &constraint_coarse, const unsigned int mg_level_fine, @@ -1787,10 +1785,10 @@ namespace internal "Polynomial transfer is only allowed on the active level " "(numbers::invalid_unsigned_int) or the coarse-grid level (0).")); - const PermutationFineDoFHandlerView view(dof_handler_fine, - dof_handler_coarse, - mg_level_fine, - mg_level_coarse); + const PermutationFineDoFHandlerView view(dof_handler_fine, + dof_handler_coarse, + mg_level_fine, + mg_level_coarse); // TODO: adjust assert AssertDimension( diff --git a/tests/multigrid-global-coarsening/multigrid_p_02.cc b/tests/multigrid-global-coarsening/multigrid_p_02.cc index 13111dc378..2b7a764838 100644 --- a/tests/multigrid-global-coarsening/multigrid_p_02.cc +++ b/tests/multigrid-global-coarsening/multigrid_p_02.cc @@ -150,7 +150,7 @@ test(const unsigned int n_refinements, const unsigned int fe_degree_fine) data_out.add_data_vector( results[l], "solution", - DataOut_DoFData, dim>::DataVectorType::type_dof_data); + DataOut_DoFData::DataVectorType::type_dof_data); data_out.build_patches(*mapping_, 2); std::ofstream output("test." + std::to_string(dim) + "." + -- 2.39.5