/**
- * 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<int dim>
class TriaObjectAccessor<0, dim> : public TriaAccessor<dim>
-{};
+{
+ public:
+ /**
+ * Constructor. Should never be called and
+ * thus produces an error.
+ */
+ TriaObjectAccessor (Triangulation<dim> *parent = 0,
+ const int level = -1,
+ const int index = -1,
+ const AccessorData *local_data = 0) :
+ TriaAccessor<dim> (parent, level, index, local_data)
+ {
+ Assert (false, ExcInternalError());
+ };
+};
* Constructor.
*/
TriaObjectAccessor (Triangulation<dim> *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<dim> (parent, level, index, local_data) {};
/**
-
-/**
- * Intermediate, "typedef"-class, not for public use.
- */
-template <int dim>
-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<dim>#. 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<dim>
- // 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<dim>
- // 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<dim>
- // 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.
* @author Wolfgang Bangerth, 1998
*/
template <int dim>
-class CellAccessor : public TriaSubstructAccessor<dim> {
+class CellAccessor : public TriaObjectAccessor<dim,dim> {
public:
/**
* Propagate the AccessorData type
* into the present class.
*/
- typedef typename TriaSubstructAccessor<dim>::AccessorData AccessorData;
+ typedef typename TriaObjectAccessor<dim,dim>::AccessorData AccessorData;
/**
* Constructor.
const int level = -1,
const int index = -1,
const AccessorData *local_data = 0) :
- TriaSubstructAccessor<dim> (parent, level, index, local_data) {};
+ TriaObjectAccessor<dim,dim> (parent, level, index, local_data) {};
/**
* Return a pointer to the #i#th
* This function is not implemented in 1D,
* and maps to QuadAccessor::line in 2D.
*/
- typename TriaSubstructAccessor<dim>::substruct_iterator
+ TriaIterator<dim,TriaObjectAccessor<dim-1, dim> >
face (const unsigned int i) const;
/**
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> >();
};
int
CellAccessor<dim>::neighbor_index (const unsigned int i) const {
Assert (i<GeometryInfo<dim>::faces_per_cell,
- typename TriaSubstructAccessor<dim>::ExcInvalidNeighbor(i));
+ ExcInvalidNeighbor(i));
return tria->levels[present_level]->
neighbors[present_index*GeometryInfo<dim>::faces_per_cell+i].second;
};
int
CellAccessor<dim>::neighbor_level (const unsigned int i) const {
Assert (i<GeometryInfo<dim>::faces_per_cell,
- typename TriaSubstructAccessor<dim>::ExcInvalidNeighbor(i));
+ ExcInvalidNeighbor(i));
return tria->levels[present_level]->
neighbors[present_index*GeometryInfo<dim>::faces_per_cell+i].first;
};
inline
bool
CellAccessor<dim>::refine_flag_set () const {
- Assert (used(), typename TriaSubstructAccessor<dim>::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
inline
bool
CellAccessor<dim>::coarsen_flag_set () const {
- Assert (used(), typename TriaSubstructAccessor<dim>::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
#ifdef DEBUG
if (q.state() != past_the_end)
- Assert (q->used(),
- typename TriaSubstructAccessor<dim>::ExcUnusedCellAsNeighbor());
+ Assert (q->used(), ExcUnusedCellAsNeighbor());
#endif
return q;
};
#ifdef DEBUG
if (q.state() != past_the_end)
- Assert (q->used(),
- typename TriaSubstructAccessor<dim>::ExcUnusedCellAsChild());
+ Assert (q->used(), ExcUnusedCellAsChild());
#endif
return q;
};
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];
};
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;
};
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];
};
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;
};
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];
};
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;
};
template <int dim>
void CellAccessor<dim>::set_neighbor (const unsigned int i,
const TriaIterator<dim,CellAccessor<dim> > &pointer) const {
- Assert (i<GeometryInfo<dim>::faces_per_cell,
- typename TriaSubstructAccessor<dim>::ExcInvalidNeighbor(i));
+ Assert (i<GeometryInfo<dim>::faces_per_cell, ExcInvalidNeighbor(i));
if (pointer.state() == valid)
{
template <int dim>
bool CellAccessor<dim>::at_boundary (const unsigned int i) const {
- Assert (used(), typename TriaSubstructAccessor<dim>::ExcCellNotUsed());
+ Assert (used(), ExcCellNotUsed());
Assert (i<GeometryInfo<dim>::faces_per_cell,
ExcIndexRange (i,0,GeometryInfo<dim>::faces_per_cell));