]> https://gitweb.dealii.org/ - dealii.git/commitdiff
make iterator definitions more visible and document the template
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 5 May 2006 07:37:55 +0000 (07:37 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 5 May 2006 07:37:55 +0000 (07:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@13054 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_handler.h
deal.II/deal.II/include/dofs/dof_iterator_selector.h
deal.II/deal.II/include/dofs/hp_dof_handler.h

index 2d66793722c7ee80f6d212292218c0a77b825023..1fa25a86855029ecbf08a18ef9f33782d874c4b0 100644 (file)
@@ -104,7 +104,7 @@ namespace internal
 template <int dim>
 class DoFHandler  :  public Subscriptor
 {
-    typedef internal::DoFIteratorSelector<DoFHandler<dim> > IteratorSelector;
+    typedef DoFIterators<DoFHandler<dim> > IteratorSelector;
   public:
     typedef typename IteratorSelector::raw_line_iterator    raw_line_iterator;
     typedef typename IteratorSelector::line_iterator        line_iterator;
index 7e02a538313c19460152de242e5a07d16ff10c41..959349044ac8b63fc37b274d9d3a3940d5c40505 100644 (file)
 //    further information on this license.
 //
 //----------------------------  dof_iterator_selector.h  ---------------------------
-#ifndef __deal2__dof_iterator_selector_h
-#define __deal2__dof_iterator_selector_h
+#ifndef __deal2__dof_iterators_h
+#define __deal2__dof_iterators_h
+
+//TODO: Rename this file to dof_iterators.h
+//TODO: Can we avoid the specializations?
+
+// To consider for the second TODO:
+//  1. Define accessors for unreasonable dimensions
+//  2. Can cell_iterator and quad_iterator in 2D be different (or hex
+//     in 3D)?
 
 template <int structdim, class DH> class DoFAccessor;
 template <class DH> class DoFCellAccessor;
@@ -24,22 +32,65 @@ template <int dim> class Triangulation;
 template <int dim> class DoFHandler;
 
 
-namespace internal 
-{
 /**
- * Define some types which differ between the dimensions. This class
- * is analogous to the TriaDimensionInfo class hierarchy.
- * 
- * @ref DoFIteratorSelector<1>
- * @ref DoFIteratorSelector<2>
- * @ref DoFIteratorSelector<3>
+ * A pseudo class defining the iterator types used by DoFHandler and
+ * hp::DoFHandler.  The typedefs in this class are synonymous with
+ * those in the handler classes, such that this class can be used in
+ * order to avoid including the complete header files of the handler.
+ *
+ * The class template is not used, but only its specializations with
+ * respect to the dimension. These differ from the template in two
+ * points: first, the iterator to objects of the same dimension as the
+ * handler is aliased to the #cell_iterator. Second, #face_iterator is
+ * aliased to objects of codimension one.
  *
- * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003
+ *
+ * @warning This raw iterators are not normally used in application
+ * programs.
+ *
+ * @ingroup dofs
+ * @ingroup Accessors
+ * @author W. Bangerth, G. Kanschat,  O. Kayser-Herold, 1998, 2003, 2006
  */
-  template <class DH>
-  struct DoFIteratorSelector
-  {
-  };
+template <class DH>
+struct DoFIterators
+{
+                                    /// The dof handler class.
+    typedef DH DoFHandler_type;
+                                    /// The topological dimension of the dof handler.
+    static const unsigned int dim = DH::dimension;
+    
+                                    /// Iterator for raw lines.
+    typedef TriaRawIterator<dim, DoFObjectAccessor<1, DH> > raw_line_iterator;
+                                    /// Iterator for usual lines.
+    typedef TriaIterator<dim, DoFObjectAccessor<1, DH> > line_iterator;
+                                    /// Iterator for active lines.
+    typedef TriaActiveIterator<dim, DoFObjectAccessor<1, DH> > active_line_iterator;
+                                    /// Iterator for raw quadrilaterals
+    typedef TriaRawIterator<dim, DoFObjectAccessor<2, DH> > raw_quad_iterator;
+                                    /// Iterator for quadrilaterals
+    typedef TriaIterator<dim ,DoFObjectAccessor<2, DH> > quad_iterator;
+                                    /// Iterator for active quadrilaterals
+    typedef TriaActiveIterator<dim ,DoFObjectAccessor<2, DH> > active_quad_iterator;
+                                    /// Iterator for raw hexahedra
+    typedef TriaRawIterator<dim ,DoFObjectAccessor<3, DH> > raw_hex_iterator;
+                                    /// Iterator for hexahedra
+    typedef TriaIterator<dim ,DoFObjectAccessor<3, DH> > hex_iterator;
+                                    /// Iterator for active hexahedra
+    typedef TriaActiveIterator<dim ,DoFObjectAccessor<3, DH> > active_hex_iterator;
+                                    /// Iterator for raw cells
+    typedef TriaRawIterator<dim, DoFCellAccessor<DH> > raw_cell_iterator;
+                                    /// Iterator for cells
+    typedef TriaIterator<dim, DoFCellAccessor<DH> > cell_iterator;
+                                    /// Iterator for active cells
+    typedef TriaActiveIterator<dim, DoFCellAccessor<DH> > active_cell_iterator;
+                                    /// Iterator for raw faces
+    typedef TriaRawIterator<dim ,DoFObjectAccessor<dim-1, DH> > raw_face_iterator;
+                                    /// Iterator for faces
+    typedef TriaIterator<dim ,DoFObjectAccessor<dim-1, DH> > face_iterator;
+                                    /// Iterator for active faces
+    typedef TriaActiveIterator<dim ,DoFObjectAccessor<dim-1, DH> > active_face_iterator;
+};
 
 
 
@@ -51,34 +102,34 @@ namespace internal
  * little more complicated since the @p DoFAccessor classes want a
  * template template argument.
  *
- * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003
+ * @author Wolfgang Bangerth, Oliver Kayser-Herold, 1998, 2003
  */
-  template <template <int> class DH>
-  struct DoFIteratorSelector<DH<1> >
-  {
-      typedef DH<1> DoFHandler_type;
-      
-      typedef TriaRawIterator<1,DoFCellAccessor<DoFHandler_type> >    raw_line_iterator;
-      typedef TriaIterator<1,DoFCellAccessor<DoFHandler_type> >       line_iterator;
-      typedef TriaActiveIterator<1,DoFCellAccessor<DoFHandler_type> > active_line_iterator;
-      
-      typedef void * raw_quad_iterator;
-      typedef void * quad_iterator;
-      typedef void * active_quad_iterator;
-      
-      typedef void * raw_hex_iterator;
-      typedef void * hex_iterator;
-      typedef void * active_hex_iterator;
-      
-      typedef raw_line_iterator    raw_cell_iterator;
-      typedef line_iterator        cell_iterator;
-      typedef active_line_iterator active_cell_iterator;
-      
-      typedef void * raw_face_iterator;
-      typedef void * face_iterator;
-      typedef void * active_face_iterator;
-  };
-  
+template <template <int> class DH>
+struct DoFIterators<DH<1> >
+{
+    typedef DH<1> DoFHandler_type;
+    
+    typedef TriaRawIterator<1,DoFCellAccessor<DoFHandler_type> >    raw_line_iterator;
+    typedef TriaIterator<1,DoFCellAccessor<DoFHandler_type> >       line_iterator;
+    typedef TriaActiveIterator<1,DoFCellAccessor<DoFHandler_type> > active_line_iterator;
+    
+    typedef void * raw_quad_iterator;
+    typedef void * quad_iterator;
+    typedef void * active_quad_iterator;
+    
+    typedef void * raw_hex_iterator;
+    typedef void * hex_iterator;
+    typedef void * active_hex_iterator;
+    
+    typedef raw_line_iterator    raw_cell_iterator;
+    typedef line_iterator        cell_iterator;
+    typedef active_line_iterator active_cell_iterator;
+    
+    typedef void * raw_face_iterator;
+    typedef void * face_iterator;
+    typedef void * active_face_iterator;
+};
+
 
 
 /**
@@ -89,33 +140,33 @@ namespace internal
  * little more complicated since the @p DoFAccessor classes want a
  * template template argument.
  *
- * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003
+ * @author Wolfgang Bangerth, Oliver Kayser-Herold, 1998, 2003
  */
-  template <template <int> class DH>
-  struct DoFIteratorSelector<DH<2> >
-  {
-      typedef DH<2> DoFHandler_type;
-      
-      typedef TriaRawIterator<2,DoFObjectAccessor<1, DoFHandler_type> >    raw_line_iterator;
-      typedef TriaIterator<2,DoFObjectAccessor<1, DoFHandler_type> >       line_iterator;
-      typedef TriaActiveIterator<2,DoFObjectAccessor<1, DoFHandler_type> > active_line_iterator;
-      
-      typedef TriaRawIterator<2,DoFCellAccessor<DoFHandler_type> >         raw_quad_iterator;
-      typedef TriaIterator<2,DoFCellAccessor<DoFHandler_type> >            quad_iterator;
-      typedef TriaActiveIterator<2,DoFCellAccessor<DoFHandler_type> >      active_quad_iterator;
-      
-      typedef void * raw_hex_iterator;
-      typedef void * hex_iterator;
-      typedef void * active_hex_iterator;
-      
-      typedef raw_quad_iterator    raw_cell_iterator;
-      typedef quad_iterator        cell_iterator;
-      typedef active_quad_iterator active_cell_iterator;
-      
-      typedef raw_line_iterator    raw_face_iterator;
-      typedef line_iterator        face_iterator;
-      typedef active_line_iterator active_face_iterator;    
-  };
+template <template <int> class DH>
+struct DoFIterators<DH<2> >
+{
+    typedef DH<2> DoFHandler_type;
+    
+    typedef TriaRawIterator<2,DoFObjectAccessor<1, DoFHandler_type> >    raw_line_iterator;
+    typedef TriaIterator<2,DoFObjectAccessor<1, DoFHandler_type> >       line_iterator;
+    typedef TriaActiveIterator<2,DoFObjectAccessor<1, DoFHandler_type> > active_line_iterator;
+    
+    typedef TriaRawIterator<2,DoFCellAccessor<DoFHandler_type> >         raw_quad_iterator;
+    typedef TriaIterator<2,DoFCellAccessor<DoFHandler_type> >            quad_iterator;
+    typedef TriaActiveIterator<2,DoFCellAccessor<DoFHandler_type> >      active_quad_iterator;
+    
+    typedef void * raw_hex_iterator;
+    typedef void * hex_iterator;
+    typedef void * active_hex_iterator;
+    
+    typedef raw_quad_iterator    raw_cell_iterator;
+    typedef quad_iterator        cell_iterator;
+    typedef active_quad_iterator active_cell_iterator;
+    
+    typedef raw_line_iterator    raw_face_iterator;
+    typedef line_iterator        face_iterator;
+    typedef active_line_iterator active_face_iterator;    
+};
 
 
 
@@ -127,10 +178,10 @@ namespace internal
  * little more complicated since the @p DoFAccessor classes want a
  * template template argument.
  *
- * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003
+ * @author Wolfgang Bangerth, Oliver Kayser-Herold, 1998, 2003
  */
   template <template <int> class DH>
-  struct DoFIteratorSelector<DH<3> >
+  struct DoFIterators<DH<3> >
   {
       typedef DH<3> DoFHandler_type;
       
@@ -154,6 +205,5 @@ namespace internal
       typedef quad_iterator        face_iterator;
       typedef active_quad_iterator active_face_iterator;    
   };
-}
 
 #endif // __deal2__dof_iterator_selector_h
index 52996f93e75184ea3978e69cab0e00681ee42558..c7abecea45d9fbf432fe709443b02e6a04819d5b 100644 (file)
@@ -60,7 +60,7 @@ namespace hp
   class DoFHandler : public Subscriptor,
                      protected Triangulation<dim>::RefinementListener
   {
-      typedef internal::DoFIteratorSelector<DoFHandler<dim> > IteratorSelector;
+      typedef DoFIterators<DoFHandler<dim> > IteratorSelector;
     public:
       typedef typename IteratorSelector::raw_line_iterator raw_line_iterator;
       typedef typename IteratorSelector::line_iterator line_iterator;

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.