]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Deprecate TriaAccessor::number_of_children.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 20 Apr 2021 16:55:52 +0000 (10:55 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 20 Apr 2021 16:55:52 +0000 (10:55 -0600)
Use TriaAccessor::n_active_descendants() instead.

examples/step-30/doc/intro.dox
examples/step-30/step-30.cc
include/deal.II/grid/grid_tools.h
include/deal.II/grid/tria_accessor.h
include/deal.II/grid/tria_accessor.templates.h
source/dofs/dof_tools_constraints.cc
source/dofs/dof_tools_sparsity.cc
source/fe/fe_values.cc
source/grid/tria.cc
source/grid/tria_accessor.cc
tests/aniso/mesh_3d_21.cc

index 20733dbcc0988d93ba18624a036dc6b12a21e3db..31a50d614433f658e8d3eeedda263653088462b7 100644 (file)
@@ -283,11 +283,11 @@ write code that works for both isotropic and anisotropic refinement:
 @endcode
      Here the number of subfaces is three. It is important to note the subtle
   differences between, for a face, TriaAccessor::n_children() and
-  TriaAccessor::number_of_children(). The first function returns the number of
+  TriaAccessor::n_active_descendants(). The first function returns the number of
   immediate children, which would be two for the above example, whereas the
   second returns the number of active offspring (i.e., including children,
   grandchildren, and further descendants), which is the correct three in
-  the example above. Using <code>face->number_of_children()</code> works for
+  the example above. Using <code>face->n_active_descendants()</code> works for
   isotropic and anisotropic as well as 2D and 3D cases, so it should always be
   used. It should be noted that if any of the cells behind the two
   small subfaces on the left side of the rightmost image is further
index 43043d571b6ae03e9f93e6983c75b26e595908f9..b9dfadf843c5f58af67ab57e67debc377faec5fb 100644 (file)
@@ -497,7 +497,7 @@ namespace Step30
                     // Now we loop over all subfaces, i.e. the children and
                     // possibly grandchildren of the current face.
                     for (unsigned int subface_no = 0;
-                         subface_no < face->number_of_children();
+                         subface_no < face->n_active_descendants();
                          ++subface_no)
                       {
                         // To get the cell behind the current subface we can
@@ -747,7 +747,7 @@ namespace Step30
                       unsigned int neighbor2 = cell->neighbor_face_no(face_no);
                       // Now we loop over all subfaces,
                       for (unsigned int subface_no = 0;
-                           subface_no < face->number_of_children();
+                           subface_no < face->n_active_descendants();
                            ++subface_no)
                         {
                           // get an iterator pointing to the cell behind the
@@ -840,7 +840,7 @@ namespace Step30
                                  ExcInternalError());
                           Assert(neighbor_face_subface.second <
                                    neighbor->face(neighbor_face_subface.first)
-                                     ->number_of_children(),
+                                     ->n_active_descendants(),
                                  ExcInternalError());
                           Assert(neighbor->neighbor_child_on_subface(
                                    neighbor_face_subface.first,
index d6473fbf3e7b11c54b2b862d1e79e0be29f69961..a9a1666399f0782d3a39f23091c23fa80b1c6810 100644 (file)
@@ -3487,7 +3487,7 @@ namespace GridTools
                 // out which border to the present
                 // cell
                 for (unsigned int c = 0;
-                     c < cell->face(n)->number_of_children();
+                     c < cell->face(n)->n_active_descendants();
                      ++c)
                   active_neighbors.push_back(
                     cell->neighbor_child_on_subface(n, c));
index 5214e06cd8c59feee9ef572fb01cad297949ca32..468efa9423bc844fb31c9d1f0af92ca8fddfa98a 100644 (file)
@@ -953,6 +953,13 @@ public:
   unsigned int
   n_children() const;
 
+  /**
+   * @deprecated Use n_active_descendants() instead.
+   */
+  DEAL_II_DEPRECATED_EARLY
+  unsigned int
+  number_of_children() const;
+
   /**
    * Compute and return the number of active descendants of this objects. For
    * example, if all of the eight children of a hex are further refined
@@ -967,7 +974,7 @@ public:
    * current object is not further refined, the answer is one.
    */
   unsigned int
-  number_of_children() const;
+  n_active_descendants() const;
 
   /**
    * Return the number of times that this object is refined. Note that not all
@@ -2128,8 +2135,16 @@ public:
    * Always zero.
    */
   static unsigned int
+  n_active_descendants();
+
+  /**
+   * @deprecated Use n_active_descendants() instead.
+   */
+  DEAL_II_DEPRECATED_EARLY
+  static unsigned int
   number_of_children();
 
+
   /**
    * Return the number of times that this object is refined. Always 0.
    */
@@ -2586,8 +2601,16 @@ public:
    * Always zero.
    */
   static unsigned int
+  n_active_descendants();
+
+  /**
+   * @deprecated Use n_active_descendants() instead.
+   */
+  DEAL_II_DEPRECATED_EARLY
+  static unsigned int
   number_of_children();
 
+
   /**
    * Return the number of times that this object is refined. Always 0.
    */
index ed0e211ca3a80586009b7e3c11b1607b28bfa205..1524e05e9f920e9faa1e8d0bcafefd3c9a8579d9 100644 (file)
@@ -1800,6 +1800,15 @@ TriaAccessor<structdim, dim, spacedim>::max_refinement_depth() const
 template <int structdim, int dim, int spacedim>
 unsigned int
 TriaAccessor<structdim, dim, spacedim>::number_of_children() const
+{
+  return n_active_descendants();
+}
+
+
+
+template <int structdim, int dim, int spacedim>
+unsigned int
+TriaAccessor<structdim, dim, spacedim>::n_active_descendants() const
 {
   if (!this->has_children())
     return 1;
@@ -1807,7 +1816,7 @@ TriaAccessor<structdim, dim, spacedim>::number_of_children() const
     {
       unsigned int sum = 0;
       for (unsigned int c = 0; c < n_children(); ++c)
-        sum += this->child(c)->number_of_children();
+        sum += this->child(c)->n_active_descendants();
       return sum;
     }
 }
@@ -2566,6 +2575,15 @@ TriaAccessor<0, dim, spacedim>::number_of_children()
 
 
 
+template <int dim, int spacedim>
+inline unsigned int
+TriaAccessor<0, dim, spacedim>::n_active_descendants()
+{
+  return 0;
+}
+
+
+
 template <int dim, int spacedim>
 inline unsigned int
 TriaAccessor<0, dim, spacedim>::max_refinement_depth()
@@ -2989,6 +3007,15 @@ TriaAccessor<0, 1, spacedim>::number_of_children()
 
 
 
+template <int spacedim>
+inline unsigned int
+TriaAccessor<0, 1, spacedim>::n_active_descendants()
+{
+  return 0;
+}
+
+
+
 template <int spacedim>
 inline unsigned int
 TriaAccessor<0, 1, spacedim>::max_refinement_depth()
index 7809d2d525566937a1de957cc7bce26bf390aa01..96aa50209a74ec4b1beed4d49a3913cc2fc0d428 100644 (file)
@@ -1139,7 +1139,7 @@ namespace DoFTools
 
                 if (dof_handler.has_hp_capabilities())
                   for (unsigned int c = 0;
-                       c < cell->face(face)->number_of_children();
+                       c < cell->face(face)->n_active_descendants();
                        ++c)
                     {
                       const auto subcell =
index 241e1e6746b3c46916c9de240bfb6871c7f70149..b295c1deac9bb8780e2a06a25ebb6ccbf053abcd 100644 (file)
@@ -608,7 +608,7 @@ namespace DoFTools
                   if (neighbor->has_children())
                     {
                       for (unsigned int sub_nr = 0;
-                           sub_nr != cell_face->number_of_children();
+                           sub_nr != cell_face->n_active_descendants();
                            ++sub_nr)
                         {
                           const typename DoFHandler<dim, spacedim>::
index 6284724fe2633b48ac624da124a0a600e9899cd2..fb39b05f0881efcf93e41351ebf29fe75f190a56 100644 (file)
@@ -5052,10 +5052,10 @@ FESubfaceValues<dim, spacedim>::reinit(
                        0,
                        GeometryInfo<dim>::max_children_per_face));
   Assert(!cell->face(face_no)->has_children() ||
-           subface_no < cell->face(face_no)->number_of_children(),
+           subface_no < cell->face(face_no)->n_active_descendants(),
          ExcIndexRange(subface_no,
                        0,
-                       cell->face(face_no)->number_of_children()));
+                       cell->face(face_no)->n_active_descendants()));
   Assert(cell->has_children() == false,
          ExcMessage("You can't use subface data for cells that are "
                     "already refined. Iterate over their children "
index 33cfcd5252545ec7d9155542c2377b5fceb20e03..2995dc9025fd38bce197dc99a5db06aa878efb5a 100644 (file)
@@ -5326,7 +5326,7 @@ namespace internal
                           if (face_ref_case ==
                               RefinementCase<dim - 1>::isotropic_refinement)
                             {
-                              if (aface->number_of_children() < 4)
+                              if (aface->n_active_descendants() < 4)
                                 // we use user_flags to denote needed
                                 // isotropic refinement
                                 aface->set_user_flag();
index 6f4e270ac5a0bcb21aec750e4e60963cbeadbb4c..44def28d05e61928b6577f60ee785cd230d83207 100644 (file)
@@ -2981,7 +2981,7 @@ CellAccessor<dim, spacedim>::neighbor_child_on_subface(
               const typename Triangulation<dim, spacedim>::face_iterator
                                  mother_face = this->face(face);
               const unsigned int total_children =
-                mother_face->number_of_children();
+                mother_face->n_active_descendants();
               AssertIndexRange(subface, total_children);
               Assert(total_children <= GeometryInfo<3>::max_children_per_face,
                      ExcInternalError());
index c39b5d54804ccb2aaa557b97cb364c152146d0ca..10bd2bb714b587623dac0483289789e784098c37 100644 (file)
@@ -66,7 +66,7 @@ void check_this(Triangulation<3> &tria)
     for (const unsigned int face_no : GeometryInfo<3>::face_indices())
       if (!cell->at_boundary(face_no) && cell->face(face_no)->has_children())
         for (unsigned int subface_no = 0;
-             subface_no < cell->face(face_no)->number_of_children();
+             subface_no < cell->face(face_no)->n_active_descendants();
              ++subface_no)
           {
             unsigned int neighbor_neighbor = cell->neighbor_face_no(face_no);

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.