From: Wolfgang Bangerth Date: Mon, 23 Apr 2001 15:20:52 +0000 (+0000) Subject: Only clean-ups. X-Git-Tag: v8.0.0~19323 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=850e6a552503c85017e56450bd39c67eee07faf9;p=dealii.git Only clean-ups. git-svn-id: https://svn.dealii.org/trunk@4463 0785d39b-7218-0410-832d-ea1e28bc413d --- 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 3bf58d32e6..2eac941ff8 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.templates.h +++ b/deal.II/deal.II/include/grid/tria_accessor.templates.h @@ -26,53 +26,64 @@ template inline void -TriaAccessor::copy_from (const TriaAccessor &a) { +TriaAccessor::copy_from (const TriaAccessor &a) +{ present_level = a.present_level; present_index = a.present_index; tria = a.tria; }; + template inline bool -TriaAccessor::operator == (const TriaAccessor &a) const { +TriaAccessor::operator == (const TriaAccessor &a) const +{ Assert (tria == a.tria, ExcCantCompareIterators()); return ((present_index == a.present_index) && (present_level == a.present_level)); }; + template inline bool -TriaAccessor::operator != (const TriaAccessor &a) const { +TriaAccessor::operator != (const TriaAccessor &a) const +{ Assert (tria == a.tria, ExcCantCompareIterators()); return ((present_index != a.present_index) || (present_level != a.present_level)); }; + template inline int -TriaAccessor::level () const { +TriaAccessor::level () const +{ return present_level; }; + template inline int -TriaAccessor::index () const { +TriaAccessor::index () const +{ return present_index; }; + template inline IteratorState -TriaAccessor::state () const { +TriaAccessor::state () const +{ if ((present_level>=0) && (present_index>=0)) return valid; else @@ -83,6 +94,7 @@ TriaAccessor::state () const { }; + template inline const Triangulation & @@ -98,74 +110,89 @@ TriaAccessor::get_triangulation () const template inline bool -TriaObjectAccessor<1,dim>::used () const { +TriaObjectAccessor<1,dim>::used () const +{ Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); return tria->levels[present_level]->lines.used[present_index]; }; + template inline bool -TriaObjectAccessor<1,dim>::user_flag_set () const { +TriaObjectAccessor<1,dim>::user_flag_set () const +{ Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->lines.user_flags[present_index]; }; + template inline void -TriaObjectAccessor<1,dim>::set_user_flag () const { +TriaObjectAccessor<1,dim>::set_user_flag () const +{ Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->lines.user_flags[present_index] = true; }; + template inline void -TriaObjectAccessor<1,dim>::clear_user_flag () const { +TriaObjectAccessor<1,dim>::clear_user_flag () const +{ Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->lines.user_flags[present_index] = false; }; + template inline TriaIterator > -TriaObjectAccessor<1,dim>::child (const unsigned int i) const { +TriaObjectAccessor<1,dim>::child (const unsigned int i) const +{ Assert (i<2, ExcIndexRange(i,0,2)); - TriaIterator > q (tria, present_level+1, child_index (i)); + TriaIterator > + q (tria, present_level+1, child_index (i)); -#ifdef DEBUG - if (q.state() != past_the_end) - Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsChild()); -#endif + Assert ((q.state() == past_the_end) || q->used(), + typename TriaAccessor::ExcUnusedCellAsChild()); + return q; }; + template inline int -TriaObjectAccessor<1,dim>::child_index (unsigned int i) const { +TriaObjectAccessor<1,dim>::child_index (unsigned int i) const +{ Assert (i<2, ExcIndexRange(i,0,2)); return tria->levels[present_level]->lines.children[present_index]+i; }; + template inline bool -TriaObjectAccessor<1,dim>::has_children () const { - Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); +TriaObjectAccessor<1,dim>::has_children () const +{ + Assert (state() == valid, + typename TriaAccessor::ExcDereferenceInvalidObject()); return (tria->levels[present_level]->lines.children[present_index] != -1); } + template inline unsigned int @@ -180,10 +207,12 @@ TriaObjectAccessor<1,dim>::max_refinement_depth () const }; + template inline void -TriaObjectAccessor<1,dim>::operator ++ () { +TriaObjectAccessor<1,dim>::operator ++ () +{ ++present_index; // is index still in the range of // the vector? @@ -206,10 +235,12 @@ TriaObjectAccessor<1,dim>::operator ++ () { }; + template inline void -TriaObjectAccessor<1,dim>::operator -- () { +TriaObjectAccessor<1,dim>::operator -- () +{ --present_index; // is index still in the range of // the vector? @@ -236,44 +267,53 @@ TriaObjectAccessor<1,dim>::operator -- () { template inline bool -TriaObjectAccessor<2,dim>::used () const { +TriaObjectAccessor<2,dim>::used () const +{ Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); return tria->levels[present_level]->quads.used[present_index]; }; + template inline bool -TriaObjectAccessor<2,dim>::user_flag_set () const { +TriaObjectAccessor<2,dim>::user_flag_set () const +{ Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->quads.user_flags[present_index]; }; + template inline void -TriaObjectAccessor<2,dim>::set_user_flag () const { +TriaObjectAccessor<2,dim>::set_user_flag () const +{ Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->quads.user_flags[present_index] = true; }; + template inline void -TriaObjectAccessor<2,dim>::clear_user_flag () const { +TriaObjectAccessor<2,dim>::clear_user_flag () const +{ Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->quads.user_flags[present_index] = false; }; + template inline TriaIterator > -TriaObjectAccessor<2,dim>::line (const unsigned int i) const { +TriaObjectAccessor<2,dim>::line (const unsigned int i) const +{ return TriaIterator > ( @@ -284,49 +324,59 @@ TriaObjectAccessor<2,dim>::line (const unsigned int i) const { }; + template inline unsigned int -TriaObjectAccessor<2,dim>::line_index (unsigned int i) const { +TriaObjectAccessor<2,dim>::line_index (unsigned int i) const +{ Assert (i<4, ExcIndexRange(i,0,4)); return tria->levels[present_level]->quads.quads[present_index].line(i); }; + template inline TriaIterator > -TriaObjectAccessor<2,dim>::child (const unsigned int i) const { +TriaObjectAccessor<2,dim>::child (const unsigned int i) const +{ Assert (i<4, ExcIndexRange(i,0,4)); - TriaIterator > q (tria, present_level+1, child_index (i)); + TriaIterator > + q (tria, present_level+1, child_index (i)); -#ifdef DEBUG - if (q.state() != past_the_end) - Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsChild()); -#endif + Assert ((q.state() == past_the_end) || q->used(), + typename TriaAccessor::ExcUnusedCellAsChild()); + return q; }; + template inline -int TriaObjectAccessor<2,dim>::child_index (unsigned int i) const { +int TriaObjectAccessor<2,dim>::child_index (unsigned int i) const +{ Assert (i<4, ExcIndexRange(i,0,4)); return tria->levels[present_level]->quads.children[present_index]+i; }; + template inline bool -TriaObjectAccessor<2,dim>::has_children () const { - Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); +TriaObjectAccessor<2,dim>::has_children () const +{ + Assert (state() == valid, + typename TriaAccessor::ExcDereferenceInvalidObject()); return (tria->levels[present_level]->quads.children[present_index] != -1); }; + template inline unsigned int @@ -344,10 +394,12 @@ TriaObjectAccessor<2,dim>::max_refinement_depth () const }; + template inline void -TriaObjectAccessor<2,dim>::operator ++ () { +TriaObjectAccessor<2,dim>::operator ++ () +{ ++present_index; // is index still in the range of // the vector? @@ -369,10 +421,12 @@ TriaObjectAccessor<2,dim>::operator ++ () { }; + template inline void -TriaObjectAccessor<2,dim>::operator -- () { +TriaObjectAccessor<2,dim>::operator -- () +{ --present_index; // is index still in the range of // the vector? @@ -399,43 +453,52 @@ TriaObjectAccessor<2,dim>::operator -- () { template inline bool -TriaObjectAccessor<3,dim>::used () const { +TriaObjectAccessor<3,dim>::used () const +{ Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); return tria->levels[present_level]->hexes.used[present_index]; }; + template inline bool -TriaObjectAccessor<3,dim>::user_flag_set () const { +TriaObjectAccessor<3,dim>::user_flag_set () const +{ Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->hexes.user_flags[present_index]; }; + template inline void -TriaObjectAccessor<3,dim>::set_user_flag () const { +TriaObjectAccessor<3,dim>::set_user_flag () const +{ Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->hexes.user_flags[present_index] = true; }; + template inline -void TriaObjectAccessor<3,dim>::clear_user_flag () const { +void TriaObjectAccessor<3,dim>::clear_user_flag () const +{ Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->hexes.user_flags[present_index] = false; }; + template inline TriaIterator > -TriaObjectAccessor<3,dim>::line (const unsigned int i) const { +TriaObjectAccessor<3,dim>::line (const unsigned int i) const +{ Assert (used(), typename TriaAccessor::ExcCellNotUsed()); Assert (i<12, ExcIndexRange (i,0,12)); @@ -469,10 +532,12 @@ TriaObjectAccessor<3,dim>::line (const unsigned int i) const { }; + template inline TriaIterator > -TriaObjectAccessor<3,dim>::quad (const unsigned int i) const { +TriaObjectAccessor<3,dim>::quad (const unsigned int i) const +{ Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return TriaIterator > @@ -484,10 +549,12 @@ TriaObjectAccessor<3,dim>::quad (const unsigned int i) const { }; + template inline unsigned int -TriaObjectAccessor<3,dim>::line_index (unsigned int i) const { +TriaObjectAccessor<3,dim>::line_index (unsigned int i) const +{ Assert (i<12, ExcIndexRange(i,0,12)); if (i<4) @@ -512,6 +579,7 @@ TriaObjectAccessor<3,dim>::line_index (unsigned int i) const { }; + template inline unsigned int @@ -523,6 +591,7 @@ TriaObjectAccessor<3,dim>::quad_index (unsigned int i) const }; + template inline TriaIterator > @@ -532,29 +601,34 @@ TriaObjectAccessor<3,dim>::child (const unsigned int i) const TriaIterator > q (tria, present_level+1, child_index (i)); -#ifdef DEBUG - if (q.state() != past_the_end) - Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsChild()); -#endif + Assert ((q.state() == past_the_end) || q->used(), + typename TriaAccessor::ExcUnusedCellAsChild()); + return q; }; + template inline -int TriaObjectAccessor<3,dim>::child_index (unsigned int i) const { +int TriaObjectAccessor<3,dim>::child_index (unsigned int i) const +{ Assert (i<8, ExcIndexRange(i,0,8)); return tria->levels[present_level]->hexes.children[present_index]+i; }; + template -bool TriaObjectAccessor<3,dim>::has_children () const { - Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); +bool TriaObjectAccessor<3,dim>::has_children () const +{ + Assert (state() == valid, + typename TriaAccessor::ExcDereferenceInvalidObject()); return (tria->levels[present_level]->hexes.children[present_index] != -1); }; + template inline unsigned int @@ -578,10 +652,12 @@ TriaObjectAccessor<3,dim>::max_refinement_depth () const }; + template inline void -TriaObjectAccessor<3,dim>::operator ++ () { +TriaObjectAccessor<3,dim>::operator ++ () +{ ++present_index; // is index still in the range of // the vector? @@ -603,10 +679,12 @@ TriaObjectAccessor<3,dim>::operator ++ () { }; + template inline void -TriaObjectAccessor<3,dim>::operator -- () { +TriaObjectAccessor<3,dim>::operator -- () +{ --present_index; // is index still in the range of // the vector? @@ -640,6 +718,7 @@ TriaObjectAccessor::used () const }; + template inline bool @@ -650,6 +729,7 @@ TriaObjectAccessor::user_flag_set () const }; + template inline void @@ -660,6 +740,7 @@ TriaObjectAccessor::set_user_flag () const }; + template inline void TriaObjectAccessor::clear_user_flag () const @@ -669,6 +750,7 @@ void TriaObjectAccessor::clear_user_flag () const }; + template inline TriaIterator > @@ -715,6 +797,7 @@ TriaObjectAccessor::line (const unsigned int i) const }; + template inline TriaIterator > @@ -733,6 +816,7 @@ TriaObjectAccessor::quad (const unsigned int i) const }; + template inline unsigned int @@ -772,6 +856,7 @@ TriaObjectAccessor::line_index (unsigned int i) const }; + template inline unsigned int @@ -784,6 +869,7 @@ TriaObjectAccessor::quad_index (unsigned int i) const }; + template inline TriaIterator > @@ -792,16 +878,17 @@ TriaObjectAccessor::child (const unsigned int i) const Assert (i < GeometryInfo::children_per_cell, ExcIndexRange(i,0,GeometryInfo::children_per_cell)); - TriaIterator > q (tria, present_level+1, child_index (i)); + TriaIterator > + q (tria, present_level+1, child_index (i)); -#ifdef DEBUG - if (q.state() != past_the_end) - Assert (q->used(), ExcUnusedCellAsChild()); -#endif + Assert ((q.state() == past_the_end) || q->used(), + ExcUnusedCellAsChild()); + return q; }; + template inline int TriaObjectAccessor::child_index (unsigned int i) const @@ -812,6 +899,7 @@ int TriaObjectAccessor::child_index (unsigned int i) const }; + template bool TriaObjectAccessor::has_children () const { @@ -820,6 +908,7 @@ bool TriaObjectAccessor::has_children () const }; + template inline unsigned int @@ -843,10 +932,12 @@ TriaObjectAccessor::max_refinement_depth () const }; + template inline void -TriaObjectAccessor::operator ++ () { +TriaObjectAccessor::operator ++ () +{ ++present_index; // is index still in the range of // the vector? @@ -868,6 +959,7 @@ TriaObjectAccessor::operator ++ () { }; + template inline void @@ -939,6 +1031,7 @@ CellAccessor::neighbor_index (const unsigned int i) const }; + template inline int @@ -1042,12 +1135,12 @@ inline TriaIterator > CellAccessor::neighbor (const unsigned int i) const { - TriaIterator > q (tria, neighbor_level (i), neighbor_index (i)); + TriaIterator > + q (tria, neighbor_level (i), neighbor_index (i)); + + Assert ((q.state() == past_the_end) || q->used(), + typename TriaAccessor::ExcUnusedCellAsNeighbor()); -#ifdef DEBUG - if (q.state() != past_the_end) - Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsNeighbor()); -#endif return q; }; @@ -1058,12 +1151,12 @@ inline TriaIterator > CellAccessor::child (const unsigned int i) const { - TriaIterator > q (tria, present_level+1, child_index (i)); + TriaIterator > + q (tria, present_level+1, child_index (i)); + + Assert ((q.state() == past_the_end) || q->used(), + typename TriaAccessor::ExcUnusedCellAsChild()); -#ifdef DEBUG - if (q.state() != past_the_end) - Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsChild()); -#endif return q; };