From 28a13c154e9cadf4a28c11060215f7b5f6df1eaa Mon Sep 17 00:00:00 2001 From: Ralf Hartmann Date: Thu, 2 Mar 2006 08:59:12 +0000 Subject: [PATCH] New n_children functions. git-svn-id: https://svn.dealii.org/trunk@12524 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/tria_accessor.h | 24 +++++++++++ .../include/grid/tria_accessor.templates.h | 40 ++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/deal.II/deal.II/include/grid/tria_accessor.h b/deal.II/deal.II/include/grid/tria_accessor.h index d8092eb2f7..24147ef651 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -598,6 +598,12 @@ class TriaObjectAccessor : public TriaAccessor */ 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 */ 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 */ 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 */ 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 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 c27c9c1720..5b1fcb50ff 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.templates.h +++ b/deal.II/deal.II/include/grid/tria_accessor.templates.h @@ -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 +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; +} + template inline @@ -432,6 +443,18 @@ TriaObjectAccessor<2,dim>::has_children () const } +template +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; +} + + template inline @@ -714,7 +737,9 @@ int TriaObjectAccessor<3,dim>::child_index (const unsigned int i) const template -bool TriaObjectAccessor<3,dim>::has_children () const +inline +bool +TriaObjectAccessor<3,dim>::has_children () const { Assert (this->state() == IteratorState::valid, typename TriaAccessor::ExcDereferenceInvalidObject()); @@ -722,6 +747,17 @@ bool TriaObjectAccessor<3,dim>::has_children () const } +template +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; +} + template inline -- 2.39.5