From 046ee7139f03e42672355c5426888ae24df9f282 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Wed, 15 Jul 2020 18:47:05 +0200 Subject: [PATCH] Replace some GeometryInfos in dof_handler.cc and dof_handler_policy.cc --- source/dofs/dof_handler.cc | 25 +++++++---------- source/dofs/dof_handler_policy.cc | 45 +++++++++++-------------------- 2 files changed, 26 insertions(+), 44 deletions(-) diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index dd0b53f1c6..4649cb5930 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -454,7 +454,7 @@ namespace internal { const unsigned int level = cell->level(); - for (const unsigned int vertex : GeometryInfo<1>::vertex_indices()) + for (const auto vertex : cell->vertex_indices()) { const unsigned int vertex_index = cell->vertex_index(vertex); @@ -528,7 +528,7 @@ namespace internal { const unsigned int level = cell->level(); - for (const unsigned int vertex : GeometryInfo<2>::vertex_indices()) + for (const auto vertex : cell->vertex_indices()) { const unsigned int vertex_index = cell->vertex_index(vertex); @@ -603,7 +603,7 @@ namespace internal { const unsigned int level = cell->level(); - for (const unsigned int vertex : GeometryInfo<3>::vertex_indices()) + for (const auto vertex : cell->vertex_indices()) { const unsigned int vertex_index = cell->vertex_index(vertex); @@ -1019,7 +1019,7 @@ namespace internal dof_handler.tria->n_vertices(), false); for (const auto &cell : dof_handler.active_cell_iterators()) if (!cell->is_artificial()) - for (const unsigned int v : GeometryInfo::vertex_indices()) + for (const auto v : cell->vertex_indices()) locally_used_vertices[cell->vertex_index(v)] = true; std::vector> vertex_fe_association( @@ -1028,7 +1028,7 @@ namespace internal for (const auto &cell : dof_handler.active_cell_iterators()) if (!cell->is_artificial()) - for (const unsigned int v : GeometryInfo::vertex_indices()) + for (const auto v : cell->vertex_indices()) vertex_fe_association[cell->active_fe_index()] [cell->vertex_index(v)] = true; @@ -1262,8 +1262,7 @@ namespace internal for (const auto &cell : dof_handler.active_cell_iterators()) if (!cell->is_artificial()) - for (const unsigned int face : - GeometryInfo::face_indices()) + for (const auto face : cell->face_indices()) if (cell->face(face)->user_flag_set() == false) { unsigned int fe_slots_needed = 0; @@ -1345,8 +1344,7 @@ namespace internal for (const auto &cell : dof_handler.active_cell_iterators()) if (!cell->is_artificial()) - for (const unsigned int face : - GeometryInfo::face_indices()) + for (const auto face : cell->face_indices()) if (!cell->face(face)->user_flag_set()) { // Same decision tree as before @@ -1519,8 +1517,6 @@ namespace internal template static void reserve_space(dealii::DoFHandler<3, spacedim> &dof_handler) { - const unsigned int dim = 3; - Assert(dof_handler.fe_collection.size() > 0, (typename dealii::DoFHandler<1, spacedim>::ExcNoFESelected())); Assert(dof_handler.tria->n_levels() > 0, @@ -1558,8 +1554,7 @@ namespace internal for (const auto &cell : dof_handler.active_cell_iterators()) if (!cell->is_artificial()) - for (unsigned int l = 0; l < GeometryInfo::lines_per_cell; - ++l) + for (const auto l : cell->line_indices()) line_fe_association[cell->active_fe_index()] [cell->line_index(l)] = true; @@ -2256,7 +2251,7 @@ DoFHandler::n_boundary_dofs() const for (const auto &cell : this->active_cell_iterators()) if (cell->is_locally_owned() && cell->at_boundary()) { - for (auto iface : GeometryInfo::face_indices()) + for (const auto iface : cell->face_indices()) { const auto face = cell->face(iface); if (face->at_boundary()) @@ -2305,7 +2300,7 @@ DoFHandler::n_boundary_dofs( for (const auto &cell : this->active_cell_iterators()) if (cell->is_locally_owned() && cell->at_boundary()) { - for (auto iface : GeometryInfo::face_indices()) + for (const auto iface : cell->face_indices()) { const auto face = cell->face(iface); const unsigned int boundary_id = face->boundary_id(); diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index 0df5e7a642..19f43f4938 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -421,7 +421,7 @@ namespace internal dof_handler.fe_collection.size(), dof_handler.fe_collection.size()); for (const auto &cell : dof_handler.active_cell_iterators()) - for (unsigned int l = 0; l < GeometryInfo::lines_per_cell; ++l) + for (const auto l : cell->line_indices()) if (cell->line(l)->user_flag_set() == false) { const auto line = cell->line(l); @@ -790,7 +790,7 @@ namespace internal dof_handler.fe_collection.size(), dof_handler.fe_collection.size()); for (const auto &cell : dof_handler.active_cell_iterators()) - for (unsigned int q = 0; q < GeometryInfo::quads_per_cell; ++q) + for (const auto q : cell->face_indices()) if ((cell->quad(q)->user_flag_set() == false) && (cell->quad(q)->n_active_fe_indices() == 2)) { @@ -1076,7 +1076,7 @@ namespace internal &dof_handler.get_triangulation()) != nullptr) for (const auto &cell : dof_handler.active_cell_iterators()) if (cell->is_ghost()) - for (const unsigned int v : GeometryInfo::vertex_indices()) + for (const unsigned int v : cell->vertex_indices()) include_vertex[cell->vertex_index(v)] = true; // loop over all vertices and see which one we need to work on @@ -1241,8 +1241,7 @@ namespace internal // mark all lines on ghost cells for (const auto &cell : dof_handler.active_cell_iterators()) if (cell->is_ghost()) - for (unsigned int l = 0; l < GeometryInfo::lines_per_cell; - ++l) + for (const auto l : cell->line_indices()) cell->line(l)->set_user_flag(); // An implementation of the algorithm described in the hp paper, @@ -1268,7 +1267,7 @@ namespace internal dof_handler.fe_collection.size(), dof_handler.fe_collection.size()); for (const auto &cell : dof_handler.active_cell_iterators()) - for (unsigned int l = 0; l < GeometryInfo::lines_per_cell; ++l) + for (const auto l : cell->line_indices()) if ((cell->is_locally_owned()) && (cell->line(l)->user_flag_set() == true)) { @@ -1525,8 +1524,7 @@ namespace internal // mark all quads on ghost cells for (const auto &cell : dof_handler.active_cell_iterators()) if (cell->is_ghost()) - for (unsigned int q = 0; q < GeometryInfo::quads_per_cell; - ++q) + for (const auto q : cell->face_indices()) cell->quad(q)->set_user_flag(); // An implementation of the algorithm described in the hp @@ -1544,7 +1542,7 @@ namespace internal dof_handler.fe_collection.size(), dof_handler.fe_collection.size()); for (const auto &cell : dof_handler.active_cell_iterators()) - for (unsigned int q = 0; q < GeometryInfo::quads_per_cell; ++q) + for (const auto q : cell->face_indices()) if ((cell->is_locally_owned()) && (cell->quad(q)->user_flag_set() == true) && (cell->quad(q)->n_active_fe_indices() == 2)) @@ -2113,8 +2111,7 @@ namespace internal for (const auto &cell : dof_handler.active_cell_iterators()) if (!cell->is_artificial()) - for (unsigned int l = 0; l < GeometryInfo::lines_per_cell; - ++l) + for (const auto l : cell->line_indices()) if (cell->line(l)->user_flag_set() == false) { const auto line = cell->line(l); @@ -2222,8 +2219,7 @@ namespace internal for (const auto &cell : dof_handler.active_cell_iterators()) if (!cell->is_artificial()) - for (unsigned int l = 0; l < GeometryInfo::lines_per_cell; - ++l) + for (const auto l : cell->line_indices()) if (cell->line(l)->user_flag_set() == false) { const auto line = cell->line(l); @@ -2300,8 +2296,7 @@ namespace internal for (const auto &cell : dof_handler.active_cell_iterators()) if (!cell->is_artificial()) - for (unsigned int q = 0; q < GeometryInfo::quads_per_cell; - ++q) + for (const auto q : cell->face_indices()) if (cell->quad(q)->user_flag_set() == false) { const auto quad = cell->quad(q); @@ -2568,14 +2563,12 @@ namespace internal dof_handler.cell_iterators_on_level(level)) if (cell->level_subdomain_id() != numbers::artificial_subdomain_id) - for (const unsigned int line : - GeometryInfo<2>::face_indices()) + for (const unsigned int line : cell->face_indices()) cell->face(line)->set_user_flag(); for (const auto &cell : dof_handler.cell_iterators_on_level(level)) - for (unsigned int l = 0; l < GeometryInfo<2>::lines_per_cell; - ++l) + for (const auto l : cell->line_indices()) if (cell->line(l)->user_flag_set()) { for (unsigned int d = 0; @@ -2634,15 +2627,12 @@ namespace internal dof_handler.cell_iterators_on_level(level)) if (cell->level_subdomain_id() != numbers::artificial_subdomain_id) - for (unsigned int line = 0; - line < GeometryInfo<3>::lines_per_cell; - ++line) + for (const auto line : cell->line_indices()) cell->line(line)->set_user_flag(); for (const auto &cell : dof_handler.cell_iterators_on_level(level)) - for (unsigned int l = 0; l < GeometryInfo<3>::lines_per_cell; - ++l) + for (const auto l : cell->line_indices()) if (cell->line(l)->user_flag_set()) { for (unsigned int d = 0; @@ -2674,14 +2664,11 @@ namespace internal dof_handler.cell_iterators_on_level(level)) if (cell->level_subdomain_id() != numbers::artificial_subdomain_id) - for (unsigned int quad = 0; - quad < GeometryInfo<3>::quads_per_cell; - ++quad) + for (const auto quad : cell->face_indices()) cell->quad(quad)->set_user_flag(); for (const auto &cell : dof_handler.cell_iterators()) - for (unsigned int l = 0; l < GeometryInfo<3>::quads_per_cell; - ++l) + for (const auto l : cell->face_indices()) if (cell->quad(l)->user_flag_set()) { for (unsigned int d = 0; -- 2.39.5