]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Clean up Accessor hierarchy. Remove SubstructAccessor classes.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 10 Aug 1999 08:20:29 +0000 (08:20 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 10 Aug 1999 08:20:29 +0000 (08:20 +0000)
git-svn-id: https://svn.dealii.org/trunk@1652 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria_accessor.h
deal.II/deal.II/include/grid/tria_accessor.templates.h
deal.II/deal.II/source/grid/tria_accessor.cc

index e43fab9d92455a21355c3cc4dc5bd5e8241529f3..9b6dd8f62f6ed9aca67c6b6da16e56d4a2c91993 100644 (file)
@@ -608,11 +608,26 @@ class TriaObjectAccessor :  public TriaAccessor<dim>
 
 
 /**
- * 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());
+      };
+};
 
 
 
@@ -633,9 +648,9 @@ class TriaObjectAccessor<1, dim> :  public TriaAccessor<dim>
                                      *  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) {};
 
                                     /**
@@ -1654,136 +1669,6 @@ class TriaObjectAccessor<3, dim> :  public TriaAccessor<dim>
 
 
 
-
-/**
- * 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.
@@ -1799,13 +1684,13 @@ class TriaSubstructAccessor<3> : public TriaObjectAccessor<3, 3> {
  * @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.
@@ -1814,7 +1699,7 @@ class CellAccessor :  public TriaSubstructAccessor<dim> {
                  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
@@ -1911,7 +1796,7 @@ class CellAccessor :  public TriaSubstructAccessor<dim> {
                                      * 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;
     
                                     /**
index f13c09455a9fbaea0457020d95d04f6b7f2ae1ac..3b94a84c31f3b088f254f217cba5173f31193e04 100644 (file)
@@ -955,10 +955,10 @@ TriaObjectAccessor<celldim, dim>::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<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;
 };
@@ -998,7 +998,7 @@ inline
 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;
 };
@@ -1010,7 +1010,7 @@ template <int dim>
 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
@@ -1049,7 +1049,7 @@ template <int dim>
 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
@@ -1092,8 +1092,7 @@ CellAccessor<dim>::neighbor (const unsigned int i) const {
 
 #ifdef DEBUG
   if (q.state() != past_the_end)
-    Assert (q->used(),
-           typename TriaSubstructAccessor<dim>::ExcUnusedCellAsNeighbor());
+    Assert (q->used(), ExcUnusedCellAsNeighbor());
 #endif
   return q;
 };
@@ -1108,8 +1107,7 @@ CellAccessor<dim>::child (const unsigned int i) const {
 
 #ifdef DEBUG
   if (q.state() != past_the_end)
-    Assert (q->used(),
-           typename TriaSubstructAccessor<dim>::ExcUnusedCellAsChild());
+    Assert (q->used(), ExcUnusedCellAsChild());
 #endif
   return q;
 };
index 9b180dd2dd751ef36df4181b3025bcc3240003bd..301e7093b46fd23431b4ca451d433e664c76f3f3 100644 (file)
@@ -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 <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)
     {
@@ -1602,7 +1601,7 @@ void CellAccessor<dim>::set_neighbor (const unsigned int i,
 
 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));
   

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.