From 5befee7cce46c088a2dda1b4d51672fa82952cb6 Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 10 Aug 1999 08:20:29 +0000 Subject: [PATCH] Clean up Accessor hierarchy. Remove SubstructAccessor classes. git-svn-id: https://svn.dealii.org/trunk@1652 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/tria_accessor.h | 163 +++--------------- .../include/grid/tria_accessor.templates.h | 18 +- deal.II/deal.II/source/grid/tria_accessor.cc | 17 +- 3 files changed, 40 insertions(+), 158 deletions(-) diff --git a/deal.II/deal.II/include/grid/tria_accessor.h b/deal.II/deal.II/include/grid/tria_accessor.h index e43fab9d92..9b6dd8f62f 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -608,11 +608,26 @@ class TriaObjectAccessor : public TriaAccessor /** - * Closure class to stop induction of classes. + * Closure class to stop induction of classes. Should never be called and thus + * producesan error when created. */ template class TriaObjectAccessor<0, dim> : public TriaAccessor -{}; +{ + public: + /** + * Constructor. Should never be called and + * thus produces an error. + */ + TriaObjectAccessor (Triangulation *parent = 0, + const int level = -1, + const int index = -1, + const AccessorData *local_data = 0) : + TriaAccessor (parent, level, index, local_data) + { + Assert (false, ExcInternalError()); + }; +}; @@ -633,9 +648,9 @@ class TriaObjectAccessor<1, dim> : public TriaAccessor * Constructor. */ TriaObjectAccessor (Triangulation *parent = 0, - const int level = -1, - const int index = -1, - const AccessorData *local_data = 0) : + const int level = -1, + const int index = -1, + const AccessorData *local_data = 0) : TriaAccessor (parent, level, index, local_data) {}; /** @@ -1654,136 +1669,6 @@ class TriaObjectAccessor<3, dim> : public TriaAccessor - -/** - * Intermediate, "typedef"-class, not for public use. - */ -template -class TriaSubstructAccessor; - - - -/** - * Intermediate, "typedef"-class, not for public use. - * - * \subsection{Rationale} - * - * This class is only a wrapper class used to do kind of a typedef - * with template parameters. This class and #TriaSubstructAccessor<2># - * wrap the following names: - * \begin{verbatim} - * TriaSubstructAccessor<1> := TriaObjectAccessor<1, 1>; - * TriaSubstructAccessor<2> := TriaObjectAccessor<2, 2>; - * TriaSubstructAccessor<3> := TriaObjectAccessor<3, 3>; - * \end{verbatim} - * We do this rather complex (and needless, provided C++ the needed constructs!) - * class hierarchy manipulation, since this way we can declare and implement - * the \Ref{CellAccessor} dimension independent as an inheritance from - * #TriaSubstructAccessor#. If we had not declared these - * types, we would have to write two class declarations, one for - * #CellAccessor<1>#, derived from #TriaObjectAccessor<1, 1># - * and one for #CellAccessor<2>#, derived from - * #TriaObjectAccessor<2, 2>#. - */ -template <> -class TriaSubstructAccessor<1> : public TriaObjectAccessor<1, 1> { - public: - /** - * Propagate the AccessorData type - * into the present class. - */ - typedef TriaObjectAccessor<1, 1>::AccessorData AccessorData; - /** - * Constructor - */ - TriaSubstructAccessor (Triangulation<1> *tria, - const int level, - const int index, - const AccessorData *local_data) : - TriaObjectAccessor<1, 1> (tria,level,index,local_data) {}; - - // do this here, since this way the - // CellAccessor has the possibility to know - // what a substruct_iterator is. Otherwise - // it would have to ask the DoFHandler - // which would need another big include - // file and maybe cyclic interdependence - typedef void * substruct_iterator; -}; - - - -/** - * Intermediate, "typedef"-class, not for public use. - * - * @see TriaSubstructAccessor<1> - */ -template <> -class TriaSubstructAccessor<2> : public TriaObjectAccessor<2, 2> { - public: - /** - * Propagate the AccessorData type - * into the present class. - */ - typedef TriaObjectAccessor<2, 2>::AccessorData AccessorData; - /** - * Constructor - */ - TriaSubstructAccessor (Triangulation<2> *tria, - const int level, - const int index, - const AccessorData *local_data) : - TriaObjectAccessor<2, 2> (tria,level,index,local_data) {}; - - // do this here, since this way the - // CellAccessor has the possibility to know - // what a substruct_iterator is. Otherwise - // it would have to ask the DoFHandler - // which would need another big include - // file and maybe cyclic interdependence - typedef TriaIterator<2,TriaObjectAccessor<1, 2> > substruct_iterator; -}; - - - - -/** - * Intermediate, "typedef"-class, not for public use. - * - * @see TriaSubstructAccessor<1> - */ -template <> -class TriaSubstructAccessor<3> : public TriaObjectAccessor<3, 3> { - public: - /** - * Propagate the AccessorData type - * into the present class. - */ - typedef TriaObjectAccessor<3, 3>::AccessorData AccessorData; - - /** - * Constructor - */ - TriaSubstructAccessor (Triangulation<3> *tria, - const int level, - const int index, - const AccessorData *local_data) : - TriaObjectAccessor<3, 3> (tria,level,index,local_data) {}; - - // do this here, since this way the - // CellAccessor has the possibility to know - // what a substruct_iterator is. Otherwise - // it would have to ask the DoFHandler - // which would need another big include - // file and maybe cyclic interdependence - typedef TriaIterator<3,TriaObjectAccessor<2, 3> > substruct_iterator; -}; - - - - - - /** * This class allows access to a cell: a line in one dimension, a quad * in two dimension, etc. @@ -1799,13 +1684,13 @@ class TriaSubstructAccessor<3> : public TriaObjectAccessor<3, 3> { * @author Wolfgang Bangerth, 1998 */ template -class CellAccessor : public TriaSubstructAccessor { +class CellAccessor : public TriaObjectAccessor { public: /** * Propagate the AccessorData type * into the present class. */ - typedef typename TriaSubstructAccessor::AccessorData AccessorData; + typedef typename TriaObjectAccessor::AccessorData AccessorData; /** * Constructor. @@ -1814,7 +1699,7 @@ class CellAccessor : public TriaSubstructAccessor { const int level = -1, const int index = -1, const AccessorData *local_data = 0) : - TriaSubstructAccessor (parent, level, index, local_data) {}; + TriaObjectAccessor (parent, level, index, local_data) {}; /** * Return a pointer to the #i#th @@ -1911,7 +1796,7 @@ class CellAccessor : public TriaSubstructAccessor { * This function is not implemented in 1D, * and maps to QuadAccessor::line in 2D. */ - typename TriaSubstructAccessor::substruct_iterator + TriaIterator > face (const unsigned int i) 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 f13c09455a..3b94a84c31 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.templates.h +++ b/deal.II/deal.II/include/grid/tria_accessor.templates.h @@ -955,10 +955,10 @@ TriaObjectAccessor::operator -- () template <> inline -Triangulation<1>::face_iterator +TriaIterator<1,TriaObjectAccessor<0, 1> > CellAccessor<1>::face (const unsigned int) const { Assert (false, ExcNotUsefulForThisDimension()); - return 0; + return TriaIterator<1,TriaObjectAccessor<0, 1> >(); }; @@ -986,7 +986,7 @@ inline int CellAccessor::neighbor_index (const unsigned int i) const { Assert (i::faces_per_cell, - typename TriaSubstructAccessor::ExcInvalidNeighbor(i)); + ExcInvalidNeighbor(i)); return tria->levels[present_level]-> neighbors[present_index*GeometryInfo::faces_per_cell+i].second; }; @@ -998,7 +998,7 @@ inline int CellAccessor::neighbor_level (const unsigned int i) const { Assert (i::faces_per_cell, - typename TriaSubstructAccessor::ExcInvalidNeighbor(i)); + ExcInvalidNeighbor(i)); return tria->levels[present_level]-> neighbors[present_index*GeometryInfo::faces_per_cell+i].first; }; @@ -1010,7 +1010,7 @@ template inline bool CellAccessor::refine_flag_set () const { - Assert (used(), typename TriaSubstructAccessor::ExcCellNotUsed()); + Assert (used(), ExcCellNotUsed()); // cells flagged for refinement must be active // (the #set_refine_flag# function checks this, // but activity may change when refinement is @@ -1049,7 +1049,7 @@ template inline bool CellAccessor::coarsen_flag_set () const { - Assert (used(), typename TriaSubstructAccessor::ExcCellNotUsed()); + Assert (used(), ExcCellNotUsed()); // cells flagged for coarsening must be active // (the #set_refine_flag# function checks this, // but activity may change when refinement is @@ -1092,8 +1092,7 @@ CellAccessor::neighbor (const unsigned int i) const { #ifdef DEBUG if (q.state() != past_the_end) - Assert (q->used(), - typename TriaSubstructAccessor::ExcUnusedCellAsNeighbor()); + Assert (q->used(), ExcUnusedCellAsNeighbor()); #endif return q; }; @@ -1108,8 +1107,7 @@ CellAccessor::child (const unsigned int i) const { #ifdef DEBUG if (q.state() != past_the_end) - Assert (q->used(), - typename TriaSubstructAccessor::ExcUnusedCellAsChild()); + Assert (q->used(), ExcUnusedCellAsChild()); #endif return q; }; diff --git a/deal.II/deal.II/source/grid/tria_accessor.cc b/deal.II/deal.II/source/grid/tria_accessor.cc index 9b180dd2dd..301e7093b4 100644 --- a/deal.II/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/deal.II/source/grid/tria_accessor.cc @@ -1489,7 +1489,7 @@ bool CellAccessor<1>::at_boundary () const { template <> unsigned char CellAccessor<1>::material_id () const { - Assert (used(), TriaSubstructAccessor<1>::ExcCellNotUsed()); + Assert (used(), ExcCellNotUsed()); return tria->levels[present_level]->lines.material_id[present_index]; }; @@ -1497,7 +1497,7 @@ unsigned char CellAccessor<1>::material_id () const { template <> void CellAccessor<1>::set_material_id (const unsigned char mat_id) const { - Assert (used(), TriaSubstructAccessor<1>::ExcCellNotUsed()); + Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->lines.material_id[present_index] = mat_id; }; @@ -1520,7 +1520,7 @@ bool CellAccessor<2>::at_boundary () const { template <> unsigned char CellAccessor<2>::material_id () const { - Assert (used(), TriaSubstructAccessor<2>::ExcCellNotUsed()); + Assert (used(), ExcCellNotUsed()); return tria->levels[present_level]->quads.material_id[present_index]; }; @@ -1528,7 +1528,7 @@ unsigned char CellAccessor<2>::material_id () const { template <> void CellAccessor<2>::set_material_id (const unsigned char mat_id) const { - Assert (used(), TriaSubstructAccessor<2>::ExcCellNotUsed()); + Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->quads.material_id[present_index] = mat_id; }; @@ -1553,7 +1553,7 @@ bool CellAccessor<3>::at_boundary () const { template <> unsigned char CellAccessor<3>::material_id () const { - Assert (used(), TriaSubstructAccessor<3>::ExcCellNotUsed()); + Assert (used(), ExcCellNotUsed()); return tria->levels[present_level]->hexes.material_id[present_index]; }; @@ -1561,7 +1561,7 @@ unsigned char CellAccessor<3>::material_id () const { template <> void CellAccessor<3>::set_material_id (const unsigned char mat_id) const { - Assert (used(), TriaSubstructAccessor<3>::ExcCellNotUsed()); + Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->hexes.material_id[present_index] = mat_id; }; @@ -1575,8 +1575,7 @@ void CellAccessor<3>::set_material_id (const unsigned char mat_id) const { template void CellAccessor::set_neighbor (const unsigned int i, const TriaIterator > &pointer) const { - Assert (i::faces_per_cell, - typename TriaSubstructAccessor::ExcInvalidNeighbor(i)); + Assert (i::faces_per_cell, ExcInvalidNeighbor(i)); if (pointer.state() == valid) { @@ -1602,7 +1601,7 @@ void CellAccessor::set_neighbor (const unsigned int i, template bool CellAccessor::at_boundary (const unsigned int i) const { - Assert (used(), typename TriaSubstructAccessor::ExcCellNotUsed()); + Assert (used(), ExcCellNotUsed()); Assert (i::faces_per_cell, ExcIndexRange (i,0,GeometryInfo::faces_per_cell)); -- 2.39.5