]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Change some variable names to better reflect their purpose. 7185/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 17 Sep 2018 17:37:47 +0000 (11:37 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 17 Sep 2018 17:37:47 +0000 (11:37 -0600)
source/dofs/dof_handler_policy.cc

index f9ce24493ef16c41088950bb6f6052c868fd3ae0..36bb1a526d387236979f3e7ee47c7045591491a8 100644 (file)
@@ -2413,7 +2413,7 @@ namespace internal
         static void
         renumber_vertex_dofs(
           const std::vector<types::global_dof_index> &new_numbers,
-          const IndexSet &                            indices,
+          const IndexSet &                            indices_we_care_about,
           DoFHandler<dim, spacedim> &                 dof_handler,
           const bool                                  check_validity)
         {
@@ -2428,9 +2428,9 @@ namespace internal
                i != dof_handler.vertex_dofs.end();
                ++i)
             if (*i != numbers::invalid_dof_index)
-              *i = (indices.size() == 0) ?
+              *i = (indices_we_care_about.size() == 0) ?
                      (new_numbers[*i]) :
-                     (new_numbers[indices.index_within_set(*i)]);
+                     (new_numbers[indices_we_care_about.index_within_set(*i)]);
             else if (check_validity)
               // if index is invalid_dof_index: check if this one
               // really is unused
@@ -2453,7 +2453,7 @@ namespace internal
         static void
         renumber_cell_dofs(
           const std::vector<types::global_dof_index> &new_numbers,
-          const IndexSet &                            indices,
+          const IndexSet &                            indices_we_care_about,
           DoFHandler<dim, spacedim> &                 dof_handler)
         {
           for (unsigned int level = 0; level < dof_handler.levels.size();
@@ -2463,9 +2463,10 @@ namespace internal
                  i != dof_handler.levels[level]->dof_object.dofs.end();
                  ++i)
               if (*i != numbers::invalid_dof_index)
-                *i = ((indices.size() == 0) ?
-                        new_numbers[*i] :
-                        new_numbers[indices.index_within_set(*i)]);
+                *i =
+                  ((indices_we_care_about.size() == 0) ?
+                     new_numbers[*i] :
+                     new_numbers[indices_we_care_about.index_within_set(*i)]);
         }
 
 
@@ -2481,7 +2482,7 @@ namespace internal
         static void
         renumber_face_dofs(
           const std::vector<types::global_dof_index> & /*new_numbers*/,
-          const IndexSet & /*indices*/,
+          const IndexSet & /*indices_we_care_about*/,
           DoFHandler<1, spacedim> & /*dof_handler*/)
         {
           // nothing to do in 1d since there are no separate faces
@@ -2493,7 +2494,7 @@ namespace internal
         static void
         renumber_face_dofs(
           const std::vector<types::global_dof_index> &new_numbers,
-          const IndexSet &                            indices,
+          const IndexSet &                            indices_we_care_about,
           DoFHandler<2, spacedim> &                   dof_handler)
         {
           // treat dofs on lines
@@ -2502,9 +2503,9 @@ namespace internal
                i != dof_handler.faces->lines.dofs.end();
                ++i)
             if (*i != numbers::invalid_dof_index)
-              *i = ((indices.size() == 0) ?
+              *i = ((indices_we_care_about.size() == 0) ?
                       new_numbers[*i] :
-                      new_numbers[indices.index_within_set(*i)]);
+                      new_numbers[indices_we_care_about.index_within_set(*i)]);
         }
 
 
@@ -2513,7 +2514,7 @@ namespace internal
         static void
         renumber_face_dofs(
           const std::vector<types::global_dof_index> &new_numbers,
-          const IndexSet &                            indices,
+          const IndexSet &                            indices_we_care_about,
           DoFHandler<3, spacedim> &                   dof_handler)
         {
           // treat dofs on lines
@@ -2522,9 +2523,9 @@ namespace internal
                i != dof_handler.faces->lines.dofs.end();
                ++i)
             if (*i != numbers::invalid_dof_index)
-              *i = ((indices.size() == 0) ?
+              *i = ((indices_we_care_about.size() == 0) ?
                       new_numbers[*i] :
-                      new_numbers[indices.index_within_set(*i)]);
+                      new_numbers[indices_we_care_about.index_within_set(*i)]);
 
           // treat dofs on quads
           for (std::vector<types::global_dof_index>::iterator i =
@@ -2532,9 +2533,9 @@ namespace internal
                i != dof_handler.faces->quads.dofs.end();
                ++i)
             if (*i != numbers::invalid_dof_index)
-              *i = ((indices.size() == 0) ?
+              *i = ((indices_we_care_about.size() == 0) ?
                       new_numbers[*i] :
-                      new_numbers[indices.index_within_set(*i)]);
+                      new_numbers[indices_we_care_about.index_within_set(*i)]);
         }
 
 
@@ -2543,7 +2544,7 @@ namespace internal
         static void
         renumber_vertex_dofs(
           const std::vector<types::global_dof_index> &new_numbers,
-          const IndexSet &                            indices,
+          const IndexSet &                            indices_we_care_about,
           hp::DoFHandler<dim, spacedim> &             dof_handler,
           const bool                                  check_validity)
         {
@@ -2615,7 +2616,7 @@ namespace internal
                           // This will later be fixed up after the first ghost
                           // exchange phase when we unify hp DoFs on neighboring
                           // cells.
-                          if (indices.size() == 0)
+                          if (indices_we_care_about.size() == 0)
                             dealii::internal::DoFAccessorImplementation::
                               Implementation::set_vertex_dof_index(
                                 dof_handler,
@@ -2625,15 +2626,17 @@ namespace internal
                                 new_numbers[old_dof_index]);
                           else
                             {
-                              if (indices.is_element(old_dof_index))
+                              if (indices_we_care_about.is_element(
+                                    old_dof_index))
                                 dealii::internal::DoFAccessorImplementation::
                                   Implementation::set_vertex_dof_index(
                                     dof_handler,
                                     vertex_index,
                                     fe_index,
                                     d,
-                                    new_numbers[indices.index_within_set(
-                                      old_dof_index)]);
+                                    new_numbers[indices_we_care_about
+                                                  .index_within_set(
+                                                    old_dof_index)]);
                               else
                                 dealii::internal::DoFAccessorImplementation::
                                   Implementation::set_vertex_dof_index(
@@ -2655,7 +2658,7 @@ namespace internal
         static void
         renumber_cell_dofs(
           const std::vector<types::global_dof_index> &new_numbers,
-          const IndexSet &                            indices,
+          const IndexSet &                            indices_we_care_about,
           hp::DoFHandler<dim, spacedim> &             dof_handler)
         {
           for (typename hp::DoFHandler<dim, spacedim>::active_cell_iterator
@@ -2689,17 +2692,17 @@ namespace internal
                         // set it to an invalid index. This will later be fixed
                         // up after the first ghost exchange phase when we unify
                         // hp DoFs on neighboring cells.
-                        if (indices.size() == 0)
+                        if (indices_we_care_about.size() == 0)
                           cell->set_dof_index(d,
                                               new_numbers[old_dof_index],
                                               fe_index);
                         else
                           {
-                            if (indices.is_element(old_dof_index))
+                            if (indices_we_care_about.is_element(old_dof_index))
                               cell->set_dof_index(
                                 d,
-                                new_numbers[indices.index_within_set(
-                                  old_dof_index)],
+                                new_numbers[indices_we_care_about
+                                              .index_within_set(old_dof_index)],
                                 fe_index);
                             else
                               cell->set_dof_index(d,
@@ -2717,7 +2720,7 @@ namespace internal
         static void
         renumber_face_dofs(
           const std::vector<types::global_dof_index> & /*new_numbers*/,
-          const IndexSet & /*indices*/,
+          const IndexSet & /*indices_we_care_about*/,
           hp::DoFHandler<1, spacedim> & /*dof_handler*/)
         {
           // nothing to do in 1d since there are no separate faces -- we've
@@ -2730,7 +2733,7 @@ namespace internal
         static void
         renumber_face_dofs(
           const std::vector<types::global_dof_index> &new_numbers,
-          const IndexSet &                            indices,
+          const IndexSet &                            indices_we_care_about,
           hp::DoFHandler<2, spacedim> &               dof_handler)
         {
           const unsigned int dim = 2;
@@ -2794,16 +2797,18 @@ namespace internal
                                   // will later be fixed up after the first
                                   // ghost exchange phase when we unify hp DoFs
                                   // on neighboring cells.
-                                  if (indices.size() == 0)
+                                  if (indices_we_care_about.size() == 0)
                                     line->set_dof_index(
                                       d, new_numbers[old_dof_index], fe_index);
                                   else
                                     {
-                                      if (indices.is_element(old_dof_index))
+                                      if (indices_we_care_about.is_element(
+                                            old_dof_index))
                                         line->set_dof_index(
                                           d,
-                                          new_numbers[indices.index_within_set(
-                                            old_dof_index)],
+                                          new_numbers[indices_we_care_about
+                                                        .index_within_set(
+                                                          old_dof_index)],
                                           fe_index);
                                       else
                                         line->set_dof_index(
@@ -2830,7 +2835,7 @@ namespace internal
         static void
         renumber_face_dofs(
           const std::vector<types::global_dof_index> &new_numbers,
-          const IndexSet &                            indices,
+          const IndexSet &                            indices_we_care_about,
           hp::DoFHandler<3, spacedim> &               dof_handler)
         {
           const unsigned int dim = 3;
@@ -2894,14 +2899,16 @@ namespace internal
                                   // will later be fixed up after the first
                                   // ghost exchange phase when we unify hp DoFs
                                   // on neighboring cells.
-                                  if (indices.size() == 0)
+                                  if (indices_we_care_about.size() == 0)
                                     line->set_dof_index(
                                       d, new_numbers[old_dof_index], fe_index);
-                                  else if (indices.is_element(old_dof_index))
+                                  else if (indices_we_care_about.is_element(
+                                             old_dof_index))
                                     line->set_dof_index(
                                       d,
-                                      new_numbers[indices.index_within_set(
-                                        old_dof_index)],
+                                      new_numbers[indices_we_care_about
+                                                    .index_within_set(
+                                                      old_dof_index)],
                                       fe_index);
                                   else
                                     line->set_dof_index(
@@ -2975,16 +2982,18 @@ namespace internal
                                   // will later be fixed up after the first
                                   // ghost exchange phase when we unify hp DoFs
                                   // on neighboring cells.
-                                  if (indices.size() == 0)
+                                  if (indices_we_care_about.size() == 0)
                                     quad->set_dof_index(
                                       d, new_numbers[old_dof_index], fe_index);
                                   else
                                     {
-                                      if (indices.is_element(old_dof_index))
+                                      if (indices_we_care_about.is_element(
+                                            old_dof_index))
                                         quad->set_dof_index(
                                           d,
-                                          new_numbers[indices.index_within_set(
-                                            old_dof_index)],
+                                          new_numbers[indices_we_care_about
+                                                        .index_within_set(
+                                                          old_dof_index)],
                                           fe_index);
                                       else
                                         quad->set_dof_index(
@@ -3020,12 +3029,12 @@ namespace internal
         template <class DoFHandlerType>
         static void
         renumber_dofs(const std::vector<types::global_dof_index> &new_numbers,
-                      const IndexSet &                            indices,
-                      DoFHandlerType &                            dof_handler,
-                      const bool check_validity)
+                      const IndexSet &indices_we_care_about,
+                      DoFHandlerType &dof_handler,
+                      const bool      check_validity)
         {
           if (DoFHandlerType::dimension == 1)
-            Assert(indices == IndexSet(0), ExcNotImplemented());
+            Assert(indices_we_care_about == IndexSet(0), ExcNotImplemented());
 
           // renumber DoF indices on vertices, cells, and faces. this
           // can be done in parallel because the respective functions
@@ -3033,14 +3042,16 @@ namespace internal
           Threads::TaskGroup<> tasks;
           tasks += Threads::new_task([&]() {
             renumber_vertex_dofs(new_numbers,
-                                 indices,
+                                 indices_we_care_about,
                                  dof_handler,
                                  check_validity);
           });
-          tasks += Threads::new_task(
-            [&]() { renumber_face_dofs(new_numbers, indices, dof_handler); });
-          tasks += Threads::new_task(
-            [&]() { renumber_cell_dofs(new_numbers, indices, dof_handler); });
+          tasks += Threads::new_task([&]() {
+            renumber_face_dofs(new_numbers, indices_we_care_about, dof_handler);
+          });
+          tasks += Threads::new_task([&]() {
+            renumber_cell_dofs(new_numbers, indices_we_care_about, dof_handler);
+          });
           tasks.join_all();
 
           // update the cache used for cell dof indices
@@ -3063,10 +3074,10 @@ namespace internal
         static void
         renumber_vertex_mg_dofs(
           const std::vector<dealii::types::global_dof_index> &new_numbers,
-          const IndexSet &                                    indices,
-          DoFHandler<dim, spacedim> &                         dof_handler,
-          const unsigned int                                  level,
-          const bool                                          check_validity)
+          const IndexSet &           indices_we_care_about,
+          DoFHandler<dim, spacedim> &dof_handler,
+          const unsigned int         level,
+          const bool                 check_validity)
         {
           Assert(level < dof_handler.get_triangulation().n_levels(),
                  ExcInternalError());
@@ -3092,13 +3103,13 @@ namespace internal
                            ExcInternalError());
 
                   if (idx != numbers::invalid_dof_index)
-                    i->set_index(
-                      level,
-                      d,
-                      dof_handler.get_fe().dofs_per_vertex,
-                      (indices.size() == 0) ?
-                        (new_numbers[idx]) :
-                        (new_numbers[indices.index_within_set(idx)]));
+                    i->set_index(level,
+                                 d,
+                                 dof_handler.get_fe().dofs_per_vertex,
+                                 (indices_we_care_about.size() == 0) ?
+                                   (new_numbers[idx]) :
+                                   (new_numbers[indices_we_care_about
+                                                  .index_within_set(idx)]));
                 }
         }
 
@@ -3115,9 +3126,9 @@ namespace internal
         static void
         renumber_cell_mg_dofs(
           const std::vector<dealii::types::global_dof_index> &new_numbers,
-          const IndexSet &                                    indices,
-          DoFHandler<dim, spacedim> &                         dof_handler,
-          const unsigned int                                  level)
+          const IndexSet &           indices_we_care_about,
+          DoFHandler<dim, spacedim> &dof_handler,
+          const unsigned int         level)
         {
           for (std::vector<types::global_dof_index>::iterator i =
                  dof_handler.mg_levels[level]->dof_object.dofs.begin();
@@ -3126,12 +3137,14 @@ namespace internal
             {
               if (*i != numbers::invalid_dof_index)
                 {
-                  Assert((indices.size() > 0 ? indices.is_element(*i) :
-                                               (*i < new_numbers.size())),
+                  Assert((indices_we_care_about.size() > 0 ?
+                            indices_we_care_about.is_element(*i) :
+                            (*i < new_numbers.size())),
                          ExcInternalError());
-                  *i = (indices.size() == 0) ?
-                         (new_numbers[*i]) :
-                         (new_numbers[indices.index_within_set(*i)]);
+                  *i =
+                    (indices_we_care_about.size() == 0) ?
+                      (new_numbers[*i]) :
+                      (new_numbers[indices_we_care_about.index_within_set(*i)]);
                 }
             }
         }
@@ -3149,7 +3162,7 @@ namespace internal
         static void
         renumber_face_mg_dofs(
           const std::vector<types::global_dof_index> & /*new_numbers*/,
-          const IndexSet & /*indices*/,
+          const IndexSet & /*indices_we_care_about*/,
           DoFHandler<1, spacedim> & /*dof_handler*/,
           const unsigned int /*level*/,
           const bool /*check_validity*/)
@@ -3163,10 +3176,10 @@ namespace internal
         static void
         renumber_face_mg_dofs(
           const std::vector<dealii::types::global_dof_index> &new_numbers,
-          const IndexSet &                                    indices,
-          DoFHandler<2, spacedim> &                           dof_handler,
-          const unsigned int                                  level,
-          const bool                                          check_validity)
+          const IndexSet &         indices_we_care_about,
+          DoFHandler<2, spacedim> &dof_handler,
+          const unsigned int       level,
+          const bool               check_validity)
         {
           if (dof_handler.get_fe().dofs_per_line > 0)
             {
@@ -3211,9 +3224,10 @@ namespace internal
                             cell->line(l)->set_mg_dof_index(
                               level,
                               d,
-                              ((indices.size() == 0) ?
+                              ((indices_we_care_about.size() == 0) ?
                                  new_numbers[idx] :
-                                 new_numbers[indices.index_within_set(idx)]));
+                                 new_numbers[indices_we_care_about
+                                               .index_within_set(idx)]));
                         }
                       cell->line(l)->clear_user_flag();
                     }
@@ -3230,10 +3244,10 @@ namespace internal
         static void
         renumber_face_mg_dofs(
           const std::vector<dealii::types::global_dof_index> &new_numbers,
-          const IndexSet &                                    indices,
-          DoFHandler<3, spacedim> &                           dof_handler,
-          const unsigned int                                  level,
-          const bool                                          check_validity)
+          const IndexSet &         indices_we_care_about,
+          DoFHandler<3, spacedim> &dof_handler,
+          const unsigned int       level,
+          const bool               check_validity)
         {
           if (dof_handler.get_fe().dofs_per_line > 0 ||
               dof_handler.get_fe().dofs_per_quad > 0)
@@ -3278,9 +3292,10 @@ namespace internal
                             cell->line(l)->set_mg_dof_index(
                               level,
                               d,
-                              ((indices.size() == 0) ?
+                              ((indices_we_care_about.size() == 0) ?
                                  new_numbers[idx] :
-                                 new_numbers[indices.index_within_set(idx)]));
+                                 new_numbers[indices_we_care_about
+                                               .index_within_set(idx)]));
                         }
                       cell->line(l)->clear_user_flag();
                     }
@@ -3316,9 +3331,10 @@ namespace internal
                             cell->quad(l)->set_mg_dof_index(
                               level,
                               d,
-                              ((indices.size() == 0) ?
+                              ((indices_we_care_about.size() == 0) ?
                                  new_numbers[idx] :
-                                 new_numbers[indices.index_within_set(idx)]));
+                                 new_numbers[indices_we_care_about
+                                               .index_within_set(idx)]));
                         }
                       cell->quad(l)->clear_user_flag();
                     }
@@ -3336,10 +3352,10 @@ namespace internal
         static void
         renumber_mg_dofs(
           const std::vector<dealii::types::global_dof_index> &new_numbers,
-          const IndexSet &                                    indices,
-          DoFHandler<dim, spacedim> &                         dof_handler,
-          const unsigned int                                  level,
-          const bool                                          check_validity)
+          const IndexSet &           indices_we_care_about,
+          DoFHandler<dim, spacedim> &dof_handler,
+          const unsigned int         level,
+          const bool                 check_validity)
         {
           Assert(level < dof_handler.get_triangulation().n_global_levels(),
                  ExcInternalError());
@@ -3349,15 +3365,24 @@ namespace internal
           // work on separate data structures
           Threads::TaskGroup<> tasks;
           tasks += Threads::new_task([&]() {
-            renumber_vertex_mg_dofs(
-              new_numbers, indices, dof_handler, level, check_validity);
+            renumber_vertex_mg_dofs(new_numbers,
+                                    indices_we_care_about,
+                                    dof_handler,
+                                    level,
+                                    check_validity);
           });
           tasks += Threads::new_task([&]() {
-            renumber_face_mg_dofs(
-              new_numbers, indices, dof_handler, level, check_validity);
+            renumber_face_mg_dofs(new_numbers,
+                                  indices_we_care_about,
+                                  dof_handler,
+                                  level,
+                                  check_validity);
           });
           tasks += Threads::new_task([&]() {
-            renumber_cell_mg_dofs(new_numbers, indices, dof_handler, level);
+            renumber_cell_mg_dofs(new_numbers,
+                                  indices_we_care_about,
+                                  dof_handler,
+                                  level);
           });
           tasks.join_all();
         }
@@ -3368,7 +3393,7 @@ namespace internal
         static void
         renumber_mg_dofs(
           const std::vector<dealii::types::global_dof_index> & /*new_numbers*/,
-          const IndexSet & /*indices*/,
+          const IndexSet & /*indices_we_care_about*/,
           hp::DoFHandler<dim, spacedim> & /*dof_handler*/,
           const unsigned int /*level*/,
           const bool /*check_validity*/)

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.