]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use GeometryInfo::vertex_indices() in include/ and source/.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 5 Mar 2020 01:46:38 +0000 (18:46 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 5 Mar 2020 04:31:17 +0000 (21:31 -0700)
34 files changed:
include/deal.II/dofs/dof_accessor.templates.h
include/deal.II/fe/fe_tools.templates.h
include/deal.II/fe/mapping_manifold.h
include/deal.II/grid/grid_tools.h
include/deal.II/grid/tria_accessor.templates.h
include/deal.II/numerics/data_out_dof_data.h
source/base/data_out_base.cc
source/distributed/tria.cc
source/distributed/tria_base.cc
source/dofs/dof_handler.cc
source/dofs/dof_handler_policy.cc
source/dofs/dof_tools.cc
source/fe/fe_enriched.cc
source/fe/fe_q_hierarchical.cc
source/fe/mapping.cc
source/fe/mapping_fe_field.cc
source/fe/mapping_manifold.cc
source/fe/mapping_q1_eulerian.cc
source/fe/mapping_q_generic.cc
source/grid/grid_generator.cc
source/grid/grid_in.cc
source/grid/grid_out.cc
source/grid/grid_reordering.cc
source/grid/grid_tools.cc
source/grid/grid_tools_dof_handlers.cc
source/grid/manifold.cc
source/grid/manifold_lib.cc
source/grid/tria.cc
source/grid/tria_accessor.cc
source/grid/tria_description.cc
source/hp/dof_handler.cc
source/numerics/data_out.cc
source/numerics/data_out_rotation.cc
source/particles/particle_handler.cc

index 269f454547fdb9cf0738b557bd46882aded0d364..aa30251af72eecbe8bbad460a460cb0b1c1a6fe7 100644 (file)
@@ -1407,9 +1407,7 @@ namespace internal
         std::vector<types::global_dof_index>::const_iterator next =
           dof_indices.begin();
 
-        for (unsigned int vertex = 0;
-             vertex < GeometryInfo<1>::vertices_per_cell;
-             ++vertex)
+        for (const unsigned int vertex : GeometryInfo<1>::vertex_indices())
           for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
             accessor.set_mg_vertex_dof_index(
               level, vertex, dof, *next++, fe_index);
@@ -1435,9 +1433,7 @@ namespace internal
         std::vector<types::global_dof_index>::const_iterator next =
           dof_indices.begin();
 
-        for (unsigned int vertex = 0;
-             vertex < GeometryInfo<2>::vertices_per_cell;
-             ++vertex)
+        for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
           for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
             accessor.set_mg_vertex_dof_index(
               level, vertex, dof, *next++, fe_index);
@@ -1470,9 +1466,7 @@ namespace internal
         std::vector<types::global_dof_index>::const_iterator next =
           dof_indices.begin();
 
-        for (unsigned int vertex = 0;
-             vertex < GeometryInfo<3>::vertices_per_cell;
-             ++vertex)
+        for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
           for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
             accessor.set_mg_vertex_dof_index(
               level, vertex, dof, *next++, fe_index);
@@ -1950,8 +1944,7 @@ namespace internal
         handler.get_fe(fe_index);
       std::vector<types::global_dof_index>::iterator next = dof_indices.begin();
 
-      for (unsigned int vertex = 0; vertex < GeometryInfo<1>::vertices_per_cell;
-           ++vertex)
+      for (const unsigned int vertex : GeometryInfo<1>::vertex_indices())
         for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
           *next++ = accessor.mg_vertex_dof_index(level, vertex, dof);
 
@@ -1978,8 +1971,7 @@ namespace internal
         handler.get_fe(fe_index);
       std::vector<types::global_dof_index>::iterator next = dof_indices.begin();
 
-      for (unsigned int vertex = 0; vertex < GeometryInfo<2>::vertices_per_cell;
-           ++vertex)
+      for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
         for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
           *next++ = accessor.mg_vertex_dof_index(level, vertex, dof);
 
@@ -2011,8 +2003,7 @@ namespace internal
         handler.get_fe(fe_index);
       std::vector<types::global_dof_index>::iterator next = dof_indices.begin();
 
-      for (unsigned int vertex = 0; vertex < GeometryInfo<3>::vertices_per_cell;
-           ++vertex)
+      for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
         for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
           *next++ = accessor.mg_vertex_dof_index(level, vertex, dof);
 
@@ -2990,9 +2981,7 @@ namespace internal
 
         unsigned int index = 0;
 
-        for (unsigned int vertex = 0;
-             vertex < GeometryInfo<dim>::vertices_per_cell;
-             ++vertex)
+        for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
           for (unsigned int d = 0; d < dofs_per_vertex; ++d, ++index)
             accessor.set_vertex_dof_index(vertex,
                                           d,
index 0a7d0d63753d483c80cad4d4d7d8210a12abae26..d8f4c374b4512c8b41651f95f12bfaaae1c01e30 100644 (file)
@@ -227,9 +227,8 @@ namespace FETools
       // for each shape function, copy the flags from the base element to this
       // one, taking into account multiplicities, and other complications
       unsigned int total_index = 0;
-      for (unsigned int vertex_number = 0;
-           vertex_number < GeometryInfo<dim>::vertices_per_cell;
-           ++vertex_number)
+      for (const unsigned int vertex_number :
+           GeometryInfo<dim>::vertex_indices())
         {
           for (unsigned int base = 0; base < fes.size(); ++base)
             for (unsigned int m = 0; m < multiplicities[base]; ++m)
@@ -419,9 +418,8 @@ namespace FETools
       // to this one, taking into account multiplicities, multiple components in
       // base elements, and other complications
       unsigned int total_index = 0;
-      for (unsigned int vertex_number = 0;
-           vertex_number < GeometryInfo<dim>::vertices_per_cell;
-           ++vertex_number)
+      for (const unsigned int vertex_number :
+           GeometryInfo<dim>::vertex_indices())
         {
           unsigned int comp_start = 0;
           for (unsigned int base = 0; base < fes.size(); ++base)
@@ -663,9 +661,8 @@ namespace FETools
       // the first vertex in the order of the base elements, then of the second
       // vertex, etc
       total_index = 0;
-      for (unsigned int vertex_number = 0;
-           vertex_number < GeometryInfo<dim>::vertices_per_cell;
-           ++vertex_number)
+      for (const unsigned int vertex_number :
+           GeometryInfo<dim>::vertex_indices())
         {
           unsigned int comp_start = 0;
           for (unsigned int base = 0; base < fe.n_base_elements(); ++base)
index 828f74d011bde57299da5331b1f7d5465314b16b..7dd5a81adca45048260ec626640afa699836a197 100644 (file)
@@ -400,7 +400,7 @@ MappingManifold<dim, spacedim>::InternalData::store_vertices(
   const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
 {
   vertices.resize(GeometryInfo<dim>::vertices_per_cell);
-  for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+  for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
     vertices[i] = cell->vertex(i);
   this->cell = cell;
 }
@@ -415,7 +415,7 @@ MappingManifold<dim, spacedim>::InternalData::
     quad.size(), std::vector<double>(GeometryInfo<dim>::vertices_per_cell));
   for (unsigned int q = 0; q < quad.size(); ++q)
     {
-      for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+      for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
         {
           cell_manifold_quadrature_weights[q][i] =
             GeometryInfo<dim>::d_linear_shape_function(quad.point(q), i);
index d891ea3bdd6095ad2590e77318385ba65c4cec8e..4369210a6090856923e7afc03913d4c76a60070b 100644 (file)
@@ -3145,7 +3145,7 @@ namespace GridTools
       cell = triangulation.begin_active(),
       endc = triangulation.end();
     for (; cell != endc; ++cell)
-      for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
         if (treated_vertices[cell->vertex_index(v)] == false)
           {
             // transform this vertex
@@ -3464,29 +3464,25 @@ namespace GridTools
           xi[d] = 0.5;
 
         Point<spacedim> x_k;
-        for (unsigned int i = 0; i < GeometryInfo<structdim>::vertices_per_cell;
-             ++i)
+        for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
           x_k += object->vertex(i) *
                  GeometryInfo<structdim>::d_linear_shape_function(xi, i);
 
         do
           {
             Tensor<1, structdim> F_k;
-            for (unsigned int i = 0;
-                 i < GeometryInfo<structdim>::vertices_per_cell;
-                 ++i)
+            for (const unsigned int i :
+                 GeometryInfo<structdim>::vertex_indices())
               F_k +=
                 (x_k - trial_point) * object->vertex(i) *
                 GeometryInfo<structdim>::d_linear_shape_function_gradient(xi,
                                                                           i);
 
             Tensor<2, structdim> H_k;
-            for (unsigned int i = 0;
-                 i < GeometryInfo<structdim>::vertices_per_cell;
-                 ++i)
-              for (unsigned int j = 0;
-                   j < GeometryInfo<structdim>::vertices_per_cell;
-                   ++j)
+            for (const unsigned int i :
+                 GeometryInfo<structdim>::vertex_indices())
+              for (const unsigned int j :
+                   GeometryInfo<structdim>::vertex_indices())
                 {
                   Tensor<2, structdim> tmp = outer_product(
                     GeometryInfo<structdim>::d_linear_shape_function_gradient(
@@ -3500,9 +3496,8 @@ namespace GridTools
             xi += delta_xi;
 
             x_k = Point<spacedim>();
-            for (unsigned int i = 0;
-                 i < GeometryInfo<structdim>::vertices_per_cell;
-                 ++i)
+            for (const unsigned int i :
+                 GeometryInfo<structdim>::vertex_indices())
               x_k += object->vertex(i) *
                      GeometryInfo<structdim>::d_linear_shape_function(xi, i);
 
@@ -3920,8 +3915,7 @@ namespace GridTools
       if (cell->is_locally_owned())
         {
           std::set<dealii::types::subdomain_id> send_to;
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             {
               const std::map<unsigned int,
                              std::set<dealii::types::subdomain_id>>::
index 572cfde36aed15593ab5a9bb537c32597ff20f5d..a4b5d33003a96db7735a38e24e329b4e606ca5ca 100644 (file)
@@ -2166,7 +2166,7 @@ TriaAccessor<structdim, dim, spacedim>::enclosing_ball() const
   // For each vertex that is found to be geometrically outside the ball
   // enlarge the ball  so that the new ball contains both the previous ball
   // and the given vertex.
-  for (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell; ++v)
+  for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
     if (!is_initial_guess_vertex[v])
       {
         const double distance = center.distance(this->vertex(v));
@@ -2188,7 +2188,7 @@ TriaAccessor<structdim, dim, spacedim>::enclosing_ball() const
 
   // Set all_vertices_within_ball false if any of the vertices of the object
   // are geometrically outside the ball
-  for (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell; ++v)
+  for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
     if (center.distance(this->vertex(v)) >
         radius + 100. * std::numeric_limits<double>::epsilon())
       {
@@ -2214,9 +2214,7 @@ TriaAccessor<structdim, dim, spacedim>::minimum_vertex_distance() const
       case 3:
         {
           double min = std::numeric_limits<double>::max();
-          for (unsigned int i = 0;
-               i < GeometryInfo<structdim>::vertices_per_cell;
-               ++i)
+          for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
             for (unsigned int j = i + 1;
                  j < GeometryInfo<structdim>::vertices_per_cell;
                  ++j)
index 2164aa86bf3ee3b87ef1f14d641c53d9bb80fe31..6bd54c4e9513b9a77745d5da905ce0cac5f10fc3 100644 (file)
@@ -1185,8 +1185,7 @@ DataOut_DoFData<DoFHandlerType, patch_dim, patch_space_dim>::merge_patches(
   // perform shift, if so desired
   if (shift != Point<patch_space_dim>())
     for (unsigned int i = old_n_patches; i < patches.size(); ++i)
-      for (unsigned int v = 0; v < GeometryInfo<patch_dim>::vertices_per_cell;
-           ++v)
+      for (const unsigned int v : GeometryInfo<patch_dim>::vertex_indices())
         patches[i].vertices[v] += shift;
 
   // adjust patch numbers
index a210f67e745b27ee4593eaae740fd336c6425bb4..cb2873f3ddee2b457dc4afccfec88f6374b5a139 100644 (file)
@@ -1772,7 +1772,7 @@ namespace DataOutBase
   {
     // TODO: make tolerance relative
     const double epsilon = 3e-16;
-    for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+    for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
       if (vertices[i].distance(patch.vertices[i]) > epsilon)
         return false;
 
@@ -1868,7 +1868,7 @@ namespace DataOutBase
 
     // TODO: make tolerance relative
     const double epsilon = 3e-16;
-    for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+    for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
       if (vertices[i].distance(patch.vertices[i]) > epsilon)
         return false;
 
@@ -8594,7 +8594,7 @@ namespace DataOutBase
         << '\n';
 
     // then write all the data that is in this patch
-    for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+    for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
       out << patch.vertices[GeometryInfo<dim>::ucd_to_deal[i]] << ' ';
     out << '\n';
 
@@ -8643,7 +8643,7 @@ namespace DataOutBase
 
 
     // then read all the data that is in this patch
-    for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+    for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
       in >> patch.vertices[GeometryInfo<dim>::ucd_to_deal[i]];
 
     for (unsigned int i : GeometryInfo<dim>::face_indices())
index 2477b09b0c5213028bb0b337b026800d7faeeade..7a3e41e09b96f865183de0b6a1e7090f299ab0eb 100644 (file)
@@ -58,7 +58,7 @@ namespace
            triangulation.begin_active();
          cell != triangulation.end();
          ++cell)
-      for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
         {
           ++vertex_touch_count[cell->vertex_index(v)];
           vertex_to_cell[cell->vertex_index(v)].emplace_back(cell, v);
@@ -147,7 +147,7 @@ namespace
         const unsigned int index =
           coarse_cell_to_p4est_tree_permutation[cell->index()];
 
-        for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+        for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
           {
             if (set_vertex_info == true)
               connectivity
@@ -349,7 +349,7 @@ namespace
         // important: only assign the level_subdomain_id if it is a ghost cell
         // even though we could fill in all.
         bool used = false;
-        for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+        for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
           {
             if (marked_vertices[dealii_cell->level()]
                                [dealii_cell->vertex_index(v)])
@@ -375,8 +375,7 @@ namespace
             dealii_cell->is_artificial() == false &&
             dealii_cell->level() + 1 < static_cast<int>(marked_vertices.size()))
           {
-            for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
               {
                 if (marked_vertices[dealii_cell->level() + 1]
                                    [dealii_cell->vertex_index(v)])
@@ -391,8 +390,7 @@ namespace
         if (!used && dealii_cell->is_active() &&
             dealii_cell->is_artificial() == false && dealii_cell->level() > 0)
           {
-            for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
               {
                 if (marked_vertices[dealii_cell->level() - 1]
                                    [dealii_cell->vertex_index(v)])
@@ -2442,8 +2440,7 @@ namespace parallel
           if (dealii_cell->is_locally_owned())
             {
               std::set<dealii::types::subdomain_id> send_to;
-              for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                   ++v)
+              for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                 {
                   const std::map<unsigned int,
                                  std::set<dealii::types::subdomain_id>>::
@@ -2466,9 +2463,8 @@ namespace parallel
                 {
                   std::vector<unsigned int>            vertex_indices;
                   std::vector<dealii::Point<spacedim>> local_vertices;
-                  for (unsigned int v = 0;
-                       v < GeometryInfo<dim>::vertices_per_cell;
-                       ++v)
+                  for (const unsigned int v :
+                       GeometryInfo<dim>::vertex_indices())
                     if (vertex_locally_moved[dealii_cell->vertex_index(v)])
                       {
                         vertex_indices.push_back(v);
@@ -3305,18 +3301,16 @@ namespace parallel
             for (; cell != endc; ++cell)
               {
                 if (cell->refine_flag_set())
-                  for (unsigned int vertex = 0;
-                       vertex < GeometryInfo<dim>::vertices_per_cell;
-                       ++vertex)
+                  for (const unsigned int vertex :
+                       GeometryInfo<dim>::vertex_indices())
                     vertex_level[topological_vertex_numbering
                                    [cell->vertex_index(vertex)]] =
                       std::max(vertex_level[topological_vertex_numbering
                                               [cell->vertex_index(vertex)]],
                                cell->level() + 1);
                 else if (!cell->coarsen_flag_set())
-                  for (unsigned int vertex = 0;
-                       vertex < GeometryInfo<dim>::vertices_per_cell;
-                       ++vertex)
+                  for (const unsigned int vertex :
+                       GeometryInfo<dim>::vertex_indices())
                     vertex_level[topological_vertex_numbering
                                    [cell->vertex_index(vertex)]] =
                       std::max(vertex_level[topological_vertex_numbering
@@ -3331,9 +3325,8 @@ namespace parallel
                     // to correct this by iterating over the entire
                     // process until we are converged
                     Assert(cell->coarsen_flag_set(), ExcInternalError());
-                    for (unsigned int vertex = 0;
-                         vertex < GeometryInfo<dim>::vertices_per_cell;
-                         ++vertex)
+                    for (const unsigned int vertex :
+                         GeometryInfo<dim>::vertex_indices())
                       vertex_level[topological_vertex_numbering
                                      [cell->vertex_index(vertex)]] =
                         std::max(vertex_level[topological_vertex_numbering
@@ -3356,9 +3349,8 @@ namespace parallel
             for (cell = tria.last_active(); cell != endc; --cell)
               if (cell->refine_flag_set() == false)
                 {
-                  for (unsigned int vertex = 0;
-                       vertex < GeometryInfo<dim>::vertices_per_cell;
-                       ++vertex)
+                  for (const unsigned int vertex :
+                       GeometryInfo<dim>::vertex_indices())
                     if (vertex_level[topological_vertex_numbering
                                        [cell->vertex_index(vertex)]] >=
                         cell->level() + 1)
@@ -3376,9 +3368,8 @@ namespace parallel
                             cell->set_refine_flag();
                             continue_iterating = true;
 
-                            for (unsigned int v = 0;
-                                 v < GeometryInfo<dim>::vertices_per_cell;
-                                 ++v)
+                            for (const unsigned int v :
+                                 GeometryInfo<dim>::vertex_indices())
                               vertex_level[topological_vertex_numbering
                                              [cell->vertex_index(v)]] =
                                 std::max(
@@ -4050,9 +4041,8 @@ namespace parallel
                       (cell->level_subdomain_id() ==
                        numbers::artificial_subdomain_id);
                     bool need_to_know = false;
-                    for (unsigned int vertex = 0;
-                         vertex < GeometryInfo<dim>::vertices_per_cell;
-                         ++vertex)
+                    for (const unsigned int vertex :
+                         GeometryInfo<dim>::vertex_indices())
                       if (active_verts[cell->vertex_index(vertex)])
                         {
                           need_to_know = true;
@@ -4509,8 +4499,7 @@ namespace parallel
       cell_iterator     cell = this->begin(level), endc = this->end(level);
       for (; cell != endc; ++cell)
         if (cell->level_subdomain_id() == this->locally_owned_subdomain())
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             marked_vertices[cell->vertex_index(v)] = true;
 
       /**
index 189be2a997ab78799a02d9018ccf9d7a5b38a3a3..97a3718aecafd7fe31da3944a968fa975c4e8acd 100644 (file)
@@ -376,7 +376,7 @@ namespace parallel
     std::vector<bool> vertex_of_own_cell(this->n_vertices(), false);
     for (const auto &cell : this->active_cell_iterators())
       if (cell->is_locally_owned())
-        for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+        for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
           vertex_of_own_cell[cell->vertex_index(v)] = true;
 
     // 3) for each vertex belonging to a locally owned cell all ghost
@@ -390,8 +390,7 @@ namespace parallel
           const types::subdomain_id owner = cell->subdomain_id();
 
           // loop over all its vertices
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             {
               // set owner if vertex belongs to a local cell
               if (vertex_of_own_cell[cell->vertex_index(v)])
index b5efafe0bf79c087254234db94a2147bd87f0a47..69133d732d07cf970c1f3f772ef541d4840a3698 100644 (file)
@@ -427,9 +427,7 @@ namespace internal
           {
             const unsigned int level = cell->level();
 
-            for (unsigned int vertex = 0;
-                 vertex < GeometryInfo<1>::vertices_per_cell;
-                 ++vertex)
+            for (const unsigned int vertex : GeometryInfo<1>::vertex_indices())
               {
                 const unsigned int vertex_index = cell->vertex_index(vertex);
 
@@ -503,9 +501,7 @@ namespace internal
           {
             const unsigned int level = cell->level();
 
-            for (unsigned int vertex = 0;
-                 vertex < GeometryInfo<2>::vertices_per_cell;
-                 ++vertex)
+            for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
               {
                 const unsigned int vertex_index = cell->vertex_index(vertex);
 
@@ -580,9 +576,7 @@ namespace internal
           {
             const unsigned int level = cell->level();
 
-            for (unsigned int vertex = 0;
-                 vertex < GeometryInfo<3>::vertices_per_cell;
-                 ++vertex)
+            for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
               {
                 const unsigned int vertex_index = cell->vertex_index(vertex);
 
index cde3c40aa844b98e45afbb257f9f3793c2d5df09..9306e7a96edd56d3dae0480ff991b65fd864d1e0 100644 (file)
@@ -235,8 +235,7 @@ namespace internal
         {
           // distribute dofs of vertices
           if (dof_handler.get_fe().dofs_per_vertex > 0)
-            for (unsigned int v = 0; v < GeometryInfo<1>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<1>::vertex_indices())
               {
                 if (cell->vertex_dof_index(v, 0) == numbers::invalid_dof_index)
                   for (unsigned int d = 0;
@@ -275,9 +274,7 @@ namespace internal
         {
           if (dof_handler.get_fe().dofs_per_vertex > 0)
             // number dofs on vertices
-            for (unsigned int vertex = 0;
-                 vertex < GeometryInfo<2>::vertices_per_cell;
-                 ++vertex)
+            for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
               // check whether dofs for this vertex have been distributed
               // (checking the first dof should be good enough)
               if (cell->vertex_dof_index(vertex, 0) ==
@@ -326,9 +323,7 @@ namespace internal
         {
           if (dof_handler.get_fe().dofs_per_vertex > 0)
             // number dofs on vertices
-            for (unsigned int vertex = 0;
-                 vertex < GeometryInfo<3>::vertices_per_cell;
-                 ++vertex)
+            for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
               // check whether dofs for this vertex have been distributed
               // (checking the first dof should be good enough)
               if (cell->vertex_dof_index(vertex, 0) ==
@@ -404,9 +399,7 @@ namespace internal
           // (only check the first dof), and if this isn't the case
           // distribute new ones there
           if (fe.dofs_per_vertex > 0)
-            for (unsigned int vertex = 0;
-                 vertex < GeometryInfo<1>::vertices_per_cell;
-                 ++vertex)
+            for (const unsigned int vertex : GeometryInfo<1>::vertex_indices())
               if (cell->vertex_dof_index(vertex, 0, fe_index) ==
                   numbers::invalid_dof_index)
                 for (unsigned int d = 0; d < fe.dofs_per_vertex;
@@ -454,9 +447,7 @@ namespace internal
           // (only check the first dof), and if this isn't the case
           // distribute new ones there
           if (fe.dofs_per_vertex > 0)
-            for (unsigned int vertex = 0;
-                 vertex < GeometryInfo<2>::vertices_per_cell;
-                 ++vertex)
+            for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
               if (cell->vertex_dof_index(vertex, 0, fe_index) ==
                   numbers::invalid_dof_index)
                 for (unsigned int d = 0; d < fe.dofs_per_vertex;
@@ -520,9 +511,7 @@ namespace internal
           // (only check the first dof), and if this isn't the case
           // distribute new ones there
           if (fe.dofs_per_vertex > 0)
-            for (unsigned int vertex = 0;
-                 vertex < GeometryInfo<3>::vertices_per_cell;
-                 ++vertex)
+            for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
               if (cell->vertex_dof_index(vertex, 0, fe_index) ==
                   numbers::invalid_dof_index)
                 for (unsigned int d = 0; d < fe.dofs_per_vertex;
@@ -1439,9 +1428,7 @@ namespace internal
                 &dof_handler.get_triangulation()) != nullptr)
             for (const auto &cell : dof_handler.active_cell_iterators())
               if (cell->is_ghost())
-                for (unsigned int v = 0;
-                     v < GeometryInfo<dim>::vertices_per_cell;
-                     ++v)
+                for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                   include_vertex[cell->vertex_index(v)] = true;
 
           // loop over all vertices and see which one we need to work on
@@ -2117,8 +2104,7 @@ namespace internal
         {
           // distribute dofs of vertices
           if (cell->get_fe().dofs_per_vertex > 0)
-            for (unsigned int v = 0; v < GeometryInfo<1>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<1>::vertex_indices())
               {
                 typename DoFHandler<dim, spacedim>::level_cell_iterator
                   neighbor = cell->neighbor(v);
@@ -2190,9 +2176,7 @@ namespace internal
         {
           if (cell->get_fe().dofs_per_vertex > 0)
             // number dofs on vertices
-            for (unsigned int vertex = 0;
-                 vertex < GeometryInfo<2>::vertices_per_cell;
-                 ++vertex)
+            for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
               // check whether dofs for this
               // vertex have been distributed
               // (only check the first dof)
@@ -2246,9 +2230,7 @@ namespace internal
         {
           if (cell->get_fe().dofs_per_vertex > 0)
             // number dofs on vertices
-            for (unsigned int vertex = 0;
-                 vertex < GeometryInfo<3>::vertices_per_cell;
-                 ++vertex)
+            for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
               // check whether dofs for this vertex have been distributed
               // (only check the first dof)
               if (cell->mg_vertex_dof_index(cell->level(), vertex, 0) ==
@@ -4932,9 +4914,7 @@ namespace internal
           for (const auto &cell : dof_handler->active_cell_iterators())
             if (cell->is_locally_owned())
               {
-                for (unsigned int v = 0;
-                     v < GeometryInfo<dim>::vertices_per_cell;
-                     ++v)
+                for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                   if (vertices_with_ghost_neighbors.find(cell->vertex_index(
                         v)) != vertices_with_ghost_neighbors.end())
                     {
index 0044ee55204e085994bd70721d31ea6bbfe04d2c..2324dfc250ba121bb1aa0cea6e4ee44cf7edb70a 100644 (file)
@@ -2720,9 +2720,8 @@ namespace DoFTools
     // Identify all vertices active on this level and remember some data
     // about them
     for (cell = dof_handler.begin(level); cell != endc; ++cell)
-      for (unsigned int v = 0;
-           v < GeometryInfo<DoFHandlerType::dimension>::vertices_per_cell;
-           ++v)
+      for (const unsigned int v :
+           GeometryInfo<DoFHandlerType::dimension>::vertex_indices())
         {
           const unsigned int vg = cell->vertex_index(v);
           vertex_dof_count[vg] += cell->get_fe().dofs_per_cell;
@@ -2777,9 +2776,8 @@ namespace DoFTools
         indices.resize(fe.dofs_per_cell);
         cell->get_mg_dof_indices(indices);
 
-        for (unsigned int v = 0;
-             v < GeometryInfo<DoFHandlerType::dimension>::vertices_per_cell;
-             ++v)
+        for (const unsigned int v :
+             GeometryInfo<DoFHandlerType::dimension>::vertex_indices())
           {
             const unsigned int vg    = cell->vertex_index(v);
             const unsigned int block = vertex_mapping[vg];
index a41a54ade3bab9647b1bfbe551747c1f2f9a2ced..214d86ea5b698a20d0dcbaf22479b63bf2e72da2 100644 (file)
@@ -1076,15 +1076,13 @@ namespace ColorEnriched
       // Mark vertices that belong to cells in subdomain 1
       for (const auto &cell : dof_handler.active_cell_iterators())
         if (predicate_1(cell)) // True ==> part of subdomain 1
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             vertices_subdomain_1[cell->vertex_index(v)] = true;
 
       // Find if cells in subdomain 2 and subdomain 1 share vertices.
       for (const auto &cell : dof_handler.active_cell_iterators())
         if (predicate_2(cell)) // True ==> part of subdomain 2
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             if (vertices_subdomain_1[cell->vertex_index(v)] == true)
               {
                 return true;
index 1ba13b069bbf0516cb38dbe00a2ac07c28d957ab..d77f389ad5613bcb2e445d19db196e68d25629a5 100644 (file)
@@ -2261,7 +2261,7 @@ FE_Q_Hierarchical<dim>::get_embedding_dofs(const unsigned int sub_degree) const
     {
       std::vector<unsigned int> embedding_dofs(
         GeometryInfo<dim>::vertices_per_cell);
-      for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+      for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
         embedding_dofs[i] = i;
 
       return embedding_dofs;
@@ -2386,7 +2386,7 @@ std::pair<Table<2, bool>, std::vector<unsigned int>>
 FE_Q_Hierarchical<dim>::get_constant_modes() const
 {
   Table<2, bool> constant_modes(1, this->dofs_per_cell);
-  for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+  for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
     constant_modes(0, i) = true;
   for (unsigned int i = GeometryInfo<dim>::vertices_per_cell;
        i < this->dofs_per_cell;
index 1ac3f4997fc90a7b408dd43b234e68faa7f04766..d00b05df834097ce1b52b52599b404e35c9eba8c 100644 (file)
@@ -29,7 +29,7 @@ Mapping<dim, spacedim>::get_vertices(
   const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
 {
   std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell> vertices;
-  for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+  for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
     {
       vertices[i] = cell->vertex(i);
     }
index f01bd9cdb69ba3ce66e91ff2d566fd0a4be93b32..da952eb2bc676a177e6d0576899d0cce767859ff 100644 (file)
@@ -201,7 +201,7 @@ namespace
     if (quad.size() == 0)
       {
         std::vector<Point<dim>> points(GeometryInfo<dim>::vertices_per_cell);
-        for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
           points[i] = GeometryInfo<dim>::unit_cell_vertex(i);
         quad = Quadrature<dim>(points);
       }
@@ -405,8 +405,7 @@ MappingFEField<dim, spacedim, VectorType, DoFHandlerType>::get_vertices(
           typename VectorType::value_type value =
             internal::ElementAccess<VectorType>::get(vector, dof_indices[i]);
           if (euler_dof_handler->get_fe().is_primitive(i))
-            for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
               vertices[v][comp] += fe_values.shape_value(i, v) * value;
           else
             Assert(false, ExcNotImplemented());
index 5a2c5ee830bd535a21db938acc3f9cbabffce992..73276788ffd33e6ec94ae152a95996c805dc3e64 100644 (file)
@@ -178,7 +178,7 @@ MappingManifold<dim, spacedim>::transform_unit_to_real_cell(
   std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell> vertices;
   std::array<double, GeometryInfo<dim>::vertices_per_cell>          weights;
 
-  for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+  for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
     {
       vertices[v] = cell->vertex(v);
       weights[v]  = GeometryInfo<dim>::d_linear_shape_function(p, v);
@@ -416,9 +416,8 @@ namespace internal
                     const Point<dim> np(p + L * ei);
 
                     // Get the weights to compute the np point in real space
-                    for (unsigned int j = 0;
-                         j < GeometryInfo<dim>::vertices_per_cell;
-                         ++j)
+                    for (const unsigned int j :
+                         GeometryInfo<dim>::vertex_indices())
                       data.vertex_weights[j] =
                         GeometryInfo<dim>::d_linear_shape_function(np, j);
 
index 7d7d381c2002c596ecfea3ce6d69a5d2bb519bee..ca0483c886a294ad6f8fdfe8547497442df2b3f2 100644 (file)
@@ -81,7 +81,7 @@ MappingQ1Eulerian<dim, VectorType, spacedim>::get_vertices(
     shiftmap_dof_handler->get_fe().dofs_per_cell);
   dof_cell->get_dof_values(*euler_transform_vectors, mapping_values);
 
-  for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+  for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
     {
       Point<spacedim> shift_vector;
 
@@ -109,7 +109,7 @@ MappingQ1Eulerian<dim, VectorType, spacedim>::compute_mapping_support_points(
     vertices = this->get_vertices(cell);
 
   std::vector<Point<spacedim>> a(GeometryInfo<dim>::vertices_per_cell);
-  for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+  for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
     a[i] = vertices[i];
 
   return a;
index ed7d7ce4d46d1cd132c3efd9e1c7f7352997668d..d2156ba6f3cd1966d6b0503f8d9a694294890d11 100644 (file)
@@ -1101,7 +1101,7 @@ namespace internal
         output[0].reinit(polynomial_degree - 1,
                          GeometryInfo<1>::vertices_per_cell);
         for (unsigned int q = 0; q < polynomial_degree - 1; ++q)
-          for (unsigned int i = 0; i < GeometryInfo<1>::vertices_per_cell; ++i)
+          for (const unsigned int i : GeometryInfo<1>::vertex_indices())
             output[0](q, i) =
               GeometryInfo<1>::d_linear_shape_function(quadrature.point(q + 1),
                                                        i);
@@ -1135,8 +1135,7 @@ namespace internal
                                           GeometryInfo<dim>::vertices_per_cell,
                                         GeometryInfo<dim>::vertices_per_cell);
         for (unsigned int q = 0; q < output.size(0); ++q)
-          for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
-               ++i)
+          for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
             output(q, i) = GeometryInfo<dim>::d_linear_shape_function(
               quadrature.point(h2l[q + GeometryInfo<dim>::vertices_per_cell]),
               i);
@@ -2598,7 +2597,7 @@ MappingQGeneric<dim, spacedim>::transform_real_to_unit_cell(
         this->compute_mapping_support_points(cell);
       a.resize(GeometryInfo<dim>::vertices_per_cell);
       std::vector<CellData<dim>> cells(1);
-      for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+      for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
         cells[0].vertices[i] = i;
       Triangulation<dim, spacedim> tria;
       tria.create_triangulation(a, cells, SubCellData());
@@ -3951,7 +3950,7 @@ MappingQGeneric<3, 3>::add_quad_support_points(
       boost::container::small_vector<Point<3>, 200> tmp_points(
         GeometryInfo<2>::vertices_per_cell +
         GeometryInfo<2>::lines_per_cell * (polynomial_degree - 1));
-      for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<2>::vertex_indices())
         tmp_points[v] = a[GeometryInfo<3>::face_to_cell_vertices(face_no, v)];
       if (polynomial_degree > 1)
         for (unsigned int line = 0; line < GeometryInfo<2>::lines_per_cell;
@@ -3983,7 +3982,7 @@ MappingQGeneric<2, 3>::add_quad_support_points(
   std::vector<Point<3>> &                   a) const
 {
   std::array<Point<3>, GeometryInfo<2>::vertices_per_cell> vertices;
-  for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+  for (const unsigned int i : GeometryInfo<2>::vertex_indices())
     vertices[i] = cell->vertex(i);
 
   Table<2, double> weights(Utilities::fixed_power<2>(polynomial_degree - 1),
@@ -3993,7 +3992,7 @@ MappingQGeneric<2, 3>::add_quad_support_points(
       {
         Point<2> point(line_support_points.point(q1 + 1)[0],
                        line_support_points.point(q2 + 1)[0]);
-        for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<2>::vertex_indices())
           weights(q, i) = GeometryInfo<2>::d_linear_shape_function(point, i);
       }
 
@@ -4025,7 +4024,7 @@ MappingQGeneric<dim, spacedim>::compute_mapping_support_points(
   // get the vertices first
   std::vector<Point<spacedim>> a;
   a.reserve(Utilities::fixed_power<dim>(polynomial_degree + 1));
-  for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+  for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
     a.push_back(cell->vertex(i));
 
   if (this->polynomial_degree > 1)
index 1474276e919b04a5bbe7181cc9e47c643813c52f..eb6c9488c5c1e1ee8a68339ad71b6c545c9cb9c0 100644 (file)
@@ -961,8 +961,7 @@ namespace GridGenerator
 
           // loop over vertices of all cells
           for (auto &cell : tria)
-            for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<2>::vertex_indices())
               {
                 // vertex has been already processed: nothing to do
                 if (vertex_processed[cell.vertex_index(v)])
@@ -1567,7 +1566,7 @@ namespace GridGenerator
 
     // Prepare cell data
     std::vector<CellData<dim>> cells(1);
-    for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+    for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
       cells[0].vertices[i] = i;
     cells[0].material_id = 0;
 
@@ -2064,7 +2063,7 @@ namespace GridGenerator
 
     typename Triangulation<dim, spacedim>::active_cell_iterator cell =
       tria.begin_active();
-    for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+    for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
       cell->vertex(i) = vertices[i];
 
     // Check that the order of the vertices makes sense, i.e., the volume of the
@@ -3535,9 +3534,8 @@ namespace GridGenerator
 
         if (cylinder_triangulation_offset == Tensor<1, 2>())
           {
-            for (unsigned int vertex_n = 0;
-                 vertex_n < GeometryInfo<2>::vertices_per_cell;
-                 ++vertex_n)
+            for (const unsigned int vertex_n :
+                 GeometryInfo<2>::vertex_indices())
               if (cell->vertex(vertex_n) == Point<2>())
                 {
                   // cylinder_tria is centered at zero, so we need to
@@ -3563,9 +3561,7 @@ namespace GridGenerator
     // and right sides of cylinder_tria inwards so that it fits in
     // bulk_tria:
     for (const auto &cell : cylinder_tria.active_cell_iterators())
-      for (unsigned int vertex_n = 0;
-           vertex_n < GeometryInfo<2>::vertices_per_cell;
-           ++vertex_n)
+      for (const unsigned int vertex_n : GeometryInfo<2>::vertex_indices())
         {
           if (std::abs(cell->vertex(vertex_n)[0] - -0.41 / 4.0) < 1e-10)
             cell->vertex(vertex_n)[0] = -0.1;
@@ -3633,7 +3629,7 @@ namespace GridGenerator
       const double shift =
         std::min(0.125 + shell_region_width * 0.5, 0.1 * 4. / 3.);
       for (const auto &cell : tria.active_cell_iterators())
-        for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
+        for (const unsigned int v : GeometryInfo<2>::vertex_indices())
           if (cell->vertex(v).distance(Point<2>(0.1, 0.205)) < 1e-10)
             cell->vertex(v) = Point<2>(0.2 - shift, 0.205);
           else if (cell->vertex(v).distance(Point<2>(0.3, 0.205)) < 1e-10)
@@ -3777,7 +3773,7 @@ namespace GridGenerator
 
     std::vector<CellData<dim>> cells(n_cells);
     // Vertices of the center cell
-    for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+    for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
       {
         Point<spacedim> p;
         for (unsigned int d = 0; d < dim; ++d)
@@ -4048,12 +4044,12 @@ namespace GridGenerator
                                          std::end(vertices_tmp));
     unsigned int cell_vertices[1][GeometryInfo<2>::vertices_per_cell];
 
-    for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+    for (const unsigned int i : GeometryInfo<2>::vertex_indices())
       cell_vertices[0][i] = i;
 
     std::vector<CellData<2>> cells(1, CellData<2>());
 
-    for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+    for (const unsigned int i : GeometryInfo<2>::vertex_indices())
       cells[0].vertices[i] = cell_vertices[0][i];
 
     cells[0].material_id = 0;
@@ -4976,7 +4972,7 @@ namespace GridGenerator
 
     for (unsigned int i = 0; i < n_cells; ++i)
       {
-        for (unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j)
+        for (const unsigned int j : GeometryInfo<3>::vertex_indices())
           cells[i].vertices[j] = cell_vertices[i][j];
         cells[i].material_id = 0;
         cells[i].manifold_id = i == 0 ? numbers::flat_manifold_id : 1;
@@ -5380,8 +5376,7 @@ namespace GridGenerator
 
         for (unsigned int i = 0; i < n_cells; ++i)
           {
-            for (unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell;
-                 ++j)
+            for (const unsigned int j : GeometryInfo<3>::vertex_indices())
               cells[i].vertices[j] = cell_vertices[i][j];
             cells[i].material_id = 0;
           }
@@ -5454,8 +5449,7 @@ namespace GridGenerator
         for (const auto &cell : tmp.active_cell_iterators())
           {
             const unsigned int cell_index = cell->active_cell_index();
-            for (unsigned int v = 0; v < GeometryInfo<3>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<3>::vertex_indices())
               cells[cell_index].vertices[v] = cell->vertex_index(v);
             cells[cell_index].material_id = 0;
           }
@@ -6155,8 +6149,7 @@ namespace GridGenerator
                    "all cells are on the same refinement level."));
 
           CellData<dim> this_cell;
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             this_cell.vertices[v] = cell->vertex_index(v);
           this_cell.material_id = cell->material_id();
           cells.push_back(this_cell);
@@ -6313,9 +6306,8 @@ namespace GridGenerator
         for (std::size_t slice_n = 0; slice_n < n_slices - 1; ++slice_n)
           {
             CellData<3> this_cell;
-            for (unsigned int vertex_n = 0;
-                 vertex_n < GeometryInfo<2>::vertices_per_cell;
-                 ++vertex_n)
+            for (const unsigned int vertex_n :
+                 GeometryInfo<2>::vertex_indices())
               {
                 this_cell.vertices[vertex_n] =
                   cell->vertex_index(vertex_n) + slice_n * input.n_vertices();
@@ -6819,7 +6811,7 @@ namespace GridGenerator
 
     for (unsigned int id = 0; cell != endc; ++cell, ++id)
       {
-        for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
           cells[id].vertices[i] = cell->vertex_index(i);
         cells[id].material_id = cell->material_id();
         cells[id].manifold_id = cell->manifold_id();
@@ -6978,9 +6970,8 @@ namespace GridGenerator
             {
               CellData<boundary_dim> c_data;
 
-              for (unsigned int j = 0;
-                   j < GeometryInfo<boundary_dim>::vertices_per_cell;
-                   ++j)
+              for (const unsigned int j :
+                   GeometryInfo<boundary_dim>::vertex_indices())
                 {
                   const unsigned int v_index = face->vertex_index(j);
 
index a046132edf5f13ac485bb840ea9d54c1d9d0b6a0..810b8b03de10ccf7960071c83d5df8a5e4a37f97 100644 (file)
@@ -595,14 +595,12 @@ GridIn<dim, spacedim>::read_unv(std::istream &in)
           cells.emplace_back();
 
           AssertThrow(in, ExcIO());
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               v++)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             in >> cells.back().vertices[v];
 
           cells.back().material_id = 0;
 
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               v++)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             cells.back().vertices[v] = vertex_indices[cells.back().vertices[v]];
 
           cell_indices[no] = no_cell;
@@ -820,8 +818,7 @@ GridIn<dim, spacedim>::read_ucd(std::istream &in,
         {
           // allocate and read indices
           cells.emplace_back();
-          for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
-               ++i)
+          for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
             in >> cells.back().vertices[i];
 
           // to make sure that the cast won't fail
@@ -841,8 +838,7 @@ GridIn<dim, spacedim>::read_ucd(std::istream &in,
 
           // transform from ucd to
           // consecutive numbering
-          for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
-               ++i)
+          for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
             if (vertex_indices.find(cells.back().vertices[i]) !=
                 vertex_indices.end())
               // vertex with this index exists
@@ -1188,7 +1184,7 @@ GridIn<dim, spacedim>::read_dbmesh(std::istream &in)
       // read in vertex numbers. they
       // are 1-based, so subtract one
       cells.emplace_back();
-      for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+      for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
         {
           in >> cells.back().vertices[i];
 
@@ -1832,9 +1828,7 @@ GridIn<dim, spacedim>::read_msh(std::istream &in)
 
                 // allocate and read indices
                 cells.emplace_back();
-                for (unsigned int i = 0;
-                     i < GeometryInfo<dim>::vertices_per_cell;
-                     ++i)
+                for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
                   in >> cells.back().vertices[i];
 
                 // to make sure that the cast won't fail
@@ -1853,9 +1847,7 @@ GridIn<dim, spacedim>::read_msh(std::istream &in)
 
                 // transform from ucd to
                 // consecutive numbering
-                for (unsigned int i = 0;
-                     i < GeometryInfo<dim>::vertices_per_cell;
-                     ++i)
+                for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
                   {
                     AssertThrow(
                       vertex_indices.find(cells.back().vertices[i]) !=
@@ -3058,8 +3050,7 @@ GridIn<dim, spacedim>::read_assimp(const std::string &filename,
         {
           if (mFaces[i].mNumIndices == GeometryInfo<dim>::vertices_per_cell)
             {
-              for (unsigned int f = 0; f < GeometryInfo<dim>::vertices_per_cell;
-                   ++f)
+              for (const unsigned int f : GeometryInfo<dim>::vertex_indices())
                 {
                   cells[valid_cell].vertices[f] =
                     mFaces[i].mIndices[f] + v_offset;
index 7df2c15a099c4ed61d0722edc24403f34ae7a3a3..5532c7b8e325bda14c0779ab1063a642e7ba2ceb 100644 (file)
@@ -849,8 +849,7 @@ GridOut::write_dx(const Triangulation<dim, spacedim> &tria,
 
       for (const auto &cell : tria.active_cell_iterators())
         {
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             out
               << '\t'
               << renumber[cell->vertex_index(GeometryInfo<dim>::dx_to_deal[v])];
@@ -1147,9 +1146,7 @@ GridOut::write_msh(const Triangulation<dim, spacedim> &tria,
 
       // Vertex numbering follows UCD conventions.
 
-      for (unsigned int vertex = 0;
-           vertex < GeometryInfo<dim>::vertices_per_cell;
-           ++vertex)
+      for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
         out << cell->vertex_index(GeometryInfo<dim>::ucd_to_deal[vertex]) + 1
             << ' ';
       out << '\n';
@@ -1268,9 +1265,7 @@ GridOut::write_ucd(const Triangulation<dim, spacedim> &tria,
       // May, 1992, p. E6
       //
       // note: vertex numbers are 1-base
-      for (unsigned int vertex = 0;
-           vertex < GeometryInfo<dim>::vertices_per_cell;
-           ++vertex)
+      for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
         out << cell->vertex_index(GeometryInfo<dim>::ucd_to_deal[vertex]) + 1
             << ' ';
       out << '\n';
@@ -2924,8 +2919,7 @@ GridOut::write_mathgl(const Triangulation<dim, spacedim> &tria,
           //   out << "\nfalse";
 
           out << "\nlist " << axes[i] << cell->active_cell_index() << " ";
-          for (unsigned int j = 0; j < GeometryInfo<dim>::vertices_per_cell;
-               ++j)
+          for (const unsigned int j : GeometryInfo<dim>::vertex_indices())
             out << cell->vertex(j)[i] << " ";
         }
       out << '\n';
@@ -2981,7 +2975,7 @@ namespace
         patch.n_subdivisions = 1;
         patch.data.reinit(5, GeometryInfo<dim>::vertices_per_cell);
 
-        for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+        for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
           {
             patch.vertices[v] = cell->vertex(v);
             patch.data(0, v)  = cell->level();
@@ -3231,7 +3225,7 @@ GridOut::write_vtk(const Triangulation<dim, spacedim> &tria,
     for (const auto &cell : tria.active_cell_iterators())
       {
         out << GeometryInfo<dim>::vertices_per_cell;
-        for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
           {
             out << ' ' << cell->vertex_index(GeometryInfo<dim>::ucd_to_deal[i]);
           }
@@ -4055,8 +4049,7 @@ namespace internal
               // write out the four sides of this cell by putting the four
               // points (+ the initial point again) in a row and lifting the
               // drawing pencil at the end
-              for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
-                   ++i)
+              for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
                 out << cell->vertex(GeometryInfo<dim>::ucd_to_deal[i]) << ' '
                     << cell->level() << ' '
                     << static_cast<unsigned int>(cell->material_id()) << '\n';
@@ -4830,9 +4823,8 @@ namespace internal
           // doing this multiply
           std::set<unsigned int> treated_vertices;
           for (const auto &cell : tria.active_cell_iterators())
-            for (unsigned int vertex = 0;
-                 vertex < GeometryInfo<dim>::vertices_per_cell;
-                 ++vertex)
+            for (const unsigned int vertex :
+                 GeometryInfo<dim>::vertex_indices())
               if (treated_vertices.find(cell->vertex_index(vertex)) ==
                   treated_vertices.end())
                 {
index 05106492d1b897b3dd712e44fd8e3f8f39d3723d..f0a4c0b36c5cb663658fcdfba7eca325fcb52fa8 100644 (file)
@@ -386,7 +386,7 @@ namespace
      */
     Cell(const CellData<dim> &c, const std::vector<Edge<dim>> &edge_list)
     {
-      for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+      for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
         vertex_indices[i] = c.vertices[i];
 
       // now for each of the edges of this cell, find the location inside the
@@ -922,13 +922,11 @@ namespace
 
             unsigned int
               temp_vertex_indices[GeometryInfo<dim>::vertices_per_cell];
-            for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
               temp_vertex_indices[v] =
                 raw_cells[cell_index]
                   .vertices[cube_permutations[origin_vertex_of_cell][v]];
-            for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
               raw_cells[cell_index].vertices[v] = temp_vertex_indices[v];
 
             break;
@@ -1037,9 +1035,9 @@ namespace
     unsigned int tmp[GeometryInfo<3>::vertices_per_cell];
     for (auto &cell : cells)
       {
-        for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<3>::vertex_indices())
           tmp[i] = cell.vertices[i];
-        for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<3>::vertex_indices())
           cell.vertices[i] = tmp[GeometryInfo<3>::ucd_to_deal[i]];
       }
   }
@@ -1065,9 +1063,9 @@ namespace
     unsigned int tmp[GeometryInfo<3>::vertices_per_cell];
     for (auto &cell : cells)
       {
-        for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<3>::vertex_indices())
           tmp[i] = cell.vertices[i];
-        for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<3>::vertex_indices())
           cell.vertices[GeometryInfo<3>::ucd_to_deal[i]] = tmp[i];
       }
   }
@@ -1159,7 +1157,7 @@ GridReordering<2>::invert_all_cells_of_negative_grid(
       // GridTools::cell_measure
       // requires the vertices to be
       // in lexicographic ordering
-      for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+      for (const unsigned int i : GeometryInfo<2>::vertex_indices())
         vertices_lex[GeometryInfo<2>::ucd_to_deal[i]] = cell.vertices[i];
       if (GridTools::cell_measure<2>(all_vertices, vertices_lex) < 0)
         {
@@ -1169,7 +1167,7 @@ GridReordering<2>::invert_all_cells_of_negative_grid(
           // Check whether the resulting cell is now ok.
           // If not, then the grid is seriously broken and
           // we just give up.
-          for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+          for (const unsigned int i : GeometryInfo<2>::vertex_indices())
             vertices_lex[GeometryInfo<2>::ucd_to_deal[i]] = cell.vertices[i];
           AssertThrow(GridTools::cell_measure<2>(all_vertices, vertices_lex) >
                         0,
@@ -1225,7 +1223,7 @@ GridReordering<3>::invert_all_cells_of_negative_grid(
       // GridTools::cell_measure
       // requires the vertices to be
       // in lexicographic ordering
-      for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+      for (const unsigned int i : GeometryInfo<3>::vertex_indices())
         vertices_lex[GeometryInfo<3>::ucd_to_deal[i]] = cell.vertices[i];
       if (GridTools::cell_measure<3>(all_vertices, vertices_lex) < 0)
         {
@@ -1237,7 +1235,7 @@ GridReordering<3>::invert_all_cells_of_negative_grid(
           // Check whether the resulting cell is now ok.
           // If not, then the grid is seriously broken and
           // we just give up.
-          for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+          for (const unsigned int i : GeometryInfo<3>::vertex_indices())
             vertices_lex[GeometryInfo<3>::ucd_to_deal[i]] = cell.vertices[i];
           AssertThrow(GridTools::cell_measure<3>(all_vertices, vertices_lex) >
                         0,
index daa42cc498b9f50f7f372f05b372eef7a58bc263..8242cf17298d2a1886bd1742338ffc4a96731554 100644 (file)
@@ -650,9 +650,8 @@ namespace GridTools
 
     unsigned int max_level_0_vertex_n = 0;
     for (const auto &cell : tria.cell_iterators_on_level(0))
-      for (unsigned int cell_vertex_n = 0;
-           cell_vertex_n < GeometryInfo<dim>::vertices_per_cell;
-           ++cell_vertex_n)
+      for (const unsigned int cell_vertex_n :
+           GeometryInfo<dim>::vertex_indices())
         max_level_0_vertex_n =
           std::max(cell->vertex_index(cell_vertex_n), max_level_0_vertex_n);
     vertices.resize(max_level_0_vertex_n + 1);
@@ -664,9 +663,8 @@ namespace GridTools
       {
         // Save cell data
         CellData<dim> cell_data;
-        for (unsigned int cell_vertex_n = 0;
-             cell_vertex_n < GeometryInfo<dim>::vertices_per_cell;
-             ++cell_vertex_n)
+        for (const unsigned int cell_vertex_n :
+             GeometryInfo<dim>::vertex_indices())
           {
             Assert(cell->vertex_index(cell_vertex_n) < vertices.size(),
                    ExcInternalError());
@@ -712,9 +710,8 @@ namespace GridTools
     {
       std::vector<bool> used_vertices(vertices.size());
       for (const CellData<dim> &cell_data : cells)
-        for (unsigned int cell_vertex_n = 0;
-             cell_vertex_n < GeometryInfo<dim>::vertices_per_cell;
-             ++cell_vertex_n)
+        for (const unsigned int cell_vertex_n :
+             GeometryInfo<dim>::vertex_indices())
           used_vertices[cell_data.vertices[cell_vertex_n]] = true;
       Assert(std::find(used_vertices.begin(), used_vertices.end(), false) ==
                used_vertices.end(),
@@ -753,7 +750,7 @@ namespace GridTools
     // first check which vertices are actually used
     std::vector<bool> vertex_used(vertices.size(), false);
     for (unsigned int c = 0; c < cells.size(); ++c)
-      for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
         {
           Assert(cells[c].vertices[v] < vertices.size(),
                  ExcMessage("Invalid vertex index encountered! cells[" +
@@ -782,13 +779,13 @@ namespace GridTools
 
     // next replace old vertex numbers by the new ones
     for (unsigned int c = 0; c < cells.size(); ++c)
-      for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
         cells[c].vertices[v] = new_vertex_numbers[cells[c].vertices[v]];
 
     // same for boundary data
     for (unsigned int c = 0; c < subcelldata.boundary_lines.size(); // NOLINT
          ++c)
-      for (unsigned int v = 0; v < GeometryInfo<1>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<1>::vertex_indices())
         {
           Assert(subcelldata.boundary_lines[c].vertices[v] <
                    new_vertex_numbers.size(),
@@ -808,7 +805,7 @@ namespace GridTools
 
     for (unsigned int c = 0; c < subcelldata.boundary_quads.size(); // NOLINT
          ++c)
-      for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<2>::vertex_indices())
         {
           Assert(subcelldata.boundary_quads[c].vertices[v] <
                    new_vertex_numbers.size(),
@@ -1183,9 +1180,7 @@ namespace GridTools
       {
         // loop over all vertices of the cell and see if it is listed in the map
         // given as first argument of the function
-        for (unsigned int vertex_no = 0;
-             vertex_no < GeometryInfo<dim>::vertices_per_cell;
-             ++vertex_no)
+        for (const unsigned int vertex_no : GeometryInfo<dim>::vertex_indices())
           {
             const unsigned int vertex_index = cell->vertex_index(vertex_no);
             const Point<dim> & vertex_point = cell->vertex(vertex_no);
@@ -1218,9 +1213,7 @@ namespace GridTools
     // according to the computed values
     std::vector<bool> vertex_touched(triangulation.n_vertices(), false);
     for (const auto &cell : dof_handler.active_cell_iterators())
-      for (unsigned int vertex_no = 0;
-           vertex_no < GeometryInfo<dim>::vertices_per_cell;
-           ++vertex_no)
+      for (const unsigned int vertex_no : GeometryInfo<dim>::vertex_indices())
         if (vertex_touched[cell->vertex_index(vertex_no)] == false)
           {
             Point<dim> &v = cell->vertex(vertex_no);
@@ -1382,9 +1375,8 @@ namespace GridTools
              ++cell)
           if (cell->is_locally_owned())
             {
-              for (unsigned int vertex_no = 0;
-                   vertex_no < GeometryInfo<dim>::vertices_per_cell;
-                   ++vertex_no)
+              for (const unsigned int vertex_no :
+                   GeometryInfo<dim>::vertex_indices())
                 {
                   const unsigned global_vertex_no =
                     cell->vertex_index(vertex_no);
@@ -1458,9 +1450,8 @@ namespace GridTools
                triangulation.begin_active();
              cell != triangulation.end();
              ++cell)
-          for (unsigned int vertex_no = 0;
-               vertex_no < GeometryInfo<dim>::vertices_per_cell;
-               ++vertex_no)
+          for (const unsigned int vertex_no :
+               GeometryInfo<dim>::vertex_indices())
             cell->vertex(vertex_no) =
               new_vertex_locations[cell->vertex_index(vertex_no)];
       }
@@ -1700,7 +1691,7 @@ namespace GridTools
     // list, but std::set throws out those cells already entered
     for (const auto &cell : mesh.active_cell_iterators())
       {
-        for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; v++)
+        for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
           if (cell->vertex_index(v) == vertex)
             {
               // OK, we found a cell that contains
@@ -2070,9 +2061,8 @@ namespace GridTools
 
         for (; i < active_cells.size(); ++i)
           if (predicate(active_cells[i]))
-            for (unsigned int v = 0;
-                 v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v :
+                 GeometryInfo<MeshType::dimension>::vertex_indices())
               for (unsigned int d = 0; d < spacedim; ++d)
                 {
                   minp[d] = std::min(minp[d], active_cells[i]->vertex(v)[d]);
@@ -2344,7 +2334,7 @@ namespace GridTools
       cell = triangulation.begin_active(),
       endc = triangulation.end();
     for (; cell != endc; ++cell)
-      for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+      for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
         vertex_to_cell_map[cell->vertex_index(i)].insert(cell);
 
     // Take care of hanging nodes
@@ -2429,8 +2419,7 @@ namespace GridTools
       {
         if (cell->is_locally_owned())
           {
-            for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
-                 ++i)
+            for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
               {
                 types::subdomain_id lowest_subdomain_id = cell->subdomain_id();
                 typename std::set<active_cell_iterator>::iterator
@@ -2799,7 +2788,7 @@ namespace GridTools
          cell != triangulation.end();
          ++cell)
       {
-        for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+        for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
           vertex_to_cell[cell->vertex_index(v)].push_back(
             cell->active_cell_index());
       }
@@ -2811,7 +2800,7 @@ namespace GridTools
          cell != triangulation.end();
          ++cell)
       {
-        for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+        for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
           for (unsigned int n = 0;
                n < vertex_to_cell[cell->vertex_index(v)].size();
                ++n)
@@ -2835,7 +2824,7 @@ namespace GridTools
          cell != triangulation.end(level);
          ++cell)
       {
-        for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+        for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
           vertex_to_cell[cell->vertex_index(v)].push_back(cell->index());
       }
 
@@ -2846,7 +2835,7 @@ namespace GridTools
          cell != triangulation.end(level);
          ++cell)
       {
-        for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+        for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
           for (unsigned int n = 0;
                n < vertex_to_cell[cell->vertex_index(v)].size();
                ++n)
@@ -3271,8 +3260,7 @@ namespace GridTools
         if (cell->is_artificial() ||
             (cell->is_ghost() &&
              (cell->subdomain_id() < tr->locally_owned_subdomain())))
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             locally_owned_vertices[cell->vertex_index(v)] = false;
 
     return locally_owned_vertices;
@@ -3412,8 +3400,7 @@ namespace GridTools
         Tensor<spacedim - structdim, spacedim>
           parent_alternating_forms[GeometryInfo<structdim>::vertices_per_cell];
 
-        for (unsigned int i = 0; i < GeometryInfo<structdim>::vertices_per_cell;
-             ++i)
+        for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
           parent_vertices[i] = object->vertex(i);
 
         GeometryInfo<structdim>::alternating_form_at_vertices(
@@ -3441,9 +3428,7 @@ namespace GridTools
           [GeometryInfo<structdim>::vertices_per_cell];
 
         for (unsigned int c = 0; c < object->n_children(); ++c)
-          for (unsigned int i = 0;
-               i < GeometryInfo<structdim>::vertices_per_cell;
-               ++i)
+          for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
             child_vertices[c][i] = object->child(c)->vertex(i);
 
         // replace mid-object
@@ -3472,9 +3457,7 @@ namespace GridTools
         // objective function
         double objective = 0;
         for (unsigned int c = 0; c < object->n_children(); ++c)
-          for (unsigned int i = 0;
-               i < GeometryInfo<structdim>::vertices_per_cell;
-               ++i)
+          for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
             objective +=
               (child_alternating_forms[c][i] -
                average_parent_alternating_form / std::pow(2., 1. * structdim))
@@ -3689,8 +3672,7 @@ namespace GridTools
 
         Point<spacedim>
           parent_vertices[GeometryInfo<structdim>::vertices_per_cell];
-        for (unsigned int i = 0; i < GeometryInfo<structdim>::vertices_per_cell;
-             ++i)
+        for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
           parent_vertices[i] = object->vertex(i);
 
         Tensor<spacedim - structdim, spacedim>
@@ -3703,9 +3685,7 @@ namespace GridTools
                         [GeometryInfo<structdim>::vertices_per_cell];
 
         for (unsigned int c = 0; c < object->n_children(); ++c)
-          for (unsigned int i = 0;
-               i < GeometryInfo<structdim>::vertices_per_cell;
-               ++i)
+          for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
             child_vertices[c][i] = object->child(c)->vertex(i);
 
         Tensor<spacedim - structdim, spacedim> child_alternating_forms
@@ -3719,12 +3699,9 @@ namespace GridTools
         old_min_product =
           child_alternating_forms[0][0] * parent_alternating_forms[0];
         for (unsigned int c = 0; c < object->n_children(); ++c)
-          for (unsigned int i = 0;
-               i < GeometryInfo<structdim>::vertices_per_cell;
-               ++i)
-            for (unsigned int j = 0;
-                 j < GeometryInfo<structdim>::vertices_per_cell;
-                 ++j)
+          for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
+            for (const unsigned int j :
+                 GeometryInfo<structdim>::vertex_indices())
               old_min_product = std::min<double>(old_min_product,
                                                  child_alternating_forms[c][i] *
                                                    parent_alternating_forms[j]);
@@ -3746,12 +3723,9 @@ namespace GridTools
         new_min_product =
           child_alternating_forms[0][0] * parent_alternating_forms[0];
         for (unsigned int c = 0; c < object->n_children(); ++c)
-          for (unsigned int i = 0;
-               i < GeometryInfo<structdim>::vertices_per_cell;
-               ++i)
-            for (unsigned int j = 0;
-                 j < GeometryInfo<structdim>::vertices_per_cell;
-                 ++j)
+          for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
+            for (const unsigned int j :
+                 GeometryInfo<structdim>::vertex_indices())
               new_min_product = std::min<double>(new_min_product,
                                                  child_alternating_forms[c][i] *
                                                    parent_alternating_forms[j]);
@@ -4414,8 +4388,7 @@ namespace GridTools
         if (cells_to_remove[cell->active_cell_index()] == false)
           {
             CellData<dim> c;
-            for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
               c.vertices[v] = cell->vertex_index(v);
             c.manifold_id = cell->manifold_id();
             c.material_id = cell->material_id();
@@ -4437,18 +4410,14 @@ namespace GridTools
               CellData<1> line;
               if (dim == 2)
                 {
-                  for (unsigned int v = 0;
-                       v < GeometryInfo<1>::vertices_per_cell;
-                       ++v)
+                  for (const unsigned int v : GeometryInfo<1>::vertex_indices())
                     line.vertices[v] = face->vertex_index(v);
                   line.boundary_id = face->boundary_id();
                   line.manifold_id = face->manifold_id();
                 }
               else
                 {
-                  for (unsigned int v = 0;
-                       v < GeometryInfo<1>::vertices_per_cell;
-                       ++v)
+                  for (const unsigned int v : GeometryInfo<1>::vertex_indices())
                     line.vertices[v] = face->line(l)->vertex_index(v);
                   line.boundary_id = face->line(l)->boundary_id();
                   line.manifold_id = face->line(l)->manifold_id();
@@ -4458,8 +4427,7 @@ namespace GridTools
           if (dim == 3)
             {
               CellData<2> quad;
-              for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell;
-                   ++v)
+              for (const unsigned int v : GeometryInfo<2>::vertex_indices())
                 quad.vertices[v] = face->vertex_index(v);
               quad.boundary_id = face->boundary_id();
               quad.manifold_id = face->manifold_id();
index 46a3ad2b052ee33be0e3ca52b706b3ea89c05a11..212df3ea3d75b3970af5e31ac718881345fe8191 100644 (file)
@@ -253,7 +253,7 @@ namespace GridTools
     // list, but std::set throws out those cells already entered
     for (; cell != endc; ++cell)
       {
-        for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; v++)
+        for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
           if (cell->vertex_index(v) == vertex)
             {
               // OK, we found a cell that contains
@@ -748,9 +748,8 @@ namespace GridTools
     // the halo layer
     for (const auto &cell : mesh.active_cell_iterators())
       if (predicate(cell)) // True predicate --> Part of subdomain
-        for (unsigned int v = 0;
-             v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
-             ++v)
+        for (const unsigned int v :
+             GeometryInfo<MeshType::dimension>::vertex_indices())
           locally_active_vertices_on_subdomain[cell->vertex_index(v)] = true;
 
     // Find the cells that do not conform to the predicate
@@ -758,9 +757,8 @@ namespace GridTools
     // These comprise the halo layer
     for (const auto &cell : mesh.active_cell_iterators())
       if (!predicate(cell)) // False predicate --> Potential halo cell
-        for (unsigned int v = 0;
-             v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
-             ++v)
+        for (const unsigned int v :
+             GeometryInfo<MeshType::dimension>::vertex_indices())
           if (locally_active_vertices_on_subdomain[cell->vertex_index(v)] ==
               true)
             {
@@ -792,9 +790,8 @@ namespace GridTools
          cell != mesh.end(level);
          ++cell)
       if (predicate(cell)) // True predicate --> Part of subdomain
-        for (unsigned int v = 0;
-             v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
-             ++v)
+        for (const unsigned int v :
+             GeometryInfo<MeshType::dimension>::vertex_indices())
           locally_active_vertices_on_level_subdomain[cell->vertex_index(v)] =
             true;
 
@@ -805,9 +802,8 @@ namespace GridTools
          cell != mesh.end(level);
          ++cell)
       if (!predicate(cell)) // False predicate --> Potential halo cell
-        for (unsigned int v = 0;
-             v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
-             ++v)
+        for (const unsigned int v :
+             GeometryInfo<MeshType::dimension>::vertex_indices())
           if (locally_active_vertices_on_level_subdomain[cell->vertex_index(
                 v)] == true)
             {
@@ -906,9 +902,8 @@ namespace GridTools
     for (const auto &cell : mesh.active_cell_iterators())
       if (!predicate(cell)) // Negation of predicate --> Not Part of subdomain
         {
-          for (unsigned int v = 0;
-               v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v :
+               GeometryInfo<MeshType::dimension>::vertex_indices())
             vertices_outside_subdomain[cell->vertex_index(v)] = true;
           n_non_predicate_cells++;
         }
@@ -926,9 +921,8 @@ namespace GridTools
     for (const auto &cell : mesh.active_cell_iterators())
       if (predicate(cell)) // True predicate --> Potential boundary cell of the
                            // subdomain
-        for (unsigned int v = 0;
-             v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
-             ++v)
+        for (const unsigned int v :
+             GeometryInfo<MeshType::dimension>::vertex_indices())
           if (vertices_outside_subdomain[cell->vertex_index(v)] == true)
             {
               subdomain_boundary_cells.push_back(cell);
@@ -1093,9 +1087,8 @@ namespace GridTools
     // if it belongs to the predicate domain, extend the bounding box.
     for (const auto &cell : mesh.active_cell_iterators())
       if (predicate(cell)) // True predicate --> Part of subdomain
-        for (unsigned int v = 0;
-             v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
-             ++v)
+        for (const unsigned int v :
+             GeometryInfo<MeshType::dimension>::vertex_indices())
           if (locally_active_vertices_on_subdomain[cell->vertex_index(v)] ==
               false)
             {
@@ -1238,7 +1231,7 @@ namespace GridTools
                                                            mesh_2.begin(0),
                                                          endc = mesh_1.end(0);
     for (; cell_1 != endc; ++cell_1, ++cell_2)
-      for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
         if (cell_1->vertex(v) != cell_2->vertex(v))
           return false;
 
@@ -1513,9 +1506,8 @@ namespace GridTools
          uniform_cell != uniform_cells.end();
          ++uniform_cell)
       {
-        for (unsigned int v = 0;
-             v < GeometryInfo<Container::dimension>::vertices_per_cell;
-             ++v)
+        for (const unsigned int v :
+             GeometryInfo<Container::dimension>::vertex_indices())
           {
             Point<Container::space_dimension> position =
               (*uniform_cell)->vertex(v);
@@ -1594,10 +1586,8 @@ namespace GridTools
                     {
                       // adjust the cell vertices of the local_triangulation to
                       // match cell vertices of the global triangulation
-                      for (unsigned int v = 0;
-                           v < GeometryInfo<
-                                 Container::dimension>::vertices_per_cell;
-                           ++v)
+                      for (const unsigned int v :
+                           GeometryInfo<Container::dimension>::vertex_indices())
                         active_tria_cell->vertex(v) = patch[i]->vertex(v);
 
                       Assert(active_tria_cell->center().distance(
index 155d34e7f8c55cbd78f215e507d480566094ffb6..e2d75590c91604b09cec7b5914ad376698045630 100644 (file)
@@ -902,16 +902,14 @@ FlatManifold<dim, spacedim>::normal_vector(
   while (true)
     {
       Point<spacedim> F;
-      for (unsigned int v = 0; v < GeometryInfo<facedim>::vertices_per_cell;
-           ++v)
+      for (const unsigned int v : GeometryInfo<facedim>::vertex_indices())
         F += face->vertex(v) *
              GeometryInfo<facedim>::d_linear_shape_function(xi, v);
 
       for (unsigned int i = 0; i < facedim; ++i)
         {
           grad_F[i] = 0;
-          for (unsigned int v = 0; v < GeometryInfo<facedim>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v : GeometryInfo<facedim>::vertex_indices())
             grad_F[i] +=
               face->vertex(v) *
               GeometryInfo<facedim>::d_linear_shape_function_gradient(xi, v)[i];
index c63ebc8c34a4a7f4764dad055db7c521a714de71..df41f41960d56fc8e521ccbe7abc70aec5390420 100644 (file)
@@ -1740,7 +1740,7 @@ namespace
 
     Point<spacedim> new_point;
     if (cell_is_flat)
-      for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<2>::vertex_indices())
         new_point += weights_vertices[v] * vertices[v];
     else
       {
@@ -1798,7 +1798,7 @@ namespace
           }
 
         // subtract contribution from the vertices (second line in formula)
-        for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
+        for (const unsigned int v : GeometryInfo<2>::vertex_indices())
           new_point -= weights_vertices[v] * vertices[v];
       }
 
@@ -1932,8 +1932,7 @@ namespace
               }
             else
               {
-                for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell;
-                     ++v)
+                for (const unsigned int v : GeometryInfo<2>::vertex_indices())
                   points[v] = vertices[face_to_cell_vertices_3d[face][v]];
                 weights[0] =
                   linear_shapes[face_even + 2] * linear_shapes[face_even + 4];
@@ -2000,7 +1999,7 @@ namespace
           }
 
         // finally add the contribution of the
-        for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+        for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
           new_point += weights_vertices[v] * vertices[v];
       }
     return new_point;
@@ -2243,9 +2242,7 @@ TransfiniteInterpolationManifold<dim, spacedim>::
 
       std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
         vertices;
-      for (unsigned int vertex_n = 0;
-           vertex_n < GeometryInfo<dim>::vertices_per_cell;
-           ++vertex_n)
+      for (const unsigned int vertex_n : GeometryInfo<dim>::vertex_indices())
         {
           vertices[vertex_n] = cell->vertex(vertex_n);
         }
@@ -2254,11 +2251,11 @@ TransfiniteInterpolationManifold<dim, spacedim>::
       // center of the loop, we can skip the expensive part below (this assumes
       // that the manifold does not deform the grid too much)
       Point<spacedim> center;
-      for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
         center += vertices[v];
       center *= 1. / GeometryInfo<dim>::vertices_per_cell;
       double radius_square = 0.;
-      for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
         radius_square =
           std::max(radius_square, (center - vertices[v]).norm_square());
       bool inside_circle = true;
@@ -2531,8 +2528,7 @@ TransfiniteInterpolationManifold<dim, spacedim>::compute_chart_points(
                 triangulation, level_coarse, nearby_cells[b]);
               message << "Looking at cell " << cell->id()
                       << " with vertices: " << std::endl;
-              for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                   ++v)
+              for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                 message << cell->vertex(v) << "    ";
               message << std::endl;
               message << "Transformation to chart coordinates: " << std::endl;
index 354fb5098559e0c0d4cdcca1af65ef68bc3104fc..96465678a1b211a723d7c46bba14cc9d5ae2c47f 100644 (file)
@@ -60,7 +60,7 @@ template <int structdim>
 bool
 CellData<structdim>::operator==(const CellData<structdim> &other) const
 {
-  for (unsigned int i = 0; i < GeometryInfo<structdim>::vertices_per_cell; i++)
+  for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
     if (vertices[i] != other.vertices[i])
       return false;
 
@@ -439,7 +439,7 @@ namespace
            triangulation.begin_active();
          cell != triangulation.end();
          ++cell)
-      for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+      for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
         {
           min_adjacent_cell_level[cell->vertex_index(v)] =
             std::min<unsigned int>(
@@ -547,9 +547,9 @@ namespace
     unsigned int tmp[GeometryInfo<3>::vertices_per_cell];
     for (auto &cell : cells)
       {
-        for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<3>::vertex_indices())
           tmp[i] = cell.vertices[i];
-        for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<3>::vertex_indices())
           cell.vertices[GeometryInfo<3>::ucd_to_deal[i]] = tmp[i];
       }
 
@@ -691,13 +691,13 @@ namespace
          ++cell)
       {
         Point<dim> vertices[GeometryInfo<dim>::vertices_per_cell];
-        for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
           vertices[i] = cell->vertex(i);
 
         Tensor<0, dim> determinants[GeometryInfo<dim>::vertices_per_cell];
         GeometryInfo<dim>::alternating_form_at_vertices(vertices, determinants);
 
-        for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
           if (determinants[i] <= 1e-9 * std::pow(cell->diameter(), 1. * dim))
             {
               distorted_cells.distorted_cells.push_back(cell);
@@ -727,13 +727,13 @@ namespace
     for (unsigned int c = 0; c < cell->n_children(); ++c)
       {
         Point<dim> vertices[GeometryInfo<dim>::vertices_per_cell];
-        for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
           vertices[i] = cell->child(c)->vertex(i);
 
         Tensor<0, dim> determinants[GeometryInfo<dim>::vertices_per_cell];
         GeometryInfo<dim>::alternating_form_at_vertices(vertices, determinants);
 
-        for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+        for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
           if (determinants[i] <=
               1e-9 * std::pow(cell->child(c)->diameter(), 1. * dim))
             return true;
@@ -1894,9 +1894,7 @@ namespace internal
         // for all lines
         for (; line != triangulation.end(); ++line)
           // for each of the two vertices
-          for (unsigned int vertex = 0;
-               vertex < GeometryInfo<dim>::vertices_per_cell;
-               ++vertex)
+          for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
             // if first cell adjacent to
             // this vertex is the present
             // one, then the neighbor is
@@ -13318,8 +13316,7 @@ Triangulation<dim, spacedim>::max_adjacent_cells() const
   // vertices used on level 0
   unsigned int max_vertex_index = 0;
   for (; cell != endc; ++cell)
-    for (unsigned int vertex = 0; vertex < GeometryInfo<dim>::vertices_per_cell;
-         ++vertex)
+    for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
       if (cell->vertex_index(vertex) > max_vertex_index)
         max_vertex_index = cell->vertex_index(vertex);
 
@@ -13332,8 +13329,7 @@ Triangulation<dim, spacedim>::max_adjacent_cells() const
   // every time we find an adjacent
   // element
   for (cell = begin(); cell != endc; ++cell)
-    for (unsigned int vertex = 0; vertex < GeometryInfo<dim>::vertices_per_cell;
-         ++vertex)
+    for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
       ++usage_count[cell->vertex_index(vertex)];
 
   return std::max(GeometryInfo<dim>::vertices_per_cell,
@@ -13684,16 +13680,14 @@ Triangulation<dim, spacedim>::fix_coarsen_flags()
           for (; cell != endc; ++cell)
             {
               if (cell->refine_flag_set())
-                for (unsigned int vertex = 0;
-                     vertex < GeometryInfo<dim>::vertices_per_cell;
-                     ++vertex)
+                for (const unsigned int vertex :
+                     GeometryInfo<dim>::vertex_indices())
                   vertex_level[cell->vertex_index(vertex)] =
                     std::max(vertex_level[cell->vertex_index(vertex)],
                              cell->level() + 1);
               else if (!cell->coarsen_flag_set())
-                for (unsigned int vertex = 0;
-                     vertex < GeometryInfo<dim>::vertices_per_cell;
-                     ++vertex)
+                for (const unsigned int vertex :
+                     GeometryInfo<dim>::vertex_indices())
                   vertex_level[cell->vertex_index(vertex)] =
                     std::max(vertex_level[cell->vertex_index(vertex)],
                              cell->level());
@@ -13706,9 +13700,8 @@ Triangulation<dim, spacedim>::fix_coarsen_flags()
                   // to correct this by iterating over the entire
                   // process until we are converged
                   Assert(cell->coarsen_flag_set(), ExcInternalError());
-                  for (unsigned int vertex = 0;
-                       vertex < GeometryInfo<dim>::vertices_per_cell;
-                       ++vertex)
+                  for (const unsigned int vertex :
+                       GeometryInfo<dim>::vertex_indices())
                     vertex_level[cell->vertex_index(vertex)] =
                       std::max(vertex_level[cell->vertex_index(vertex)],
                                cell->level() - 1);
@@ -13728,9 +13721,8 @@ Triangulation<dim, spacedim>::fix_coarsen_flags()
           for (cell = last_active(); cell != endc; --cell)
             if (cell->refine_flag_set() == false)
               {
-                for (unsigned int vertex = 0;
-                     vertex < GeometryInfo<dim>::vertices_per_cell;
-                     ++vertex)
+                for (const unsigned int vertex :
+                     GeometryInfo<dim>::vertex_indices())
                   if (vertex_level[cell->vertex_index(vertex)] >=
                       cell->level() + 1)
                     {
@@ -13745,9 +13737,8 @@ Triangulation<dim, spacedim>::fix_coarsen_flags()
                         {
                           cell->set_refine_flag();
 
-                          for (unsigned int v = 0;
-                               v < GeometryInfo<dim>::vertices_per_cell;
-                               ++v)
+                          for (const unsigned int v :
+                               GeometryInfo<dim>::vertex_indices())
                             vertex_level[cell->vertex_index(v)] =
                               std::max(vertex_level[cell->vertex_index(v)],
                                        cell->level() + 1);
@@ -14356,16 +14347,14 @@ Triangulation<dim, spacedim>::prepare_coarsening_and_refinement()
           for (const auto &cell : active_cell_iterators())
             {
               if (cell->refine_flag_set())
-                for (unsigned int vertex = 0;
-                     vertex < GeometryInfo<dim>::vertices_per_cell;
-                     ++vertex)
+                for (const unsigned int vertex :
+                     GeometryInfo<dim>::vertex_indices())
                   vertex_level[cell->vertex_index(vertex)] =
                     std::max(vertex_level[cell->vertex_index(vertex)],
                              cell->level() + 1);
               else if (!cell->coarsen_flag_set())
-                for (unsigned int vertex = 0;
-                     vertex < GeometryInfo<dim>::vertices_per_cell;
-                     ++vertex)
+                for (const unsigned int vertex :
+                     GeometryInfo<dim>::vertex_indices())
                   vertex_level[cell->vertex_index(vertex)] =
                     std::max(vertex_level[cell->vertex_index(vertex)],
                              cell->level());
@@ -14376,9 +14365,8 @@ Triangulation<dim, spacedim>::prepare_coarsening_and_refinement()
                   // always true (the coarsen flag could be removed
                   // again) and so we may make an error here
                   Assert(cell->coarsen_flag_set(), ExcInternalError());
-                  for (unsigned int vertex = 0;
-                       vertex < GeometryInfo<dim>::vertices_per_cell;
-                       ++vertex)
+                  for (const unsigned int vertex :
+                       GeometryInfo<dim>::vertex_indices())
                     vertex_level[cell->vertex_index(vertex)] =
                       std::max(vertex_level[cell->vertex_index(vertex)],
                                cell->level() - 1);
@@ -14398,9 +14386,8 @@ Triangulation<dim, spacedim>::prepare_coarsening_and_refinement()
           for (active_cell_iterator cell = last_active(); cell != end(); --cell)
             if (cell->refine_flag_set() == false)
               {
-                for (unsigned int vertex = 0;
-                     vertex < GeometryInfo<dim>::vertices_per_cell;
-                     ++vertex)
+                for (const unsigned int vertex :
+                     GeometryInfo<dim>::vertex_indices())
                   if (vertex_level[cell->vertex_index(vertex)] >=
                       cell->level() + 1)
                     {
@@ -14415,9 +14402,8 @@ Triangulation<dim, spacedim>::prepare_coarsening_and_refinement()
                         {
                           cell->set_refine_flag();
 
-                          for (unsigned int v = 0;
-                               v < GeometryInfo<dim>::vertices_per_cell;
-                               ++v)
+                          for (const unsigned int v :
+                               GeometryInfo<dim>::vertex_indices())
                             vertex_level[cell->vertex_index(v)] =
                               std::max(vertex_level[cell->vertex_index(v)],
                                        cell->level() + 1);
index efc1c01a62dc9ddb89a497e2e187b99aa57533cc..7e85fd1f7fe3aa848fa469fe767766cb1522c302 100644 (file)
@@ -1265,7 +1265,7 @@ namespace
   measure(const TriaAccessor<2, 2, 2> &accessor)
   {
     unsigned int vertex_indices[GeometryInfo<2>::vertices_per_cell];
-    for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+    for (const unsigned int i : GeometryInfo<2>::vertex_indices())
       vertex_indices[i] = accessor.vertex_index(i);
 
     return GridTools::cell_measure<2>(
@@ -1277,7 +1277,7 @@ namespace
   measure(const TriaAccessor<3, 3, 3> &accessor)
   {
     unsigned int vertex_indices[GeometryInfo<3>::vertices_per_cell];
-    for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+    for (const unsigned int i : GeometryInfo<3>::vertex_indices())
       vertex_indices[i] = accessor.vertex_index(i);
 
     return GridTools::cell_measure<3>(
@@ -1570,7 +1570,7 @@ TriaAccessor<structdim, dim, spacedim>::intermediate_point(
   std::array<Point<spacedim>, GeometryInfo<structdim>::vertices_per_cell> p;
   std::array<double, GeometryInfo<structdim>::vertices_per_cell>          w;
 
-  for (unsigned int i = 0; i < GeometryInfo<structdim>::vertices_per_cell; ++i)
+  for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
     {
       p[i] = this->vertex(i);
       w[i] = GeometryInfo<structdim>::d_linear_shape_function(coordinates, i);
@@ -1690,17 +1690,16 @@ TriaAccessor<structdim, dim, spacedim>::real_to_unit_cell_affine_approximation(
   // copy vertices to avoid expensive resolution of vertex index inside loop
   std::array<Point<spacedim>, GeometryInfo<structdim>::vertices_per_cell>
     vertices;
-  for (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell; ++v)
+  for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
     vertices[v] = this->vertex(v);
   for (unsigned int d = 0; d < spacedim; ++d)
-    for (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell;
-         ++v)
+    for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
       for (unsigned int e = 0; e < structdim; ++e)
         A[d][e] += vertices[v][d] * TransformR2UAffine<structdim>::KA[v][e];
 
   // b = vertex * Kb
   Tensor<1, spacedim> b = point;
-  for (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell; ++v)
+  for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
     b -= vertices[v] * TransformR2UAffine<structdim>::Kb[v];
 
   DerivativeForm<1, spacedim, structdim> A_inv = A.covariant_form().transpose();
@@ -1718,8 +1717,7 @@ TriaAccessor<structdim, dim, spacedim>::center(
     {
       Assert(use_interpolation == false, ExcNotImplemented());
       Point<spacedim> p;
-      for (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell;
-           ++v)
+      for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
         p += vertex(v);
       return p / GeometryInfo<structdim>::vertices_per_cell;
     }
index 5d34c7d9138cc46314d80ed900de6ee6446f6d3d..541d684624186ccfbf5f750106cf8df9cd907583 100644 (file)
@@ -164,8 +164,7 @@ namespace TriangulationDescription
           TriaIterator<CellAccessor<dim, spacedim>> &cell,
           std::vector<bool> &vertices_owned_by_locally_owned_cells) {
           // add local vertices
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             {
               vertices_owned_by_locally_owned_cells[cell->vertex_index(v)] =
                 true;
@@ -204,8 +203,7 @@ namespace TriangulationDescription
           auto is_locally_relevant = [&](
                                        TriaIterator<CellAccessor<dim, spacedim>>
                                          &cell) {
-            for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
               if (vertices_owned_by_locally_owned_cells[cell->vertex_index(v)])
                 return true;
             return false;
@@ -228,16 +226,12 @@ namespace TriangulationDescription
                 dealii::CellData<dim> cell_data;
                 cell_data.material_id = cell->material_id();
                 cell_data.manifold_id = cell->manifold_id();
-                for (unsigned int v = 0;
-                     v < GeometryInfo<dim>::vertices_per_cell;
-                     ++v)
+                for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                   cell_data.vertices[v] = cell->vertex_index(v);
                 construction_data.coarse_cells.push_back(cell_data);
 
                 // b) save indices of each vertex of this cell
-                for (unsigned int v = 0;
-                     v < GeometryInfo<dim>::vertices_per_cell;
-                     ++v)
+                for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                   vertices_locally_relevant[cell->vertex_index(v)] =
                     numbers::invalid_unsigned_int;
 
@@ -304,8 +298,7 @@ namespace TriangulationDescription
 
           // 4) correct vertices of cells (make them local)
           for (auto &cell : construction_data.coarse_cells)
-            for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
               cell.vertices[v] = vertices_locally_relevant[cell.vertices[v]];
         }
       else
@@ -347,9 +340,8 @@ namespace TriangulationDescription
               // owned cell)
               auto is_locally_relevant_on_level =
                 [&](TriaIterator<CellAccessor<dim, spacedim>> &cell) {
-                  for (unsigned int v = 0;
-                       v < GeometryInfo<dim>::vertices_per_cell;
-                       ++v)
+                  for (const unsigned int v :
+                       GeometryInfo<dim>::vertex_indices())
                     if (vertices_owned_by_locally_owned_cells_on_level
                           [cell->vertex_index(v)])
                       return true;
@@ -376,16 +368,12 @@ namespace TriangulationDescription
                 dealii::CellData<dim> cell_data;
                 cell_data.material_id = cell->material_id();
                 cell_data.manifold_id = cell->manifold_id();
-                for (unsigned int v = 0;
-                     v < GeometryInfo<dim>::vertices_per_cell;
-                     ++v)
+                for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                   cell_data.vertices[v] = cell->vertex_index(v);
                 construction_data.coarse_cells.push_back(cell_data);
 
                 // save indices of each vertex of this cell
-                for (unsigned int v = 0;
-                     v < GeometryInfo<dim>::vertices_per_cell;
-                     ++v)
+                for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                   vertices_locally_relevant[cell->vertex_index(v)] =
                     numbers::invalid_unsigned_int;
 
@@ -405,8 +393,7 @@ namespace TriangulationDescription
 
             // c) correct vertices of cells (make them local)
             for (auto &cell : construction_data.coarse_cells)
-              for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                   ++v)
+              for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                 cell.vertices[v] = vertices_locally_relevant[cell.vertices[v]];
           }
 
@@ -428,9 +415,7 @@ namespace TriangulationDescription
           auto is_locally_relevant_on_active_level =
             [&](TriaIterator<CellAccessor<dim, spacedim>> &cell) {
               if (cell->active())
-                for (unsigned int v = 0;
-                     v < GeometryInfo<dim>::vertices_per_cell;
-                     ++v)
+                for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                   if (vertices_owned_by_locally_owned_active_cells
                         [cell->vertex_index(v)])
                     return true;
@@ -454,9 +439,8 @@ namespace TriangulationDescription
               // on level
               auto is_locally_relevant_on_level =
                 [&](TriaIterator<CellAccessor<dim, spacedim>> &cell) {
-                  for (unsigned int v = 0;
-                       v < GeometryInfo<dim>::vertices_per_cell;
-                       ++v)
+                  for (const unsigned int v :
+                       GeometryInfo<dim>::vertex_indices())
                     if (vertices_owned_by_locally_owned_cells_on_level
                           [cell->vertex_index(v)])
                       return true;
index 5723a253fa57c905fd0bbc6a08851e33f7df0594..879dad4f441b6619435eb9a1f758cf1812d68d6c 100644 (file)
@@ -178,8 +178,7 @@ namespace internal
                cell != dof_handler.end();
                ++cell)
             if (!cell->is_artificial())
-              for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                   ++v)
+              for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                 locally_used_vertices[cell->vertex_index(v)] = true;
 
           std::vector<std::vector<bool>> vertex_fe_association(
@@ -191,8 +190,7 @@ namespace internal
                cell != dof_handler.end();
                ++cell)
             if (!cell->is_artificial())
-              for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                   ++v)
+              for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
                 vertex_fe_association[cell->active_fe_index()]
                                      [cell->vertex_index(v)] = true;
 
index b33264a4f065a572523cd538d3a6f96def3231ad..b3e92e3cb3d301af80c7e85a603591be39c7736c 100644 (file)
@@ -102,9 +102,8 @@ DataOut<dim, DoFHandlerType>::build_one_patch(
   // set the vertices of the patch. if the mapping does not preserve locations
   // (e.g. MappingQEulerian), we need to compute the offset of the vertex for
   // the graphical output. Otherwise, we can just use the vertex info.
-  for (unsigned int vertex = 0;
-       vertex < GeometryInfo<DoFHandlerType::dimension>::vertices_per_cell;
-       ++vertex)
+  for (const unsigned int vertex :
+       GeometryInfo<DoFHandlerType::dimension>::vertex_indices())
     if (scratch_data.mapping_collection[0].preserves_vertex_locations())
       patch.vertices[vertex] = cell_and_index->first->vertex(vertex);
     else
index 6db2d3448c95ca527e72a418758cb442e14e4804..8930c8af7676727a4f1caf6ff95024be7e77e26a 100644 (file)
@@ -159,9 +159,8 @@ DataOutRotation<dim, DoFHandlerType>::build_one_patch(
 
           case 2:
             {
-              for (unsigned int vertex = 0;
-                   vertex < GeometryInfo<dimension>::vertices_per_cell;
-                   ++vertex)
+              for (const unsigned int vertex :
+                   GeometryInfo<dimension>::vertex_indices())
                 {
                   const Point<dimension> v = (*cell)->vertex(vertex);
 
index f470a83534eaa7ec212ee8d564fdad7ded2f9f5c..c0ed663d28416d5ab885704acc77422c8bc12678 100644 (file)
@@ -1106,8 +1106,7 @@ namespace Particles
     for (const auto &cell : triangulation->active_cell_iterators())
       {
         if (cell->is_ghost())
-          for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-               ++v)
+          for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
             vertex_to_neighbor_subdomain[cell->vertex_index(v)].insert(
               cell->subdomain_id());
       }
@@ -1117,8 +1116,7 @@ namespace Particles
         if (!cell->is_ghost())
           {
             std::set<unsigned int> cell_to_neighbor_subdomain;
-            for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
-                 ++v)
+            for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
               {
                 cell_to_neighbor_subdomain.insert(
                   vertex_to_neighbor_subdomain[cell->vertex_index(v)].begin(),

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.