]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix source/fe
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 6 Jan 2019 21:42:26 +0000 (22:42 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 18 Jan 2019 10:27:10 +0000 (11:27 +0100)
source/fe/fe_abf.cc
source/fe/fe_enriched.cc
source/fe/fe_q_base.cc
source/fe/fe_system.cc
source/fe/mapping_c1.cc

index da6817056eda260566985a9a1f71644d9cb75037..6a2655e9c35c4fdbd205afd66c73b92ee9139b6d 100644 (file)
@@ -100,11 +100,11 @@ FE_ABF<dim>::FE_ABF(const unsigned int deg)
   this->interface_constraints.reinit((1 << (dim - 1)) * this->dofs_per_face,
                                      this->dofs_per_face);
   unsigned int target_row = 0;
-  for (unsigned int d = 0; d < face_embeddings.size(); ++d)
-    for (unsigned int i = 0; i < face_embeddings[d].m(); ++i)
+  for (const auto &face_embedding : face_embeddings)
+    for (unsigned int i = 0; i < face_embedding.m(); ++i)
       {
-        for (unsigned int j = 0; j < face_embeddings[d].n(); ++j)
-          this->interface_constraints(target_row, j) = face_embeddings[d](i, j);
+        for (unsigned int j = 0; j < face_embedding.n(); ++j)
+          this->interface_constraints(target_row, j) = face_embedding(i, j);
         ++target_row;
       }
 }
index 195101e5ee5ce106ceba13f87f3f930e31685cdd..8dd92350b1b6334b0bb6ade95b8f8d547bb87406 100644 (file)
@@ -1072,14 +1072,14 @@ namespace ColorEnriched
         dof_handler.get_triangulation().n_vertices(), false);
 
       // Mark vertices that belong to cells in subdomain 1
-      for (auto cell : dof_handler.active_cell_iterators())
+      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)
             vertices_subdomain_1[cell->vertex_index(v)] = true;
 
       // Find if cells in subdomain 2 and subdomain 1 share vertices.
-      for (auto cell : dof_handler.active_cell_iterators())
+      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)
@@ -1173,7 +1173,7 @@ namespace ColorEnriched
        * of predicates active in the given cell.
        */
       unsigned int map_index = 0;
-      for (auto cell : dof_handler.active_cell_iterators())
+      for (const auto &cell : dof_handler.active_cell_iterators())
         {
           // set default FE index ==> no enrichment and no active predicates
           cell->set_active_fe_index(0);
@@ -1289,7 +1289,7 @@ namespace ColorEnriched
        */
 
       // loop through faces
-      for (auto cell : dof_handler.active_cell_iterators())
+      for (const auto &cell : dof_handler.active_cell_iterators())
         {
           const unsigned int           fe_index = cell->active_fe_index();
           const std::set<unsigned int> fe_set   = fe_sets.at(fe_index);
@@ -1413,8 +1413,7 @@ namespace ColorEnriched
       // loop through color sets and create FE_enriched element for each
       // of them provided before calling this function, we have color
       // enrichment function associated with each color.
-      for (unsigned int color_set_id = 0; color_set_id < fe_sets.size();
-           ++color_set_id)
+      for (const auto &fe_set : fe_sets)
         {
           std::vector<const FiniteElement<dim, spacedim> *> vec_fe_enriched(
             n_colors, &fe_nothing);
@@ -1422,12 +1421,12 @@ namespace ColorEnriched
             const typename Triangulation<dim, spacedim>::cell_iterator &)>>>
             functions(n_colors, {dummy_function});
 
-          for (const auto it : fe_sets[color_set_id])
+          for (const unsigned int color_id : fe_set)
             {
-              // Given a color id ( = it), corresponding color enrichment
+              // Given a color id, corresponding color enrichment
               // function is at index id-1 because color_enrichments are
               // indexed from zero and colors are indexed from 1.
-              const unsigned int ind = it - 1;
+              const unsigned int ind = color_id - 1;
 
               AssertIndexRange(ind, vec_fe_enriched.size());
               AssertIndexRange(ind, functions.size());
index 79bdddd3e088c4a45e7ee1c5009425714315f599..3742ebdd6a822eb51dca8e6b5f7e676d173e0eab 100644 (file)
@@ -329,9 +329,9 @@ struct FE_Q_Base<PolynomialType, xdim, xspacedim>::Implementation
         for (unsigned int child = 0;
              child < GeometryInfo<dim - 1>::max_children_per_cell;
              ++child)
-          for (unsigned int i = 0; i < inner_points.size(); ++i)
+          for (const auto &inner_point : inner_points)
             constraint_points.push_back(
-              GeometryInfo<dim - 1>::child_to_cell_coordinates(inner_points[i],
+              GeometryInfo<dim - 1>::child_to_cell_coordinates(inner_point,
                                                                child));
       }
 
index 277477978094a4b58849963eeaeaed0d0201d226..7477fa495cde7ee9e464750cd66268d763f3eefa 100644 (file)
@@ -2162,10 +2162,9 @@ FESystem<dim, spacedim>::hp_object_dof_identities(
                 Assert(false, ExcNotImplemented());
             }
 
-          for (unsigned int i = 0; i < base_identities.size(); ++i)
-            identities.emplace_back(base_identities[i].first + dof_offset,
-                                    base_identities[i].second +
-                                      dof_offset_other);
+          for (const auto &base_identity : base_identities)
+            identities.emplace_back(base_identity.first + dof_offset,
+                                    base_identity.second + dof_offset_other);
 
           // record the dofs treated above as already taken care of
           dof_offset += base.template n_dofs_per_object<structdim>();
@@ -2407,10 +2406,9 @@ FESystem<dim, spacedim>::get_constant_modes() const
                              k) = base_table.first(c, ind.second);
         }
       for (unsigned int r = 0; r < element_multiplicity; ++r)
-        for (unsigned int c = 0; c < base_table.second.size(); ++c)
+        for (const unsigned int c : base_table.second)
           components.push_back(
-            comp + r * this->base_elements[i].first->n_components() +
-            base_table.second[c]);
+            comp + r * this->base_elements[i].first->n_components() + c);
     }
   AssertDimension(components.size(), constant_modes.n_rows());
   return std::pair<Table<2, bool>, std::vector<unsigned int>>(constant_modes,
index c8d8e0083d6f94fdb3c1760a93179802a7618318..ffaa8871a4a42803ddb58ba944f16a8ee62133a5 100644 (file)
@@ -143,12 +143,12 @@ MappingC1<2>::MappingC1Generic::add_line_support_points(
                                                Point<2>(t2, s_t2)};
           // then transform these points to real coordinates by rotating,
           // scaling and shifting
-          for (unsigned int i = 0; i < 2; ++i)
+          for (const auto &new_unit_point : new_unit_points)
             {
-              Point<2> real_point(std::cos(alpha) * new_unit_points[i][0] -
-                                    std::sin(alpha) * new_unit_points[i][1],
-                                  std::sin(alpha) * new_unit_points[i][0] +
-                                    std::cos(alpha) * new_unit_points[i][1]);
+              Point<2> real_point(std::cos(alpha) * new_unit_point[0] -
+                                    std::sin(alpha) * new_unit_point[1],
+                                  std::sin(alpha) * new_unit_point[0] +
+                                    std::cos(alpha) * new_unit_point[1]);
               real_point *= h;
               real_point += line->vertex(0);
               a.push_back(real_point);

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.