From b10d0e93903511e93f415aff1da81b996e63994c Mon Sep 17 00:00:00 2001 From: Ralf Hartmann Date: Mon, 6 Mar 2006 08:36:28 +0000 Subject: [PATCH] n_children function call only allowed if has_children()==true. git-svn-id: https://svn.dealii.org/trunk@12535 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/tria_accessor.h | 20 +++++++++++++++++++ .../include/grid/tria_accessor.templates.h | 18 ++++++----------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/deal.II/deal.II/include/grid/tria_accessor.h b/deal.II/deal.II/include/grid/tria_accessor.h index f82ea4ea06..830d69af8d 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -601,6 +601,11 @@ class TriaObjectAccessor : public TriaAccessor /** * Return the number of immediate * children of this object. + * + * An assertion assures that this + * function can only be called + * for TriaObjects with + * has_children()==true. */ unsigned int n_children() const; @@ -1085,6 +1090,11 @@ class TriaObjectAccessor<1, dim> : public TriaAccessor /** * Return the number of immediate * children of this object. + * + * An assertion assures that this + * function can only be called + * for TriaObjects with + * has_children()==true. */ unsigned int n_children() const; @@ -1571,6 +1581,11 @@ class TriaObjectAccessor<2, dim> : public TriaAccessor /** * Return the number of immediate * children of this object. + * + * An assertion assures that this + * function can only be called + * for TriaObjects with + * has_children()==true. */ unsigned int n_children() const; @@ -2099,6 +2114,11 @@ class TriaObjectAccessor<3, dim> : public TriaAccessor /** * Return the number of immediate * children of this object. + * + * An assertion assures that this + * function can only be called + * for TriaObjects with + * has_children()==true. */ unsigned int n_children() const; diff --git a/deal.II/deal.II/include/grid/tria_accessor.templates.h b/deal.II/deal.II/include/grid/tria_accessor.templates.h index 5b1fcb50ff..105f2bfc0e 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.templates.h +++ b/deal.II/deal.II/include/grid/tria_accessor.templates.h @@ -229,10 +229,8 @@ inline unsigned int TriaObjectAccessor<1,dim>::n_children () const { - Assert (this->state() == IteratorState::valid, - typename TriaAccessor::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::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::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; } -- 2.39.5