]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New n_children functions.
authorRalf Hartmann <Ralf.Hartmann@dlr.de>
Thu, 2 Mar 2006 08:59:12 +0000 (08:59 +0000)
committerRalf Hartmann <Ralf.Hartmann@dlr.de>
Thu, 2 Mar 2006 08:59:12 +0000 (08:59 +0000)
git-svn-id: https://svn.dealii.org/trunk@12524 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria_accessor.h
deal.II/deal.II/include/grid/tria_accessor.templates.h

index d8092eb2f7e10b13219a3476d353ecda7ee3591a..24147ef65144e1b4ed7b0cb2076f92cce5ae0e6f 100644 (file)
@@ -598,6 +598,12 @@ class TriaObjectAccessor :  public TriaAccessor<dim>
                                      */
     bool has_children () const;
 
+                                    /**
+                                     * Return the number of
+                                     * children of this cell.
+                                     */
+    unsigned int n_children() const;
+
                                     /**
                                      * Number of times that this
                                      * object is refined. Note that
@@ -1076,6 +1082,12 @@ class TriaObjectAccessor<1, dim> :  public TriaAccessor<dim>
                                      */
     bool has_children () const;
 
+                                    /**
+                                     * Return the number of
+                                     * children of this cell.
+                                     */
+    unsigned int n_children() const;
+
                                     /**
                                      * Return the number of times
                                      * that this cell is
@@ -1556,6 +1568,12 @@ class TriaObjectAccessor<2, dim> :  public TriaAccessor<dim>
                                      */
     bool has_children () const;
 
+                                    /**
+                                     * Return the number of
+                                     * children of this cell.
+                                     */
+    unsigned int n_children() const;
+
                                     /**
                                      * Return the number of times
                                      * that this cell is
@@ -2078,6 +2096,12 @@ class TriaObjectAccessor<3, dim> :  public TriaAccessor<dim>
                                      */
     bool has_children () const;
 
+                                    /**
+                                     * Return the number of
+                                     * children of this cell.
+                                     */
+    unsigned int n_children() const;
+
                                     /**
                                      * Return the number of times
                                      * that this cell is
index c27c9c1720cf95642bfe645cda1187837c530841..5b1fcb50ff4fe17f0b1e4e62388d6af13ba3afc2 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -224,6 +224,17 @@ TriaObjectAccessor<1,dim>::has_children () const
 }
 
 
+template <int dim>
+inline
+unsigned int
+TriaObjectAccessor<1,dim>::n_children () const
+{
+  Assert (this->state() == IteratorState::valid,
+         typename TriaAccessor<dim>::ExcDereferenceInvalidObject());
+                                  // a line has always 2 children
+  return has_children() ? 2 : 0;
+}
+
 
 template <int dim>
 inline
@@ -432,6 +443,18 @@ TriaObjectAccessor<2,dim>::has_children () const
 }
 
 
+template <int dim>
+inline
+unsigned int
+TriaObjectAccessor<2,dim>::n_children () const
+{
+  Assert (this->state() == IteratorState::valid,
+         typename TriaAccessor<dim>::ExcDereferenceInvalidObject());
+                                  // a quad has always 4 children
+  return has_children() ? 4 : 0;
+}
+
+
 
 template <int dim>
 inline
@@ -714,7 +737,9 @@ int TriaObjectAccessor<3,dim>::child_index (const unsigned int i) const
 
 
 template <int dim>
-bool TriaObjectAccessor<3,dim>::has_children () const
+inline
+bool
+TriaObjectAccessor<3,dim>::has_children () const
 {
   Assert (this->state() == IteratorState::valid,
          typename TriaAccessor<dim>::ExcDereferenceInvalidObject());
@@ -722,6 +747,17 @@ bool TriaObjectAccessor<3,dim>::has_children () const
 }
 
 
+template <int dim>
+inline
+unsigned int
+TriaObjectAccessor<3,dim>::n_children () const
+{
+  Assert (this->state() == IteratorState::valid,
+         typename TriaAccessor<dim>::ExcDereferenceInvalidObject());
+                                  // a hex has always 8 children
+  return has_children() ? 8 : 0;
+}
+
 
 template <int dim>
 inline

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.