]> https://gitweb.dealii.org/ - dealii.git/commitdiff
n_children function call only allowed if has_children()==true.
authorRalf Hartmann <Ralf.Hartmann@dlr.de>
Mon, 6 Mar 2006 08:36:28 +0000 (08:36 +0000)
committerRalf Hartmann <Ralf.Hartmann@dlr.de>
Mon, 6 Mar 2006 08:36:28 +0000 (08:36 +0000)
git-svn-id: https://svn.dealii.org/trunk@12535 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 f82ea4ea0626b2a24bb061890d638f8538fc06ac..830d69af8d11cc042a95299ad3eea59c4568f88a 100644 (file)
@@ -601,6 +601,11 @@ class TriaObjectAccessor :  public TriaAccessor<dim>
                                     /**
                                      * Return the number of immediate
                                      * children of this object.
+                                     *
+                                     * An assertion assures that this
+                                     * function can only be called
+                                     * for TriaObjects with
+                                     * <tt>has_children()==true</tt>.
                                      */
     unsigned int n_children() const;
 
@@ -1085,6 +1090,11 @@ class TriaObjectAccessor<1, dim> :  public TriaAccessor<dim>
                                     /**
                                      * Return the number of immediate
                                      * children of this object.
+                                     *
+                                     * An assertion assures that this
+                                     * function can only be called
+                                     * for TriaObjects with
+                                     * <tt>has_children()==true</tt>.
                                      */
     unsigned int n_children() const;
 
@@ -1571,6 +1581,11 @@ class TriaObjectAccessor<2, dim> :  public TriaAccessor<dim>
                                     /**
                                      * Return the number of immediate
                                      * children of this object.
+                                     *
+                                     * An assertion assures that this
+                                     * function can only be called
+                                     * for TriaObjects with
+                                     * <tt>has_children()==true</tt>.
                                      */
     unsigned int n_children() const;
 
@@ -2099,6 +2114,11 @@ class TriaObjectAccessor<3, dim> :  public TriaAccessor<dim>
                                     /**
                                      * Return the number of immediate
                                      * children of this object.
+                                     *
+                                     * An assertion assures that this
+                                     * function can only be called
+                                     * for TriaObjects with
+                                     * <tt>has_children()==true</tt>.
                                      */
     unsigned int n_children() const;
 
index 5b1fcb50ff4fe17f0b1e4e62388d6af13ba3afc2..105f2bfc0e7a464dae4fff76f0b009f42acf5c66 100644 (file)
@@ -229,10 +229,8 @@ 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;
+  Assert (has_children()==true, TriaAccessor<1>::ExcCellHasNoChildren());
+  return GeometryInfo<1>::children_per_cell;
 }
 
 
@@ -448,10 +446,8 @@ 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;
+  Assert (has_children()==true, TriaAccessor<2>::ExcCellHasNoChildren());
+  return GeometryInfo<2>::children_per_cell;
 }
 
 
@@ -752,10 +748,8 @@ 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;
+  Assert (has_children()==true, TriaAccessor<3>::ExcCellHasNoChildren());
+  return GeometryInfo<3>::children_per_cell;
 }
 
 

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.