From: wolf Date: Sun, 3 Jan 1999 18:49:54 +0000 (+0000) Subject: Add functions to recursively set or clear user flags. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=965b2b3d8fde5f3720dbde6f23cb26bdbe0dda14;p=dealii-svn.git Add functions to recursively set or clear user flags. git-svn-id: https://svn.dealii.org/trunk@721 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/grid/tria_accessor.h b/deal.II/deal.II/include/grid/tria_accessor.h index a708b8075e..275a1d74b4 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -341,6 +341,20 @@ class LineAccessor : public TriaAccessor { */ void clear_user_flag () const; + /** + * set the user flag of this object + * and of all its children and their + * children, etc. + */ + void recursively_set_user_flag () const; + + /** + * Clear the user flag of this object + * and of all its children and their + * children, etc. + */ + void recursively_clear_user_flag () const; + /** * Set the user pointer of this line * to #p#. @@ -656,6 +670,20 @@ class QuadAccessor : public TriaAccessor { */ void clear_user_flag () const; + /** + * set the user flag of this object + * and of all its children and their + * children, etc. + */ + void recursively_set_user_flag () const; + + /** + * Clear the user flag of this object + * and of all its children and their + * children, etc. + */ + void recursively_clear_user_flag () const; + /** * Set the user pointer of this line * to #p#. diff --git a/deal.II/deal.II/source/grid/tria_accessor.cc b/deal.II/deal.II/source/grid/tria_accessor.cc index 3d7585e8bc..3cd54727f6 100644 --- a/deal.II/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/deal.II/source/grid/tria_accessor.cc @@ -138,6 +138,36 @@ void LineAccessor::set_user_flag () const { +template +void LineAccessor::clear_user_flag () const { + Assert (used(), ExcCellNotUsed()); + tria->levels[present_level]->lines.user_flags[present_index] = false; +}; + + + +template +void LineAccessor::recursively_set_user_flag () const { + set_user_flag (); + + if (has_children()) + for (unsigned int c=0; c<2; ++c) + child(c)->recursively_set_user_flag (); +}; + + + +template +void LineAccessor::recursively_clear_user_flag () const { + clear_user_flag (); + + if (has_children()) + for (unsigned int c=0; c<2; ++c) + child(c)->recursively_clear_user_flag (); +}; + + + template void LineAccessor::set_user_pointer (void *p) const { Assert (used(), ExcCellNotUsed()); @@ -163,14 +193,6 @@ void * LineAccessor::user_pointer () const { -template -void LineAccessor::clear_user_flag () const { - Assert (used(), ExcCellNotUsed()); - tria->levels[present_level]->lines.user_flags[present_index] = false; -}; - - - template TriaIterator > LineAccessor::child (const unsigned int i) const { @@ -415,6 +437,28 @@ void QuadAccessor::clear_user_flag () const { +template +void QuadAccessor::recursively_set_user_flag () const { + set_user_flag (); + + if (has_children()) + for (unsigned int c=0; c<4; ++c) + child(c)->recursively_set_user_flag (); +}; + + + +template +void QuadAccessor::recursively_clear_user_flag () const { + clear_user_flag (); + + if (has_children()) + for (unsigned int c=0; c<4; ++c) + child(c)->recursively_clear_user_flag (); +}; + + + template void QuadAccessor::set_user_pointer (void *p) const { Assert (used(), ExcCellNotUsed());