]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add the rather strange function number_of_children to the triangulation iterators.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 10 Nov 1998 00:14:31 +0000 (00:14 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 10 Nov 1998 00:14:31 +0000 (00:14 +0000)
git-svn-id: https://svn.dealii.org/trunk@665 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria_accessor.h
deal.II/deal.II/source/grid/tria_accessor.cc

index 6c87c9e3fce5faba00dcb973e2d3387cc6cccbbe..a708b8075e028b9cebc3347d3048ccb8e31f8e56 100644 (file)
@@ -489,6 +489,22 @@ class LineAccessor :  public TriaAccessor<dim> {
                                      */
     double measure () const;
 
+                                    /**
+                                     * Compute and return the number of
+                                     * children of this line. Actually,
+                                     * this function only counts the number
+                                     * of active children, i.e. the number
+                                     * if lines which are not further
+                                     * refined. Thus, if both of the two
+                                     * children of a line are further
+                                     * refined exactly once, the returned
+                                     * number will be four, not six.
+                                     *
+                                     * If the present cell is not refined,
+                                     * one is returned.
+                                     */
+    unsigned int number_of_children () const;
+    
   private:
                                     /**
                                      *  Copy operator. This is normally
@@ -509,6 +525,8 @@ class LineAccessor :  public TriaAccessor<dim> {
                                      */
     void operator = (const LineAccessor &);
 
+    
+
   public:
 //  protected:
                                     // would be better to make this private,
@@ -806,6 +824,22 @@ class QuadAccessor :  public TriaAccessor<dim> {
                                      */
     double measure () const;
 
+                                    /**
+                                     * Compute and return the number of
+                                     * children of this quad. Actually,
+                                     * this function only counts the number
+                                     * of active children, i.e. the number
+                                     * if quads which are not further
+                                     * refined. Thus, if all of the four
+                                     * children of a quad are further
+                                     * refined exactly once, the returned
+                                     * number will be 16, not 20.
+                                     *
+                                     * If the present cell is not refined,
+                                     * one is returned.
+                                     */
+    unsigned int number_of_children () const;
+
   private:
                                     /**
                                      *  Copy operator. This is normally
index 5a770686a82d56a6151262a1f279ecbf6ab4afcb..3d7585e8bcc2665dfcbd13f4f06ed389cb766508 100644 (file)
@@ -320,7 +320,22 @@ template <int dim>
 double LineAccessor<dim>::measure () const {
   return sqrt((vertex(1)-vertex(0)).square());
 };
-  
+
+
+
+template <int dim>
+unsigned int LineAccessor<dim>::number_of_children () const {
+  if (!has_children())
+    return 1;
+  else
+    {
+      unsigned int sum = 0;
+      for (unsigned int c=0; c<2; ++c)
+       sum += child(c)->number_of_children();
+      return sum;
+    };
+};
+
 
 
 
@@ -711,6 +726,21 @@ double QuadAccessor<2>::measure () const {
 
 
 
+template <int dim>
+unsigned int QuadAccessor<dim>::number_of_children () const {
+  if (!has_children())
+    return 1;
+  else
+    {
+      unsigned int sum = 0;
+      for (unsigned int c=0; c<4; ++c)
+       sum += child(c)->number_of_children();
+      return sum;
+    };
+};
+
+
+
 
 
 

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.