]> https://gitweb.dealii.org/ - dealii.git/commitdiff
more improvements on iterator definition classes
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 5 May 2006 16:44:56 +0000 (16:44 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 5 May 2006 16:44:56 +0000 (16:44 +0000)
git-svn-id: https://svn.dealii.org/trunk@13069 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
deal.II/deal.II/include/grid/tria.h
deal.II/deal.II/include/grid/tria_iterator_selector.h

index 1fa25a86855029ecbf08a18ef9f33782d874c4b0..8034d0171f4f0b7916ed23b9aee69dc9d81ed4d5 100644 (file)
@@ -104,7 +104,7 @@ namespace internal
 template <int dim>
 class DoFHandler  :  public Subscriptor
 {
-    typedef DoFIterators<DoFHandler<dim> > IteratorSelector;
+    typedef internal::DoFIterators<DoFHandler<dim> > IteratorSelector;
   public:
     typedef typename IteratorSelector::raw_line_iterator    raw_line_iterator;
     typedef typename IteratorSelector::line_iterator        line_iterator;
index 959349044ac8b63fc37b274d9d3a3940d5c40505..2d6e47b96411897cff208684da562347c0fda74f 100644 (file)
@@ -1,4 +1,4 @@
-//----------------------------  dof_iterator_selector.h  ---------------------------
+//----------------------------------------------------------------------
 //    $Id$
 //    Version: $Name$
 //
@@ -9,7 +9,7 @@
 //    to the file deal.II/doc/license.html for the  text  and
 //    further information on this license.
 //
-//----------------------------  dof_iterator_selector.h  ---------------------------
+//----------------------------------------------------------------------
 #ifndef __deal2__dof_iterators_h
 #define __deal2__dof_iterators_h
 
@@ -32,6 +32,8 @@ template <int dim> class Triangulation;
 template <int dim> class DoFHandler;
 
 
+namespace internal
+{
 /**
  * A pseudo class defining the iterator types used by DoFHandler and
  * hp::DoFHandler.  The typedefs in this class are synonymous with
@@ -52,45 +54,45 @@ template <int dim> class DoFHandler;
  * @ingroup Accessors
  * @author W. Bangerth, G. Kanschat,  O. Kayser-Herold, 1998, 2003, 2006
  */
-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;
+  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;
-};
+                                      /// 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;
+  };
 
 
 
@@ -104,31 +106,31 @@ struct DoFIterators
  *
  * @author Wolfgang Bangerth, Oliver Kayser-Herold, 1998, 2003
  */
-template <template <int> class DH>
-struct DoFIterators<DH<1> >
-{
-    typedef DH<1> DoFHandler_type;
+  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 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_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 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 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;
-};
+      typedef void * raw_face_iterator;
+      typedef void * face_iterator;
+      typedef void * active_face_iterator;
+  };
 
 
 
@@ -142,31 +144,31 @@ struct DoFIterators<DH<1> >
  *
  * @author Wolfgang Bangerth, Oliver Kayser-Herold, 1998, 2003
  */
-template <template <int> class DH>
-struct DoFIterators<DH<2> >
-{
-    typedef DH<2> DoFHandler_type;
+  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,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 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 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_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;    
-};
+      typedef raw_line_iterator    raw_face_iterator;
+      typedef line_iterator        face_iterator;
+      typedef active_line_iterator active_face_iterator;    
+  };
 
 
 
@@ -205,5 +207,6 @@ struct DoFIterators<DH<2> >
       typedef quad_iterator        face_iterator;
       typedef active_quad_iterator active_face_iterator;    
   };
+}
 
 #endif // __deal2__dof_iterator_selector_h
index c7abecea45d9fbf432fe709443b02e6a04819d5b..128d80cb268e8417185a7f33f7492c323e456ae8 100644 (file)
@@ -60,7 +60,7 @@ namespace hp
   class DoFHandler : public Subscriptor,
                      protected Triangulation<dim>::RefinementListener
   {
-      typedef DoFIterators<DoFHandler<dim> > IteratorSelector;
+      typedef internal::DoFIterators<DoFHandler<dim> > IteratorSelector;
     public:
       typedef typename IteratorSelector::raw_line_iterator raw_line_iterator;
       typedef typename IteratorSelector::line_iterator line_iterator;
index 594f47cc75790b05f9ab068ecc236df561c25947..e66568a6d7f1646bd95bacb94d019caa925a2062 100644 (file)
@@ -375,7 +375,7 @@ namespace internal
  *  
  *  The Triangulation class provides iterator which enable looping over all
  *  lines, cells, etc without knowing the exact representation used to
- *  describe them. Their names are typedefs imported from the IteratorSelector
+ *  describe them. Their names are typedefs imported from the Iterators
  *  class (thus making them local types to this class) and are as follows:
  *
  *  <ul>
@@ -1177,7 +1177,7 @@ class Triangulation : public Subscriptor
                                      * the definition of the iterator
                                      * classes simpler.
                                      */
-    typedef internal::TriaIteratorSelector<dim> IteratorSelector;
+    typedef internal::TriaIterators<dim> IteratorSelector;
                      
   public:
     
index ec3f54c95a32a53e7ae7f578518b24b4fd353e64..b1e2593263a0bdf00ddc470a753fd5508d9cd0cd 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2003, 2004, 2005 by the deal.II authors
+//    Copyright (C) 2003, 2004, 2005, 2006 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -30,16 +30,52 @@ namespace internal
 {
 
 /**
- *  This class implements some types which differ between the
- *  dimensions.  Declare it to have a template parameter, but do not
- *  actually declare anything concrete apart from the other classes
- *  which are explicitly instantiated ones with the same name.
+ * Definition of the iterator types of the Triangulation.
  *
- * @author Wolfgang Bangerth, 1998
+ * @note The actual definitions used are defined in specializations of
+ * this class. The template is just here for documentation and shows a
+ * generic case, while it is clear that for instance #quad_iterator is
+ * of no use in one dimension.
+ *
+ * @author Wolfgang Bangerth, Guido Kanschat, 1998, 2006
  */
   template <int dim>
-  struct TriaIteratorSelector
+  struct TriaIterators
   {
+                                      /// Iterate on raw lines
+      typedef TriaRawIterator<dim,TriaObjectAccessor<1, dim> > raw_line_iterator;
+                                      /// Iterate on raw lines
+      typedef TriaIterator<dim,TriaObjectAccessor<1, dim> > line_iterator;
+                                      /// Iterate on raw lines
+      typedef TriaActiveIterator<dim,TriaObjectAccessor<1, dim> > active_line_iterator;
+    
+                                      /// Iterate on raw quadrilaterals
+      typedef TriaRawIterator<dim,TriaObjectAccessor<2, dim> > raw_quad_iterator;
+                                      /// Iterate on quadrilaterals
+      typedef TriaIterator<dim,TriaObjectAccessor<2, dim> > quad_iterator;
+                                      /// Iterate on active quadrilaterals
+      typedef TriaActiveIterator<dim,TriaObjectAccessor<2, dim> > active_quad_iterator;
+
+                                      /// Iterate on raw hexahedra
+      typedef TriaRawIterator<dim,TriaObjectAccessor<3, dim> > raw_hex_iterator;
+                                      /// Iterate on hexahedra
+      typedef TriaIterator<dim,TriaObjectAccessor<3, dim> > hex_iterator;
+                                      /// Iterate on active hexahedra
+      typedef TriaActiveIterator<dim,TriaObjectAccessor<3, dim> > active_hex_iterator;
+
+                                      /// Iterate on raw cells
+      typedef TriaRawIterator<dim,CellAccessor<dim> > raw_cell_iterator;
+                                      /// Iterate on cells
+      typedef TriaIterator<dim,CellAccessor<dim> > cell_iterator;
+                                      /// Iterate on active cells
+      typedef TriaActiveIterator<dim,CellAccessor<dim> > active_cell_iterator;
+
+                                      /// Iterate on raw faces
+      typedef TriaRawIterator<dim,TriaObjectAccessor<dim-1, dim> > raw_face_iterator;
+                                      /// Iterate on faces
+      typedef TriaIterator<dim,TriaObjectAccessor<dim-1, dim> > face_iterator;
+                                      /// Iterate on active faces
+      typedef TriaActiveIterator<dim,TriaObjectAccessor<dim-1, dim> > active_face_iterator;
   };
 
 
@@ -73,7 +109,7 @@ namespace internal
  * @author Wolfgang Bangerth, 1998
  */
   template <>
-  struct TriaIteratorSelector<1>
+  struct TriaIterators<1>
   {
       typedef TriaRawIterator<1,CellAccessor<1> >    raw_line_iterator;
       typedef TriaIterator<1,CellAccessor<1> >       line_iterator;
@@ -133,7 +169,7 @@ namespace internal
  * @author Wolfgang Bangerth, 1998
  */
   template <>
-  struct TriaIteratorSelector<2>
+  struct TriaIterators<2>
   {
       typedef TriaRawIterator<2,TriaObjectAccessor<1, 2> >    raw_line_iterator;
       typedef TriaIterator<2,TriaObjectAccessor<1, 2> >       line_iterator;
@@ -163,7 +199,7 @@ namespace internal
  *  These are the declararions for the 3D case only.
  *
  *  For the declarations of the data types, more or less the same holds
- *  as for lower dimensions (see <tt>TriaIteratorSelector<[12]></tt>). The
+ *  as for lower dimensions (see <tt>TriaIterators<[12]></tt>). The
  *  dimension specific data types are here, since we are in three dimensions:
  *  @verbatim
  *    typedef raw_hex_iterator    raw_cell_iterator;
@@ -178,7 +214,7 @@ namespace internal
  * @author Wolfgang Bangerth, 1998
  */
   template <>
-  struct TriaIteratorSelector<3>
+  struct TriaIterators<3>
   {
       typedef TriaRawIterator<3,TriaObjectAccessor<1, 3> >    raw_line_iterator;
       typedef TriaIterator<3,TriaObjectAccessor<1, 3> >       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.