]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Merged the hp_branch to mainline.
authoroliver <oliver@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 20 Dec 2005 00:17:42 +0000 (00:17 +0000)
committeroliver <oliver@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 20 Dec 2005 00:17:42 +0000 (00:17 +0000)
git-svn-id: https://svn.dealii.org/trunk@11887 0785d39b-7218-0410-832d-ea1e28bc413d

49 files changed:
deal.II/deal.II/include/dofs/dof_accessor.h
deal.II/deal.II/include/dofs/dof_accessor.templates.h
deal.II/deal.II/include/dofs/dof_handler.h
deal.II/deal.II/include/dofs/dof_iterator_selector.h [new file with mode: 0644]
deal.II/deal.II/include/dofs/dof_renumbering.h
deal.II/deal.II/include/dofs/dof_tools.h
deal.II/deal.II/include/dofs/hp_dof_handler.h [new file with mode: 0644]
deal.II/deal.II/include/dofs/hp_dof_levels.h [new file with mode: 0644]
deal.II/deal.II/include/fe/fe_collection.h [new file with mode: 0644]
deal.II/deal.II/include/fe/fe_tools.h
deal.II/deal.II/include/fe/fe_values.h
deal.II/deal.II/include/fe/hp_fe_values.h [new file with mode: 0644]
deal.II/deal.II/include/fe/mapping_collection.h [new file with mode: 0644]
deal.II/deal.II/include/fe/q_collection.h [new file with mode: 0644]
deal.II/deal.II/include/fe/select_fe_values.h [new file with mode: 0644]
deal.II/deal.II/include/multigrid/mg_dof_accessor.h
deal.II/deal.II/include/multigrid/mg_dof_handler.h
deal.II/deal.II/include/multigrid/mg_transfer.templates.h
deal.II/deal.II/include/numerics/data_out.h
deal.II/deal.II/include/numerics/data_out_faces.h
deal.II/deal.II/include/numerics/data_out_rotation.h
deal.II/deal.II/include/numerics/data_out_stack.h
deal.II/deal.II/include/numerics/derivative_approximation.h
deal.II/deal.II/include/numerics/vectors.h
deal.II/deal.II/include/numerics/vectors.templates.h
deal.II/deal.II/source/dofs/dof_accessor.cc
deal.II/deal.II/source/dofs/dof_handler.cc
deal.II/deal.II/source/dofs/dof_levels.cc
deal.II/deal.II/source/dofs/dof_renumbering.cc
deal.II/deal.II/source/dofs/dof_tools.cc
deal.II/deal.II/source/dofs/hp_dof_accessor.cc [new file with mode: 0644]
deal.II/deal.II/source/dofs/hp_dof_handler.cc [new file with mode: 0644]
deal.II/deal.II/source/dofs/hp_dof_levels.cc [new file with mode: 0644]
deal.II/deal.II/source/fe/fe_collection.cc [new file with mode: 0644]
deal.II/deal.II/source/fe/fe_tools.cc
deal.II/deal.II/source/fe/fe_values.cc
deal.II/deal.II/source/fe/hp_fe_values.cc [new file with mode: 0644]
deal.II/deal.II/source/fe/mapping_collection.cc [new file with mode: 0644]
deal.II/deal.II/source/fe/q_collection.cc [new file with mode: 0644]
deal.II/deal.II/source/multigrid/mg_dof_accessor.cc
deal.II/deal.II/source/multigrid/mg_dof_handler.cc
deal.II/deal.II/source/multigrid/mg_transfer_block.cc
deal.II/deal.II/source/numerics/data_out.cc
deal.II/deal.II/source/numerics/data_out_faces.cc
deal.II/deal.II/source/numerics/data_out_rotation.cc
deal.II/deal.II/source/numerics/data_out_stack.cc
deal.II/deal.II/source/numerics/derivative_approximation.cc
deal.II/deal.II/source/numerics/matrices.cc
deal.II/deal.II/source/numerics/vectors.cc

index 3f486b48d133d23bf0131859d2ad4da527d77b7f..374ecda3997d58edc1c731d46510f196a7ee81bb 100644 (file)
@@ -23,13 +23,14 @@ template <typename number> class SparseMatrix;
 template <typename number> class Vector;
 
 template <int dim> class DoFHandler;
+template <int dim> class hpDoFHandler;
 template <int dim> class FiniteElement;
 
-template <int celldim, int dim> class DoFObjectAccessor;
-template <int dim>              class DoFObjectAccessor<0, dim>;
-template <int dim>              class DoFObjectAccessor<1, dim>;
-template <int dim>              class DoFObjectAccessor<2, dim>;
-template <int dim>              class DoFObjectAccessor<3, dim>;
+template <int celldim, int dim, template <int> class DH> class DoFObjectAccessor;
+template <int dim, template <int> class DH>              class DoFObjectAccessor<0, dim, DH>;
+template <int dim, template <int> class DH>              class DoFObjectAccessor<1, dim, DH>;
+template <int dim, template <int> class DH>              class DoFObjectAccessor<2, dim, DH>;
+template <int dim, template <int> class DH>              class DoFObjectAccessor<3, dim, DH>;
 
 template <int dim, typename Accessor> class TriaRawIterator;
 
@@ -67,7 +68,7 @@ template <int dim, typename Accessor> class TriaRawIterator;
  * @ingroup Accessors 
  * @author Wolfgang Bangerth, 1998
  */
-template <int dim>
+template <int dim, template <int> class DH>
 class DoFAccessor
 {
   public:
@@ -86,35 +87,27 @@ class DoFAccessor
                                      * non-const, even if they preserve
                                      * constness.
                                      */
-    DoFAccessor (const DoFHandler<dim> *dof_handler);
+    DoFAccessor (const DH<dim> *dof_handler);
 
                                     /**
                                      * Reset the DoF handler pointer.
                                      */
-    void set_dof_handler (DoFHandler<dim> *dh);
+    void set_dof_handler (DH<dim> *dh);
 
                                     /**
                                      * Return a handle on the
                                      * DoFHandler object which we
                                      * are using.
                                      */
-    const DoFHandler<dim> &
+    const DH<dim> &
     get_dof_handler () const;
 
-                                     /**
-                                      * Return the finite element that
-                                      * is used on the cell pointed to
-                                      * by this iterator.
-                                      */
-    const FiniteElement<dim> &
-    get_fe () const;
-    
                                     /**
                                      * Copy operator.
                                      */
-    DoFAccessor<dim> &
-    operator = (const DoFAccessor<dim> &da);
-    
+    DoFAccessor<dim, DH> &
+    operator = (const DoFAccessor<dim, DH> &da);
+
                                     /**
                                      * Exception for child classes
                                      *
@@ -170,7 +163,7 @@ class DoFAccessor
                                      * Store the address of the DoFHandler object
                                      * to be accessed.
                                      */
-    DoFHandler<dim> *dof_handler;
+    DH<dim> *dof_handler;  
 };
 
 
@@ -275,22 +268,23 @@ class DoFObjectAccessor_Inheritance<dim,dim>
  * @ingroup dofs 
  * @ingroup Accessors 
  */
-template<int celldim, int dim>
-class DoFObjectAccessor : public DoFAccessor<dim>,
+template<int celldim, int dim, template <int> class DH>
+class DoFObjectAccessor : public DoFAccessor<dim, DH>,
                          public TriaObjectAccessor<celldim,dim>
 {
   public:
                                     /**
                                      * Data type  passed by the iterator class.
                                      */
-    typedef DoFHandler<dim> AccessorData;
+    typedef DH<dim> AccessorData;
 
                                     /**
                                      * Declare base class as a local typedef
                                      * for simpler access.
                                      */
     typedef TriaObjectAccessor<celldim,dim> BaseClass;
-    
+
+
                                     /**
                                      * Default constructor. Unused, thus
                                      * not implemented.
@@ -414,19 +408,47 @@ class DoFObjectAccessor : public DoFAccessor<dim>,
     template <class OutputVector, typename number>
     void set_dof_values (const Vector<number> &local_values,
                         OutputVector         &values) const;
+                         
+
+                                     /**
+                                      * Return the finite element that
+                                      * is used on the cell pointed to
+                                      * by this iterator. For non-hp
+                                      * DoF handlers, this is of
+                                      * course always the same
+                                      * element, independent of the
+                                      * cell we are presently on, but
+                                      * for hp DoF handlers, this may
+                                      * change from cell to cell.
+                                      */
+    const FiniteElement<dim> &
+    get_fe () const;
+    
+                                     /**
+                                     *  Returns the index inside the FECollection
+                                     *  of the FiniteElement used for this cell.
+                                     */
+    unsigned int active_fe_index () const;
+
+                                     /**
+                                     *  Sets the index of the FiniteElement used for
+                                     *  this cell.
+                                     */
+    void set_active_fe_index (const unsigned int i);
+
 
                                     /**
                                      *  Pointer to the <i>i</i>th line
                                      *  bounding this Object.
                                      */
-    TriaIterator<dim,DoFObjectAccessor<1, dim> >
+    TriaIterator<dim,DoFObjectAccessor<1, dim, DH> >
     line (const unsigned int i) const;
 
                                     /**
                                      *  Pointer to the <i>i</i>th quad
                                      *  bounding this Object.
                                      */
-    TriaIterator<dim,DoFObjectAccessor<2, dim> >
+    TriaIterator<dim,DoFObjectAccessor<2, dim, DH> >
     quad (const unsigned int i) const;
     
                                     /**
@@ -436,7 +458,7 @@ class DoFObjectAccessor : public DoFAccessor<dim>,
                                      * class returns a hex accessor without
                                      * access to the DoF data.
                                      */
-    TriaIterator<dim,DoFObjectAccessor<celldim, dim> > child (const unsigned int) const;
+    TriaIterator<dim,DoFObjectAccessor<celldim, dim, DH> > child (const unsigned int) const;
 
                                     /**
                                      * Distribute a local (cell
@@ -477,7 +499,7 @@ class DoFObjectAccessor : public DoFAccessor<dim>,
                                      * Implement the copy operator needed
                                      * for the iterator classes.
                                      */
-    void copy_from (const DoFObjectAccessor<celldim, dim> &a);
+    void copy_from (const DoFObjectAccessor<celldim, dim, DH> &a);
 
   protected:    
                                     /**
@@ -504,9 +526,9 @@ class DoFObjectAccessor : public DoFAccessor<dim>,
  * Closure class.
  * @ingroup dofs
  */
-template<int dim>
-class DoFObjectAccessor<0, dim> : public DoFAccessor<dim>,
-                                 public DoFObjectAccessor_Inheritance<0,dim>::BaseClass
+template<int dim, template <int> class DH>
+class DoFObjectAccessor<0, dim, DH> : public DoFAccessor<dim, DH>,
+                                     public DoFObjectAccessor_Inheritance<0,dim>::BaseClass
 {
   public:
     typedef void AccessorData;
@@ -555,9 +577,9 @@ class DoFObjectAccessor<0, dim> : public DoFAccessor<dim>,
  * @ingroup dofs
  * @author Wolfgang Bangerth, 1998
  */
-template <int dim>
-class DoFObjectAccessor<1, dim> :  public DoFAccessor<dim>,
-                                  public DoFObjectAccessor_Inheritance<1,dim>::BaseClass
+template <int dim, template <int> class DH>
+class DoFObjectAccessor<1, dim, DH> :  public DoFAccessor<dim, DH>,
+                                      public DoFObjectAccessor_Inheritance<1,dim>::BaseClass
 {
   public:
                                     /**
@@ -565,7 +587,7 @@ class DoFObjectAccessor<1, dim> :  public DoFAccessor<dim>,
                                      * class expects to get passed from the
                                      * iterator classes.
                                      */
-    typedef DoFHandler<dim> AccessorData;
+    typedef DH<dim> AccessorData;
 
                                     /**
                                      * Declare base class as a local typedef
@@ -693,6 +715,33 @@ class DoFObjectAccessor<1, dim> :  public DoFAccessor<dim>,
     void set_dof_values (const Vector<number> &local_values,
                         OutputVector         &values) const;
 
+
+                                     /**
+                                      * Return the finite element that
+                                      * is used on the cell pointed to
+                                      * by this iterator. For non-hp
+                                      * DoF handlers, this is of
+                                      * course always the same
+                                      * element, independent of the
+                                      * cell we are presently on, but
+                                      * for hp DoF handlers, this may
+                                      * change from cell to cell.
+                                      */
+    const FiniteElement<dim> &
+    get_fe () const;
+    
+                                     /**
+                                     *  Returns the index inside the FECollection
+                                     *  of the FiniteElement used for this cell.
+                                     */
+    unsigned int active_fe_index () const;
+
+                                     /**
+                                     *  Sets the index of the FiniteElement used for
+                                     *  this cell.
+                                     */
+    void set_active_fe_index (const unsigned int i);
+
                                     /**
                                      * Return the @p ith child as a DoF line
                                      * iterator. This function is needed since
@@ -700,7 +749,7 @@ class DoFObjectAccessor<1, dim> :  public DoFAccessor<dim>,
                                      * class returns a line accessor without
                                      * access to the DoF data.
                                      */
-    TriaIterator<dim,DoFObjectAccessor<1,dim> > child (const unsigned int) const;
+    TriaIterator<dim,DoFObjectAccessor<1,dim,DH> > child (const unsigned int) const;
 
                                     /**
                                      * Distribute a local (cell based) vector
@@ -739,18 +788,18 @@ class DoFObjectAccessor<1, dim> :  public DoFAccessor<dim>,
                                      * Implement the copy operator needed
                                      * for the iterator classes.
                                      */
-    void copy_from (const DoFObjectAccessor<1,dim> &a);
+    void copy_from (const DoFObjectAccessor<1,dim,DH> &a);
 
   protected:    
                                     /**
                                      *  Compare for equality.            
                                      */
-    bool operator == (const DoFObjectAccessor<1,dim> &) const;
+    bool operator == (const DoFObjectAccessor<1,dim,DH> &) const;
        
                                     /**
                                      * Compare for inequality.
                                      */
-    bool operator != (const DoFObjectAccessor<1,dim> &) const;
+    bool operator != (const DoFObjectAccessor<1,dim,DH> &) const;
 
 
                                      /**
@@ -767,9 +816,9 @@ class DoFObjectAccessor<1, dim> :  public DoFAccessor<dim>,
  *
  * @ingroup dofs
  */
-template <int dim>
-class DoFObjectAccessor<2, dim> :  public DoFAccessor<dim>,
-                                  public DoFObjectAccessor_Inheritance<2,dim>::BaseClass
+template <int dim, template <int> class DH>
+class DoFObjectAccessor<2, dim, DH> :  public DoFAccessor<dim, DH>,
+                                      public DoFObjectAccessor_Inheritance<2,dim>::BaseClass
 {
   public:
                                     /**
@@ -777,7 +826,7 @@ class DoFObjectAccessor<2, dim> :  public DoFAccessor<dim>,
                                      * class expects to get passed from the
                                      * iterator classes.
                                      */
-    typedef DoFHandler<dim> AccessorData;
+    typedef DH<dim> AccessorData;
 
                                     /**
                                      * Declare base class as a local typedef
@@ -906,11 +955,38 @@ class DoFObjectAccessor<2, dim> :  public DoFAccessor<dim>,
     void set_dof_values (const Vector<number> &local_values,
                         OutputVector         &values) const;
 
+
+                                     /**
+                                      * Return the finite element that
+                                      * is used on the cell pointed to
+                                      * by this iterator. For non-hp
+                                      * DoF handlers, this is of
+                                      * course always the same
+                                      * element, independent of the
+                                      * cell we are presently on, but
+                                      * for hp DoF handlers, this may
+                                      * change from cell to cell.
+                                      */
+    const FiniteElement<dim> &
+    get_fe () const;
+    
+                                     /**
+                                     *  Returns the index inside the FECollection
+                                     *  of the FiniteElement used for this cell.
+                                     */
+    unsigned int active_fe_index () const;
+
+                                     /**
+                                     *  Sets the index of the FiniteElement used for
+                                     *  this cell.
+                                     */
+    void set_active_fe_index (const unsigned int i);
+
                                     /**
                                      *  Return a pointer to the @p ith line
                                      *  bounding this @p Quad.
                                      */
-    TriaIterator<dim,DoFObjectAccessor<1, dim> >
+    TriaIterator<dim,DoFObjectAccessor<1, dim, DH> >
     line (const unsigned int i) const;
     
                                     /**
@@ -920,7 +996,7 @@ class DoFObjectAccessor<2, dim> :  public DoFAccessor<dim>,
                                      * class returns a quad accessor without
                                      * access to the DoF data.
                                      */
-    TriaIterator<dim,DoFObjectAccessor<2, dim> >
+    TriaIterator<dim,DoFObjectAccessor<2, dim, DH> >
     child (const unsigned int) const;
 
                                     /**
@@ -960,18 +1036,18 @@ class DoFObjectAccessor<2, dim> :  public DoFAccessor<dim>,
                                      * Implement the copy operator needed
                                      * for the iterator classes.
                                      */
-    void copy_from (const DoFObjectAccessor<2, dim> &a);
+    void copy_from (const DoFObjectAccessor<2, dim, DH> &a);
 
   protected:    
                                     /**
                                      *  Compare for equality.            
                                      */
-    bool operator == (const DoFObjectAccessor<2,dim> &) const;
+    bool operator == (const DoFObjectAccessor<2,dim,DH> &) const;
        
                                     /**
                                      * Compare for inequality.
                                      */
-    bool operator != (const DoFObjectAccessor<2,dim> &) const;
+    bool operator != (const DoFObjectAccessor<2,dim,DH> &) const;
 
 
                                      /**
@@ -988,9 +1064,9 @@ class DoFObjectAccessor<2, dim> :  public DoFAccessor<dim>,
  *
  * @ingroup dofs
  */
-template <int dim>
-class DoFObjectAccessor<3, dim> :  public DoFAccessor<dim>,
-                                  public DoFObjectAccessor_Inheritance<3,dim>::BaseClass
+template <int dim, template <int> class DH>
+class DoFObjectAccessor<3, dim, DH> :  public DoFAccessor<dim, DH>,
+                                      public DoFObjectAccessor_Inheritance<3,dim>::BaseClass
 {
   public:
                                     /**
@@ -998,7 +1074,7 @@ class DoFObjectAccessor<3, dim> :  public DoFAccessor<dim>,
                                      * class expects to get passed from the
                                      * iterator classes.
                                      */
-    typedef DoFHandler<dim> AccessorData;
+    typedef DH<dim> AccessorData;
 
                                     /**
                                      * Declare base class as a local typedef
@@ -1127,18 +1203,45 @@ class DoFObjectAccessor<3, dim> :  public DoFAccessor<dim>,
     void set_dof_values (const Vector<number> &local_values,
                         OutputVector         &values) const;
 
+
+                                     /**
+                                      * Return the finite element that
+                                      * is used on the cell pointed to
+                                      * by this iterator. For non-hp
+                                      * DoF handlers, this is of
+                                      * course always the same
+                                      * element, independent of the
+                                      * cell we are presently on, but
+                                      * for hp DoF handlers, this may
+                                      * change from cell to cell.
+                                      */
+    const FiniteElement<dim> &
+    get_fe () const;
+
+                                     /**
+                                     *  Returns the index inside the FECollection
+                                     *  of the FiniteElement used for this cell.
+                                     */
+    unsigned int active_fe_index () const;
+
+                                     /**
+                                     *  Sets the index of the FiniteElement used for
+                                     *  this cell.
+                                     */
+    void set_active_fe_index (const unsigned int i);
+
                                     /**
                                      *  Return a pointer to the @p ith line
                                      *  bounding this @p Hex.
                                      */
-    TriaIterator<dim,DoFObjectAccessor<1, dim> >
+    TriaIterator<dim,DoFObjectAccessor<1, dim, DH> >
     line (const unsigned int i) const;
 
                                     /**
                                      *  Return a pointer to the @p ith quad
                                      *  bounding this @p Hex.
                                      */
-    TriaIterator<dim,DoFObjectAccessor<2, dim> >
+    TriaIterator<dim,DoFObjectAccessor<2, dim, DH> >
     quad (const unsigned int i) const;
     
                                     /**
@@ -1148,7 +1251,7 @@ class DoFObjectAccessor<3, dim> :  public DoFAccessor<dim>,
                                      * class returns a hex accessor without
                                      * access to the DoF data.
                                      */
-    TriaIterator<dim,DoFObjectAccessor<3, dim> > child (const unsigned int) const;
+    TriaIterator<dim,DoFObjectAccessor<3, dim, DH> > child (const unsigned int) const;
 
                                     /**
                                      * Distribute a local (cell
@@ -1189,18 +1292,18 @@ class DoFObjectAccessor<3, dim> :  public DoFAccessor<dim>,
                                      * Implement the copy operator needed
                                      * for the iterator classes.
                                      */
-    void copy_from (const DoFObjectAccessor<3, dim> &a);
+    void copy_from (const DoFObjectAccessor<3, dim, DH> &a);
 
   protected:    
                                     /**
                                      *  Compare for equality.            
                                      */
-    bool operator == (const DoFObjectAccessor<3,dim> &) const;
+    bool operator == (const DoFObjectAccessor<3,dim,DH> &) const;
        
                                     /**
                                      * Compare for inequality.
                                      */
-    bool operator != (const DoFObjectAccessor<3,dim> &) const;
+    bool operator != (const DoFObjectAccessor<3,dim,DH> &) const;
 
 
                                      /**
@@ -1232,8 +1335,8 @@ class DoFObjectAccessor<3, dim> :  public DoFAccessor<dim>,
  * @ingroup dofs
  * @author Wolfgang Bangerth, 1998
  */
-template <int dim>
-class DoFCellAccessor :  public DoFObjectAccessor<dim, dim>
+template <int dim, template <int> class DH>
+class DoFCellAccessor :  public DoFObjectAccessor<dim, dim, DH>
 {
   public:
                                     /**
@@ -1242,7 +1345,7 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim>
                                      * get passed from the iterator
                                      * classes.
                                      */
-    typedef typename DoFObjectAccessor<dim, dim>::AccessorData AccessorData;
+    typedef typename DoFObjectAccessor<dim, dim, DH>::AccessorData AccessorData;
     
                                     /**
                                      * Constructor
@@ -1261,7 +1364,7 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim>
                                      * without access to the DoF
                                      * data.
                                      */
-    TriaIterator<dim,DoFCellAccessor<dim> >
+    TriaIterator<dim,DoFCellAccessor<dim, DH> >
     neighbor (const unsigned int) const;
 
                                     /**
@@ -1273,20 +1376,21 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim>
                                      * without access to the DoF
                                      * data.
                                      */
-    TriaIterator<dim,DoFCellAccessor<dim> >
+    TriaIterator<dim,DoFCellAccessor<dim, DH> >
     child (const unsigned int) const;
 
                                     /**
                                      * Return an iterator to the @p ith face
                                      * of this cell.
                                      *
-                                     * This function is not implemented in 1D,
-                                     * and maps to DoFObjectAccessor<2, dim>::line in 2D.
+                                     * This function is not implemented in
+                                     * 1D, and maps to DoFObjectAccessor<2,
+                                     * dim>::line in 2D.
                                      */
-    TriaIterator<dim, DoFObjectAccessor<dim-1, dim> >
+    TriaIterator<dim, DoFObjectAccessor<dim-1, dim, DH> >
     face (const unsigned int i) const;
 
-                                    /**
+                                     /**
                                      * Return the result of the
                                      * @p neighbor_child_on_subface
                                      * function of the base class,
@@ -1297,7 +1401,7 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim>
                                      * access to the triangulation
                                      * data).
                                      */
-    TriaIterator<dim,DoFCellAccessor<dim> >
+    TriaIterator<dim,DoFCellAccessor<dim,DH> >
     neighbor_child_on_subface (const unsigned int face_no,
                                const unsigned int subface_no) const;
 
@@ -1334,7 +1438,7 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim>
                                      * child alone, i.e.  it should
                                      * be possible to compute the
                                      * restriction by writing values
-                                     * obtained from each child
+                                     * obtained from each child
                                      * directly into the output
                                      * vector, without, for example,
                                      * computing an average over all
@@ -1463,9 +1567,72 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim>
 
 /* -------------- declaration of explicit specializations ------------- */
 
-template <> TriaIterator<1, DoFObjectAccessor<0,1> > DoFCellAccessor<1>::face (const unsigned int) const;
-template <> TriaIterator<2, DoFObjectAccessor<1,2> > DoFCellAccessor<2>::face (const unsigned int i) const;
-template <> TriaIterator<3, DoFObjectAccessor<2,3> > DoFCellAccessor<3>::face (const unsigned int i) const;
+template <>
+TriaIterator<1, DoFObjectAccessor<0,1, DoFHandler> >
+DoFCellAccessor<1, DoFHandler>::face (const unsigned int) const;
+template <>
+TriaIterator<2, DoFObjectAccessor<1,2, DoFHandler> >
+DoFCellAccessor<2, DoFHandler>::face (const unsigned int i) const;
+template <>
+TriaIterator<3, DoFObjectAccessor<2,3, DoFHandler> >
+DoFCellAccessor<3, DoFHandler>::face (const unsigned int i) const;
+
+template <>
+const FiniteElement<1> &
+DoFObjectAccessor<1,1,hpDoFHandler>::get_fe () const;
+template <>
+const FiniteElement<2> &
+DoFObjectAccessor<1,2,hpDoFHandler>::get_fe () const;
+template <>
+const FiniteElement<3> &
+DoFObjectAccessor<1,3,hpDoFHandler>::get_fe () const;
+template <>
+const FiniteElement<2> &
+DoFObjectAccessor<2,2,hpDoFHandler>::get_fe () const;
+template <>
+const FiniteElement<3> &
+DoFObjectAccessor<2,3,hpDoFHandler>::get_fe () const;
+template <>
+const FiniteElement<3> &
+DoFObjectAccessor<3,3,hpDoFHandler>::get_fe () const;
+
+template <>
+unsigned int
+DoFObjectAccessor<1,1,hpDoFHandler>::active_fe_index () const;
+template <>
+unsigned int
+DoFObjectAccessor<1,2,hpDoFHandler>::active_fe_index () const;
+template <>
+unsigned int
+DoFObjectAccessor<1,3,hpDoFHandler>::active_fe_index () const;
+template <>
+unsigned int
+DoFObjectAccessor<2,2,hpDoFHandler>::active_fe_index () const;
+template <>
+unsigned int
+DoFObjectAccessor<2,3,hpDoFHandler>::active_fe_index () const;
+template <>
+unsigned int
+DoFObjectAccessor<3,3,hpDoFHandler>::active_fe_index () const;
+
+template <>
+void
+DoFObjectAccessor<1,1,hpDoFHandler>::set_active_fe_index (const unsigned int i);
+template <>
+void
+DoFObjectAccessor<1,2,hpDoFHandler>::set_active_fe_index (const unsigned int i);
+template <>
+void
+DoFObjectAccessor<1,3,hpDoFHandler>::set_active_fe_index (const unsigned int i);
+template <>
+void
+DoFObjectAccessor<2,2,hpDoFHandler>::set_active_fe_index (const unsigned int i);
+template <>
+void
+DoFObjectAccessor<2,3,hpDoFHandler>::set_active_fe_index (const unsigned int i);
+template <>
+void
+DoFObjectAccessor<3,3,hpDoFHandler>::set_active_fe_index (const unsigned int i);
 
 
 // include more templates
index 982a7bcb255aaafbb01be3bc7c9c16bd8e0f4cbf..22e75dd93caf04f28292fad727903e6738279b98 100644 (file)
@@ -17,7 +17,9 @@
 #include <base/config.h>
 #include <dofs/dof_accessor.h>
 #include <dofs/dof_handler.h>
+#include <dofs/hp_dof_handler.h>
 #include <dofs/dof_levels.h>
+#include <dofs/hp_dof_levels.h>
 #include <grid/tria_iterator.h>
 #include <grid/tria_iterator.templates.h>
 
@@ -27,8 +29,8 @@
 /*------------------------- Functions: DoFAccessor ---------------------------*/
 
 
-template <int dim>
-DoFAccessor<dim>::DoFAccessor ()
+template <int dim, template <int> class DH>
+DoFAccessor<dim, DH>::DoFAccessor ()
                 :
                dof_handler(0)
 {
@@ -37,17 +39,17 @@ DoFAccessor<dim>::DoFAccessor ()
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-DoFAccessor<dim>::DoFAccessor (const DoFHandler<dim> *dof_handler) :
-               dof_handler(const_cast<DoFHandler<dim>*>(dof_handler))
+DoFAccessor<dim, DH>::DoFAccessor (const DH<dim> *dof_handler) :
+               dof_handler(const_cast<DH<dim>*>(dof_handler))
 {}
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 void
-DoFAccessor<dim>::set_dof_handler (DoFHandler<dim> *dh)
+DoFAccessor<dim, DH>::set_dof_handler (DH<dim> *dh)
 {
   Assert (dh != 0, ExcInvalidObject());
   dof_handler = dh;
@@ -55,30 +57,19 @@ DoFAccessor<dim>::set_dof_handler (DoFHandler<dim> *dh)
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-const DoFHandler<dim> &
-DoFAccessor<dim>::get_dof_handler () const
+const DH<dim> &
+DoFAccessor<dim, DH>::get_dof_handler () const
 {
-  return *dof_handler;
+  return *this->dof_handler;
 }
 
 
-
-template <int dim>
-inline
-const FiniteElement<dim> &
-DoFAccessor<dim>::get_fe () const
-{
-  return *dof_handler->selected_fe;
-}
-
-
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-DoFAccessor<dim> &
-DoFAccessor<dim>::operator = (const DoFAccessor<dim> &da)
+DoFAccessor<dim, DH> &
+DoFAccessor<dim, DH>::operator = (const DoFAccessor<dim, DH> &da)
 {
   this->set_dof_handler (da.dof_handler);
   return *this;
@@ -86,10 +77,10 @@ DoFAccessor<dim>::operator = (const DoFAccessor<dim> &da)
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 bool
-DoFAccessor<dim>::operator == (const DoFAccessor<dim> &a) const
+DoFAccessor<dim, DH>::operator == (const DoFAccessor<dim, DH> &a) const
 {
   Assert (dof_handler == a.dof_handler, ExcCantCompareIterators());
 
@@ -101,10 +92,10 @@ DoFAccessor<dim>::operator == (const DoFAccessor<dim> &a) const
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 bool
-DoFAccessor<dim>::operator != (const DoFAccessor<dim> &a) const
+DoFAccessor<dim, DH>::operator != (const DoFAccessor<dim, DH> &a) const
 {
   Assert (dof_handler == a.dof_handler, ExcCantCompareIterators());
 
@@ -123,16 +114,15 @@ DoFAccessor<dim>::operator != (const DoFAccessor<dim> &a) const
 /*------------------------- Functions: DoFObjectAccessor<1,dim> -----------------------*/
 
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-DoFObjectAccessor<1,dim>::
+DoFObjectAccessor<1,dim,DH>::
 DoFObjectAccessor (const Triangulation<dim> *tria,
                    const int                 level,
                    const int                 index,
                    const AccessorData       *local_data)
                 :
-                DoFAccessor<dim> (local_data),
+                DoFAccessor<dim,DH> (local_data),
                 DoFObjectAccessor_Inheritance<1,dim>::BaseClass (tria,
                                                                  level,
                                                                  index)
@@ -140,10 +130,10 @@ DoFObjectAccessor (const Triangulation<dim> *tria,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 unsigned int
-DoFObjectAccessor<1,dim>::dof_index (const unsigned int i) const
+DoFObjectAccessor<1,dim,DH>::dof_index (const unsigned int i) const
 {
                                   // since the exception classes are
                                   // from a template dependent base
@@ -154,7 +144,7 @@ DoFObjectAccessor<1,dim>::dof_index (const unsigned int i) const
                                   // non-template dependent name and
                                   // use that to specify the
                                   // qualified exception names
-  typedef DoFAccessor<dim> BaseClass;
+  typedef DoFAccessor<dim, DH> BaseClass;
   
   Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -168,12 +158,11 @@ DoFObjectAccessor<1,dim>::dof_index (const unsigned int i) const
 }
 
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 unsigned int
-DoFObjectAccessor<1,dim>::vertex_dof_index (const unsigned int vertex,
-                                           const unsigned int i) const
+DoFObjectAccessor<1,dim,DH>::vertex_dof_index (const unsigned int vertex,
+                                              const unsigned int i) const
 {
                                   // since the exception classes are
                                   // from a template dependent base
@@ -184,7 +173,7 @@ DoFObjectAccessor<1,dim>::vertex_dof_index (const unsigned int vertex,
                                   // non-template dependent name and
                                   // use that to specify the
                                   // qualified exception names
-  typedef DoFAccessor<dim> BaseClass;
+  typedef DoFAccessor<dim, DH> BaseClass;
   
   Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject());
   Assert (&this->get_fe() != 0, typename BaseClass::ExcInvalidObject());
@@ -199,11 +188,10 @@ DoFObjectAccessor<1,dim>::vertex_dof_index (const unsigned int vertex,
 }
 
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 void
-DoFObjectAccessor<1,dim>::get_dof_indices (std::vector<unsigned int> &dof_indices) const
+DoFObjectAccessor<1,dim,DH>::get_dof_indices (std::vector<unsigned int> &dof_indices) const
 {
                                   // since the exception classes are
                                   // from a template dependent base
@@ -214,12 +202,12 @@ DoFObjectAccessor<1,dim>::get_dof_indices (std::vector<unsigned int> &dof_indice
                                   // non-template dependent name and
                                   // use that to specify the
                                   // qualified exception names
-  typedef DoFAccessor<dim> BaseClass;
+  typedef DoFAccessor<dim, DH> BaseClass;
   
   Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject());
   Assert (&this->get_fe() != 0, typename BaseClass::ExcInvalidObject());
-  Assert (dof_indices.size() == (2*this->dof_handler->get_fe().dofs_per_vertex +
-                                this->dof_handler->get_fe().dofs_per_line),
+  Assert (dof_indices.size() == (2*this->get_fe().dofs_per_vertex +
+                                this->get_fe().dofs_per_line),
          typename BaseClass::ExcVectorDoesNotMatch());
 
                                   // this function really only makes
@@ -231,12 +219,12 @@ DoFObjectAccessor<1,dim>::get_dof_indices (std::vector<unsigned int> &dof_indice
                                   // not allocated for this
                                   // non-active thing
   Assert (!this->has_children() ||
-         (this->dof_handler->get_fe().dofs_per_cell ==
-          2*this->dof_handler->get_fe().dofs_per_vertex),
-         typename DoFAccessor<dim>::ExcNotActive());
+         (this->get_fe().dofs_per_cell ==
+          2*this->get_fe().dofs_per_vertex),
+         typename BaseClass::ExcNotActive());
   
-  const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = this->dof_handler->get_fe().dofs_per_line;
+  const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+                    dofs_per_line   = this->get_fe().dofs_per_line;
   std::vector<unsigned int>::iterator next = dof_indices.begin();
   for (unsigned int vertex=0; vertex<2; ++vertex)
     for (unsigned int d=0; d<dofs_per_vertex; ++d)
@@ -247,15 +235,15 @@ DoFObjectAccessor<1,dim>::get_dof_indices (std::vector<unsigned int> &dof_indice
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-TriaIterator<dim,DoFObjectAccessor<1,dim> >
-DoFObjectAccessor<1,dim>::child (const unsigned int i) const
+TriaIterator<dim,DoFObjectAccessor<1,dim,DH> >
+DoFObjectAccessor<1,dim,DH>::child (const unsigned int i) const
 {
-  TriaIterator<dim,DoFObjectAccessor<1,dim> > q (this->tria,
-                                                this->present_level+1,
-                                                this->child_index (i),
-                                                this->dof_handler);
+  TriaIterator<dim,DoFObjectAccessor<1,dim,DH> > q (this->tria,
+                                                   this->present_level+1,
+                                                   this->child_index (i),
+                                                   this->dof_handler);
   
 #ifdef DEBUG
   if (q.state() != IteratorState::past_the_end)
@@ -266,11 +254,39 @@ DoFObjectAccessor<1,dim>::child (const unsigned int i) const
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
+inline
+const FiniteElement<dim> &
+DoFObjectAccessor<1,dim,DH>::get_fe () const
+{
+  return *this->dof_handler->selected_fe;
+}
+
+
+template <int dim, template <int> class DH>
+inline
+unsigned int
+DoFObjectAccessor<1,dim,DH>::active_fe_index () const
+{
+    return 0;
+}
+
+
+template <int dim, template <int> class DH>
+inline
+void
+DoFObjectAccessor<1,dim,DH>::set_active_fe_index (const unsigned int i)
+{
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+  Assert (i == 0, typename BaseClass::ExcInvalidObject());
+}
+
+
+template <int dim, template <int> class DH>
 template <typename number, typename OutputVector>
 inline
 void
-DoFObjectAccessor<1, dim>::
+DoFObjectAccessor<1, dim, DH>::
 distribute_local_to_global (const Vector<number> &local_source,
                            OutputVector         &global_destination) const
 {
@@ -283,7 +299,7 @@ distribute_local_to_global (const Vector<number> &local_source,
                                   // non-template dependent name and
                                   // use that to specify the
                                   // qualified exception names
-  typedef DoFAccessor<dim> BaseClass;
+  typedef DoFAccessor<dim,DH> BaseClass;
   
   Assert (this->dof_handler != 0,
          typename BaseClass::ExcInvalidObject());
@@ -310,11 +326,11 @@ distribute_local_to_global (const Vector<number> &local_source,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <typename number, typename OutputMatrix>
 inline
 void
-DoFObjectAccessor<1, dim>::
+DoFObjectAccessor<1, dim, DH>::
 distribute_local_to_global (const FullMatrix<number> &local_source,
                            OutputMatrix             &global_destination) const
 {
@@ -327,7 +343,7 @@ distribute_local_to_global (const FullMatrix<number> &local_source,
                                   // non-template dependent name and
                                   // use that to specify the
                                   // qualified exception names
-  typedef DoFAccessor<dim> BaseClass;
+  typedef DoFAccessor<dim,DH> BaseClass;
   
   Assert (this->dof_handler != 0,
          typename BaseClass::ExcInvalidObject());
@@ -359,10 +375,10 @@ distribute_local_to_global (const FullMatrix<number> &local_source,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 void
-DoFObjectAccessor<1,dim>::copy_from (const DoFObjectAccessor<1,dim> &a)
+DoFObjectAccessor<1,dim,DH>::copy_from (const DoFObjectAccessor<1,dim,DH> &a)
 {
   BaseClass::copy_from (a);
   this->set_dof_handler (a.dof_handler);
@@ -370,39 +386,38 @@ DoFObjectAccessor<1,dim>::copy_from (const DoFObjectAccessor<1,dim> &a)
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 bool
-DoFObjectAccessor<1,dim>::operator == (const DoFObjectAccessor<1,dim> &a) const
+DoFObjectAccessor<1,dim,DH>::operator == (const DoFObjectAccessor<1,dim,DH> &a) const
 {
   return (TriaObjectAccessor<1,dim>::operator == (a)
           &&
-          DoFAccessor<dim>::operator == (a));
+          DoFAccessor<dim,DH>::operator == (a));
 }
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 bool
-DoFObjectAccessor<1,dim>::operator != (const DoFObjectAccessor<1,dim> &a) const
+DoFObjectAccessor<1,dim,DH>::operator != (const DoFObjectAccessor<1,dim,DH> &a) const
 {
   return (TriaObjectAccessor<1,dim>::operator != (a)
           ||
-          DoFAccessor<dim>::operator != (a));
+          DoFAccessor<dim,DH>::operator != (a));
 }
 
 
 /*------------------------- Functions: DoFObjectAccessor<2,dim> -----------------------*/
 
-template <int dim>
-inline
-DoFObjectAccessor<2,dim>::
+template <int dim, template <int> class DH>
+DoFObjectAccessor<2,dim,DH>::
 DoFObjectAccessor (const Triangulation<dim> *tria,
                    const int                 level,
                    const int                 index,
                    const AccessorData       *local_data)
                 :
-                DoFAccessor<dim> (local_data),
+                DoFAccessor<dim,DH> (local_data),
                 DoFObjectAccessor_Inheritance<2,dim>::BaseClass (tria,
                                                                  level,
                                                                  index)
@@ -410,16 +425,19 @@ DoFObjectAccessor (const Triangulation<dim> *tria,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-unsigned int DoFObjectAccessor<2,dim>::dof_index (const unsigned int i) const
+unsigned int
+DoFObjectAccessor<2,dim,DH>::dof_index (const unsigned int i) const
 {
+  typedef DoFAccessor<dim,DH> BaseClass;
+  
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
                                   // and enough room was reserved
   Assert (&this->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (i<this->get_fe().dofs_per_quad,
          ExcIndexRange (i, 0, this->get_fe().dofs_per_quad));
 
@@ -428,16 +446,18 @@ unsigned int DoFObjectAccessor<2,dim>::dof_index (const unsigned int i) const
 }
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 unsigned int
-DoFObjectAccessor<2,dim>::vertex_dof_index (const unsigned int vertex,
-                                           const unsigned int i) const
+DoFObjectAccessor<2,dim,DH>::vertex_dof_index (const unsigned int vertex,
+                                              const unsigned int i) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (vertex<4, ExcIndexRange (i,0,4));
   Assert (i<this->get_fe().dofs_per_vertex,
          ExcIndexRange (i, 0, this->get_fe().dofs_per_vertex));
@@ -450,19 +470,21 @@ DoFObjectAccessor<2,dim>::vertex_dof_index (const unsigned int vertex,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 void
-DoFObjectAccessor<2,dim>::get_dof_indices (std::vector<unsigned int> &dof_indices) const
+DoFObjectAccessor<2,dim,DH>::get_dof_indices (std::vector<unsigned int> &dof_indices) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
-  Assert (dof_indices.size() == (4*this->dof_handler->get_fe().dofs_per_vertex +
-                                4*this->dof_handler->get_fe().dofs_per_line +
-                                this->dof_handler->get_fe().dofs_per_quad),
-         typename DoFAccessor<dim>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcInvalidObject());
+  Assert (dof_indices.size() == (4*this->get_fe().dofs_per_vertex +
+                                4*this->get_fe().dofs_per_line +
+                                this->get_fe().dofs_per_quad),
+         typename BaseClass::ExcVectorDoesNotMatch());
 
                                   // this function really only makes
                                   // sense on non-active objects if
@@ -473,14 +495,14 @@ DoFObjectAccessor<2,dim>::get_dof_indices (std::vector<unsigned int> &dof_indice
                                   // not allocated for this
                                   // non-active thing
   Assert (!this->has_children() ||
-         (this->dof_handler->get_fe().dofs_per_cell ==
-          4*this->dof_handler->get_fe().dofs_per_vertex),
-         typename DoFAccessor<dim>::ExcNotActive());
+         (this->get_fe().dofs_per_cell ==
+          4*this->get_fe().dofs_per_vertex),
+         typename BaseClass::ExcNotActive());
   
   
-  const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = this->dof_handler->get_fe().dofs_per_line,
-                    dofs_per_quad   = this->dof_handler->get_fe().dofs_per_quad;
+  const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+                    dofs_per_line   = this->get_fe().dofs_per_line,
+                    dofs_per_quad   = this->get_fe().dofs_per_quad;
   std::vector<unsigned int>::iterator next = dof_indices.begin();
   for (unsigned int vertex=0; vertex<4; ++vertex)
     for (unsigned int d=0; d<dofs_per_vertex; ++d)
@@ -493,15 +515,14 @@ DoFObjectAccessor<2,dim>::get_dof_indices (std::vector<unsigned int> &dof_indice
 }
 
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-TriaIterator<dim,DoFObjectAccessor<1,dim> >
-DoFObjectAccessor<2,dim>::line (const unsigned int i) const
+TriaIterator<dim,DoFObjectAccessor<1,dim,DH> >
+DoFObjectAccessor<2,dim,DH>::line (const unsigned int i) const
 {
   Assert (i<4, ExcIndexRange (i, 0, 4));
 
-  return TriaIterator<dim,DoFObjectAccessor<1,dim> >
+  return TriaIterator<dim,DoFObjectAccessor<1,dim,DH> >
     (
       this->tria,
       this->present_level,
@@ -511,13 +532,12 @@ DoFObjectAccessor<2,dim>::line (const unsigned int i) const
 }
 
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-TriaIterator<dim,DoFObjectAccessor<2,dim> >
-DoFObjectAccessor<2,dim>::child (const unsigned int i) const
+TriaIterator<dim,DoFObjectAccessor<2,dim,DH> >
+DoFObjectAccessor<2,dim,DH>::child (const unsigned int i) const
 {
-  TriaIterator<dim,DoFObjectAccessor<2,dim> > q (this->tria,
+  TriaIterator<dim,DoFObjectAccessor<2,dim,DH> > q (this->tria,
                                                 this->present_level+1,
                                                 this->child_index (i),
                                                 this->dof_handler);
@@ -530,12 +550,40 @@ DoFObjectAccessor<2,dim>::child (const unsigned int i) const
 }
 
 
+template <int dim, template <int> class DH>
+inline
+const FiniteElement<dim> &
+DoFObjectAccessor<2,dim,DH>::get_fe () const
+{
+  return *this->dof_handler->selected_fe;
+}
+
+
+template <int dim, template <int> class DH>
+inline
+unsigned int
+DoFObjectAccessor<2,dim,DH>::active_fe_index () const
+{
+    return 0;
+}
+
+
+template <int dim, template <int> class DH>
+inline
+void
+DoFObjectAccessor<2,dim,DH>::set_active_fe_index (const unsigned int i)
+{
+  typedef DoFAccessor<dim, DH> BaseClass;
+  Assert (i == 0, typename BaseClass::ExcInvalidObject());
+}
+
+
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <typename number, typename OutputVector>
 inline
 void
-DoFObjectAccessor<2, dim>::
+DoFObjectAccessor<2, dim, DH>::
 distribute_local_to_global (const Vector<number> &local_source,
                            OutputVector         &global_destination) const
 {
@@ -548,7 +596,7 @@ distribute_local_to_global (const Vector<number> &local_source,
                                   // non-template dependent name and
                                   // use that to specify the
                                   // qualified exception names
-  typedef DoFAccessor<dim> BaseClass;
+  typedef DoFAccessor<dim,DH> BaseClass;
   
   Assert (this->dof_handler != 0,
          typename BaseClass::ExcInvalidObject());
@@ -576,11 +624,11 @@ distribute_local_to_global (const Vector<number> &local_source,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <typename number, typename OutputMatrix>
 inline
 void
-DoFObjectAccessor<2, dim>::
+DoFObjectAccessor<2, dim, DH>::
 distribute_local_to_global (const FullMatrix<number> &local_source,
                            OutputMatrix             &global_destination) const
 {
@@ -593,7 +641,7 @@ distribute_local_to_global (const FullMatrix<number> &local_source,
                                   // non-template dependent name and
                                   // use that to specify the
                                   // qualified exception names
-  typedef DoFAccessor<dim> BaseClass;
+  typedef DoFAccessor<dim,DH> BaseClass;
   
   Assert (this->dof_handler != 0,
          typename BaseClass::ExcInvalidObject());
@@ -626,10 +674,10 @@ distribute_local_to_global (const FullMatrix<number> &local_source,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 void
-DoFObjectAccessor<2,dim>::copy_from (const DoFObjectAccessor<2,dim> &a)
+DoFObjectAccessor<2,dim,DH>::copy_from (const DoFObjectAccessor<2,dim,DH> &a)
 {
   BaseClass::copy_from (a);
   this->set_dof_handler (a.dof_handler);
@@ -637,41 +685,40 @@ DoFObjectAccessor<2,dim>::copy_from (const DoFObjectAccessor<2,dim> &a)
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 bool
-DoFObjectAccessor<2,dim>::operator == (const DoFObjectAccessor<2,dim> &a) const
+DoFObjectAccessor<2,dim,DH>::operator == (const DoFObjectAccessor<2,dim,DH> &a) const
 {
   return (TriaObjectAccessor<2,dim>::operator == (a)
           &&
-          DoFAccessor<dim>::operator == (a));
+          DoFAccessor<dim,DH>::operator == (a));
 }
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 bool
-DoFObjectAccessor<2,dim>::operator != (const DoFObjectAccessor<2,dim> &a) const
+DoFObjectAccessor<2,dim,DH>::operator != (const DoFObjectAccessor<2,dim,DH> &a) const
 {
   return (TriaObjectAccessor<2,dim>::operator != (a)
           ||
-          DoFAccessor<dim>::operator != (a));
+          DoFAccessor<dim,DH>::operator != (a));
 }
 
 
 
 /*------------------------- Functions: DoFObjectAccessor<3,dim> -----------------------*/
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-DoFObjectAccessor<3,dim>::
+DoFObjectAccessor<3,dim,DH>::
 DoFObjectAccessor (const Triangulation<dim> *tria,
                    const int                 level,
                    const int                 index,
                    const AccessorData       *local_data)
                 :
-                DoFAccessor<dim> (local_data),
+                DoFAccessor<dim,DH> (local_data),
                 DoFObjectAccessor_Inheritance<3,dim>::BaseClass (tria,
                                                                  level,
                                                                  index)
@@ -679,17 +726,19 @@ DoFObjectAccessor (const Triangulation<dim> *tria,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 unsigned int
-DoFObjectAccessor<3,dim>::dof_index (const unsigned int i) const
+DoFObjectAccessor<3,dim,DH>::dof_index (const unsigned int i) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
                                   // and enough room was reserved
   Assert (&this->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (i<this->get_fe().dofs_per_hex,
          ExcIndexRange (i, 0, this->get_fe().dofs_per_hex));
 
@@ -698,17 +747,18 @@ DoFObjectAccessor<3,dim>::dof_index (const unsigned int i) const
 }
 
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 unsigned int
-DoFObjectAccessor<3,dim>::vertex_dof_index (const unsigned int vertex,
-                                           const unsigned int i) const
+DoFObjectAccessor<3,dim,DH>::vertex_dof_index (const unsigned int vertex,
+                                              const unsigned int i) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (vertex<8, ExcIndexRange (i,0,8));
   Assert (i<this->get_fe().dofs_per_vertex,
          ExcIndexRange (i, 0, this->get_fe().dofs_per_vertex));
@@ -720,21 +770,22 @@ DoFObjectAccessor<3,dim>::vertex_dof_index (const unsigned int vertex,
 }
 
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 void
-DoFObjectAccessor<3,dim>::get_dof_indices (std::vector<unsigned int> &dof_indices) const
+DoFObjectAccessor<3,dim,DH>::get_dof_indices (std::vector<unsigned int> &dof_indices) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
-  Assert (dof_indices.size() == (8*this->dof_handler->get_fe().dofs_per_vertex +
-                                12*this->dof_handler->get_fe().dofs_per_line +
-                                6*this->dof_handler->get_fe().dofs_per_quad +
-                                this->dof_handler->get_fe().dofs_per_hex),
-         typename DoFAccessor<dim>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcInvalidObject());
+  Assert (dof_indices.size() == (8*this->get_fe().dofs_per_vertex +
+                                12*this->get_fe().dofs_per_line +
+                                6*this->get_fe().dofs_per_quad +
+                                this->get_fe().dofs_per_hex),
+         typename BaseClass::ExcVectorDoesNotMatch());
 
                                   // this function really only makes
                                   // sense on non-active objects if
@@ -745,14 +796,14 @@ DoFObjectAccessor<3,dim>::get_dof_indices (std::vector<unsigned int> &dof_indice
                                   // not allocated for this
                                   // non-active thing
   Assert (!this->has_children() ||
-         (this->dof_handler->get_fe().dofs_per_cell ==
-          8*this->dof_handler->get_fe().dofs_per_vertex),
-         typename DoFAccessor<dim>::ExcNotActive());
+         (this->get_fe().dofs_per_cell ==
+          8*this->get_fe().dofs_per_vertex),
+         typename BaseClass::ExcNotActive());
   
-  const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = this->dof_handler->get_fe().dofs_per_line,
-                    dofs_per_quad   = this->dof_handler->get_fe().dofs_per_quad,
-                    dofs_per_hex    = this->dof_handler->get_fe().dofs_per_hex;
+  const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+                    dofs_per_line   = this->get_fe().dofs_per_line,
+                    dofs_per_quad   = this->get_fe().dofs_per_quad,
+                    dofs_per_hex    = this->get_fe().dofs_per_hex;
   std::vector<unsigned int>::iterator next = dof_indices.begin();
   for (unsigned int vertex=0; vertex<8; ++vertex)
     for (unsigned int d=0; d<dofs_per_vertex; ++d)
@@ -769,13 +820,13 @@ DoFObjectAccessor<3,dim>::get_dof_indices (std::vector<unsigned int> &dof_indice
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-TriaIterator<dim,DoFObjectAccessor<1,dim> >
-DoFObjectAccessor<3,dim>::line (const unsigned int i) const
+TriaIterator<dim,DoFObjectAccessor<1,dim,DH> >
+DoFObjectAccessor<3,dim,DH>::line (const unsigned int i) const
 {
   TriaIterator<dim,TriaObjectAccessor<1,dim> > l = BaseClass::line(i);
-  return TriaIterator<dim,DoFObjectAccessor<1,dim> >
+  return TriaIterator<dim,DoFObjectAccessor<1,dim,DH> >
     (
       this->tria,
       this->present_level,
@@ -785,15 +836,14 @@ DoFObjectAccessor<3,dim>::line (const unsigned int i) const
 }
 
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-TriaIterator<dim,DoFObjectAccessor<2,dim> >
-DoFObjectAccessor<3,dim>::quad (const unsigned int i) const
+TriaIterator<dim,DoFObjectAccessor<2,dim,DH> >
+DoFObjectAccessor<3,dim,DH>::quad (const unsigned int i) const
 {
   Assert (i<6, ExcIndexRange (i, 0, 6));
 
-  return TriaIterator<dim,DoFObjectAccessor<2,dim> >
+  return TriaIterator<dim,DoFObjectAccessor<2,dim,DH> >
     (
       this->tria,
       this->present_level,
@@ -803,16 +853,15 @@ DoFObjectAccessor<3,dim>::quad (const unsigned int i) const
 }
 
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-TriaIterator<dim,DoFObjectAccessor<3,dim> >
-DoFObjectAccessor<3,dim>::child (const unsigned int i) const
+TriaIterator<dim,DoFObjectAccessor<3,dim,DH> >
+DoFObjectAccessor<3,dim,DH>::child (const unsigned int i) const
 {
-  TriaIterator<dim,DoFObjectAccessor<3,dim> > q (this->tria,
-                                                this->present_level+1,
-                                                this->child_index (i),
-                                                this->dof_handler);
+  TriaIterator<dim,DoFObjectAccessor<3,dim,DH> > q (this->tria,
+                                                   this->present_level+1,
+                                                   this->child_index (i),
+                                                   this->dof_handler);
   
 #ifdef DEBUG
   if (q.state() != IteratorState::past_the_end)
@@ -822,12 +871,39 @@ DoFObjectAccessor<3,dim>::child (const unsigned int i) const
 }
 
 
+template <int dim, template <int> class DH>
+inline
+const FiniteElement<dim> &
+DoFObjectAccessor<3,dim,DH>::get_fe () const
+{
+  return *this->dof_handler->selected_fe;
+}
+
+
+template <int dim, template <int> class DH>
+inline
+unsigned int
+DoFObjectAccessor<3,dim,DH>::active_fe_index () const
+{
+    return 0;
+}
+
+
+template <int dim, template <int> class DH>
+inline
+void
+DoFObjectAccessor<3,dim,DH>::set_active_fe_index (const unsigned int i)
+{
+  typedef DoFAccessor<dim, DH> BaseClass;
+  Assert (i == 0, typename BaseClass::ExcInvalidObject());
+}
+
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <typename number, typename OutputVector>
 inline
 void
-DoFObjectAccessor<3, dim>::
+DoFObjectAccessor<3, dim, DH>::
 distribute_local_to_global (const Vector<number> &local_source,
                            OutputVector         &global_destination) const
 {
@@ -840,7 +916,7 @@ distribute_local_to_global (const Vector<number> &local_source,
                                   // non-template dependent name and
                                   // use that to specify the
                                   // qualified exception names
-  typedef DoFAccessor<dim> BaseClass;
+  typedef DoFAccessor<dim,DH> BaseClass;
   
   Assert (this->dof_handler != 0,
          typename BaseClass::ExcInvalidObject());
@@ -869,11 +945,11 @@ distribute_local_to_global (const Vector<number> &local_source,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <typename number, typename OutputMatrix>
 inline
 void
-DoFObjectAccessor<3, dim>::
+DoFObjectAccessor<3, dim, DH>::
 distribute_local_to_global (const FullMatrix<number> &local_source,
                            OutputMatrix             &global_destination) const
 {
@@ -886,7 +962,7 @@ distribute_local_to_global (const FullMatrix<number> &local_source,
                                   // non-template dependent name and
                                   // use that to specify the
                                   // qualified exception names
-  typedef DoFAccessor<dim> BaseClass;
+  typedef DoFAccessor<dim,DH> BaseClass;
   
   Assert (this->dof_handler != 0,
          typename BaseClass::ExcInvalidObject());
@@ -920,8 +996,8 @@ distribute_local_to_global (const FullMatrix<number> &local_source,
 
 
 
-template <int dim>
-void DoFObjectAccessor<3,dim>::copy_from (const DoFObjectAccessor<3,dim> &a)
+template <int dim, template <int> class DH>
+void DoFObjectAccessor<3,dim,DH>::copy_from (const DoFObjectAccessor<3,dim,DH> &a)
 {
   BaseClass::copy_from (a);
   this->set_dof_handler (a.dof_handler);
@@ -929,52 +1005,51 @@ void DoFObjectAccessor<3,dim>::copy_from (const DoFObjectAccessor<3,dim> &a)
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 bool
-DoFObjectAccessor<3,dim>::operator == (const DoFObjectAccessor<3,dim> &a) const
+DoFObjectAccessor<3,dim,DH>::operator == (const DoFObjectAccessor<3,dim,DH> &a) const
 {
   return (TriaObjectAccessor<3,dim>::operator == (a)
           &&
-          DoFAccessor<dim>::operator == (a));
+          DoFAccessor<dim,DH>::operator == (a));
 }
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
 bool
-DoFObjectAccessor<3,dim>::operator != (const DoFObjectAccessor<3,dim> &a) const
+DoFObjectAccessor<3,dim,DH>::operator != (const DoFObjectAccessor<3,dim,DH> &a) const
 {
   return (TriaObjectAccessor<3,dim>::operator != (a)
           ||
-          DoFAccessor<dim>::operator != (a));
+          DoFAccessor<dim,DH>::operator != (a));
 }
 
 
 /*------------------------- Functions: DoFCellAccessor -----------------------*/
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-DoFCellAccessor<dim>::
+DoFCellAccessor<dim,DH>::
 DoFCellAccessor (const Triangulation<dim> *tria,
                  const int                 level,
                  const int                 index,
                  const AccessorData       *local_data)
                 :
-                DoFObjectAccessor<dim, dim> (tria,level,index,local_data)
+                DoFObjectAccessor<dim, dim, DH> (tria,level,index,local_data)
 {}
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-TriaIterator<dim,DoFCellAccessor<dim> >
-DoFCellAccessor<dim>::neighbor (const unsigned int i) const
+TriaIterator<dim,DoFCellAccessor<dim,DH> >
+DoFCellAccessor<dim,DH>::neighbor (const unsigned int i) const
 {
-  TriaIterator<dim,DoFCellAccessor<dim> > q (this->tria,
-                                            this->neighbor_level (i),
-                                            this->neighbor_index (i),
-                                            this->dof_handler);
+  TriaIterator<dim,DoFCellAccessor<dim,DH> > q (this->tria,
+                                               this->neighbor_level (i),
+                                               this->neighbor_index (i),
+                                               this->dof_handler);
   
 #ifdef DEBUG
   if (q.state() != IteratorState::past_the_end)
@@ -984,15 +1059,15 @@ DoFCellAccessor<dim>::neighbor (const unsigned int i) const
 }
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 inline
-TriaIterator<dim,DoFCellAccessor<dim> >
-DoFCellAccessor<dim>::child (const unsigned int i) const
+TriaIterator<dim,DoFCellAccessor<dim,DH> >
+DoFCellAccessor<dim,DH>::child (const unsigned int i) const
 {
-  TriaIterator<dim,DoFCellAccessor<dim> > q (this->tria,
-                                            this->present_level+1,
-                                            this->child_index (i),
-                                            this->dof_handler);
+  TriaIterator<dim,DoFCellAccessor<dim,DH> > q (this->tria,
+                                               this->present_level+1,
+                                               this->child_index (i),
+                                               this->dof_handler);
   
 #ifdef DEBUG
   if (q.state() != IteratorState::past_the_end)
@@ -1002,4 +1077,394 @@ DoFCellAccessor<dim>::child (const unsigned int i) const
 }
 
 
+/*--------------- Functions: DoFObjectAccessor<1,dim,hpDoFHandler> -----------*/
+
+template <>
+inline
+unsigned int
+DoFObjectAccessor<1,1,hpDoFHandler>::dof_index (const unsigned int i) const
+{
+                                  // since the exception classes are
+                                  // from a template dependent base
+                                  // class, we have to fully qualify
+                                  // them. to work around more
+                                  // trouble, typedef the template
+                                  // dependent base class to a
+                                  // non-template dependent name and
+                                  // use that to specify the
+                                  // qualified exception names
+  typedef DoFAccessor<1, hpDoFHandler> BaseClass;
+  
+  Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0, BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_line,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_line));
+
+  const unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_line_index_offset[this->present_index];
+  return this->dof_handler->levels[this->present_level]
+    ->line_dofs[offset+i];
+}
+
+
+template <>
+inline
+unsigned int
+DoFObjectAccessor<1,2,hpDoFHandler>::dof_index (const unsigned int i) const
+{
+                                  // since the exception classes are
+                                  // from a template dependent base
+                                  // class, we have to fully qualify
+                                  // them. to work around more
+                                  // trouble, typedef the template
+                                  // dependent base class to a
+                                  // non-template dependent name and
+                                  // use that to specify the
+                                  // qualified exception names
+  typedef DoFAccessor<2, hpDoFHandler> BaseClass;
+  
+  Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0, BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_line,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_line));
+
+  const unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_line_index_offset[this->present_index];
+  return this->dof_handler->levels[this->present_level]
+    ->line_dofs[offset+i];
+}
+
+
+template <>
+inline
+unsigned int
+DoFObjectAccessor<1,3,hpDoFHandler>::dof_index (const unsigned int i) const
+{
+                                  // since the exception classes are
+                                  // from a template dependent base
+                                  // class, we have to fully qualify
+                                  // them. to work around more
+                                  // trouble, typedef the template
+                                  // dependent base class to a
+                                  // non-template dependent name and
+                                  // use that to specify the
+                                  // qualified exception names
+  typedef DoFAccessor<3, hpDoFHandler> BaseClass;
+  
+  Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0, BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_line,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_line));
+
+  const unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_line_index_offset[this->present_index];
+  return this->dof_handler->levels[this->present_level]
+    ->line_dofs[offset+i];
+}
+
+
+template <>
+inline
+const FiniteElement<1> &
+DoFObjectAccessor<1,1,hpDoFHandler>::get_fe () const
+{
+  return dof_handler->finite_elements->get_fe(active_fe_index ());
+}
+template <>
+inline
+const FiniteElement<2> &
+DoFObjectAccessor<1,2,hpDoFHandler>::get_fe () const
+{
+  return dof_handler->finite_elements->get_fe(active_fe_index ());
+}
+template <>
+inline
+const FiniteElement<3> &
+DoFObjectAccessor<1,3,hpDoFHandler>::get_fe () const
+{
+  return dof_handler->finite_elements->get_fe(active_fe_index ());
+}
+
+
+template <>
+inline
+unsigned int
+DoFObjectAccessor<1,1,hpDoFHandler>::active_fe_index () const
+{
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+  return dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index];
+}
+template <>
+inline
+unsigned int
+DoFObjectAccessor<1,2,hpDoFHandler>::active_fe_index () const
+{
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+  return dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index];
+}
+template <>
+inline
+unsigned int
+DoFObjectAccessor<1,3,hpDoFHandler>::active_fe_index () const
+{
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+  return dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index];
+}
+
+
+template <>
+inline
+void
+DoFObjectAccessor<1,1,hpDoFHandler>::set_active_fe_index (const unsigned int i)
+{
+  Assert (dof_handler != 0, ExcInvalidObject());
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+//TODO: dof_handler->finite_elements not always defined, when this method is called
+//  Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject());
+  dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index] = i;
+}
+template <>
+inline
+void
+DoFObjectAccessor<1,2,hpDoFHandler>::set_active_fe_index (const unsigned int i)
+{
+  Assert (dof_handler != 0, ExcInvalidObject());
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+//TODO: dof_handler->finite_elements not always defined, when this method is called
+//  Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject());
+  dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index] = i;
+}
+template <>
+inline
+void
+DoFObjectAccessor<1,3,hpDoFHandler>::set_active_fe_index (const unsigned int i)
+{
+  Assert (dof_handler != 0, ExcInvalidObject());
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+//TODO: dof_handler->finite_elements not always defined, when this method is called
+//  Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject());
+  dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index] = i;
+}
+
+
+/*------------- Functions: DoFObjectAccessor<2,dim,hpDoFHandler> -------------*/
+
+template <>
+inline
+unsigned int DoFObjectAccessor<2,2,hpDoFHandler>::dof_index (const unsigned int i) const
+{
+  typedef DoFAccessor<2, hpDoFHandler> BaseClass;
+
+  Assert (this->dof_handler != 0,
+         BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0,
+         BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_quad,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_quad));
+
+  const unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_quad_index_offset[this->present_index];
+  return this->dof_handler->levels[this->present_level]
+    ->quad_dofs[offset+i];
+}
+
+template <>
+inline
+unsigned int DoFObjectAccessor<2,3,hpDoFHandler>::dof_index (const unsigned int i) const
+{
+  typedef DoFAccessor<3, hpDoFHandler> BaseClass;
+
+  Assert (this->dof_handler != 0,
+         BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0,
+         BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_quad,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_quad));
+
+  const unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_quad_index_offset[this->present_index];
+  return this->dof_handler->levels[this->present_level]
+    ->quad_dofs[offset+i];
+}
+
+
+template <>
+inline
+const FiniteElement<2> &
+DoFObjectAccessor<2,2,hpDoFHandler>::get_fe () const
+{
+  return dof_handler->finite_elements->get_fe(active_fe_index ());
+}
+template <>
+inline
+const FiniteElement<3> &
+DoFObjectAccessor<2,3,hpDoFHandler>::get_fe () const
+{
+  return dof_handler->finite_elements->get_fe(active_fe_index ());
+}
+
+
+template <>
+inline
+unsigned int
+DoFObjectAccessor<2,2,hpDoFHandler>::active_fe_index () const
+{
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+  return dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index];
+}
+
+
+
+template <>
+inline
+unsigned int
+DoFObjectAccessor<2,3,hpDoFHandler>::active_fe_index () const
+{
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+  return dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index];
+}
+
+
+template <>
+inline
+void
+DoFObjectAccessor<2,2,hpDoFHandler>::set_active_fe_index (const unsigned int i)
+{
+  Assert (dof_handler != 0, ExcInvalidObject());
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+//TODO: dof_handler->finite_elements not always defined, when this method is called
+//  Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject());
+  dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index] = i;
+}
+
+
+
+template <>
+inline
+void
+DoFObjectAccessor<2,3,hpDoFHandler>::set_active_fe_index (const unsigned int i)
+{
+  Assert (dof_handler != 0, ExcInvalidObject());
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+//TODO: dof_handler->finite_elements not always defined, when this method is called
+//  Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject());
+  dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index] = i;
+}
+
+
+/*------------- Functions: DoFObjectAccessor<3,dim,hpDoFHandler> -------------*/
+
+template <>
+inline
+unsigned int
+DoFObjectAccessor<3,3,hpDoFHandler>::dof_index (const unsigned int i) const
+{
+  typedef DoFAccessor<3, hpDoFHandler> BaseClass;
+
+  Assert (this->dof_handler != 0,
+         BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0,
+         BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_hex,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_hex));
+
+  const unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_hex_index_offset[this->present_index];
+  return this->dof_handler->levels[this->present_level]
+    ->hex_dofs[offset+i];
+}
+
+
+template <>
+inline
+const FiniteElement<3> &
+DoFObjectAccessor<3,3,hpDoFHandler>::get_fe () const
+{
+  return dof_handler->finite_elements->get_fe(active_fe_index ());
+}
+
+
+template <>
+inline
+unsigned int
+DoFObjectAccessor<3,3,hpDoFHandler>::active_fe_index () const
+{
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+  return dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index];
+}
+
+
+template <>
+inline
+void
+DoFObjectAccessor<3,3,hpDoFHandler>::set_active_fe_index (const unsigned int i)
+{
+  Assert (dof_handler != 0, ExcInvalidObject());
+  Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
+         dof_handler->levels[this->present_level]->active_fe_indices.size (),
+         ExcIndexRange (this->present_index, 0,
+                        dof_handler->levels[this->present_level]->active_fe_indices.size ()));
+//TODO: dof_handler->finite_elements not always defined, when this method is called
+//  Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject());
+  dof_handler->levels[this->present_level]
+      ->active_fe_indices[this->present_index] = i;
+}
+
+
 #endif
index a2fe4b218762b8aa9d320e49bd7a9f2445f69afe..4e12d819c96b066b03a0886022d0a0673a17ae4a 100644 (file)
 #include <base/config.h>
 #include <base/exceptions.h>
 #include <base/smartpointer.h>
+#include <dofs/dof_iterator_selector.h>
 #include <dofs/function_map.h>
+
 #include <vector>
 #include <map>
 #include <set>
 
-template <int dim> class DoFAccessor;
-template <int dim> class DoFCellAccessor;
 template <int dim> class DoFLevel;
-template <int celldim, int dim> class DoFObjectAccessor;
-template <int dim>              class DoFObjectAccessor<0, dim>;
-template <int dim>              class DoFObjectAccessor<1, dim>;
-template <int dim>              class DoFObjectAccessor<2, dim>;
-template <int dim>              class DoFObjectAccessor<3, dim>;
-template <int dim> class FiniteElement;
-template <int dim, typename Accessor> class TriaRawIterator;
-template <int dim, typename Accessor> class TriaIterator;
-template <int dim, typename Accessor> class TriaActiveIterator;
-template <int dim> class Triangulation;
-
-
-/**
- * Define some types which differ between the dimensions.
- * 
- * @ref DoFDimensionInfo<1>
- * @ref DoFDimensionInfo<2>
- * @ref DoFDimensionInfo<3>
- *
- * @ingroup dofs
- * @author Wolfgang Bangerth, 1998
- */
-template <int dim>
-class DoFDimensionInfo
-{
-  public:
-                                    /**
-                                     * For internal use only
-                                     */
-    typedef void * raw_line_iterator;
-                                    /**
-                                     * Iterator for lines in the
-                                     * DoFHandler
-                                     */
-    typedef void * line_iterator;
-                                    /**
-                                     * Iterator skipping all refined
-                                     * lines
-                                     */
-    typedef void * active_line_iterator;
-
-                                    /**
-                                     * For internal use only
-                                     */
-    typedef void * raw_quad_iterator;
-                                    /**
-                                     * Iterator for quadrilaterals in
-                                     * the DoFHandler
-                                     */
-    typedef void * quad_iterator;
-                                    /**
-                                     * Iterator skipping all refined
-                                     * quadrilaterals
-                                     */
-    typedef void * active_quad_iterator;
-
-                                    /**
-                                     * For internal use only
-                                     */
-    typedef void * raw_hex_iterator;
-                                    /**
-                                     * Iterator for hexahedra in the
-                                     * DoFHandler
-                                     */
-    typedef void * hex_iterator;
-                                    /**
-                                     * Iterator skipping all refined
-                                     * hexahedra
-                                     */
-    typedef void * active_hex_iterator;
-
-                                    /**
-                                     * For internal use only
-                                     */
-    typedef void * raw_cell_iterator;
-                                    /**
-                                     * All cells of the DoFHandler;
-                                     * depending on the dimension
-                                     * this is typedefed to
-                                     * <ol>
-                                     * <li> #line_iterator
-                                     * <li> #quad_iterator
-                                     * <li> #hex_iterator
-                                     * </ol>
-                                     */
-    typedef void * cell_iterator;
-                                    /**
-                                     * All active cells of the DoFHandler
-                                     * Depending on the dimension
-                                     * this is typedefed to
-                                     * <ol>
-                                     * <li> #active_line_iterator
-                                     * <li> #active_quad_iterator
-                                     * <li> #active_hex_iterator
-                                     * </ol>
-                                     */
-    typedef void * active_cell_iterator;
-
-                                    /**
-                                     * For internal use only
-                                     */
-    typedef void * raw_face_iterator;
-                                    /**
-                                     * All faces of the DoFHandler
-                                     * Depending on the dimension
-                                     * this is typedefed to
-                                     * <ol>
-                                     * <li> <tt>void*</tt>
-                                     * <li> #line_iterator
-                                     * <li> #quad_iterator
-                                     * </ol>
-                                     */
-    typedef void * face_iterator;
-                                    /**
-                                     * All active faces of the DoFHandler
-                                     * Depending on the dimension
-                                     * this is typedefed to
-                                     * <ol>
-                                     * <li> <tt>void*</tt>
-                                     * <li> #active_line_iterator
-                                     * <li> #active_quad_iterator
-                                     * </ol>
-                                     */
-    typedef void * active_face_iterator;
-};
-
-
-
-/**
- * Define some types for the DoF handling in one dimension.
- *
- * @ingroup dofs
- * @author Wolfgang Bangerth, 1998
- */
-template <>
-class DoFDimensionInfo<1>
-{
-  public:
-    typedef TriaRawIterator<1,DoFCellAccessor<1> >    raw_line_iterator;
-    typedef TriaIterator<1,DoFCellAccessor<1> >       line_iterator;
-    typedef TriaActiveIterator<1,DoFCellAccessor<1> > 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;
-};
-
-
-
-/**
- * Define some types for the DoF handling in two dimensions.
- *
- * @ingroup dofs
- * @author Wolfgang Bangerth, 1998
- */
-template <>
-class DoFDimensionInfo<2>
-{
-  public:
-    typedef TriaRawIterator<2,DoFObjectAccessor<1, 2> >    raw_line_iterator;
-    typedef TriaIterator<2,DoFObjectAccessor<1, 2> >       line_iterator;
-    typedef TriaActiveIterator<2,DoFObjectAccessor<1, 2> > active_line_iterator;
-    
-    typedef TriaRawIterator<2,DoFCellAccessor<2> >         raw_quad_iterator;
-    typedef TriaIterator<2,DoFCellAccessor<2> >            quad_iterator;
-    typedef TriaActiveIterator<2,DoFCellAccessor<2> >      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;    
-};
-
-
-
-/**
- * Define some types for the DoF handling in two dimensions.
- *
- * @ingroup dofs
- * @author Wolfgang Bangerth, 1998
- */
-template <>
-class DoFDimensionInfo<3>
-{
-  public:
-    typedef TriaRawIterator<3,DoFObjectAccessor<1, 3> >    raw_line_iterator;
-    typedef TriaIterator<3,DoFObjectAccessor<1, 3> >       line_iterator;
-    typedef TriaActiveIterator<3,DoFObjectAccessor<1, 3> > active_line_iterator;
-
-    typedef TriaRawIterator<3,DoFObjectAccessor<2, 3> >    raw_quad_iterator;
-    typedef TriaIterator<3,DoFObjectAccessor<2, 3> >       quad_iterator;
-    typedef TriaActiveIterator<3,DoFObjectAccessor<2, 3> > active_quad_iterator;
-
-    typedef TriaRawIterator<3,DoFCellAccessor<3> >         raw_hex_iterator;
-    typedef TriaIterator<3,DoFCellAccessor<3> >            hex_iterator;
-    typedef TriaActiveIterator<3,DoFCellAccessor<3> >      active_hex_iterator;
-
-    typedef raw_hex_iterator    raw_cell_iterator;
-    typedef hex_iterator        cell_iterator;
-    typedef active_hex_iterator active_cell_iterator;
-
-    typedef raw_quad_iterator    raw_face_iterator;
-    typedef quad_iterator        face_iterator;
-    typedef active_quad_iterator active_face_iterator;    
-};
-
 
 
 /**
@@ -321,29 +96,29 @@ class DoFDimensionInfo<3>
  * @author Wolfgang Bangerth, 1998
  */
 template <int dim>
-class DoFHandler  :  public Subscriptor,
-                    public DoFDimensionInfo<dim>
+class DoFHandler  :  public Subscriptor
 {
+    typedef internal::DoFIteratorSelector<DoFHandler<dim> > IteratorSelector;
   public:
-    typedef typename DoFDimensionInfo<dim>::raw_line_iterator raw_line_iterator;
-    typedef typename DoFDimensionInfo<dim>::line_iterator line_iterator;
-    typedef typename DoFDimensionInfo<dim>::active_line_iterator active_line_iterator;
+    typedef typename IteratorSelector::raw_line_iterator    raw_line_iterator;
+    typedef typename IteratorSelector::line_iterator        line_iterator;
+    typedef typename IteratorSelector::active_line_iterator active_line_iterator;
 
-    typedef typename DoFDimensionInfo<dim>::raw_quad_iterator raw_quad_iterator;
-    typedef typename DoFDimensionInfo<dim>::quad_iterator quad_iterator;
-    typedef typename DoFDimensionInfo<dim>::active_quad_iterator active_quad_iterator;
+    typedef typename IteratorSelector::raw_quad_iterator    raw_quad_iterator;
+    typedef typename IteratorSelector::quad_iterator        quad_iterator;
+    typedef typename IteratorSelector::active_quad_iterator active_quad_iterator;
 
-    typedef typename DoFDimensionInfo<dim>::raw_hex_iterator raw_hex_iterator;
-    typedef typename DoFDimensionInfo<dim>::hex_iterator hex_iterator;
-    typedef typename DoFDimensionInfo<dim>::active_hex_iterator active_hex_iterator;
+    typedef typename IteratorSelector::raw_hex_iterator    raw_hex_iterator;
+    typedef typename IteratorSelector::hex_iterator        hex_iterator;
+    typedef typename IteratorSelector::active_hex_iterator active_hex_iterator;
 
-    typedef typename DoFDimensionInfo<dim>::raw_cell_iterator raw_cell_iterator;
-    typedef typename DoFDimensionInfo<dim>::cell_iterator cell_iterator;
-    typedef typename DoFDimensionInfo<dim>::active_cell_iterator active_cell_iterator;
+    typedef typename IteratorSelector::raw_cell_iterator    raw_cell_iterator;
+    typedef typename IteratorSelector::cell_iterator        cell_iterator;
+    typedef typename IteratorSelector::active_cell_iterator active_cell_iterator;
 
-    typedef typename DoFDimensionInfo<dim>::raw_face_iterator raw_face_iterator;
-    typedef typename DoFDimensionInfo<dim>::face_iterator face_iterator;
-    typedef typename DoFDimensionInfo<dim>::active_face_iterator active_face_iterator;
+    typedef typename IteratorSelector::raw_face_iterator    raw_face_iterator;
+    typedef typename IteratorSelector::face_iterator        face_iterator;
+    typedef typename IteratorSelector::active_face_iterator active_face_iterator;
 
                                     /**
                                      * Alias the @p FunctionMap type
@@ -1099,16 +874,16 @@ class DoFHandler  :  public Subscriptor,
     n_boundary_dofs (const std::set<unsigned char> &boundary_indicators) const;
 
                                     /**
-                                     * Return a constant reference to the
-                                     * selected finite element object. This
-                                     * function is inline, so it should
-                                     * be reasonably fast.
+                                     * Return a constant reference to
+                                     * the selected finite element
+                                     * object.
                                      */
     const FiniteElement<dim> & get_fe () const;
 
                                     /**
-                                     * Return a constant reference to the
-                                     * triangulation underlying this object.
+                                     * Return a constant reference to
+                                     * the triangulation underlying
+                                     * this object.
                                      */
     const Triangulation<dim> & get_tria () const;
     
@@ -1262,12 +1037,12 @@ class DoFHandler  :  public Subscriptor,
                                     /*
                                      * Make accessor objects friends.
                                      */
-    template <int dim1> friend class DoFAccessor;
+    template <int dim1, template <int> class DH> friend class DoFAccessor;
 
                                     /*
                                      * Make accessor objects friends.
                                      */
-    template <int dim1, int dim2> friend class DoFObjectAccessor;
+    template <int dim1, int dim2, template <int> class DH> friend class DoFObjectAccessor;
 };
 
 
@@ -1295,16 +1070,16 @@ template <> DoFHandler<1>::cell_iterator DoFHandler<1>::last () const;
 template <> DoFHandler<1>::cell_iterator DoFHandler<1>::last (const unsigned int level) const;
 template <> DoFHandler<1>::active_cell_iterator DoFHandler<1>::last_active () const;
 template <> DoFHandler<1>::active_cell_iterator DoFHandler<1>::last_active (const unsigned int level) const;
-template <> DoFDimensionInfo<1>::raw_face_iterator DoFHandler<1>::begin_raw_face (const unsigned int) const;
-template <> DoFDimensionInfo<1>::face_iterator DoFHandler<1>::begin_face (const unsigned int) const;
-template <> DoFDimensionInfo<1>::active_face_iterator DoFHandler<1>::begin_active_face (const unsigned int) const;
-template <> DoFDimensionInfo<1>::raw_face_iterator DoFHandler<1>::end_face () const;
-template <> DoFDimensionInfo<1>::raw_face_iterator DoFHandler<1>::last_raw_face () const;
-template <> DoFDimensionInfo<1>::raw_face_iterator DoFHandler<1>::last_raw_face (const unsigned int) const;
-template <> DoFDimensionInfo<1>::face_iterator DoFHandler<1>::last_face () const;
-template <> DoFDimensionInfo<1>::face_iterator DoFHandler<1>::last_face (const unsigned int) const;
-template <> DoFDimensionInfo<1>::active_face_iterator DoFHandler<1>::last_active_face () const;
-template <> DoFDimensionInfo<1>::active_face_iterator DoFHandler<1>::last_active_face (const unsigned int) const;
+template <> DoFHandler<1>::raw_face_iterator DoFHandler<1>::begin_raw_face (const unsigned int) const;
+template <> DoFHandler<1>::face_iterator DoFHandler<1>::begin_face (const unsigned int) const;
+template <> DoFHandler<1>::active_face_iterator DoFHandler<1>::begin_active_face (const unsigned int) const;
+template <> DoFHandler<1>::raw_face_iterator DoFHandler<1>::end_face () const;
+template <> DoFHandler<1>::raw_face_iterator DoFHandler<1>::last_raw_face () const;
+template <> DoFHandler<1>::raw_face_iterator DoFHandler<1>::last_raw_face (const unsigned int) const;
+template <> DoFHandler<1>::face_iterator DoFHandler<1>::last_face () const;
+template <> DoFHandler<1>::face_iterator DoFHandler<1>::last_face (const unsigned int) const;
+template <> DoFHandler<1>::active_face_iterator DoFHandler<1>::last_active_face () const;
+template <> DoFHandler<1>::active_face_iterator DoFHandler<1>::last_active_face (const unsigned int) const;
 template <> DoFHandler<1>::raw_quad_iterator DoFHandler<1>::begin_raw_quad (const unsigned int) const;
 template <> DoFHandler<1>::quad_iterator DoFHandler<1>::begin_quad (const unsigned int) const;
 template <> DoFHandler<1>::active_quad_iterator DoFHandler<1>::begin_active_quad (const unsigned int) const;
@@ -1335,16 +1110,16 @@ template <> DoFHandler<2>::cell_iterator DoFHandler<2>::last () const;
 template <> DoFHandler<2>::cell_iterator DoFHandler<2>::last (const unsigned int level) const;
 template <> DoFHandler<2>::active_cell_iterator DoFHandler<2>::last_active () const;
 template <> DoFHandler<2>::active_cell_iterator DoFHandler<2>::last_active (const unsigned int level) const;
-template <> DoFDimensionInfo<2>::raw_face_iterator DoFHandler<2>::begin_raw_face (const unsigned int level) const;
-template <> DoFDimensionInfo<2>::face_iterator DoFHandler<2>::begin_face (const unsigned int level) const;
-template <> DoFDimensionInfo<2>::active_face_iterator DoFHandler<2>::begin_active_face (const unsigned int level) const;
-template <> DoFDimensionInfo<2>::raw_face_iterator DoFHandler<2>::end_face () const;
-template <> DoFDimensionInfo<2>::raw_face_iterator DoFHandler<2>::last_raw_face () const;
-template <> DoFDimensionInfo<2>::raw_face_iterator DoFHandler<2>::last_raw_face (const unsigned int level) const;
-template <> DoFDimensionInfo<2>::face_iterator DoFHandler<2>::last_face () const;
-template <> DoFDimensionInfo<2>::face_iterator DoFHandler<2>::last_face (const unsigned int level) const;
-template <> DoFDimensionInfo<2>::active_face_iterator DoFHandler<2>::last_active_face () const;
-template <> DoFDimensionInfo<2>::active_face_iterator DoFHandler<2>::last_active_face (const unsigned int level) const;
+template <> DoFHandler<2>::raw_face_iterator DoFHandler<2>::begin_raw_face (const unsigned int level) const;
+template <> DoFHandler<2>::face_iterator DoFHandler<2>::begin_face (const unsigned int level) const;
+template <> DoFHandler<2>::active_face_iterator DoFHandler<2>::begin_active_face (const unsigned int level) const;
+template <> DoFHandler<2>::raw_face_iterator DoFHandler<2>::end_face () const;
+template <> DoFHandler<2>::raw_face_iterator DoFHandler<2>::last_raw_face () const;
+template <> DoFHandler<2>::raw_face_iterator DoFHandler<2>::last_raw_face (const unsigned int level) const;
+template <> DoFHandler<2>::face_iterator DoFHandler<2>::last_face () const;
+template <> DoFHandler<2>::face_iterator DoFHandler<2>::last_face (const unsigned int level) const;
+template <> DoFHandler<2>::active_face_iterator DoFHandler<2>::last_active_face () const;
+template <> DoFHandler<2>::active_face_iterator DoFHandler<2>::last_active_face (const unsigned int level) const;
 template <> DoFHandler<2>::raw_hex_iterator DoFHandler<2>::begin_raw_hex (const unsigned int) const;
 template <> DoFHandler<2>::hex_iterator DoFHandler<2>::begin_hex (const unsigned int) const;
 template <> DoFHandler<2>::active_hex_iterator DoFHandler<2>::begin_active_hex (const unsigned int) const;
@@ -1397,7 +1172,8 @@ template <> void DoFHandler<3>::reserve_space ();
 
 template <int dim>
 inline
-unsigned int DoFHandler<dim>::n_dofs () const
+unsigned int
+DoFHandler<dim>::n_dofs () const
 {
   return used_dofs;
 }
@@ -1406,14 +1182,24 @@ unsigned int DoFHandler<dim>::n_dofs () const
 
 template <int dim>
 inline
-const FiniteElement<dim> & DoFHandler<dim>::get_fe () const
+const FiniteElement<dim> &
+DoFHandler<dim>::get_fe () const
 {
   Assert(selected_fe!=0, ExcNoFESelected());
   return *selected_fe;
 }
 
 
-/*----------------------------   dof.h     ---------------------------*/
+template <int dim>
+inline
+const Triangulation<dim> &
+DoFHandler<dim>::get_tria () const
+{
+  return *tria;
+}
+
+
+/*----------------------------   dof_handler.h     ---------------------------*/
 
 #endif
-/*----------------------------   dof.h     ---------------------------*/
+/*----------------------------   dof_handler.h     ---------------------------*/
diff --git a/deal.II/deal.II/include/dofs/dof_iterator_selector.h b/deal.II/deal.II/include/dofs/dof_iterator_selector.h
new file mode 100644 (file)
index 0000000..19e4012
--- /dev/null
@@ -0,0 +1,157 @@
+//----------------------------  dof_iterator_selector.h  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  dof_iterator_selector.h  ---------------------------
+#ifndef __deal2__dof_iterator_selector_h
+#define __deal2__dof_iterator_selector_h
+
+template <int dim, template <int> class DH> class DoFAccessor;
+template <int dim, template <int> class DH> class DoFCellAccessor;
+template <int celldim, int dim, template <int> class DH> class DoFObjectAccessor;
+template <int dim, template <int> class DH>              class DoFObjectAccessor<0, dim, DH>;
+template <int dim, template <int> class DH>              class DoFObjectAccessor<1, dim, DH>;
+template <int dim, template <int> class DH>              class DoFObjectAccessor<2, dim, DH>;
+template <int dim, template <int> class DH>              class DoFObjectAccessor<3, dim, DH>;
+template <int dim> class FiniteElement;
+template <int dim, typename Accessor> class TriaRawIterator;
+template <int dim, typename Accessor> class TriaIterator;
+template <int dim, typename Accessor> class TriaActiveIterator;
+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>
+ *
+ * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003
+ */
+  template <class DH>
+  struct DoFIteratorSelector
+  {
+  };
+
+
+
+/**
+ * Define some types for the DoF handling in one dimension.
+ *
+ * The types have the same meaning as those declared in
+ * TriaDimensionInfo<2>, only the treatment of templates is a
+ * little more complicated since the @p DoFAccessor classes want a
+ * template template argument.
+ *
+ * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003
+ */
+  template <template <int> class DH>
+  struct DoFIteratorSelector<DH<1> >
+  {
+      typedef TriaRawIterator<1,DoFCellAccessor<1, DH> >    raw_line_iterator;
+      typedef TriaIterator<1,DoFCellAccessor<1, DH> >       line_iterator;
+      typedef TriaActiveIterator<1,DoFCellAccessor<1, DH> > 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;
+  };
+  
+
+
+/**
+ * Define some types for the DoF handling in two dimensions.
+ *
+ * The types have the same meaning as those declared in
+ * TriaDimensionInfo<2>, only the treatment of templates is a
+ * little more complicated since the @p DoFAccessor classes want a
+ * template template argument.
+ *
+ * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003
+ */
+  template <template <int> class DH>
+  struct DoFIteratorSelector<DH<2> >
+  {
+      typedef TriaRawIterator<2,DoFObjectAccessor<1, 2, DH> >    raw_line_iterator;
+      typedef TriaIterator<2,DoFObjectAccessor<1, 2, DH> >       line_iterator;
+      typedef TriaActiveIterator<2,DoFObjectAccessor<1, 2, DH> > active_line_iterator;
+      
+      typedef TriaRawIterator<2,DoFCellAccessor<2, DH> >         raw_quad_iterator;
+      typedef TriaIterator<2,DoFCellAccessor<2, DH> >            quad_iterator;
+      typedef TriaActiveIterator<2,DoFCellAccessor<2, DH> >      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;    
+  };
+
+
+
+/**
+ * Define some types for the DoF handling in two dimensions.
+ *
+ * The types have the same meaning as those declared in
+ * TriaDimensionInfo<3>, only the treatment of templates is a
+ * little more complicated since the @p DoFAccessor classes want a
+ * template template argument.
+ *
+ * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003
+ */
+  template <template <int> class DH>
+  struct DoFIteratorSelector<DH<3> >
+  {
+      typedef TriaRawIterator<3,DoFObjectAccessor<1, 3, DH> >    raw_line_iterator;
+      typedef TriaIterator<3,DoFObjectAccessor<1, 3, DH> >       line_iterator;
+      typedef TriaActiveIterator<3,DoFObjectAccessor<1, 3, DH> > active_line_iterator;
+      
+      typedef TriaRawIterator<3,DoFObjectAccessor<2, 3, DH> >    raw_quad_iterator;
+      typedef TriaIterator<3,DoFObjectAccessor<2, 3, DH> >       quad_iterator;
+      typedef TriaActiveIterator<3,DoFObjectAccessor<2, 3, DH> > active_quad_iterator;
+      
+      typedef TriaRawIterator<3,DoFCellAccessor<3, DH> >         raw_hex_iterator;
+      typedef TriaIterator<3,DoFCellAccessor<3, DH> >            hex_iterator;
+      typedef TriaActiveIterator<3,DoFCellAccessor<3, DH> >      active_hex_iterator;
+      
+      typedef raw_hex_iterator    raw_cell_iterator;
+      typedef hex_iterator        cell_iterator;
+      typedef active_hex_iterator active_cell_iterator;
+      
+      typedef raw_quad_iterator    raw_face_iterator;
+      typedef quad_iterator        face_iterator;
+      typedef active_quad_iterator active_face_iterator;    
+  };
+}
+
+#endif // __deal2__dof_iterator_selector_h
index c8fae18298df1bfca769f6a0d23873a57a12d61e..0895c3666e4a5f1c825bc9289bafdeb18d810eae 100644 (file)
@@ -218,9 +218,9 @@ class DoFRenumbering
                                      * of this class for details on
                                      * the different methods.
                                      */
-    template <int dim>
+    template <int dim, template <int> class DH>
     static void 
-    Cuthill_McKee (DoFHandler<dim>            &dof_handler,
+    Cuthill_McKee (DH<dim>                    &dof_handler,
                   const bool                  reversed_numbering = false,
                   const bool                  use_constraints    = false,
                   const std::vector<unsigned int> &starting_indices   = std::vector<unsigned int>());
@@ -234,10 +234,10 @@ class DoFRenumbering
                                      * returns the renumbering
                                      * vector.
                                      */    
-    template <int dim>
+    template <int dim, template <int> class DH>
     static void
     compute_Cuthill_McKee (std::vector<unsigned int>& new_dof_indices,
-                          const DoFHandler<dim>&,
+                          const DH<dim>&,
                           const bool reversed_numbering = false,
                           const bool use_constraints    = false,
                           const std::vector<unsigned int> &starting_indices   = std::vector<unsigned int>());
index 2da37850551c18513ed267eda15a7d680bd67261..e38c2615b618b3da744963038b1a0ec1e2e3be43 100644 (file)
@@ -30,6 +30,7 @@ template <int dim> class Function;
 template <int dim> class Point;
 template <int dim> class FiniteElement;
 template <int dim> class DoFHandler;
+template <int dim> class hpDoFHandler;
 template <int dim> class MGDoFHandler;
 class ConstraintMatrix;
 template <template <int> class GridClass, int dim> class InterGridMap;
@@ -348,11 +349,11 @@ class DoFTools
                                      * previously added entries are
                                      * not deleted.
                                      */
-    template <int dim, class SparsityPattern>
+    template <int dim, class SparsityPattern, template <int> class DH>
     static
     void
-    make_sparsity_pattern (const DoFHandler<dim> &dof,
-                          SparsityPattern       &sparsity_pattern);
+    make_sparsity_pattern (const DH<dim>   &dof,
+                          SparsityPattern &sparsity_pattern);
 
                                     /**
                                      * Locate non-zero entries for
@@ -470,9 +471,9 @@ class DoFTools
                                      * size of the sparsity pattern is
                                      * already correct.
                                      */
-    template <int dim, class SparsityPattern>
+    template <int dim, class SparsityPattern, template <int> class DH>
     static void
-    make_boundary_sparsity_pattern (const DoFHandler<dim>           &dof,
+    make_boundary_sparsity_pattern (const DH<dim>                   &dof,
                                    const std::vector<unsigned int> &dof_to_boundary_mapping,
                                    SparsityPattern                 &sparsity_pattern);
 
@@ -484,9 +485,9 @@ class DoFTools
                                      * specified end points to each
                                      * other.
                                      */
-    template <class SparsityPattern>
+    template <class SparsityPattern, template <int> class DH>
     static void
-    make_boundary_sparsity_pattern (const DoFHandler<1>             &dof,
+    make_boundary_sparsity_pattern (const DH<1>                     &dof,
                                    const std::vector<unsigned int> &dof_to_boundary_mapping,
                                    SparsityPattern                 &sparsity_pattern);
 
@@ -521,9 +522,9 @@ class DoFTools
                                      * pattern, the same holds as
                                      * said above.
                                      */
-    template <int dim, class SparsityPattern>
+    template <int dim, class SparsityPattern, template <int> class DH>
     static void
-    make_boundary_sparsity_pattern (const DoFHandler<dim> &dof,
+    make_boundary_sparsity_pattern (const DH<dim> &dof,
                                    const typename FunctionMap<dim>::type &boundary_indicators,
                                    const std::vector<unsigned int>  &dof_to_boundary_mapping,
                                    SparsityPattern    &sparsity); 
@@ -537,9 +538,9 @@ class DoFTools
                                      * specified end points to each
                                      * other.
                                      */
-    template <class SparsityPattern>
+    template <class SparsityPattern, template <int> class DH>
     static void
-    make_boundary_sparsity_pattern (const DoFHandler<1>             &dof,
+    make_boundary_sparsity_pattern (const DH<1>                     &dof,
                                    const FunctionMap<1>::type      &boundary_indicators,
                                    const std::vector<unsigned int> &dof_to_boundary_mapping,
                                    SparsityPattern                 &sparsity); 
@@ -561,18 +562,18 @@ class DoFTools
                                      * extra matrix entries are
                                      * considered.
                                      */
-    template<int dim, class SparsityPattern>
+    template<int dim, class SparsityPattern, template <int> class DH>
     static void
-    make_flux_sparsity_pattern (const DoFHandler<dim> &dof_handler,
-                               SparsityPattern       &sparsity_pattern);
+    make_flux_sparsity_pattern (const DH<dim>   &dof_handler,
+                               SparsityPattern &sparsity_pattern);
 
                                     /**
                                      * Same function, but for 1d.
                                      */
-    template<class SparsityPattern>
+    template<class SparsityPattern, template <int> class DH>
     static void
-    make_flux_sparsity_pattern (const DoFHandler<1> &dof_handler,
-                               SparsityPattern     &sparsity_pattern);
+    make_flux_sparsity_pattern (const DH<1>     &dof_handler,
+                               SparsityPattern &sparsity_pattern);
     
                                     /**
                                      * This function does the same as
@@ -651,6 +652,31 @@ class DoFTools
     static void
     make_hanging_node_constraints (const DoFHandler<3> &dof_handler,
                                   ConstraintMatrix    &constraints);
+
+                                    /**
+                                     * Declaration of same function
+                                     * for hpDoFHandler
+                                     */
+    static void
+    make_hanging_node_constraints (const hpDoFHandler<1> &dof_handler,
+                                  ConstraintMatrix      &constraints);
+
+                                    /**
+                                     * Declaration of same function
+                                     * for different space dimension.
+                                     */
+    static void
+    make_hanging_node_constraints (const hpDoFHandler<2> &dof_handler,
+                                  ConstraintMatrix      &constraints);
+
+                                    /**
+                                     * Declaration of same function
+                                     * for different space dimension.
+                                     */
+    static void
+    make_hanging_node_constraints (const hpDoFHandler<3> &dof_handler,
+                                  ConstraintMatrix      &constraints);
+
                                     //@}
     
                                     /**
@@ -712,9 +738,9 @@ class DoFTools
                                      * speak: they are
                                      * non-primitive).
                                      */
-    template <int dim, typename Number>
+    template <int dim, typename Number, template <int> class DH>
     static void
-    distribute_cell_to_dof_vector (const DoFHandler<dim> &dof_handler,
+    distribute_cell_to_dof_vector (const DH<dim>         &dof_handler,
                                   const Vector<Number>  &cell_data,
                                   Vector<double>        &dof_data,
                                   const unsigned int     component = 0);
@@ -770,9 +796,9 @@ class DoFTools
                                      */
     template <int dim>
     static void
-    extract_dofs (const DoFHandler<dim>      &dof_handler,
-                 const std::vector<bool>    &component_select,
-                 std::vector<bool>          &selected_dofs);
+    extract_dofs (const DoFHandler<dim>   &dof_handler,
+                 const std::vector<bool> &component_select,
+                 std::vector<bool>       &selected_dofs);
 
                                     /**
                                      * Do the same thing as
@@ -832,9 +858,9 @@ class DoFTools
                                      * in the mask corresponding to
                                      * later components are ignored.
                                      */
-    template <int dim>
+    template <int dim, template <int> class DH>
     static void
-    extract_boundary_dofs (const DoFHandler<dim>      &dof_handler,
+    extract_boundary_dofs (const DH<dim>              &dof_handler,
                           const std::vector<bool>    &component_select,
                           std::vector<bool>          &selected_dofs,
                           const std::set<unsigned char> &boundary_indicators = std::set<unsigned char>());
@@ -843,8 +869,9 @@ class DoFTools
                                      * Declaration of same function
                                      * for different space dimension.
                                      */
+    template <template <int> class DH>
     static void
-    extract_boundary_dofs (const DoFHandler<1>        &dof_handler,
+    extract_boundary_dofs (const DH<1>                &dof_handler,
                           const std::vector<bool>    &component_select,
                           std::vector<bool>          &selected_dofs,
                           const std::set<unsigned char> &boundary_indicators = std::set<unsigned char>());
@@ -904,12 +931,12 @@ class DoFTools
                                      * @p get_subdomain_association
                                      * function.
                                      */
-    template <int dim>
+    template <int dim, template <int> class DH>
     static void
-    extract_subdomain_dofs (const DoFHandler<dim> &dof_handler,
-                           const unsigned int     subdomain_id,
-                           std::vector<bool>     &selected_dofs);
-
+    extract_subdomain_dofs (const DH<dim>      &dof_handler,
+                           const unsigned int  subdomain_id,
+                           std::vector<bool>  &selected_dofs);
+    
                                      /**
                                       * For each DoF, return in the output
                                       * array to which subdomain (as given by
@@ -1054,7 +1081,8 @@ class DoFTools
                              std::vector<unsigned int>& dofs_per_component,
                              const bool vector_valued_once = false,
                              std::vector<unsigned int>  target_component
-                             =std::vector<unsigned int>());
+                             = std::vector<unsigned int>());
+
 
                                     /**
                                      * @deprecated See the previous
@@ -1353,9 +1381,9 @@ class DoFTools
                                      * Prior content of @p mapping
                                      * is deleted.
                                      */
-    template <int dim>
+    template <int dim, template <int> class DH>
     static void
-    map_dof_to_boundary_indices (const DoFHandler<dim>      &dof_handler,
+    map_dof_to_boundary_indices (const DH<dim>              &dof_handler,
                                 std::vector<unsigned int>  &mapping);
 
                                     /**
@@ -1363,8 +1391,8 @@ class DoFTools
                                      * for different space dimension.
                                      */
     static void
-    map_dof_to_boundary_indices (const DoFHandler<1>        &dof_handler,
-                                std::vector<unsigned int>  &mapping);
+    map_dof_to_boundary_indices (const DoFHandler<1>       &dof_handler,
+                                std::vector<unsigned int> &mapping);
     
                                     /**
                                      * Same as the previous function,
@@ -1377,9 +1405,9 @@ class DoFTools
                                      * See the general doc of this
                                      * class for more information.
                                      */
-    template <int dim>
+    template <int dim, template <int> class DH>
     static void
-    map_dof_to_boundary_indices (const DoFHandler<dim>         &dof_handler,
+    map_dof_to_boundary_indices (const DH<dim>              &dof_handler,
                                 const std::set<unsigned char> &boundary_indicators,
                                 std::vector<unsigned int>     &mapping);
 
@@ -1387,8 +1415,9 @@ class DoFTools
                                      * Declaration of same function
                                      * for different space dimension.
                                      */
+    template <template <int> class DH>
     static void
-    map_dof_to_boundary_indices (const DoFHandler<1>           &dof_handler,
+    map_dof_to_boundary_indices (const DH<1>                   &dof_handler,
                                 const std::set<unsigned char> &boundary_indicators,
                                 std::vector<unsigned int>     &mapping);
     
@@ -1442,10 +1471,10 @@ class DoFTools
                                      * of support points of all its
                                      * components.
                                      */
-    template <int dim, class Comp>
+    template <int dim, template <int> class DH, class Comp>
     static void
-    map_support_points_to_dofs (const Mapping<dim>       &mapping,
-                               const DoFHandler<dim>    &dof_handler,
+    map_support_points_to_dofs (const Mapping<dim>    &mapping,
+                               const DH<dim>         &dof_handler,
                                std::map<Point<dim>, unsigned int, Comp> &point_to_index_map);
     
                                     /**
@@ -1593,11 +1622,11 @@ DoFTools::make_sparsity_pattern (
 }
 
 
-template <int dim, class Comp>
+template <int dim, template <int> class DH, class Comp>
 void
 DoFTools::map_support_points_to_dofs (
   const Mapping<dim>       &mapping,
-  const DoFHandler<dim>    &dof_handler,
+  const DH<dim>            &dof_handler,
   std::map<Point<dim>, unsigned int, Comp> &point_to_index_map)
 {
                                   // let the checking of arguments be
diff --git a/deal.II/deal.II/include/dofs/hp_dof_handler.h b/deal.II/deal.II/include/dofs/hp_dof_handler.h
new file mode 100644 (file)
index 0000000..fc2fdd2
--- /dev/null
@@ -0,0 +1,1151 @@
+//----------------------------  hp_dof_handler.h  ------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  hp_dof_handler.h  ------------------------
+#ifndef __deal2__hp_dof_handler_h
+#define __deal2__hp_dof_handler_h
+
+
+
+#include <base/config.h>
+#include <base/exceptions.h>
+#include <base/smartpointer.h>
+#include <dofs/function_map.h>
+#include <dofs/dof_iterator_selector.h>
+#include <fe/fe_collection.h>
+
+#include <vector>
+#include <map>
+#include <set>
+
+template <int> class hpDoFLevel;
+
+
+/**
+ * Manage the distribution and numbering of the degrees of freedom for
+ * hp-FEM algorithms.
+ */
+template <int dim>
+class hpDoFHandler  :  public Subscriptor,
+                       protected Triangulation<dim>::RefinementListener
+{
+    typedef internal::DoFIteratorSelector<hpDoFHandler<dim> > IteratorSelector;
+  public:
+    typedef typename IteratorSelector::raw_line_iterator raw_line_iterator;
+    typedef typename IteratorSelector::line_iterator line_iterator;
+    typedef typename IteratorSelector::active_line_iterator active_line_iterator;
+
+    typedef typename IteratorSelector::raw_quad_iterator raw_quad_iterator;
+    typedef typename IteratorSelector::quad_iterator quad_iterator;
+    typedef typename IteratorSelector::active_quad_iterator active_quad_iterator;
+
+    typedef typename IteratorSelector::raw_hex_iterator raw_hex_iterator;
+    typedef typename IteratorSelector::hex_iterator hex_iterator;
+    typedef typename IteratorSelector::active_hex_iterator active_hex_iterator;
+
+    typedef typename IteratorSelector::raw_cell_iterator raw_cell_iterator;
+    typedef typename IteratorSelector::cell_iterator cell_iterator;
+    typedef typename IteratorSelector::active_cell_iterator active_cell_iterator;
+
+    typedef typename IteratorSelector::raw_face_iterator raw_face_iterator;
+    typedef typename IteratorSelector::face_iterator face_iterator;
+    typedef typename IteratorSelector::active_face_iterator active_face_iterator;
+
+                                    /**
+                                     * Alias the @p FunctionMap type
+                                     * declared elsewhere.
+                                     */
+    typedef typename FunctionMap<dim>::type FunctionMap;
+    
+                                    /**
+                                     * When the arrays holding the
+                                     * DoF indices are set up, but
+                                     * before they are filled with
+                                     * actual values, they are set to
+                                     * an invalid value, in order to
+                                     * monitor possible
+                                     * problems. This invalid value
+                                     * is the constant defined here.
+                                     *
+                                     * Please note that you should
+                                     * not rely on it having a
+                                     * certain value, but rather take
+                                     * its symbolic name.
+                                     */
+    static const unsigned int invalid_dof_index = static_cast<unsigned int>(-1);
+
+    
+                                    /**
+                                     * Constructor. Take @p tria as the
+                                     * triangulation to work on.
+                                     */
+    hpDoFHandler (const Triangulation<dim> &tria);
+    
+                                    /**
+                                     * Destructor.
+                                     */
+    virtual ~hpDoFHandler ();
+    
+                                    /**
+                                     * Go through the triangulation and
+                                     * distribute the degrees of freedoms
+                                     * needed for the given finite element
+                                     * according to the given distribution
+                                     * method.
+                                     *
+                                     * A pointer of the transferred
+                                     * finite element is
+                                     * stored. Therefore, the
+                                     * lifetime of the finite element
+                                     * object shall be longer than
+                                     * that of this object. If you
+                                     * don't want this behaviour, you
+                                     * may want to call the @p clear
+                                     * member function which also
+                                     * releases the lock of this
+                                     * object to the finite element.
+                                     */
+    virtual void distribute_dofs (const FECollection<dim> &fe);
+
+                                    /**
+                                     * Clear all data of this object and
+                                     * especially delete the lock this object
+                                     * has to the finite element used the last
+                                     * time when @p distribute_dofs was called.
+                                     */
+    virtual void clear ();
+    
+                                    /**
+                                     * Actually do the renumbering based on
+                                     * a list of new dof numbers for all the
+                                     * dofs.
+                                     *
+                                     * @p new_numbers is an array of integers
+                                     * with size equal to the number of dofs
+                                     * on the present grid. It stores the new
+                                     * indices after renumbering in the
+                                     * order of the old indices.
+                                     *
+                                     * This function is called by the
+                                     * @p renumber_dofs function after computing
+                                     * the ordering of the degrees of freedom.
+                                     * However, you can call this function
+                                     * yourself, which is necessary if a user
+                                     * wants to implement an ordering scheme
+                                     * herself, for example downwind numbering.
+                                     */
+    void renumber_dofs (const std::vector<unsigned int> &new_numbers);
+
+                                    /**
+                                     * Return the maximum number of
+                                     * degrees of freedom a degree of freedom
+                                     * in the given triangulation with the
+                                     * given finite element may couple with.
+                                     * This is the maximum number of entries
+                                     * per line in the system matrix; this
+                                     * information can therefore be used upon
+                                     * construction of the SparsityPattern
+                                     * object.
+                                     *
+                                     * The returned number is not really the
+                                     * maximum number but an estimate based
+                                     * on the finite element and the maximum
+                                     * number of cells meeting at a vertex.
+                                     * The number holds for the constrained
+                                     * matrix also.
+                                     *
+                                     * The determination of the number of
+                                     * couplings can be done by simple
+                                     * picture drawing. An example can be
+                                     * found in the implementation of this
+                                     * function.
+                                     */
+    unsigned int max_couplings_between_dofs () const;
+
+                                    /**
+                                     * Return the number of degrees of freedom
+                                     * located on the boundary another dof on
+                                     * the boundary can couple with.
+                                     *
+                                     * The number is the same as for
+                                     * @p max_coupling_between_dofs in one
+                                     * dimension less.
+                                     */
+    unsigned int max_couplings_between_boundary_dofs () const;
+
+                                    /**
+                                     *  @name Cell iterator functions
+                                     */
+                                    /*@{*/
+                                    /**
+                                     *  Iterator to the first cell, used
+                                     *  or not, on level @p level. If a level
+                                     *  has no cells, a past-the-end iterator
+                                     *  is returned.
+                                     *
+                                     *  This function calls @p begin_raw_line
+                                     *  in 1D and @p begin_raw_quad in 2D.
+                                     */
+    raw_cell_iterator    begin_raw   (const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator to the first used cell
+                                     *  on level @p level.
+                                     *
+                                     *  This function calls @p begin_line
+                                     *  in 1D and @p begin_quad in 2D.
+                                     */
+    cell_iterator        begin       (const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator to the first active
+                                     *  cell on level @p level.
+                                     *
+                                     *  This function calls @p begin_active_line
+                                     *  in 1D and @p begin_active_quad in 2D.
+                                     */
+    active_cell_iterator begin_active(const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator past the end; this
+                                     *  iterator serves for comparisons of
+                                     *  iterators with past-the-end or
+                                     *  before-the-beginning states.
+                                     *
+                                     *  This function calls @p end_line
+                                     *  in 1D and @p end_quad in 2D.
+                                     */
+    raw_cell_iterator    end () const;
+
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If @p level is
+                                     * the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    cell_iterator        end (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If @p level is
+                                     * the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    raw_cell_iterator    end_raw (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If @p level
+                                     * is the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    active_cell_iterator end_active (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the
+                                     *  last cell, used or not.
+                                     *
+                                     *  This function calls @p last_raw_line
+                                     *  in 1D and @p last_raw_quad in 2D.
+                                     */
+    raw_cell_iterator    last_raw () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  cell of the level @p level, used or not.
+                                     *
+                                     *  This function calls @p last_raw_line
+                                     *  in 1D and @p last_raw_quad in 2D.
+                                     */
+    raw_cell_iterator    last_raw (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  used cell.
+                                     *
+                                     *  This function calls @p last_line
+                                     *  in 1D and @p last_quad in 2D.
+                                     */
+    cell_iterator        last () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  used cell on level @p level.
+                                     *
+                                     *  This function calls @p last_line
+                                     *  in 1D and @p last_quad in 2D.
+                                     */
+    cell_iterator        last (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  active cell.
+                                     *
+                                     *  This function calls @p last_active_line
+                                     *  in 1D and @p last_active_quad in 2D.
+                                     */
+    active_cell_iterator last_active () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  active cell on level @p level.
+                                     *
+                                     *  This function calls @p last_active_line
+                                     *  in 1D and @p last_active_quad in 2D.
+                                     */
+    active_cell_iterator last_active (const unsigned int level) const;
+                                    //@}
+
+                                    /*---------------------------------------*/
+
+                                    /**
+                                     *  @name Face iterator functions
+                                     */
+                                    /*@{*/
+                                    /**
+                                     *  Iterator to the first face, used
+                                     *  or not, on level @p level. If a level
+                                     *  has no faces, a past-the-end iterator
+                                     *  is returned.
+                                     *
+                                     *  This function calls @p begin_raw_line
+                                     *  in 2D and @p begin_raw_quad in 3D.
+                                     */
+    raw_face_iterator    begin_raw_face   (const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator to the first used face
+                                     *  on level @p level.
+                                     *
+                                     *  This function calls @p begin_line
+                                     *  in 2D and @p begin_quad in 3D.
+                                     */
+    face_iterator        begin_face       (const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator to the first active
+                                     *  face on level @p level.
+                                     *
+                                     *  This function calls @p begin_active_line
+                                     *  in 2D and @p begin_active_quad in 3D.
+                                     */
+    active_face_iterator begin_active_face(const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator past the end; this
+                                     *  iterator serves for comparisons of
+                                     *  iterators with past-the-end or
+                                     *  before-the-beginning states.
+                                     *
+                                     *  This function calls @p end_line
+                                     *  in 2D and @p end_quad in 3D.
+                                     */
+    raw_face_iterator    end_face () const;
+
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If @p level is
+                                     * the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    face_iterator        end_face (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If @p level is
+                                     * the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    raw_face_iterator    end_raw_face (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If @p level
+                                     * is the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    active_face_iterator end_active_face (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the
+                                     *  last face, used or not.
+                                     *
+                                     *  This function calls @p last_raw_line
+                                     *  in 2D and @p last_raw_quad in 3D.
+                                     */
+    raw_face_iterator    last_raw_face () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  face of the level @p level, used or not.
+                                     *
+                                     *  This function calls @p last_raw_line
+                                     *  in 2D and @p last_raw_quad in 3D.
+                                     */
+    raw_face_iterator    last_raw_face (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  used face.
+                                     *
+                                     *  This function calls @p last_line
+                                     *  in 2D and @p last_quad in 3D.
+                                     */
+    face_iterator        last_face () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  used face on level @p level.
+                                     *
+                                     *  This function calls @p last_line
+                                     *  in 2D and @p last_quad in 3D.
+                                     */
+    face_iterator        last_face (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  active face.
+                                     *
+                                     *  This function calls @p last_active_line
+                                     *  in 2D and @p last_active_quad in 3D.
+                                     */
+    active_face_iterator last_active_face () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  active face on level @p level.
+                                     *
+                                     *  This function calls @p last_active_line
+                                     *  in 2D and @p last_active_quad in 3D.
+                                     */
+    active_face_iterator last_active_face (const unsigned int level) const;
+                                    //@}
+
+
+                                    /*---------------------------------------*/
+
+                                    /**
+                                     *  @name Line iterator functions
+                                     */
+                                    /*@{*/
+                                    /**
+                                     *  Iterator to the first line, used
+                                     *  or not, on level @p level. If a level
+                                     *  has no lines, a past-the-end iterator
+                                     *  is returned.
+                                     */
+    raw_line_iterator    begin_raw_line   (const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator to the first used line
+                                     *  on level @p level.
+                                     */
+    line_iterator        begin_line       (const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator to the first active
+                                     *  line on level @p level.
+                                     */
+    active_line_iterator begin_active_line(const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator past the end; this
+                                     *  iterator serves for comparisons of
+                                     *  iterators with past-the-end or
+                                     *  before-the-beginning states.
+                                     */
+    raw_line_iterator    end_line () const;
+
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If @p level is
+                                     * the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    line_iterator        end_line (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If @p level is
+                                     * the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    raw_line_iterator    end_raw_line (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If @p level
+                                     * is the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    active_line_iterator end_active_line (const unsigned int level) const;
+
+
+                                    /**
+                                     *  Return an iterator pointing to the
+                                     *  last line, used or not.
+                                     */
+    raw_line_iterator    last_raw_line () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  line of the level @p level, used or not.
+
+                                     */
+    raw_line_iterator    last_raw_line (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  used line.
+                                     */
+    line_iterator        last_line () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  used line on level @p level.
+                                     */
+    line_iterator        last_line (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  active line.
+                                     */
+    active_line_iterator last_active_line () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  active line on level @p level.
+                                     */
+    active_line_iterator last_active_line (const unsigned int level) const;
+                                    /*@}*/       
+
+                                    /*---------------------------------------*/
+
+                                    /**
+                                     *  @name Quad iterator functions*/
+                                    /*@{
+                                     */
+                                    /**
+                                     *  Iterator to the first quad, used
+                                     *  or not, on level @p level. If a level
+                                     *  has no quads, a past-the-end iterator
+                                     *  is returned.
+                                     */
+    raw_quad_iterator    begin_raw_quad   (const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator to the first used quad
+                                     *  on level @p level.
+                                     */
+    quad_iterator        begin_quad       (const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator to the first active
+                                     *  quad on level @p level.
+                                     */
+    active_quad_iterator begin_active_quad(const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator past the end; this
+                                     *  iterator serves for comparisons of
+                                     *  iterators with past-the-end or
+                                     *  before-the-beginning states.
+                                     */
+    raw_quad_iterator    end_quad () const;
+
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If @p level is
+                                     * the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    quad_iterator        end_quad (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If @p level is
+                                     * the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    raw_quad_iterator    end_raw_quad (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If @p level
+                                     * is the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    active_quad_iterator end_active_quad (const unsigned int level) const;
+
+
+                                    /**
+                                     *  Return an iterator pointing to the
+                                     *  last quad, used or not.
+                                     */
+    raw_quad_iterator    last_raw_quad () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  quad of the level @p level, used or not.
+
+                                     */
+    raw_quad_iterator    last_raw_quad (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  used quad.
+                                     */
+    quad_iterator        last_quad () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  used quad on level @p level.
+                                     */
+    quad_iterator        last_quad (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  active quad.
+                                     */
+    active_quad_iterator last_active_quad () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  active quad on level @p level.
+                                     */
+    active_quad_iterator last_active_quad (const unsigned int level) const;
+                                    /*@}*/
+
+                                    /*---------------------------------------*/
+
+                                    /**
+                                     *  @name Hex iterator functions*/
+                                    /*@{
+                                     */
+                                    /**
+                                     *  Iterator to the first hex, used
+                                     *  or not, on level @p level. If a level
+                                     *  has no hexs, a past-the-end iterator
+                                     *  is returned.
+                                     */
+    raw_hex_iterator
+    begin_raw_hex   (const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator to the first used hex
+                                     *  on level @p level.
+                                     */
+    hex_iterator
+    begin_hex       (const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator to the first active
+                                     *  hex on level @p level.
+                                     */
+    active_hex_iterator
+    begin_active_hex(const unsigned int level = 0) const;
+
+                                    /**
+                                     *  Iterator past the end; this
+                                     *  iterator serves for comparisons of
+                                     *  iterators with past-the-end or
+                                     *  before-the-beginning states.
+                                     */
+    raw_hex_iterator
+    end_hex () const;
+
+                                    /**
+                                     * Return an iterator which is the first
+                                     * iterator not on level. If @p level is
+                                     * the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    hex_iterator        end_hex (const unsigned int level) const;
+    
+                                    /**
+                                     * Return a raw iterator which is the first
+                                     * iterator not on level. If @p level is
+                                     * the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    raw_hex_iterator    end_raw_hex (const unsigned int level) const;
+
+                                    /**
+                                     * Return an active iterator which is the
+                                     * first iterator not on level. If @p level
+                                     * is the last level, then this returns
+                                     * <tt>end()</tt>.
+                                     */
+    active_hex_iterator end_active_hex (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the
+                                     *  last hex, used or not.
+                                     */
+    raw_hex_iterator
+    last_raw_hex () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  hex of the level @p level, used or not.
+
+                                     */
+    raw_hex_iterator
+    last_raw_hex (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  used hex.
+                                     */
+    hex_iterator
+    last_hex () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  used hex on level @p level.
+                                     */
+    hex_iterator
+    last_hex (const unsigned int level) const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  active hex.
+                                     */
+    active_hex_iterator
+    last_active_hex () const;
+
+                                    /**
+                                     *  Return an iterator pointing to the last
+                                     *  active hex on level @p level.
+                                     */
+    active_hex_iterator
+    last_active_hex (const unsigned int level) const;
+                                    /*@}*/
+
+                                    /*---------------------------------------*/
+
+
+                                    /**
+                                     * Return number of degrees of freedom.
+                                     * Included in this number are those
+                                     * DoFs which are constrained by
+                                     * hanging nodes.
+                                     */
+    unsigned int n_dofs () const;
+
+                                    /**
+                                     * Return the number of degrees of freedom
+                                     * located on the boundary.
+                                     */
+    unsigned int n_boundary_dofs () const;
+
+                                    /**
+                                     * Return the number of degrees
+                                     * of freedom located on those
+                                     * parts of the boundary which
+                                     * have a boundary indicator
+                                     * listed in the given set. The
+                                     * reason that a @p map rather
+                                     * than a @p set is used is the
+                                     * same as descibed in the
+                                     * section on the
+                                     * @p make_boundary_sparsity_pattern
+                                     * function.
+                                     */
+    unsigned int
+    n_boundary_dofs (const FunctionMap &boundary_indicators) const;
+
+                                    /**
+                                     * Same function, but with
+                                     * different data type of the
+                                     * argument, which is here simply
+                                     * a list of the boundary
+                                     * indicators under
+                                     * consideration.
+                                     */
+    unsigned int
+    n_boundary_dofs (const std::set<unsigned char> &boundary_indicators) const;
+
+                                    /**
+                                     * Return a constant reference to
+                                     * the set of finite element
+                                     * objects that are used by this
+                                     * @p hpDoFHandler.
+                                     */
+    const FECollection<dim> & get_fe () const;
+
+                                    /**
+                                     * Return a constant reference to the
+                                     * triangulation underlying this object.
+                                     */
+    const Triangulation<dim> & get_tria () const;
+    
+                                    /**
+                                     * Determine an estimate for the
+                                     * memory consumption (in bytes)
+                                     * of this object.
+                                     *
+                                     * This function is made virtual,
+                                     * since a dof handler object
+                                     * might be accessed through a
+                                     * pointers to thisr base class,
+                                     * although the actual object
+                                     * might be a derived class.
+                                     */
+    virtual unsigned int memory_consumption () const;
+
+                                    /**
+                                     * Exception
+                                     */
+    DeclException0 (ExcInvalidTriangulation);
+                                    /**
+                                     * Exception
+                                     */
+    DeclException0 (ExcNoFESelected);
+                                    /**
+                                     * Exception
+                                     */
+    DeclException0 (ExcRenumberingIncomplete);
+                                    /**
+                                     * Exception
+                                     */
+    DeclException0 (ExcGridsDoNotMatch);
+                                    /**
+                                     * Exception
+                                     */
+    DeclException0 (ExcInvalidBoundaryIndicator);
+                                    /**
+                                     * Exception
+                                     */
+    DeclException1 (ExcMatrixHasWrongSize,
+                   int,
+                   << "The matrix has the wrong dimension " << arg1);
+                                    /**
+                                     *  Exception
+                                     */
+    DeclException0 (ExcFunctionNotUseful);
+                                    /**
+                                     * Exception
+                                     */
+    DeclException1 (ExcNewNumbersNotConsecutive,
+                   int,
+                   << "The given list of new dof indices is not consecutive: "
+                   << "the index " << arg1 << " does not exist.");
+
+  protected:
+    
+                                    /**
+                                     * Address of the triangulation to
+                                     * work on.
+                                     */
+    SmartPointer<const Triangulation<dim> > tria;
+
+                                    /**
+                                     * Store a pointer to the finite
+                                     * element set given latest for
+                                     * the distribution of dofs. In
+                                     * order to avoid destruction of
+                                     * the object before the lifetime
+                                     * of the DoF handler, we
+                                     * subscribe to the finite
+                                     * element object. To unlock the
+                                     * FE before the end of the
+                                     * lifetime of this DoF handler,
+                                     * use the <tt>clear()</tt> function
+                                     * (this clears all data of this
+                                     * object as well, though).
+                                     */
+    SmartPointer<const FECollection<dim> > finite_elements;
+
+  private:
+
+                                    /**
+                                     * Copy constructor. I can see no reason
+                                     * why someone might want to use it, so
+                                     * I don't provide it. Since this class
+                                     * has pointer members, making it private
+                                     * prevents the compiler to provide it's
+                                     * own, incorrect one if anyone chose to
+                                     * copy such an object.
+                                     */
+    hpDoFHandler (const hpDoFHandler &);
+
+                                    /**
+                                     * Copy operator. I can see no reason
+                                     * why someone might want to use it, so
+                                     * I don't provide it. Since this class
+                                     * has pointer members, making it private
+                                     * prevents the compiler to provide it's
+                                     * own, incorrect one if anyone chose to
+                                     * copy such an object.
+                                     */
+    hpDoFHandler & operator = (const hpDoFHandler &);
+
+                                    /**
+                                     * Reserve enough space in the 
+                                     * <tt>levels[]</tt> objects to store the
+                                     * numbers of the degrees of freedom
+                                     * needed for the given element. The
+                                     * given element is that one which
+                                     * was selected when calling
+                                     * @p distribute_dofs the last time.
+                                     */
+    void reserve_space ();
+
+                                    /**
+                                     * Free all used memory.
+                                     */
+    void clear_space ();
+    
+                                    /**
+                                     * Distribute dofs on the given cell,
+                                     * with new dofs starting with index
+                                     * @p next_free_dof. Return the next
+                                     * unused index number. The finite
+                                     * element used is the one given to
+                                     * @p distribute_dofs, which is copied
+                                     * to @p selected_fe.
+                                     *
+                                     * This function is excluded from the
+                                     * @p distribute_dofs function since
+                                     * it can not be implemented dimension
+                                     * independent.
+                                     */
+    unsigned int distribute_dofs_on_cell (active_cell_iterator &cell,
+                                         unsigned int next_free_dof);
+
+
+                                    /**
+                                     *  Create default tables for the
+                                     *  active_fe_indices in the
+                                     *  hpDoFLevel()s. They are
+                                     *  initialized with the base fe.
+                                     *  This method is called before
+                                     *  refinement and before distribute_dofs
+                                     *  is called. It ensures each cell has
+                                     *  a valid active_fe_index.
+                                     */
+
+    void create_active_fe_table ();
+
+                                    /**
+                                     *  Methods of the RefinementListener
+                                     *  coming from the Triangulation.
+                                     *  Here they are used to administrate the
+                                     *  the active_fe_fields during the spatial
+                                     *  refinement.
+                                     */
+
+    virtual void pre_refinement_notification (const Triangulation<dim> &tria);
+    virtual void post_refinement_notification (const Triangulation<dim> &tria);
+
+
+                                    /**
+                                     * Space to store the DoF numbers for the
+                                     * different levels. Analogous to the
+                                     * <tt>levels[]</tt> tree of the Triangulation
+                                     * objects.
+                                     */
+    std::vector<hpDoFLevel<dim>*>    levels;
+
+                                    /**
+                                     * Store the number of dofs created last
+                                     * time.
+                                     */
+    unsigned int              used_dofs;
+
+                                    /**
+                                     * Array to store the indices for degrees
+                                     * of freedom located at vertices.
+                                     */
+    std::vector<unsigned int>      vertex_dofs;
+
+                                     /**
+                                     * Array to store the information, if a
+                                     * cell on some level has children or
+                                     * not. It is used by the refinement
+                                     * listeners as a persistent buffer during
+                                     * the refinement.
+                                     */
+    std::vector<std::vector<bool> *> has_children;
+                                     
+                                    /**
+                                     * Make accessor objects friends.
+                                     */
+    template <int dim1, template <int> class DH> friend class DoFAccessor;
+
+                                    /**
+                                     * Make accessor objects friends.
+                                     */
+    template <int dim1, int dim2, template <int> class DH> friend class DoFObjectAccessor;
+
+                                    /**
+                                     * Make Triangulation friend.
+                                     */
+//    friend class Triangulation<dim>;
+};
+
+
+
+
+/* -------------- declaration of explicit specializations ------------- */
+
+template <> unsigned int hpDoFHandler<1>::n_boundary_dofs () const;
+template <> unsigned int hpDoFHandler<1>::n_boundary_dofs (const FunctionMap &) const;
+template <> unsigned int hpDoFHandler<1>::n_boundary_dofs (const std::set<unsigned char> &) const;
+template <> unsigned int hpDoFHandler<1>::max_couplings_between_dofs () const;
+template <> unsigned int hpDoFHandler<1>::max_couplings_between_boundary_dofs () const;
+template <> unsigned int hpDoFHandler<2>::max_couplings_between_dofs () const;
+template <> unsigned int hpDoFHandler<2>::max_couplings_between_boundary_dofs () const;
+template <> unsigned int hpDoFHandler<3>::max_couplings_between_dofs () const;
+template <> unsigned int hpDoFHandler<3>::max_couplings_between_boundary_dofs () const;
+
+template <> hpDoFHandler<1>::raw_cell_iterator hpDoFHandler<1>::begin_raw (const unsigned int level) const;
+template <> hpDoFHandler<1>::cell_iterator hpDoFHandler<1>::begin (const unsigned int level) const;
+template <> hpDoFHandler<1>::active_cell_iterator hpDoFHandler<1>::begin_active (const unsigned int level) const;
+template <> hpDoFHandler<1>::raw_cell_iterator hpDoFHandler<1>::end () const;
+template <> hpDoFHandler<1>::raw_cell_iterator hpDoFHandler<1>::last_raw () const;
+template <> hpDoFHandler<1>::raw_cell_iterator hpDoFHandler<1>::last_raw (const unsigned int level) const;
+template <> hpDoFHandler<1>::cell_iterator hpDoFHandler<1>::last () const;
+template <> hpDoFHandler<1>::cell_iterator hpDoFHandler<1>::last (const unsigned int level) const;
+template <> hpDoFHandler<1>::active_cell_iterator hpDoFHandler<1>::last_active () const;
+template <> hpDoFHandler<1>::active_cell_iterator hpDoFHandler<1>::last_active (const unsigned int level) const;
+template <> hpDoFHandler<1>::raw_face_iterator hpDoFHandler<1>::begin_raw_face (const unsigned int) const;
+template <> hpDoFHandler<1>::face_iterator hpDoFHandler<1>::begin_face (const unsigned int) const;
+template <> hpDoFHandler<1>::active_face_iterator hpDoFHandler<1>::begin_active_face (const unsigned int) const;
+template <> hpDoFHandler<1>::raw_face_iterator hpDoFHandler<1>::end_face () const;
+template <> hpDoFHandler<1>::raw_face_iterator hpDoFHandler<1>::last_raw_face () const;
+template <> hpDoFHandler<1>::raw_face_iterator hpDoFHandler<1>::last_raw_face (const unsigned int) const;
+template <> hpDoFHandler<1>::face_iterator hpDoFHandler<1>::last_face () const;
+template <> hpDoFHandler<1>::face_iterator hpDoFHandler<1>::last_face (const unsigned int) const;
+template <> hpDoFHandler<1>::active_face_iterator hpDoFHandler<1>::last_active_face () const;
+template <> hpDoFHandler<1>::active_face_iterator hpDoFHandler<1>::last_active_face (const unsigned int) const;
+template <> hpDoFHandler<1>::raw_quad_iterator hpDoFHandler<1>::begin_raw_quad (const unsigned int) const;
+template <> hpDoFHandler<1>::quad_iterator hpDoFHandler<1>::begin_quad (const unsigned int) const;
+template <> hpDoFHandler<1>::active_quad_iterator hpDoFHandler<1>::begin_active_quad (const unsigned int) const;
+template <> hpDoFHandler<1>::raw_quad_iterator hpDoFHandler<1>::end_quad () const;
+template <> hpDoFHandler<1>::raw_quad_iterator hpDoFHandler<1>::last_raw_quad (const unsigned int) const;
+template <> hpDoFHandler<1>::quad_iterator hpDoFHandler<1>::last_quad (const unsigned int) const;
+template <> hpDoFHandler<1>::active_quad_iterator hpDoFHandler<1>::last_active_quad (const unsigned int) const;
+template <> hpDoFHandler<1>::raw_quad_iterator hpDoFHandler<1>::last_raw_quad () const;
+template <> hpDoFHandler<1>::quad_iterator hpDoFHandler<1>::last_quad () const;
+template <> hpDoFHandler<1>::active_quad_iterator hpDoFHandler<1>::last_active_quad () const;
+template <> hpDoFHandler<1>::raw_hex_iterator hpDoFHandler<1>::begin_raw_hex (const unsigned int) const;
+template <> hpDoFHandler<1>::hex_iterator hpDoFHandler<1>::begin_hex (const unsigned int) const;
+template <> hpDoFHandler<1>::active_hex_iterator hpDoFHandler<1>::begin_active_hex (const unsigned int) const;
+template <> hpDoFHandler<1>::raw_hex_iterator hpDoFHandler<1>::end_hex () const;
+template <> hpDoFHandler<1>::raw_hex_iterator hpDoFHandler<1>::last_raw_hex (const unsigned int) const;
+template <> hpDoFHandler<1>::raw_hex_iterator hpDoFHandler<1>::last_raw_hex () const;
+template <> hpDoFHandler<1>::hex_iterator hpDoFHandler<1>::last_hex (const unsigned int) const;
+template <> hpDoFHandler<1>::hex_iterator hpDoFHandler<1>::last_hex () const;
+template <> hpDoFHandler<1>::active_hex_iterator hpDoFHandler<1>::last_active_hex (const unsigned int) const;
+template <> hpDoFHandler<1>::active_hex_iterator hpDoFHandler<1>::last_active_hex () const;
+template <> hpDoFHandler<2>::raw_cell_iterator hpDoFHandler<2>::begin_raw (const unsigned int level) const;
+template <> hpDoFHandler<2>::cell_iterator hpDoFHandler<2>::begin (const unsigned int level) const;
+template <> hpDoFHandler<2>::active_cell_iterator hpDoFHandler<2>::begin_active (const unsigned int level) const;
+template <> hpDoFHandler<2>::raw_cell_iterator hpDoFHandler<2>::end () const;
+template <> hpDoFHandler<2>::raw_cell_iterator hpDoFHandler<2>::last_raw () const;
+template <> hpDoFHandler<2>::raw_cell_iterator hpDoFHandler<2>::last_raw (const unsigned int level) const;
+template <> hpDoFHandler<2>::cell_iterator hpDoFHandler<2>::last () const;
+template <> hpDoFHandler<2>::cell_iterator hpDoFHandler<2>::last (const unsigned int level) const;
+template <> hpDoFHandler<2>::active_cell_iterator hpDoFHandler<2>::last_active () const;
+template <> hpDoFHandler<2>::active_cell_iterator hpDoFHandler<2>::last_active (const unsigned int level) const;
+template <> hpDoFHandler<2>::raw_face_iterator hpDoFHandler<2>::begin_raw_face (const unsigned int level) const;
+template <> hpDoFHandler<2>::face_iterator hpDoFHandler<2>::begin_face (const unsigned int level) const;
+template <> hpDoFHandler<2>::active_face_iterator hpDoFHandler<2>::begin_active_face (const unsigned int level) const;
+template <> hpDoFHandler<2>::raw_face_iterator hpDoFHandler<2>::end_face () const;
+template <> hpDoFHandler<2>::raw_face_iterator hpDoFHandler<2>::last_raw_face () const;
+template <> hpDoFHandler<2>::raw_face_iterator hpDoFHandler<2>::last_raw_face (const unsigned int level) const;
+template <> hpDoFHandler<2>::face_iterator hpDoFHandler<2>::last_face () const;
+template <> hpDoFHandler<2>::face_iterator hpDoFHandler<2>::last_face (const unsigned int level) const;
+template <> hpDoFHandler<2>::active_face_iterator hpDoFHandler<2>::last_active_face () const;
+template <> hpDoFHandler<2>::active_face_iterator hpDoFHandler<2>::last_active_face (const unsigned int level) const;
+template <> hpDoFHandler<2>::raw_hex_iterator hpDoFHandler<2>::begin_raw_hex (const unsigned int) const;
+template <> hpDoFHandler<2>::hex_iterator hpDoFHandler<2>::begin_hex (const unsigned int) const;
+template <> hpDoFHandler<2>::active_hex_iterator hpDoFHandler<2>::begin_active_hex (const unsigned int) const;
+template <> hpDoFHandler<2>::raw_hex_iterator hpDoFHandler<2>::end_hex () const;
+template <> hpDoFHandler<2>::raw_hex_iterator hpDoFHandler<2>::last_raw_hex (const unsigned int) const;
+template <> hpDoFHandler<2>::raw_hex_iterator hpDoFHandler<2>::last_raw_hex () const;
+template <> hpDoFHandler<2>::hex_iterator hpDoFHandler<2>::last_hex (const unsigned int) const;
+template <> hpDoFHandler<2>::hex_iterator hpDoFHandler<2>::last_hex () const;
+template <> hpDoFHandler<2>::active_hex_iterator hpDoFHandler<2>::last_active_hex (const unsigned int) const;
+template <> hpDoFHandler<2>::active_hex_iterator hpDoFHandler<2>::last_active_hex () const;
+template <> hpDoFHandler<3>::raw_cell_iterator hpDoFHandler<3>::begin_raw (const unsigned int level) const;
+template <> hpDoFHandler<3>::cell_iterator hpDoFHandler<3>::begin (const unsigned int level) const;
+template <> hpDoFHandler<3>::active_cell_iterator hpDoFHandler<3>::begin_active (const unsigned int level) const;
+template <> hpDoFHandler<3>::raw_cell_iterator hpDoFHandler<3>::end () const;
+template <> hpDoFHandler<3>::raw_cell_iterator hpDoFHandler<3>::last_raw () const;
+template <> hpDoFHandler<3>::raw_cell_iterator hpDoFHandler<3>::last_raw (const unsigned int level) const;
+template <> hpDoFHandler<3>::cell_iterator hpDoFHandler<3>::last () const;
+template <> hpDoFHandler<3>::cell_iterator hpDoFHandler<3>::last (const unsigned int level) const;
+template <> hpDoFHandler<3>::active_cell_iterator hpDoFHandler<3>::last_active () const;
+template <> hpDoFHandler<3>::active_cell_iterator hpDoFHandler<3>::last_active (const unsigned int level) const;
+template <> hpDoFHandler<3>::raw_face_iterator hpDoFHandler<3>::begin_raw_face (const unsigned int level) const;
+template <> hpDoFHandler<3>::face_iterator hpDoFHandler<3>::begin_face (const unsigned int level) const;
+template <> hpDoFHandler<3>::active_face_iterator hpDoFHandler<3>::begin_active_face (const unsigned int level) const;
+template <> hpDoFHandler<3>::raw_face_iterator hpDoFHandler<3>::end_face () const;
+template <> hpDoFHandler<3>::raw_face_iterator hpDoFHandler<3>::last_raw_face () const;
+template <> hpDoFHandler<3>::raw_face_iterator hpDoFHandler<3>::last_raw_face (const unsigned int level) const;
+template <> hpDoFHandler<3>::face_iterator hpDoFHandler<3>::last_face () const;
+template <> hpDoFHandler<3>::face_iterator hpDoFHandler<3>::last_face (const unsigned int level) const;
+template <> hpDoFHandler<3>::active_face_iterator hpDoFHandler<3>::last_active_face () const;
+template <> hpDoFHandler<3>::active_face_iterator hpDoFHandler<3>::last_active_face (const unsigned int level) const;
+
+template <>
+unsigned int hpDoFHandler<1>::distribute_dofs_on_cell (active_cell_iterator &cell,
+                                                    unsigned int          next_free_dof);
+template <>
+unsigned int hpDoFHandler<2>::distribute_dofs_on_cell (active_cell_iterator &cell,
+                                                    unsigned int          next_free_dof);
+template <>
+unsigned int hpDoFHandler<3>::distribute_dofs_on_cell (active_cell_iterator &cell,
+                                                    unsigned int          next_free_dof);
+template <> void hpDoFHandler<1>::renumber_dofs (const std::vector<unsigned int> &new_numbers);
+template <> void hpDoFHandler<2>::renumber_dofs (const std::vector<unsigned int> &new_numbers);
+template <> void hpDoFHandler<3>::renumber_dofs (const std::vector<unsigned int> &new_numbers);
+template <> void hpDoFHandler<1>::reserve_space ();
+template <> void hpDoFHandler<2>::reserve_space ();
+template <> void hpDoFHandler<3>::reserve_space ();
+
+/* ----------------------- Inline functions ---------------------------------- */
+
+template <int dim>
+inline
+unsigned int
+hpDoFHandler<dim>::n_dofs () const
+{
+  return used_dofs;
+}
+
+
+
+template <int dim>
+inline
+const FECollection<dim> &
+hpDoFHandler<dim>::get_fe () const
+{
+  return *finite_elements;
+}
+
+
+template <int dim>
+inline
+const Triangulation<dim> &
+hpDoFHandler<dim>::get_tria () const
+{
+  return *tria;
+}
+
+
+/*----------------------------   dof.h     ---------------------------*/
+
+#endif
+/*----------------------------   dof.h     ---------------------------*/
diff --git a/deal.II/deal.II/include/dofs/hp_dof_levels.h b/deal.II/deal.II/include/dofs/hp_dof_levels.h
new file mode 100644 (file)
index 0000000..bd61d72
--- /dev/null
@@ -0,0 +1,222 @@
+//----------------------------  hp_dof_levels.h  ------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  hp_dof_levels.h  ------------------------
+#ifndef __deal2__hp_dof_levels_h
+#define __deal2__hp_dof_levels_h
+
+
+#include <base/config.h>
+#include <vector>
+
+
+/**
+ * Store the indices of the degrees of freedom which are located on
+ * objects of dimension @p N.  Declare this general template
+ * class, but do not actually use it. Rather, only specializations of
+ * this class are used.
+ *
+ * @author Wolfgang Bangerth, 1998, Oliver Kayser-Herold 2003.
+ */
+template <int N>
+class hpDoFLevel
+{
+  private:
+                                       /**
+                                        * Make the constructor private
+                                        * to avoid that someone uses
+                                        * this class.
+                                        */
+    hpDoFLevel ();
+};
+
+
+/**
+ *  Store all information which belongs to one level of the multilevel hierarchy.
+ *
+ *  In @ref{hpDoFLevel<0>} all data is stored which is not
+ *  dependent on the dimension, e.g. a field to store the
+ *  index referring to the FECollection class.
+ */
+template <>
+class hpDoFLevel<0>
+{
+  public:
+                                    /**
+                                     *  Indices specifying the finite element
+                                     *  of FECollection to use for the
+                                     *  different cells. The meaning
+                                     *  what a cell is, is dimension specific,
+                                     *  therefore also the length of this
+                                     *  vector depends on the dimension: in
+                                     *  one dimension, the length of this
+                                     *  vector equals the length of the
+                                     *  @p lines vector, in two dimensions
+                                     *  that of the @p quads vector, etc.
+                                     */
+
+    std::vector<unsigned int> active_fe_indices;
+};
+
+
+/**
+ * Store the indices of the degrees of freedom which are located on
+ * the lines.
+ *
+ * @sect3{Information for all hpDoFLevel() classes}
+ *
+ * The hpDoFLevel()<tt><N></tt> classes 
+ * store the global indices of the degrees of freedom for each cell on a
+ * certain level. The index or number of a degree of freedom is the zero-based
+ * index of the according value in the solution vector and the row and column
+ * index in the global matrix or the multigrid matrix for this level. These
+ * indices refer to the unconstrained vectors and matrices, where we have not
+ * taken account of the constraints introduced by hanging nodes. If more than
+ * one value corresponds to one basis function, for example for vector equations
+ * where the solution is vector valued and thus has several degrees of freedom
+ * for each basis function, we nonetheless store only one index. This can then
+ * be viewed as the index into a block vector, where each block contains the
+ * different values according to a degree of freedom. It is left to the derived
+ * classes, whether the values in a block are stored consecutively or distributed
+ * (e.g. if the solution function is $u=(u_1, u_2)$, we could store the values
+ * in the solution vector like
+ * $\ldots, u_1^m, u_2^m, u_1^{m+1}, u_2^{m+1},\ldots$ with $m$ denoting the
+ * $m$th basis function, or $\ldots, u_1^m, u_1^{m+1}, u_1^{m+2}, \ldots,
+ * u_2^m, u_2^{m+1}, u_2^{m+2}, \ldots$, respectively). Likewise, the
+ * constraint matrix returned by DoFHandler<tt>::make_hanging_node_constraints ()</tt>
+ * is then
+ * to be understood as a block matrix.
+ *
+ * The storage format of the degrees of freedom indices (short: DoF
+ * indices) is somewhat like a mirror of the data structures of the
+ * triangulation classes.  There is a hierarchy of
+ * hpDoFLevel()<tt><dim></tt> classes for the different dimensions which
+ * have objects named @p line_dofs, @p quad_dofs and so on, in which
+ * the indices of DoFs located on lines and quads, respectively, are
+ * stored. The indices are stored levelwise. 
+ *
+ * Due to the fact that different elements could have a different number
+ * of DoFs on each line, the DoFs on each line are stored in a nested data
+ * structure. @p dof_line_index_offset is used to find the start of the
+ * DoFs indices inside @p line_dofs. Hence the retrieval of DoF indices
+ * for a specific line @p i is a two step process:
+ * 1. Determine the index @p j in @p line_dofs, as the @p ith element of
+ *    @p dof_line_index_offset
+ * 2. Get the DoF indices starting from the @p jth element in @p line_dofs.
+ *
+ * The DoF indices for vertices are not stored this way, since they
+ * need different treatment in multigrid environments. If no multigrid
+ * is used, the indices are stored in the @p vertex_dofs array of the
+ * DoFHandler class.
+ *
+ * @author Wolfgang Bangerth, 1998, Oliver Kayser-Herold 2003.
+ */
+template <>
+class hpDoFLevel<1> : public hpDoFLevel<0>
+{
+  public:
+
+                                       /**
+                                       * Store the start index for
+                                       * the degrees of freedom of each
+                                       * line in the @p line_dofs array.
+                                       */
+    std::vector<unsigned int> dof_line_index_offset;
+
+                                       /**
+                                        * Store the global indices of
+                                        * the degrees of freedom. See
+                                        * hpDoFLevel() for detailed
+                                        * information.
+                                        */
+    std::vector<unsigned int> line_dofs;
+
+                                       /**
+                                        * Determine an estimate for the
+                                        * memory consumption (in bytes)
+                                        * of this object.
+                                        */
+    unsigned int memory_consumption () const;
+};
+
+
+/**
+ * Store the indices of the degrees of freedom which are located on
+ * quads.  See @ref{hpDoFLevel<1>} for more information.
+ *
+ * @author Wolfgang Bangerth, 1998, Oliver Kayser-Herold 2003.
+ */
+template <>
+class hpDoFLevel<2> : public hpDoFLevel<1>
+{
+  public:
+
+                                       /**
+                                       * Store the start index for
+                                       * the degrees of freedom of each
+                                       * quad in the @p quad_dofs array.
+                                       */
+    std::vector<unsigned int> dof_quad_index_offset;
+
+                                       /**
+                                        * Store the global indices of
+                                        * the degrees of freedom. See
+                                        * hpDoFLevel() for detailed
+                                        * information.
+                                        */
+    std::vector<unsigned int> quad_dofs;
+
+                                       /**
+                                        * Determine an estimate for the
+                                        * memory consumption (in bytes)
+                                        * of this object.
+                                        */
+    unsigned int memory_consumption () const;
+};
+
+
+
+/**
+ * Store the indices of the degrees of freedom which are located on
+ * hexhedra.  See @ref{hpDoFLevel<1>} for more information.
+ *
+ * @author Wolfgang Bangerth, 1998, Oliver Kayser-Herold 2003.
+ */
+template <>
+class hpDoFLevel<3> : public hpDoFLevel<2>
+{
+  public:
+
+                                       /**
+                                       * Store the start index for
+                                       * the degrees of freedom of each
+                                       * hex in the @p hex_dofs array.
+                                       */
+    std::vector<unsigned int> dof_hex_index_offset;
+
+                                       /**
+                                        * Store the global indices of
+                                        * the degrees of freedom. See
+                                        * hpDoFLevel() for detailed
+                                        * information.
+                                        */
+    std::vector<unsigned int> hex_dofs;
+
+                                       /**
+                                        * Determine an estimate for the
+                                        * memory consumption (in bytes)
+                                        * of this object.
+                                        */
+    unsigned int memory_consumption () const;
+};
+
+
+#endif
diff --git a/deal.II/deal.II/include/fe/fe_collection.h b/deal.II/deal.II/include/fe/fe_collection.h
new file mode 100644 (file)
index 0000000..ff24d2b
--- /dev/null
@@ -0,0 +1,279 @@
+//----------------------------  fe_collection.h  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003, 2004 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  fe_collection.h  ---------------------------
+#ifndef __deal2__fe_collection_h
+#define __deal2__fe_collection_h
+
+#include <base/config.h>
+#include <base/subscriptor.h>
+#include <fe/fe.h>
+
+
+/**
+ * This class acts as a collection of finite element objects used in the
+ * hpDoFHandler(). It is thus to a hpDoFHandler() what a
+ * FiniteElement is to a DoFHandler. This collection stores copies
+ * of the original elements added to it, and is therefore handling its memory
+ * manegement itself.
+ *
+ * In addition to offering access to the elements of the collection, this
+ * class provides access to the maximal number of degrees of freedom per
+ * vertex, line, etc, to allow allocation of as much memory as is necessary in
+ * the worst case when using the finite elements associated with the cells of
+ * a triangulation.
+ * 
+ * @author Wolfgang Bangerth, 2003
+ */
+template <int dim>
+class FECollection : public Subscriptor
+{
+  public:
+                                     /**
+                                      * Destructor. Destroy the elements of
+                                      * the collection.
+                                      */
+    ~FECollection ();
+    
+                                     /**
+                                      * Add a finite element. This function
+                                      * generates a copy of the given element,
+                                      * i.e. you can do things like
+                                      * <tt>add_fe(FE_Q<dim>(1));</tt>. The
+                                      * internal copy is later destroyed by
+                                      * this object upon destruction of the
+                                      * entire collection.
+                                      *
+                                      * The returned value is the new number
+                                      * of finite elements in the collection.
+                                      *
+                                      * When a new element is added, it needs
+                                      * to have the same number of vector
+                                      * components as all other elements
+                                      * already in the collection.
+                                      */
+    unsigned int
+    add_fe (const FiniteElement<dim> &new_fe);
+
+                                     /**
+                                      * Get a reference to the given element
+                                      * in this collection.
+                                      */
+    const FiniteElement<dim> &
+    get_fe (const unsigned int index) const;
+
+                                     /**
+                                      * Return the number of finite element
+                                      * objects stored in this collection.
+                                      */
+    unsigned int n_finite_elements () const;
+
+                                     /**
+                                      * Return the number of vector components
+                                      * of the finite elements in this
+                                      * collection.  This number must be the
+                                      * same for all elements in the
+                                      * collection.
+                                      */
+    unsigned int n_components () const;
+
+                                     /**
+                                      * Return the maximal number of degrees
+                                      * of freedom per vertex over all
+                                      * elements of this collection.
+                                      */
+    unsigned int max_dofs_per_vertex () const;
+
+                                     /**
+                                      * Return the maximal number of degrees
+                                      * of freedom per line over all elements
+                                      * of this collection.
+                                      */
+    unsigned int max_dofs_per_line () const;
+
+                                     /**
+                                      * Return the maximal number of degrees
+                                      * of freedom per quad over all elements
+                                      * of this collection.
+                                      */
+    unsigned int max_dofs_per_quad () const;
+
+                                     /**
+                                      * Return the maximal number of degrees
+                                      * of freedom per hex over all elements
+                                      * of this collection.
+                                      */
+    unsigned int max_dofs_per_hex () const;
+
+                                     /**
+                                      * Return the maximal number of degrees
+                                      * of freedom per face over all elements
+                                      * of this collection.
+                                      */
+    unsigned int max_dofs_per_face () const;
+
+                                     /**
+                                      * Return the maximal number of degrees
+                                      * of freedom per cell over all elements
+                                      * of this collection.
+                                      */
+    unsigned int max_dofs_per_cell () const;
+
+                                     /**
+                                      * Return an estimate for the memory
+                                      * allocated for this object.
+                                      */
+    unsigned int memory_consumption () const;
+
+                                     /**
+                                      * Exception
+                                      */
+    DeclException0 (ExcNoFiniteElements);    
+    
+  private:
+                                     /**
+                                      * Array of pointers to the finite
+                                      * elements stored by this collection.
+                                      */
+    std::vector<SmartPointer<const FiniteElement<dim> > > finite_elements;
+};
+
+
+
+/* --------------- inline functions ------------------- */
+
+template <int dim>
+inline
+unsigned int
+FECollection<dim>::n_finite_elements () const 
+{
+  return finite_elements.size();
+}
+
+
+template <int dim>
+inline
+unsigned int
+FECollection<dim>::n_components () const
+{
+  Assert (finite_elements.size () > 0, ExcNoFiniteElements());
+  return finite_elements[0]->n_components ();
+}
+
+
+template <int dim>
+inline
+const FiniteElement<dim> &
+FECollection<dim>::get_fe (const unsigned int index) const 
+{
+  Assert (index < finite_elements.size(),
+          ExcIndexRange (index, 0, finite_elements.size()));
+  return *finite_elements[index];
+}
+
+
+
+template <int dim>
+unsigned int
+FECollection<dim>::max_dofs_per_vertex () const 
+{
+  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+  
+  unsigned int max = 0;
+  for (unsigned int i=0; i<finite_elements.size(); ++i)
+    if (finite_elements[i]->dofs_per_vertex > max)
+      max = finite_elements[i]->dofs_per_vertex;
+
+  return max;
+}
+
+
+
+template <int dim>
+unsigned int
+FECollection<dim>::max_dofs_per_line () const 
+{
+  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+  
+  unsigned int max = 0;
+  for (unsigned int i=0; i<finite_elements.size(); ++i)
+    if (finite_elements[i]->dofs_per_line > max)
+      max = finite_elements[i]->dofs_per_line;
+
+  return max;
+}
+
+
+
+template <int dim>
+unsigned int
+FECollection<dim>::max_dofs_per_quad () const 
+{
+  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+  
+  unsigned int max = 0;
+  for (unsigned int i=0; i<finite_elements.size(); ++i)
+    if (finite_elements[i]->dofs_per_quad > max)
+      max = finite_elements[i]->dofs_per_quad;
+
+  return max;
+}
+
+
+
+template <int dim>
+unsigned int
+FECollection<dim>::max_dofs_per_hex () const 
+{
+  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+  
+  unsigned int max = 0;
+  for (unsigned int i=0; i<finite_elements.size(); ++i)
+    if (finite_elements[i]->dofs_per_hex > max)
+      max = finite_elements[i]->dofs_per_hex;
+
+  return max;
+}
+
+
+
+template <int dim>
+unsigned int
+FECollection<dim>::max_dofs_per_face () const 
+{
+  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+  
+  unsigned int max = 0;
+  for (unsigned int i=0; i<finite_elements.size(); ++i)
+    if (finite_elements[i]->dofs_per_face > max)
+      max = finite_elements[i]->dofs_per_face;
+
+  return max;
+}
+
+
+
+template <int dim>
+unsigned int
+FECollection<dim>::max_dofs_per_cell () const 
+{
+  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+  
+  unsigned int max = 0;
+  for (unsigned int i=0; i<finite_elements.size(); ++i)
+    if (finite_elements[i]->dofs_per_cell > max)
+      max = finite_elements[i]->dofs_per_cell;
+
+  return max;
+}
+
+
+#endif
index 2a7e69f5149f363d74b8664fa7bd1932e09c485a..5515948cdd6f74e9b1692f82de6be575a0f7372c 100644 (file)
@@ -540,13 +540,15 @@ class FETools
                                      * object.
                                      */
     template <int dim,
+              template <int> class DH1,
+              template <int> class DH2,
               class InVector, class OutVector>
     static
     void
-    interpolate (const DoFHandler<dim> &dof1,
-                 const InVector        &u1,
-                 const DoFHandler<dim> &dof2,
-                 OutVector             &u2);
+    interpolate (const DH1<dim> &dof1,
+                 const InVector &u1,
+                 const DH2<dim> &dof2,
+                 OutVector      &u2);
     
                                     /**
                                      * Gives the interpolation of a
@@ -586,7 +588,25 @@ class FETools
                             const InVector&         u1,
                             const DoFHandler<dim>&  dof2,
                             const ConstraintMatrix& constraints,
-                            OutVector&              u2);    
+                            OutVector&              u2);
+
+
+                                     /**
+                                      * Same as last function, except
+                                      * that one or both of the dof
+                                      * handler objects might be of
+                                      * type @p hpDoFHandler.
+                                      */
+    template <int dim,
+              template <int> class DH1,
+              template <int> class DH2,              
+              class InVector, class OutVector>
+    static void interpolate (const DH1<dim>         &dof1,
+                            const InVector         &u1,
+                            const DH2<dim>         &dof2,
+                            const ConstraintMatrix &constraints,
+                            OutVector&              u2);
+    
 
                                     /**
                                      * Gives the interpolation of the
@@ -616,6 +636,20 @@ class FETools
                                      */
     template <int dim, class InVector, class OutVector>
     static void back_interpolate (const DoFHandler<dim>    &dof1,
+                                 const InVector           &u1,
+                                 const FiniteElement<dim> &fe2,
+                                 OutVector                &u1_interpolated);
+
+                                     /**
+                                      * Same as last function, except
+                                      * that the dof handler objects
+                                      * might be of type
+                                      * @p hpDoFHandler.
+                                      */
+    template <int dim,
+              template <int> class DH,
+              class InVector, class OutVector>
+    static void back_interpolate (const DH<dim>            &dof1,
                                  const InVector           &u1,
                                  const FiniteElement<dim> &fe2,
                                  OutVector                &u1_interpolated);
index d089a7317c8799ea130ca8d87ba4894e5ff1050d..ba05db4c486e9852aec572a7f75af2176a0cfb3f 100644 (file)
@@ -30,6 +30,7 @@
 #include <grid/tria_iterator.h>
 #include <dofs/dof_handler.h>
 #include <dofs/dof_accessor.h>
+#include <dofs/hp_dof_handler.h>
 #include <fe/fe.h>
 #include <fe/fe_update_flags.h>
 #include <fe/mapping.h>
@@ -1671,6 +1672,21 @@ class FEValues : public FEValuesBase<dim>
                                      */
     void reinit (const typename DoFHandler<dim>::cell_iterator &cell);
 
+                                    /**
+                                     * Reinitialize the gradients,
+                                     * Jacobi determinants, etc for
+                                     * the given cell of type
+                                     * "iterator into a hpDoFHandler
+                                     * object", and the finite
+                                     * element associated with this
+                                     * object. It is assumed that the
+                                     * finite element used by the
+                                     * given cell is also the one
+                                     * used by this @p FEValues
+                                     * object.
+                                     */
+    void reinit (const typename hpDoFHandler<dim>::cell_iterator &cell);
+
                                     /**
                                      * Reinitialize the gradients,
                                      * Jacobi determinants, etc for
@@ -1942,7 +1958,23 @@ class FEFaceValues : public FEFaceValuesBase<dim>
                                      */
     void reinit (const typename DoFHandler<dim>::cell_iterator &cell,
                 const unsigned int                            face_no);
-    
+
+                                    /**
+                                     * Reinitialize the gradients,
+                                     * Jacobi determinants, etc for
+                                     * the given cell of type
+                                     * "iterator into a hpDoFHandler
+                                     * object", and the finite
+                                     * element associated with this
+                                     * object. It is assumed that the
+                                     * finite element used by the
+                                     * given cell is also the one
+                                     * used by this FEValues
+                                     * object.
+                                     */
+    void reinit (const typename hpDoFHandler<dim>::cell_iterator &cell,
+                const unsigned int                              face_no);
+
                                     /**
                                      * Reinitialize the gradients,
                                      * Jacobi determinants, etc for
@@ -1957,7 +1989,7 @@ class FEFaceValues : public FEFaceValuesBase<dim>
                                      * object.
                                      */
     void reinit (const typename MGDoFHandler<dim>::cell_iterator &cell,
-                const unsigned int                               face_no);
+                const unsigned int                              face_no);
 
                                     /**
                                      * Reinitialize the gradients,
@@ -2094,7 +2126,24 @@ class FESubfaceValues : public FEFaceValuesBase<dim>
                 const unsigned int                    face_no,
                 const unsigned int                    subface_no);
 
-                                    /**
+                                    /**
+                                     * Reinitialize the gradients,
+                                     * Jacobi determinants, etc for
+                                     * the given cell of type
+                                     * "iterator into a hpDoFHandler
+                                     * object", and the finite
+                                     * element associated with this
+                                     * object. It is assumed that the
+                                     * finite element used by the
+                                     * given cell is also the one
+                                     * used by this FEValues
+                                     * object.
+                                     */
+    void reinit (const typename hpDoFHandler<dim>::cell_iterator &cell,
+                const unsigned int                    face_no,
+                const unsigned int                    subface_no);
+    
+                                    /**
                                      * Reinitialize the gradients,
                                      * Jacobi determinants, etc for
                                      * the given cell of type
@@ -2110,7 +2159,7 @@ class FESubfaceValues : public FEFaceValuesBase<dim>
     void reinit (const typename MGDoFHandler<dim>::cell_iterator &cell,
                 const unsigned int                    face_no,
                 const unsigned int                    subface_no);
-
+    
                                     /**
                                      * Reinitialize the gradients,
                                      * Jacobi determinants, etc for
@@ -2140,7 +2189,7 @@ class FESubfaceValues : public FEFaceValuesBase<dim>
     void reinit (const typename Triangulation<dim>::cell_iterator &cell,
                 const unsigned int                    face_no,
                 const unsigned int                    subface_no);
-    
+
                                      /**
                                       * Return a reference to this
                                       * very object.
diff --git a/deal.II/deal.II/include/fe/hp_fe_values.h b/deal.II/deal.II/include/fe/hp_fe_values.h
new file mode 100644 (file)
index 0000000..4d40559
--- /dev/null
@@ -0,0 +1,476 @@
+//----------------------------  hp_fe_values.h  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003, 2004 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  hp_fe_values.h  ---------------------------
+#ifndef __deal2__hp_fe_values_h
+#define __deal2__hp_fe_values_h
+
+#include <base/config.h>
+#include <fe/fe.h>
+#include <fe/fe_collection.h>
+#include <fe/q_collection.h>
+#include <fe/mapping_collection.h>
+#include <fe/fe_values.h>
+
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+template <int dim> class MappingQ1;
+template <int dim> class FiniteElement;
+
+
+namespace internal 
+{
+/**
+ * Map between finite element objects and @p FEValues (the second
+ * template parameter, which might be <tt>FEValues<dim></tt>,
+ * <tt>FEFaceValues<dim></tt>, ...) objects. The <tt>hpFE*Values</tt> classes
+ * use this to hold an <tt>FE*Values</tt> object for each finite element
+ * that is used in the triangulation that it integrates on.
+ */
+  template <int dim, class FEValues>
+  class FEValuesMap
+  {
+    public:
+                                       /**
+                                        * Make destructor virtual,
+                                        * since we have virtual
+                                        * functions in this class.
+                                        */
+      virtual ~FEValuesMap ();
+      
+                                       /**
+                                        * Return a reference to the
+                                        * @p FEValues object selected
+                                        * by the last call to
+                                        * @p select_fe_values. The
+                                        * returned value is a constant
+                                        * reference since the only
+                                        * non-const function in the
+                                        * underlying class would be
+                                        * @p reinit, which you must
+                                        * not call directly any way;
+                                        * rather, use the @p reinit
+                                        * function of the
+                                        * <tt>hpFE*Values</tt> class.
+                                        */
+      const FEValues & get_present_fe_values () const;
+
+    protected:
+                                       /**
+                                        * Create an object of type
+                                        * @p FEValues for this
+                                        * particular finite
+                                        * element. Since the type of
+                                        * @p FEValues is not known
+                                        * here, we have to leave this
+                                        * to derived classes.
+                                        */
+      virtual
+      FEValues * create_fe_values (const FiniteElement<dim> &fe) const = 0;
+      
+                                       /**
+                                        * Select the @p FEValues
+                                        * object corresponding to the
+                                        * finite element object given
+                                        * as argument. If there is no
+                                        * such @p FEValues object
+                                        * yet, then one is created by
+                                        * calling @p create_fe_values
+                                        * with this finite element
+                                        * object.
+                                        *
+                                        * A non-const reference to
+                                        * this object is returned.
+                                        */
+      FEValues &
+      select_fe_values (const FiniteElement<dim> &fe);
+      
+
+                                       /**
+                                        * This field remembers the
+                                       * @p{active_fe_index} of the
+                                       * cell, which was used for
+                                       * the last call to @p{reinit}.
+                                       */
+      unsigned int present_fe_index;
+
+    private:
+                                       /**
+                                        * Have a map from pointers to
+                                        * finite elements to objects
+                                        * of type @p FEValues.
+                                        *
+                                        * Note that the shared pointer
+                                        * will make sure that the
+                                        * memory previously allocated
+                                        * is released when the
+                                        * destructor of this class is
+                                        * run.
+                                        */
+      std::map<SmartPointer<const FiniteElement<dim> >,
+               boost::shared_ptr<FEValues> > fe_to_fe_values_map;
+
+                                       /**
+                                        * Pointer to the @p FEValues
+                                        * object that is used for the
+                                        * present cell. This always
+                                        * points to one of the objects
+                                        * in the map above, and to
+                                        * which one is determined by
+                                        * the last call to
+                                        * @p select_fe_values.
+                                        */
+      boost::shared_ptr<FEValues> present_fe_values;
+
+  };
+
+
+/**
+ * Base class for the <tt>hpFE*Values</tt> classes, storing the data that
+ * is common to them. The first template parameter denotes the space
+ * dimension we are in, the second the dimensionality of the object
+ * that we integrate on, i.e. for usual @p hpFEValues it is equal to
+ * the first one, while for face integration it is one less.
+ *
+ * @author Wolfgang Bangerth, 2003
+ */
+  template <int dim, int q_dim>
+  class hpFEValuesBase 
+  {
+  private:
+                                       /**
+                                        * Default mapping, in case
+                                        * none was provided through
+                                        * the call to the constructor.
+                                        */
+      static const MappingQ1<dim> default_mapping;
+
+  public:
+                                       /**
+                                        * Constructor. Set the fields
+                                        * of this class to the values
+                                        * indicated by the parameters
+                                        * to the constructor.
+                                        */
+      hpFEValuesBase (const MappingCollection<dim> &mapping_collection,
+                      const QCollection<q_dim>     &qcollection,
+                      const UpdateFlags             update_flags);
+
+
+                                       /**
+                                        * Constructor. Set the fields
+                                        * of this class to the values
+                                        * indicated by the parameters
+                                        * to the constructor, and
+                                        * choose a @p MappingQ1
+                                        * object for the mapping
+                                        * object.
+                                        */
+      hpFEValuesBase (const QCollection<q_dim> &qcollection,
+                      const UpdateFlags         update_flags);
+
+
+  protected:
+                                       /**
+                                       * A copy of the MappingCollection
+                                       * object, which was specified
+                                       * upon construction of the
+                                       * object.
+                                        */
+      const MappingCollection<dim> mapping_collection;
+    
+                                       /**
+                                        * Copy of the quadrature
+                                       * collection object
+                                        * provided to the
+                                        * constructor.
+                                        */
+      const QCollection<q_dim> qcollection;
+
+                                       /**
+                                        * Values of the update flags as
+                                        * given to the constructor.
+                                        */
+      const UpdateFlags update_flags;
+  };
+}
+
+
+
+template <int dim>
+class hpFEValues : public internal::FEValuesMap<dim,FEValues<dim> >,
+                   protected internal::hpFEValuesBase<dim,dim>
+{
+  public:
+                                     /**
+                                      * Constructor. Initialize this
+                                      * object with the given
+                                      * parameters.
+                                      *
+                                      * The finite element
+                                      * collection parameter is
+                                      * actually ignored, but is in
+                                      * the signature of this
+                                      * function to make it
+                                      * compatible with the
+                                      * signature of the respective
+                                      * constructor of the usual
+                                      * FEValues object, with
+                                      * the respective parameter in
+                                      * that function also being the
+                                      * return value of the
+                                      * DoFHandler<tt>::get_fe()</tt>
+                                      * function.
+                                      */
+    hpFEValues (const MappingCollection<dim> &mapping_collection,
+                const FECollection<dim>      &fe_collection,
+                const QCollection<dim>       &qcollection,
+                const UpdateFlags             update_flags);
+
+
+                                     /**
+                                      * Constructor. Initialize this
+                                      * object with the given
+                                      * parameters, and choose a
+                                      * @p MappingQ1 object for the
+                                      * mapping object.
+                                      *
+                                      * The finite element
+                                      * collection parameter is
+                                      * actually ignored, but is in
+                                      * the signature of this
+                                      * function to make it
+                                      * compatible with the
+                                      * signature of the respective
+                                      * constructor of the usual
+                                      * FEValues object, with
+                                      * the respective parameter in
+                                      * that function also being the
+                                      * return value of the
+                                      * DoFHandler<tt>::get_fe()</tt>
+                                      * function.
+                                      */
+    hpFEValues (const FECollection<dim> &fe_collection,
+                const QCollection<dim>  &qcollection,
+                const UpdateFlags        update_flags);
+
+
+                                     /**
+                                      * Reinitialize the object for
+                                      * the given cell. This selects
+                                      * the right @p FEValues object
+                                      * for the finite element in use
+                                      * by the cell given, and calling
+                                      * the @p reinit function on
+                                      * this object.
+                                      */
+    void
+    reinit (const typename hpDoFHandler<dim>::cell_iterator &cell);
+
+  protected:
+                                     /**
+                                      * Create an object of type
+                                      * @p FEValues for this
+                                      * particular finite element.
+                                      */
+    virtual
+    FEValues<dim> *
+    create_fe_values (const FiniteElement<dim> &fe) const;
+};
+
+
+
+template <int dim>
+class hpFEFaceValues : public internal::FEValuesMap<dim,FEFaceValues<dim> >,
+                       protected internal::hpFEValuesBase<dim,dim-1>
+{
+  public:
+                                     /**
+                                      * Constructor. Initialize this
+                                      * object with the given
+                                      * parameters.
+                                      *
+                                      * The finite element
+                                      * collection parameter is
+                                      * actually ignored, but is in
+                                      * the signature of this
+                                      * function to make it
+                                      * compatible with the
+                                      * signature of the respective
+                                      * constructor of the usual
+                                      * FEValues object, with
+                                      * the respective parameter in
+                                      * that function also being the
+                                      * return value of the
+                                      * DoFHandler<tt>::get_fe()</tt>
+                                      * function.
+                                      */
+    hpFEFaceValues (const MappingCollection<dim> &mapping_collection,
+                    const FECollection<dim>      &fe_collection,
+                    const QCollection<dim-1>     &qcollection,
+                    const UpdateFlags             update_flags);
+
+
+                                     /**
+                                      * Constructor. Initialize this
+                                      * object with the given
+                                      * parameters, and choose a
+                                      * @p MappingQ1 object for the
+                                      * mapping object.
+                                      *
+                                      * The finite element
+                                      * collection parameter is
+                                      * actually ignored, but is in
+                                      * the signature of this
+                                      * function to make it
+                                      * compatible with the
+                                      * signature of the respective
+                                      * constructor of the usual
+                                      * FEValues object, with
+                                      * the respective parameter in
+                                      * that function also being the
+                                      * return value of the
+                                      * DoFHandler<tt>::get_fe()</tt>
+                                      * function.
+                                      */
+    hpFEFaceValues (const FECollection<dim>  &fe_collection,
+                    const QCollection<dim-1> &qcollection,
+                    const UpdateFlags         update_flags);
+
+
+                                     /**
+                                      * Reinitialize the object for
+                                      * the given cell. This selects
+                                      * the right @p FEValues object
+                                      * for the finite element in use
+                                      * by the cell given, and calling
+                                      * the @p reinit function on
+                                      * this object.
+                                      */
+    void
+    reinit (const typename hpDoFHandler<dim>::cell_iterator &cell,
+            const unsigned int face_no);
+
+  protected:
+                                     /**
+                                      * Create an object of type
+                                      * @p FEValues for this
+                                      * particular finite element.
+                                      */
+    virtual
+    FEFaceValues<dim> *
+    create_fe_values (const FiniteElement<dim> &fe) const;
+};
+
+
+
+template <int dim>
+class hpFESubfaceValues : public internal::FEValuesMap<dim,FESubfaceValues<dim> >,
+                          protected internal::hpFEValuesBase<dim,dim-1>
+{
+  public:
+                                     /**
+                                      * Constructor. Initialize this
+                                      * object with the given
+                                      * parameters.
+                                      *
+                                      * The finite element
+                                      * collection parameter is
+                                      * actually ignored, but is in
+                                      * the signature of this
+                                      * function to make it
+                                      * compatible with the
+                                      * signature of the respective
+                                      * constructor of the usual
+                                      * FEValues object, with
+                                      * the respective parameter in
+                                      * that function also being the
+                                      * return value of the
+                                      * DoFHandler<tt>::get_fe()</tt>
+                                      * function.
+                                      */
+    hpFESubfaceValues (const MappingCollection<dim> &mapping_collection,
+                       const FECollection<dim>      &fe_collection,
+                       const QCollection<dim-1>     &qcollection,
+                       const UpdateFlags             update_flags);
+
+
+                                     /**
+                                      * Constructor. Initialize this
+                                      * object with the given
+                                      * parameters, and choose a
+                                      * @p MappingQ1 object for the
+                                      * mapping object.
+                                      *
+                                      * The finite element
+                                      * collection parameter is
+                                      * actually ignored, but is in
+                                      * the signature of this
+                                      * function to make it
+                                      * compatible with the
+                                      * signature of the respective
+                                      * constructor of the usual
+                                      * FEValues object, with
+                                      * the respective parameter in
+                                      * that function also being the
+                                      * return value of the
+                                      * DoFHandler<tt>::get_fe()</tt>
+                                      * function.
+                                      */
+    hpFESubfaceValues (const FECollection<dim>  &fe_collection,
+                       const QCollection<dim-1> &qcollection,
+                       const UpdateFlags         update_flags);
+
+
+                                     /**
+                                      * Reinitialize the object for
+                                      * the given cell. This selects
+                                      * the right @p FEValues object
+                                      * for the finite element in use
+                                      * by the cell given, and calling
+                                      * the @p reinit function on
+                                      * this object.
+                                      */
+    void
+    reinit (const typename hpDoFHandler<dim>::cell_iterator &cell,
+            const unsigned int face_no,
+            const unsigned int subface_no);
+
+  protected:
+                                     /**
+                                      * Create an object of type
+                                      * @p FEValues for this
+                                      * particular finite element.
+                                      */
+    virtual
+    FESubfaceValues<dim> *
+    create_fe_values (const FiniteElement<dim> &fe) const;
+};
+
+
+// -------------- inline and template functions --------------
+
+namespace internal 
+{
+  template <int dim, class FEValues>
+  inline
+  const FEValues &
+  FEValuesMap<dim,FEValues>::get_present_fe_values () const
+  {
+    return *present_fe_values;
+  }
+}
+
+
+
+
+#endif
diff --git a/deal.II/deal.II/include/fe/mapping_collection.h b/deal.II/deal.II/include/fe/mapping_collection.h
new file mode 100644 (file)
index 0000000..ed111e5
--- /dev/null
@@ -0,0 +1,129 @@
+//------------------------  mapping_collection.h  --------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2005 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//------------------------  mapping_collection.h  --------------------------
+#ifndef __deal2__mapping_collection_h
+#define __deal2__mapping_collection_h
+
+#include <base/config.h>
+#include <base/subscriptor.h>
+#include <base/smartpointer.h>
+#include <fe/mapping.h>
+#include <fe/fe.h>
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+
+/**
+ * This class implements a collection of mapping objects used in the
+ * hpDoFHandler(). It is thus to a hpDoFHandler() what a Mapping is to a
+ * DoFHandler. This collection stores pointers to the original mapping
+ * objects added to it. Hence the handling of the memory consumed by
+ * the mapping objects must be done by the user of the class.
+ *
+ * Although it is strongly recommended to supply an appropriate mapping
+ * for each finite element type used in a hp-computation, the MappingCollection
+ * class implements a conversion constructor from a single mapping.
+ * Therefore it is possible to offer only a single mapping to the
+ * hpFEValues class instead of a MappingCollection. This is for the
+ * convenience of the user, as many simple geometries do not require
+ * different mappings along the boundary to achieve optimal convergence rates.
+ * Hence providing a single mapping object will usually suffice.
+ * 
+ * @author Oliver Kayser-Herold, 2005
+ */
+template <int dim>
+class MappingCollection : public Subscriptor
+{
+  public:
+                                     /**
+                                      * Default constructor. Initialises
+                                     * this QCollection.
+                                     */
+    MappingCollection ();
+
+                                     /**
+                                      * Conversion constructor. This
+                                     * constructor creates a MappingCollection
+                                     * from a single mapping. In
+                                     * the newly created MappingCollection, this
+                                     * mapping is used for all active_fe
+                                     * indices.
+                                     */
+    MappingCollection (const Mapping<dim> &mapping);
+
+                                     /**
+                                      * Returns the number of mapping
+                                     * objects stored in this container.
+                                     */
+    unsigned int n_mappings () const;
+
+                                     /**
+                                      * Returns the mapping object which
+                                     * was specified by the user for the
+                                     * active_fe_index which is provided
+                                     * as a parameter to this method.
+                                     */
+    const Mapping<dim> &
+    get_mapping (const unsigned int active_fe_index) const;
+    
+                                    /**
+                                     * Determine an estimate for the
+                                     * memory consumption (in bytes)
+                                     * of this object.
+                                     */
+    unsigned int memory_consumption () const;
+
+                                     /**
+                                      * Adds a new mapping to the MappingCollection.
+                                     * The mappings have to be added in the order
+                                     * of the active_fe_indices. Thus the reference
+                                     * to the mapping object for active_fe_index 0
+                                     * has to be added first, followed by the
+                                     * mapping object for active_fe_index 1.
+                                     */
+    unsigned int add_mapping (const Mapping<dim> &new_mapping);
+
+  private:
+                                    /**
+                                     * Upon construction of a <tt>MappingCollection</tt>
+                                     * the later functionality of the class is specified.
+                                     * Either it is a real collection, which provides
+                                     * different mappings for each active_fe_index
+                                     * or its a "unreal" collection, which returns
+                                     * a the same mapping for all active_fe_indices.
+                                     * This boolean remembers which type this object
+                                     * is.
+                                     */
+    bool single_mapping;
+
+                                    /**
+                                     * The real container, which stores pointers
+                                     * to the different Mapping objects.
+                                     */
+    std::vector<SmartPointer<const Mapping<dim> > > mappings;
+};
+
+
+
+/* --------------- inline functions ------------------- */
+
+template <int dim>
+inline
+unsigned int
+MappingCollection<dim>::n_mappings () const 
+{
+    return mappings.size();
+}
+
+
+#endif
diff --git a/deal.II/deal.II/include/fe/q_collection.h b/deal.II/deal.II/include/fe/q_collection.h
new file mode 100644 (file)
index 0000000..788c119
--- /dev/null
@@ -0,0 +1,132 @@
+//----------------------------  q_collection.h  ----------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2005 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  q_collection.h  ----------------------------
+#ifndef __deal2__q_collection_h
+#define __deal2__q_collection_h
+
+#include <base/config.h>
+#include <base/subscriptor.h>
+#include <base/quadrature.h>
+#include <base/smartpointer.h>
+#include <fe/fe.h>
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+/**
+ * This class implements a collection of quadrature objects used in the
+ * hpDoFHandler(). It is thus to a hpDoFHandler() what a Quadrature is to a
+ * DoFHandler. This collection stores pointers to the original quadrature
+ * elements added to it. Hence the handling of the memory consumed by
+ * the quadrature objects must be done by the user of the class.
+ *
+ * Although it is strongly recommended to supply an appropriate quadrature
+ * for each finite element type used in a hp-computation, the QCollection
+ * class implements a conversion constructor from a single quadrature.
+ * Therefore it is possible to offer only a single quadrature to the
+ * hpFEValues class instead of a QCollection. The reason for this
+ * mechanism lies in the structure of the deal.II library. At many places
+ * throughout the library pseudo quadrature rules are constructed to obtain
+ * the values of the finite element function at certain points. An example
+ * is the DataOut class. Due to this conversion constructor, these lines
+ * of code continue to work without modifications.
+ * 
+ * @author Oliver Kayser-Herold, 2005
+ */
+template <int dim>
+class QCollection : public Subscriptor
+{
+  public:
+                                     /**
+                                      * Default constructor. Initialises
+                                     * this QCollection.
+                                     */
+    QCollection ();
+
+                                     /**
+                                      * Conversion constructor. This
+                                     * constructor creates a QCollection
+                                     * from a single quadrature rule. In
+                                     * the newly created QCollection, this
+                                     * quadrature is used for all active_fe
+                                     * indices.
+                                     */
+    QCollection (const Quadrature<dim> &quadrature);
+
+                                     /**
+                                      * Returns the number of quadrature
+                                     * pointers stored in this object.
+                                     */
+    unsigned int n_quadratures () const;
+
+                                     /**
+                                      * Returns a reference to the quadrature rule which
+                                     * was specified by the user for the
+                                     * active_fe_index which is provided
+                                     * as a parameter to this method.
+                                     */
+    const Quadrature<dim> &
+    get_quadrature (const unsigned int active_fe_index) const;
+    
+                                    /**
+                                     * Determine an estimate for the
+                                     * memory consumption (in bytes)
+                                     * of this object.
+                                     */
+    unsigned int memory_consumption () const;
+
+                                     /**
+                                      * Adds a new quadrature rule to the QCollection.
+                                     * The quadrature rules have to be added in the order
+                                     * of the active_fe_indices. Thus the reference
+                                     * to the quadrature rule for active_fe_index 0
+                                     * has to be added first, followed by the
+                                     * quadrature rule for active_fe_index 1.
+                                     */
+    unsigned int add_quadrature (const Quadrature<dim> &new_quadrature);
+
+    DeclException0 (ExcNoQuadrature);
+    
+  private:
+                                    /**
+                                     * Upon construction of a <tt>QCollection</tt>
+                                     * the later functionality of the class is specified.
+                                     * Either it is a real collection, which provides
+                                     * different quadrature rules for each active_fe_index
+                                     * or its a "unreal" collection, which returns
+                                     * a the same quadrature rule for all active_fe_indices.
+                                     * This boolean remembers which type this object
+                                     * is.
+                                     */
+    bool single_quadrature;
+
+                                    /**
+                                     * The real container, which stores pointers
+                                     * to the different quadrature objects.
+                                     */
+    std::vector<SmartPointer<const Quadrature<dim> > > quadratures;
+};
+
+
+
+/* --------------- inline functions ------------------- */
+
+template <int dim>
+inline
+unsigned int
+QCollection<dim>::n_quadratures () const 
+{
+    return quadratures.size();
+}
+
+
+#endif
diff --git a/deal.II/deal.II/include/fe/select_fe_values.h b/deal.II/deal.II/include/fe/select_fe_values.h
new file mode 100644 (file)
index 0000000..3e2cd83
--- /dev/null
@@ -0,0 +1,51 @@
+//----------------------------  select_fe_values.h  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  select_fe_values.h  ---------------------------
+#ifndef __deal2__select_fe_values_h
+#define __deal2__select_fe_values_h
+
+#include <base/config.h>
+
+template <int> class DoFHandler;
+template <int> class hpDoFHandler;
+
+template <int> class FEValues;
+template <int> class FEFaceValues;
+template <int> class FESubfaceValues;
+
+template <int> class hpFEValues;
+template <int> class hpFEFaceValues;
+template <int> class hpFESubfaceValues;
+
+
+
+template <typename> struct SelectFEValues;
+
+template <int dim> struct SelectFEValues<DoFHandler<dim> >
+{
+    typedef FEValues<dim>        FEValues;
+    typedef FEFaceValues<dim>    FEFaceValues;
+    typedef FESubfaceValues<dim> FESubfaceValues;
+};
+
+
+template <int dim> struct SelectFEValues<hpDoFHandler<dim> >
+{
+    typedef hpFEValues<dim>        FEValues;
+    typedef hpFEFaceValues<dim>    FEFaceValues;
+    typedef hpFESubfaceValues<dim> FESubfaceValues;
+};
+
+
+
+
+#endif
index e81dfda211820274c58dfe0e0e6a15cc4290a433..8911e4a2154853b3e461a376132325793a20579b 100644 (file)
@@ -80,7 +80,8 @@ class MGDoFAccessor {
                                      * Reset the DoF handler pointer.
                                      */
     void set_mg_dof_handler (MGDoFHandler<dim> *dh) {
-      Assert (dh != 0, typename DoFAccessor<dim>::ExcInvalidObject());
+       typedef DoFAccessor<dim, DoFHandler> BaseClass;
+      Assert (dh != 0, typename BaseClass::ExcInvalidObject());
       mg_dof_handler = dh;
     };
 
@@ -130,7 +131,7 @@ class MGDoFObjectAccessor_Inheritance
                                      * See the full documentation for
                                      * more information.
                                      */
-    typedef DoFObjectAccessor<celldim,dim> BaseClass;
+    typedef DoFObjectAccessor<celldim,dim,DoFHandler> BaseClass;
 };
 
 
@@ -156,7 +157,7 @@ class MGDoFObjectAccessor_Inheritance<dim,dim>
                                      * See the full documentation for
                                      * more information.
                                      */
-    typedef DoFCellAccessor<dim> BaseClass;
+    typedef DoFCellAccessor<dim, DoFHandler> BaseClass;
 };
 
 
index e1dbea212f9c900590f13a62ffa18932e5e25b4e..e6e8869b288ea59620ffe6b7cc04dc156b9d4ee3 100644 (file)
@@ -255,7 +255,7 @@ class MGDoFHandler : public DoFHandler<dim>
                                      * A copy of the transferred
                                      * finite element is stored.
                                      */
-    virtual void distribute_dofs (const FiniteElement<dim> &, 
+    virtual void distribute_dofs (const FiniteElement<dim> &,
                                  const unsigned int offset = 0);
 
                                     /**
index cb725f5ce5b12ef78d4dfaf2219678b124f496ff..6931906f31f96cbc9ae878707698962ab02d9233 100644 (file)
@@ -113,12 +113,11 @@ MGTransferPrebuilt<VECTOR>::copy_to_mg (
                                       // by restricting from fine level.
       for (; level_cell!=level_end; ++level_cell)
        {
-         DoFObjectAccessor<dim, dim>& global_cell = *level_cell;
                                           // get the dof numbers of
                                           // this cell for the global
                                           // and the level-wise
                                           // numbering
-         global_cell.get_dof_indices(global_dof_indices);
+         level_cell->get_dof_indices(global_dof_indices);
          level_cell->get_mg_dof_indices (level_dof_indices);
 
                                           // transfer the global
@@ -184,14 +183,13 @@ MGTransferPrebuilt<VECTOR>::copy_from_mg(
                                   // monotonuosly increasing
   for (; level_cell != endc; ++level_cell)
     {
-      DoFObjectAccessor<dim, dim>& global_cell = *level_cell;
       const unsigned int level = level_cell->level();
       
                                       // get the dof numbers of
                                       // this cell for the global
                                       // and the level-wise
                                       // numbering
-      global_cell.get_dof_indices (global_dof_indices);
+      level_cell->get_dof_indices (global_dof_indices);
       level_cell->get_mg_dof_indices(level_dof_indices);
 
                                       // copy level-wise data to
@@ -232,14 +230,13 @@ MGTransferPrebuilt<VECTOR>::copy_from_mg_add (
                                   // monotonuosly increasing
   for (; level_cell != endc; ++level_cell)
     {
-      DoFObjectAccessor<dim, dim>& global_cell = *level_cell;
       const unsigned int level = level_cell->level();
       
                                       // get the dof numbers of
                                       // this cell for the global
                                       // and the level-wise
                                       // numbering
-      global_cell.get_dof_indices (global_dof_indices);
+      level_cell->get_dof_indices (global_dof_indices);
       level_cell->get_mg_dof_indices(level_dof_indices);
 
 //TODO:[GK] Probably wrong for continuous elements
@@ -400,12 +397,11 @@ MGTransferSelect<number>::do_copy_to_mg (
                                       // by restricting from fine level.
       for (; level_cell!=level_end; ++level_cell)
        {
-         DoFObjectAccessor<dim, dim>& global_cell = *level_cell;
                                           // get the dof numbers of
                                           // this cell for the global
                                           // and the level-wise
                                           // numbering
-         global_cell.get_dof_indices(global_dof_indices);
+         level_cell->get_dof_indices(global_dof_indices);
          level_cell->get_mg_dof_indices (level_dof_indices);
 
                                           // transfer the global
@@ -522,14 +518,13 @@ MGTransferSelect<number>::do_copy_from_mg (
                                   // monotonuosly increasing
   for (; level_cell != endc; ++level_cell)
     {
-       DoFObjectAccessor<dim, dim>& global_cell = *level_cell;
       const unsigned int level = level_cell->level();
 
                                       // get the dof numbers of
                                       // this cell for the global
                                       // and the level-wise
                                       // numbering
-      global_cell.get_dof_indices (global_dof_indices);
+      level_cell->get_dof_indices (global_dof_indices);
       level_cell->get_mg_dof_indices(level_dof_indices);
 
                                       // copy level-wise data to
@@ -583,14 +578,13 @@ MGTransferSelect<number>::do_copy_from_mg_add (
                                   // monotonuosly increasing
   for (; level_cell != endc; ++level_cell)
     {
-       DoFObjectAccessor<dim, dim>& global_cell = *level_cell;
       const unsigned int level = level_cell->level();
 
                                       // get the dof numbers of
                                       // this cell for the global
                                       // and the level-wise
                                       // numbering
-      global_cell.get_dof_indices (global_dof_indices);
+      level_cell->get_dof_indices (global_dof_indices);
       level_cell->get_mg_dof_indices(level_dof_indices);
 
 //TODO:[GK+WB] Probably wrong for continuous elements
@@ -708,12 +702,11 @@ MGTransferBlock<number>::copy_to_mg (
                                       // by restricting from fine level.
       for (; level_cell!=level_end; ++level_cell)
        {
-         DoFObjectAccessor<dim, dim>& global_cell = *level_cell;
                                           // get the dof numbers of
                                           // this cell for the global
                                           // and the level-wise
                                           // numbering
-         global_cell.get_dof_indices(global_dof_indices);
+         level_cell->get_dof_indices(global_dof_indices);
          level_cell->get_mg_dof_indices (level_dof_indices);
 
                                           // transfer the global
@@ -769,13 +762,12 @@ MGTransferBlock<number>::copy_from_mg (
                                   // increasing
   for (; level_cell != endc; ++level_cell)
     {
-       DoFObjectAccessor<dim, dim>& global_cell = *level_cell;
       const unsigned int level = level_cell->level();
                                       // get the dof numbers of
                                       // this cell for the global
                                       // and the level-wise
                                       // numbering
-      global_cell.get_dof_indices (global_dof_indices);
+      level_cell->get_dof_indices (global_dof_indices);
       level_cell->get_mg_dof_indices(level_dof_indices);
 
                                       // copy level-wise data to
@@ -816,14 +808,13 @@ MGTransferBlock<number>::copy_from_mg_add (
                                   // increasing
   for (; level_cell != endc; ++level_cell)
     {
-       DoFObjectAccessor<dim, dim>& global_cell = *level_cell;
       const unsigned int level = level_cell->level();
 
                                       // get the dof numbers of
                                       // this cell for the global
                                       // and the level-wise
                                       // numbering
-      global_cell.get_dof_indices (global_dof_indices);
+      level_cell->get_dof_indices (global_dof_indices);
       level_cell->get_mg_dof_indices(level_dof_indices);
 
 //TODO:[GK] Probably wrong for continuous elements
index 5513190b67592385802c7148042a49f00ad9ab20..5f3be59ee1dbb1cd7cd4c329a552be87dbb66401 100644 (file)
@@ -162,10 +162,51 @@ template <int>      class FEValuesBase;
  * @ingroup IO
  * @author Wolfgang Bangerth, 1999
  */
-template <int dof_handler_dim, int patch_dim, int patch_space_dim=patch_dim>
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim=patch_dim>
 class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
 {
+#ifdef DEAL_II_TEMPLATE_TEMPLATE_TYPEDEF_BUG
+                                    // helper class
+    struct DH_dim : public DH<dof_handler_dim>
+    {
+                                        // constructor. will
+                                        // not be implemented,
+                                        // but suppresses compiler
+                                        // warning about non-default
+                                        // constructor of GridClass
+       DH_dim ();
+
+                                        /**
+                                         * Declare iterator type, for
+                                         * access from outside.
+                                         */
+       typedef typename DH<dof_handler_dim>::cell_iterator cell_iterator;
+       typedef typename DH<dof_handler_dim>::active_cell_iterator active_cell_iterator;
+    };
   public:
+    
+                                    /**
+                                     * Typedef to the iterator type
+                                     * of the dof handler class under
+                                     * consideration.
+                                     */
+    typedef typename DH_dim::cell_iterator cell_iterator;
+    typedef typename DH_dim::active_cell_iterator active_cell_iterator;
+
+#else
+  public:
+
+                                    /**
+                                     * Typedef to the iterator type
+                                     * of the dof handler class under
+                                     * consideration.
+                                     */
+    typedef typename DH<dof_handler_dim>::cell_iterator cell_iterator;
+    typedef typename DH<dof_handler_dim>::active_cell_iterator active_cell_iterator;
+#endif
+  public:
+
                                     /**
                                      * Type describing what the
                                      * vector given to
@@ -210,7 +251,7 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                      * and the mapping between nodes
                                      * and node values.
                                      */
-    void attach_dof_handler (const DoFHandler<dof_handler_dim> &);
+    void attach_dof_handler (const DH<dof_handler_dim> &);
 
                                     /**
                                      * Add a data vector together
@@ -416,7 +457,7 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                       * patches.
                                       */
     template <int dof_handler_dim2>
-    void merge_patches (const DataOut_DoFData<dof_handler_dim2,patch_dim,patch_space_dim> &source,
+    void merge_patches (const DataOut_DoFData<dof_handler_dim2,DH,patch_dim,patch_space_dim> &source,
                        const Point<patch_space_dim> &shift = Point<patch_space_dim>());
     
                                     /**
@@ -669,7 +710,7 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                     /**
                                      * Pointer to the dof handler object.
                                      */
-    SmartPointer<const DoFHandler<dof_handler_dim> > dofs;
+    SmartPointer<const DH<dof_handler_dim> > dofs;
 
                                     /**
                                      * List of data elements with vectors of
@@ -714,7 +755,8 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                      * friends. Needed for the
                                      * merge_patches() function.
                                      */
-    template <int,int,int> friend class DataOut_DoFData;
+    template <int,template <int> class, int,int>
+    friend class DataOut_DoFData;
 
 #ifdef DEAL_II_NESTED_CLASS_FRIEND_BUG
                                      /**
@@ -736,9 +778,9 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
 #  ifdef DEAL_II_NESTED_CLASS_TEMPL_FRIEND_BUG
     template <typename> friend class DataEntry;
 #  else
-    template <int N1, int N2, int N3>
+    template <int N1, template <int> class DH, int N2, int N3>
     template <typename>
-    friend class DataOut_DoFData<N1,N2,N3>::DataEntry;
+    friend class DataOut_DoFData<N1,DH,N2,N3>::DataEntry;
 #  endif
 #endif
 };
@@ -819,10 +861,18 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
  * @ingroup IO
  * @author Wolfgang Bangerth, 1999
  */
-template <int dim>
-class DataOut : public DataOut_DoFData<dim,dim> 
+template <int dim, template <int> class DH = DoFHandler>
+class DataOut : public DataOut_DoFData<dim,DH,dim> 
 {
   public:
+                                    /**
+                                     * Typedef to the iterator type
+                                     * of the dof handler class under
+                                     * consideration.
+                                     */
+    typedef typename DataOut_DoFData<dim,DH,dim>::cell_iterator cell_iterator;
+    typedef typename DataOut_DoFData<dim,DH,dim>::active_cell_iterator active_cell_iterator;
+    
                                     /**
                                      * This is the central function
                                      * of this class since it builds
@@ -891,8 +941,7 @@ class DataOut : public DataOut_DoFData<dim,dim>
                                      * might want to return other
                                      * cells in a derived class.
                                      */
-    virtual typename DoFHandler<dim>::cell_iterator
-    first_cell ();
+    virtual cell_iterator first_cell ();
     
                                     /**
                                      * Return the next cell after
@@ -915,8 +964,7 @@ class DataOut : public DataOut_DoFData<dim,dim>
                                      * only one of the two functions
                                      * might not be a good idea.
                                      */
-    virtual typename DoFHandler<dim>::cell_iterator
-    next_cell (const typename DoFHandler<dim>::cell_iterator &cell);
+    virtual cell_iterator next_cell (const cell_iterator &cell);
 
                                     /**
                                      * Exception
@@ -973,11 +1021,12 @@ class DataOut : public DataOut_DoFData<dim,dim>
 
 // -------------------- template and inline functions ------------------------
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+          int patch_dim, int patch_space_dim>
 template <int dof_handler_dim2>
 void
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
-merge_patches (const DataOut_DoFData<dof_handler_dim2,patch_dim,patch_space_dim> &source,
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
+merge_patches (const DataOut_DoFData<dof_handler_dim2,DH,patch_dim,patch_space_dim> &source,
               const Point<patch_space_dim> &shift)
 {
   const std::vector<Patch> source_patches = source.get_patches ();
index f8f582e415bd9b38a1b47b0d3454679b521556e8..6501a328899986056e5e99a83d9c0ace212e502d 100644 (file)
@@ -78,11 +78,18 @@ template <int dim> class DoFHandler;
  * @ingroup IO
  * @author Wolfgang Bangerth, 2000
  */
-template <int dim>
-class DataOutFaces : public DataOut_DoFData<dim,dim-1,dim>
+template <int dim, template <int> class DH = DoFHandler>
+class DataOutFaces : public DataOut_DoFData<dim,DH,dim-1,dim>
 {
   public:
-                                    /**
+                                    /**
+                                     * Typedef to the iterator type
+                                     * of the dof handler class under
+                                     * consideration.
+                                     */
+    typedef typename DataOut_DoFData<dim,DH,dim-1,dim>::cell_iterator cell_iterator;
+
+                                     /**
                                      * This is the central function
                                      * of this class since it builds
                                      * the list of patches to be
@@ -120,7 +127,7 @@ class DataOutFaces : public DataOut_DoFData<dim,dim-1,dim>
                                      * aliased to a name that is
                                      * better to type.
                                      */
-    typedef typename std::pair<typename DoFHandler<dim>::cell_iterator,unsigned int> FaceDescriptor;
+    typedef typename std::pair<cell_iterator,unsigned int> FaceDescriptor;
     
     
                                     /**
index 21eba0272cd1bbb1d816783afa278f89643becfe..29cd1b1c4389ca8e2db6a1a96671fd463f150bc6 100644 (file)
@@ -80,11 +80,18 @@ template <int dim> class DoFHandler;
  * @ingroup IO
  * @author Wolfgang Bangerth, 2000
  */
-template <int dim>
-class DataOutRotation : public DataOut_DoFData<dim,dim+1>
+template <int dim, template <int> class DH = DoFHandler>
+class DataOutRotation : public DataOut_DoFData<dim,DH,dim+1>
 {
   public:
-                                    /**
+                                    /**
+                                     * Typedef to the iterator type
+                                     * of the dof handler class under
+                                     * consideration.
+                                     */
+    typedef typename DataOut_DoFData<dim,DH,dim+1>::cell_iterator cell_iterator;
+
+                                     /**
                                      * This is the central function
                                      * of this class since it builds
                                      * the list of patches to be
@@ -124,8 +131,7 @@ class DataOutRotation : public DataOut_DoFData<dim,dim+1>
                                      * return other cells in a
                                      * derived class.
                                      */
-    virtual typename DoFHandler<dim>::cell_iterator
-    first_cell ();
+    virtual cell_iterator first_cell ();
     
                                     /**
                                      * Return the next cell after @p cell which
@@ -146,8 +152,7 @@ class DataOutRotation : public DataOut_DoFData<dim,dim+1>
                                      * of the two functions might not be
                                      * a good idea.
                                      */
-    virtual typename DoFHandler<dim>::cell_iterator
-    next_cell (const typename DoFHandler<dim>::cell_iterator &cell);
+    virtual cell_iterator next_cell (const cell_iterator &cell);
 
                                     /**
                                      * Exception
@@ -199,7 +204,7 @@ class DataOutRotation : public DataOut_DoFData<dim,dim+1>
 
 /* -------------- declaration of explicit specializations ------------- */
 
-template <> void DataOutRotation<3>::build_some_patches (Data);
+template <> void DataOutRotation<3,DoFHandler>::build_some_patches (Data);
 
 
 #endif
index df9ba68e196578f7986917179ec80bd1e68636e2..e8096e2bffd63bfa86f960c7bff6e75bb49976bb 100644 (file)
@@ -101,7 +101,7 @@ template <int dim> class DoFHandler;
  * @ingroup IO
  * @author Wolfgang Bangerth, 1999
  */
-template <int dim>
+template <int dim, template <int> class DH = DoFHandler>
 class DataOutStack : public DataOutInterface<dim+1> 
 {
   public:
@@ -141,7 +141,7 @@ class DataOutStack : public DataOutInterface<dim+1>
                                      * data vectors for the present
                                      * parameter value.
                                      */
-    void attach_dof_handler (const DoFHandler<dim> &dof_handler);
+    void attach_dof_handler (const DH<dim> &dof_handler);
 
                                     /**
                                      * Declare a data vector. The @p vector_type
@@ -370,7 +370,7 @@ class DataOutStack : public DataOutInterface<dim+1>
                                      * corresponding to the present parameter
                                      * value.
                                      */
-    SmartPointer<const DoFHandler<dim> > dof_handler;
+    SmartPointer<const DH<dim> > dof_handler;
 
                                     /**
                                      * List of patches of all past and
index a19944c5cd086ee45e566e64f1bdb5b33cb8c901..73b5bd486c4352f94ae1cc15785fe71361025085 100644 (file)
 
 #include <base/config.h>
 #include <base/exceptions.h>
-#include <dofs/dof_handler.h>
 #include <fe/fe_update_flags.h>
 #include <fe/mapping.h>
 #include <utility>
 
+template <int dim> class DoFHandler;
+template <int dim> class hpDoFHandler;
+
 
 
 /**
@@ -184,10 +186,10 @@ class DerivativeApproximation
                                      * number of vector components can be
                                      * given here.
                                      */
-    template <int dim, class InputVector>
+    template <int dim, template <int> class DH, class InputVector>
     static void
     approximate_gradient (const Mapping<dim>    &mapping,
-                         const DoFHandler<dim> &dof,
+                         const DH<dim>         &dof,
                          const InputVector     &solution,
                          Vector<float>         &derivative_norm,
                          const unsigned int     component = 0);
@@ -197,9 +199,9 @@ class DerivativeApproximation
                                      * function, see above, with
                                      * <tt>mapping=MappingQ1@<dim@>()</tt>.
                                      */
-    template <int dim, class InputVector>
+    template <int dim, template <int> class DH, class InputVector>
     static void
-    approximate_gradient (const DoFHandler<dim> &dof,
+    approximate_gradient (const DH<dim>         &dof,
                          const InputVector     &solution,
                          Vector<float>         &derivative_norm,
                          const unsigned int     component = 0);
@@ -231,10 +233,10 @@ class DerivativeApproximation
                                      * number of vector components can be
                                      * given here.
                                      */
-    template <int dim, class InputVector>
+    template <int dim, template <int> class DH, class InputVector>
     static void
     approximate_second_derivative (const Mapping<dim>    &mapping,
-                                  const DoFHandler<dim> &dof,
+                                  const DH<dim>         &dof,
                                   const InputVector     &solution,
                                   Vector<float>         &derivative_norm,
                                   const unsigned int     component = 0);
@@ -244,9 +246,9 @@ class DerivativeApproximation
                                      * function, see above, with
                                      * <tt>mapping=MappingQ1@<dim@>()</tt>.
                                      */
-    template <int dim, class InputVector>
+    template <int dim, template <int> class DH, class InputVector>
     static void
-    approximate_second_derivative (const DoFHandler<dim> &dof,
+    approximate_second_derivative (const DH<dim>         &dof,
                                   const InputVector     &solution,
                                   Vector<float>         &derivative_norm,
                                   const unsigned int     component = 0);
@@ -463,10 +465,11 @@ class DerivativeApproximation
                                      * solution vector we are to work
                                      * on.
                                      */
-    template <class DerivativeDescription, int dim, class InputVector>
+    template <class DerivativeDescription, int dim,
+              template <int> class DH, class InputVector>
     static void
     approximate_derivative (const Mapping<dim>    &mapping,
-                           const DoFHandler<dim> &dof,
+                           const DH<dim>         &dof,
                            const InputVector     &solution,
                            const unsigned int     component,
                            Vector<float>         &derivative_norm);
@@ -477,10 +480,11 @@ class DerivativeApproximation
                                      * the range given by the third
                                      * parameter.
                                      */
-    template <class DerivativeDescription, int dim, class InputVector>
+    template <class DerivativeDescription, int dim,
+              template <int> class DH, class InputVector>
     static void
     approximate (const Mapping<dim>    &mapping,
-                const DoFHandler<dim> &dof,
+                const DH<dim>         &dof,
                 const InputVector     &solution,
                 const unsigned int     component,
                 const IndexInterval   &index_interval,
@@ -490,12 +494,17 @@ class DerivativeApproximation
 
 /* -------------- declaration of explicit specializations ------------- */
 
-template <> double DerivativeApproximation::SecondDerivative<1>::derivative_norm (
-  const Derivative &d);
-template <> double DerivativeApproximation::SecondDerivative<2>::derivative_norm (
-  const Derivative &d);
-template <> double DerivativeApproximation::SecondDerivative<3>::derivative_norm (
-  const Derivative &d);
+template <>
+double
+DerivativeApproximation::SecondDerivative<1>::derivative_norm (const Derivative &d);
+
+template <>
+double
+DerivativeApproximation::SecondDerivative<2>::derivative_norm (const Derivative &d);
+
+template <>
+double
+DerivativeApproximation::SecondDerivative<3>::derivative_norm (const Derivative &d);
 
 
 #endif
index 6484ad3eb8ad955006e85111179bc392e097f8b2..57d2d3a3e13098aa087d835dd3d7ca807e6bdc41 100644 (file)
@@ -31,6 +31,7 @@ template <typename number> class Vector;
 template <typename number> class FullMatrix;
 template <int dim> class Mapping;
 template <int dim> class DoFHandler;
+template <int dim> class hpDoFHandler;
 class ConstraintMatrix;
 
 
@@ -667,23 +668,40 @@ class VectorTools
                                      * See the general doc for more
                                      * information.
                                      */
-    template <int dim>
-    static void interpolate_boundary_values (const Mapping<dim>            &mapping,
-                                            const DoFHandler<dim>         &dof,
-                                            const typename FunctionMap<dim>::type &function_map,
-                                            std::map<unsigned int,double> &boundary_values,
-                                            const std::vector<bool>       &component_mask = std::vector<bool>());
+    template <int dim, template <int> class DH>
+    static
+    void
+    interpolate_boundary_values (const Mapping<dim>            &mapping,
+                                 const DH<dim>                 &dof,
+                                 const typename FunctionMap<dim>::type &function_map,
+                                 std::map<unsigned int,double> &boundary_values,
+                                 const std::vector<bool>       &component_mask = std::vector<bool>());
 
                                     /**
                                      * Declaration of specialization
                                      * of the previous function for
-                                     * 1d.
+                                     * 1d and a DoFHandler.
+                                     */
+    static
+    void
+    interpolate_boundary_values (const Mapping<1>              &mapping,
+                                 const DoFHandler<1>           &dof,
+                                 const FunctionMap<1>::type    &function_map,
+                                 std::map<unsigned int,double> &boundary_values,
+                                 const std::vector<bool>       &component_mask = std::vector<bool>());
+
+                                    /**
+                                     * Declaration of specialization
+                                     * of the previous function for
+                                     * 1d and a hpDoFHandler().
                                      */
-    static void interpolate_boundary_values (const Mapping<1>              &mapping,
-                                            const DoFHandler<1>           &dof,
-                                            const FunctionMap<1>::type    &function_map,
-                                            std::map<unsigned int,double> &boundary_values,
-                                            const std::vector<bool>       &component_mask = std::vector<bool>());
+    static
+    void
+    interpolate_boundary_values (const Mapping<1>              &mapping,
+                                 const hpDoFHandler<1>         &dof,
+                                 const FunctionMap<1>::type    &function_map,
+                                 std::map<unsigned int,double> &boundary_values,
+                                 const std::vector<bool>       &component_mask = std::vector<bool>());
 
                                     /**
                                      * Same function as above, but
@@ -697,52 +715,63 @@ class VectorTools
                                      * This function is there mainly
                                      * for backward compatibility.
                                      */
-    template <int dim>
-    static void interpolate_boundary_values (const Mapping<dim>            &mapping,
-                                            const DoFHandler<dim>         &dof,
-                                            const unsigned char            boundary_component,
-                                            const Function<dim>           &boundary_function,
-                                            std::map<unsigned int,double> &boundary_values,
-                                            const std::vector<bool>       &component_mask = std::vector<bool>());
+    template <int dim, template <int> class DH>
+    static
+    void
+    interpolate_boundary_values (const Mapping<dim>            &mapping,
+                                 const DH<dim>                 &dof,
+                                 const unsigned char            boundary_component,
+                                 const Function<dim>           &boundary_function,
+                                 std::map<unsigned int,double> &boundary_values,
+                                 const std::vector<bool>       &component_mask = std::vector<bool>());
 
                                     /**
                                      * Declaration of specialization
                                      * of the previous function for
                                      * 1d.
                                      */
-    static void interpolate_boundary_values (const Mapping<1>              &mapping,
-                                            const DoFHandler<1>           &dof,
-                                            const unsigned char            boundary_component,
-                                            const Function<1>             &boundary_function,
-                                            std::map<unsigned int,double> &boundary_values,
-                                            const std::vector<bool>       &component_mask = std::vector<bool>());
+    template <template <int> class DH>
+    static
+    void
+    interpolate_boundary_values (const Mapping<1>              &mapping,
+                                 const DH<1>                   &dof,
+                                 const unsigned char            boundary_component,
+                                 const Function<1>             &boundary_function,
+                                 std::map<unsigned int,double> &boundary_values,
+                                 const std::vector<bool>       &component_mask = std::vector<bool>());
 
+    
                                     /**
                                      * Calls the other
                                      * @p interpolate_boundary_values
                                      * function, see above, with
                                      * <tt>mapping=MappingQ1@<dim@>()</tt>.
                                      */
-    template <int dim>
-    static void interpolate_boundary_values (const DoFHandler<dim>         &dof,
-                                            const unsigned char            boundary_component,
-                                            const Function<dim>           &boundary_function,
-                                            std::map<unsigned int,double> &boundary_values,
-                                            const std::vector<bool>       &component_mask = std::vector<bool>());
+    template <int dim, template <int> class DH>
+    static
+    void
+    interpolate_boundary_values (const DH<dim>                 &dof,
+                                 const unsigned char            boundary_component,
+                                 const Function<dim>           &boundary_function,
+                                 std::map<unsigned int,double> &boundary_values,
+                                 const std::vector<bool>       &component_mask = std::vector<bool>());
 
+    
                                     /**
                                      * Calls the other
                                      * @p interpolate_boundary_values
                                      * function, see above, with
                                      * <tt>mapping=MappingQ1@<dim@>()</tt>.
                                      */
-    template <int dim>
-    static void interpolate_boundary_values (const DoFHandler<dim>         &dof,
-                                            const typename FunctionMap<dim>::type &function_map,
-                                            std::map<unsigned int,double> &boundary_values,
-                                            const std::vector<bool>       &component_mask = std::vector<bool>());
-
-
+    template <int dim, template <int> class DH>
+    static
+    void
+    interpolate_boundary_values (const DH<dim>                 &dof,
+                                 const typename FunctionMap<dim>::type &function_map,
+                                 std::map<unsigned int,double> &boundary_values,
+                                 const std::vector<bool>       &component_mask = std::vector<bool>());
+    
+    
                                     /**
                                      * Project @p function to the boundary
                                      * of the domain, using the given quadrature
index 4f07b685c28246c49d7f06acfcdb74f9f8410df1..156850c5bda84f6f6b6a295ddf0332c1cf090832 100644 (file)
@@ -713,9 +713,12 @@ VectorTools::create_boundary_right_hand_side (const DoFHandler<dim>   &dof_handl
 
 #if deal_II_dimension == 1
 
+//TODO[?] Actually the Mapping object should be a MappingCollection object for the
+// hpDoFHandler.
+template <template <int> class DH>
 void
 VectorTools::interpolate_boundary_values (const Mapping<1>         &,
-                                         const DoFHandler<1>      &dof,
+                                         const DH<1>              &dof,
                                          const unsigned char       boundary_component,
                                          const Function<1>        &boundary_function,
                                          std::map<unsigned int,double> &boundary_values,
@@ -724,19 +727,6 @@ VectorTools::interpolate_boundary_values (const Mapping<1>         &,
   Assert (boundary_component != 255,
          ExcInvalidBoundaryIndicator());
 
-  const FiniteElement<1> &fe = dof.get_fe();
-  Assert (fe.n_components() == boundary_function.n_components,
-         ExcComponentMismatch());
-
-                                  // set the component mask to either
-                                  // the original value or a vector
-                                  // of @p{true}s
-  const std::vector<bool> component_mask ((component_mask_.size() == 0) ?
-                                         std::vector<bool> (fe.n_components(), true) :
-                                         component_mask_);
-  Assert (std::count(component_mask.begin(), component_mask.end(), true) > 0,
-         ExcComponentMismatch());
-  
                                   // check whether boundary values at
                                   // the left or right boundary of
                                   // the line are
@@ -752,13 +742,28 @@ VectorTools::interpolate_boundary_values (const Mapping<1>         &,
                                   // cell by first traversing the coarse
                                   // grid to its end and then going
                                   // to the children
-  DoFHandler<1>::cell_iterator outermost_cell = dof.begin(0);
+  typename DH<1>::cell_iterator outermost_cell = dof.begin(0);
   while (outermost_cell->neighbor(direction).state() == IteratorState::valid)
     outermost_cell = outermost_cell->neighbor(direction);
   
   while (outermost_cell->has_children())
     outermost_cell = outermost_cell->child(direction);
 
+                                   // get the FE corresponding to this
+                                   // cell
+  const FiniteElement<1> &fe = outermost_cell->get_fe();
+  Assert (fe.n_components() == boundary_function.n_components,
+         ExcComponentMismatch());
+
+                                  // set the component mask to either
+                                  // the original value or a vector
+                                  // of @p{true}s
+  const std::vector<bool> component_mask ((component_mask_.size() == 0) ?
+                                         std::vector<bool> (fe.n_components(), true) :
+                                         component_mask_);
+  Assert (std::count(component_mask.begin(), component_mask.end(), true) > 0,
+         ExcComponentMismatch());
+
                                   // now set the value of the
                                   // outermost degree of
                                   // freedom. setting also
@@ -785,7 +790,8 @@ VectorTools::interpolate_boundary_values (const Mapping<1>         &,
 }
 
 
-
+//TODO[?] Actually the Mapping object should be a MappingCollection object for the
+// hpDoFHandler.
 void
 VectorTools::interpolate_boundary_values (const Mapping<1>              &mapping,
                                          const DoFHandler<1>           &dof,
@@ -800,14 +806,30 @@ VectorTools::interpolate_boundary_values (const Mapping<1>              &mapping
 }
 
 
+//TODO[?] Actually the Mapping object should be a MappingCollection object for the
+// hpDoFHandler.
+void
+VectorTools::interpolate_boundary_values (const Mapping<1>              &mapping,
+                                         const hpDoFHandler<1>           &dof,
+                                         const FunctionMap<1>::type    &function_map,
+                                         std::map<unsigned int,double> &boundary_values,
+                                         const std::vector<bool>       &component_mask)
+{
+  for (FunctionMap<1>::type::const_iterator i=function_map.begin();
+       i!=function_map.end(); ++i)
+    interpolate_boundary_values (mapping, dof, i->first, *i->second,
+                                boundary_values, component_mask);
+}
+
+
 #endif
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 void
 VectorTools::
 interpolate_boundary_values (const Mapping<dim>            &mapping,
-                             const DoFHandler<dim>         &dof,
+                             const DH<dim>                 &dof,
                              const typename FunctionMap<dim>::type &function_map,
                              std::map<unsigned int,double> &boundary_values,
                              const std::vector<bool>       &component_mask_)
@@ -821,8 +843,7 @@ interpolate_boundary_values (const Mapping<dim>            &mapping,
   Assert (function_map.find(255) == function_map.end(),
          ExcInvalidBoundaryIndicator());
 
-  const FiniteElement<dim> &fe           = dof.get_fe();
-  const unsigned int        n_components = fe.n_components();
+  const unsigned int        n_components = get_n_components(dof);
   const bool                fe_is_system = (n_components != 1);
 
   for (typename FunctionMap<dim>::type::const_iterator i=function_map.begin();
@@ -834,85 +855,109 @@ interpolate_boundary_values (const Mapping<dim>            &mapping,
                                   // the original value or a vector
                                   // of @p{true}s
   const std::vector<bool> component_mask ((component_mask_.size() == 0) ?
-                                         std::vector<bool> (fe.n_components(), true) :
+                                         std::vector<bool> (n_components, true) :
                                          component_mask_);
   Assert (std::count(component_mask.begin(), component_mask.end(), true) > 0,
          ExcComponentMismatch());
 
                                   // field to store the indices
-  std::vector<unsigned int> face_dofs (fe.dofs_per_face,
-                                      DoFHandler<dim>::invalid_dof_index);
-  std::vector<Point<dim> >  dof_locations (face_dofs.size(), Point<dim>());
-  
+  std::vector<unsigned int> face_dofs;
+  face_dofs.reserve (max_dofs_per_face(dof));
+  std::fill (face_dofs.begin (), face_dofs.end (), DoFHandler<dim>::invalid_dof_index);
+
+  std::vector<Point<dim> >  dof_locations;
+  dof_locations.reserve (max_dofs_per_face(dof));
+  std::fill (dof_locations.begin(), dof_locations.end (), Point<dim>());
+
                                   // array to store the values of
                                   // the boundary function at the
                                   // boundary points. have to arrays
                                   // for scalar and vector functions
                                   // to use the more efficient one
                                   // respectively
-  std::vector<double>          dof_values_scalar (fe.dofs_per_face);
-  std::vector<Vector<double> > dof_values_system (fe.dofs_per_face,
-                                                 Vector<double>(fe.n_components()));
+  std::vector<double>          dof_values_scalar;
+  std::vector<Vector<double> > dof_values_system;
+  dof_values_scalar.reserve (max_dofs_per_face (dof));
+  dof_values_system.reserve (max_dofs_per_face (dof));
 
-                                  // next generate a quadrature rule
-                                  // on the face from the unit
-                                  // support points. this wil be used
-                                  // to obtain the quadrature points
-                                  // on the real cell's face
-  std::vector<Point<dim-1> >
-    unit_support_points = fe.get_unit_face_support_points();
-  
-                                  // check whether there are support
-                                  // points on the face. if not, then
-                                  // we should try a more clever
-                                  // way. the idea is that a finite
-                                  // element may not offer support
-                                  // points for all its shape
-                                  // functions, but maybe only
-                                  // some. if it offers support
-                                  // points for the components we are
-                                  // interested in in this function,
-                                  // then that's fine. if not, the
-                                  // function we call in the finite
-                                  // element will raise an
-                                  // exception. the support points
-                                  // for the other shape functions
-                                  // are left uninitialized (well,
-                                  // initialized by the default
-                                  // constructor), since we don't
-                                  // need them anyway.
-  if (unit_support_points.size() == 0)
-    {
-      unit_support_points.resize (fe.dofs_per_face);
-      for (unsigned int i=0; i<fe.dofs_per_face; ++i)
-        if (component_mask[fe.face_system_to_component_index(i).first]
-            == true)
-          unit_support_points[i] = fe.unit_face_support_point(i);
-    };
-
-  Quadrature<dim-1> aux_quad (unit_support_points);
-  FEFaceValues<dim> fe_values (mapping, fe, aux_quad, update_q_points);
-
-  typename DoFHandler<dim>::active_cell_iterator cell = dof.begin_active(),
-                                                endc = dof.end();
+  typename DH<dim>::active_cell_iterator cell = dof.begin_active(),
+                                        endc = dof.end();
   for (; cell!=endc; ++cell)
     for (unsigned int face_no = 0; face_no < GeometryInfo<dim>::faces_per_cell;
         ++face_no)
       {
-       typename DoFHandler<dim>::face_iterator face = cell->face(face_no);
+        const FiniteElement<dim> &fe = cell->get_fe();
+        
+       typename DH<dim>::face_iterator face = cell->face(face_no);
        const unsigned char boundary_component = face->boundary_indicator();
        if (function_map.find(boundary_component) != function_map.end()) 
                                           // face is of the right component
          {
+//TODO[?] Should work for both DoFHandlers. But probably not the most efficient
+// implementation.
+                                            // next generate a quadrature rule
+                                            // on the face from the unit
+                                            // support points. this wil be used
+                                            // to obtain the quadrature points
+                                            // on the real cell's face
+            std::vector<Point<dim-1> > 
+               unit_support_points = fe.get_unit_face_support_points();
+  
+                                            // check whether there are support
+                                            // points on the face. if not, then
+                                            // we should try a more clever
+                                            // way. the idea is that a finite
+                                            // element may not offer support
+                                            // points for all its shape
+                                            // functions, but maybe only
+                                            // some. if it offers support
+                                            // points for the components we are
+                                            // interested in in this function,
+                                            // then that's fine. if not, the
+                                            // function we call in the finite
+                                            // element will raise an
+                                            // exception. the support points
+                                            // for the other shape functions
+                                            // are left uninitialized (well,
+                                            // initialized by the default
+                                            // constructor), since we don't
+                                            // need them anyway.
+           if (unit_support_points.size() == 0)
+             {
+               unit_support_points.resize (fe.dofs_per_face);
+                for (unsigned int i=0; i<fe.dofs_per_face; ++i)
+                  if (component_mask[fe.face_system_to_component_index(i).first]
+                      == true)
+                unit_support_points[i] = fe.unit_face_support_point(i);
+              };
+
+            Quadrature<dim-1> aux_quad (unit_support_points);
+            FEFaceValues<dim> fe_values (mapping, fe, aux_quad, update_q_points);
+//TODO[?] End of inefficient code
+
                                             // get indices, physical location and
                                             // boundary values of dofs on this
                                             // face
+            face_dofs.resize (fe.dofs_per_face);
            face->get_dof_indices (face_dofs);
            fe_values.reinit(cell, face_no);
-           const std::vector<Point<dim> > &dof_locations = fe_values.get_quadrature_points ();
+           const std::vector<Point<dim> > &dof_locations
+              = fe_values.get_quadrature_points ();
            
            if (fe_is_system)
              {
+                                                 // resize
+                                                 // array. avoid
+                                                 // construction of a
+                                                 // memory allocating
+                                                 // temporary if
+                                                 // possible
+                if (dof_values_system.size() < fe.dofs_per_face)
+                  dof_values_system.resize (fe.dofs_per_face,
+                                            Vector<double>(fe.n_components()));
+                else
+                  dof_values_system.resize (fe.dofs_per_face);
+                
                function_map.find(boundary_component)->second
                   ->vector_value_list (dof_locations, dof_values_system);
                
@@ -1034,9 +1079,9 @@ interpolate_boundary_values (const Mapping<dim>            &mapping,
              {
                                                 // get only the one component that
                                                 // this function has
-               function_map.find(boundary_component)->second->value_list (dof_locations,
-                                                                          dof_values_scalar,
-                                                                          0);
+                dof_values_scalar.resize (fe.dofs_per_face);
+               function_map.find(boundary_component)->second
+                  ->value_list (dof_locations, dof_values_scalar, 0);
                
                                                 // enter into list
                
@@ -1049,10 +1094,10 @@ interpolate_boundary_values (const Mapping<dim>            &mapping,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 void
 VectorTools::interpolate_boundary_values (const Mapping<dim>            &mapping,
-                                         const DoFHandler<dim>         &dof,
+                                         const DH<dim>                 &dof,
                                          const unsigned char            boundary_component,
                                          const Function<dim>           &boundary_function,
                                          std::map<unsigned int,double> &boundary_values,
@@ -1066,9 +1111,11 @@ VectorTools::interpolate_boundary_values (const Mapping<dim>            &mapping
 
 
   
-template <int dim>
+//TODO[?] Change for real hpDoFHandler
+// This function might not work anymore if the real hpDoFHandler is available.
+template <int dim, template <int> class DH>
 void
-VectorTools::interpolate_boundary_values (const DoFHandler<dim>         &dof,
+VectorTools::interpolate_boundary_values (const DH<dim>                 &dof,
                                          const unsigned char            boundary_component,
                                          const Function<dim>           &boundary_function,
                                          std::map<unsigned int,double> &boundary_values,
@@ -1082,9 +1129,11 @@ VectorTools::interpolate_boundary_values (const DoFHandler<dim>         &dof,
 
 
 
-template <int dim>
+//TODO[?] Change for real hpDoFHandler
+// This function might not work anymore if the real hpDoFHandler is available.
+template <int dim, template <int> class DH>
 void
-VectorTools::interpolate_boundary_values (const DoFHandler<dim>         &dof,
+VectorTools::interpolate_boundary_values (const DH<dim>                 &dof,
                                          const typename FunctionMap<dim>::type &function_map,
                                          std::map<unsigned int,double> &boundary_values,
                                          const std::vector<bool>       &component_mask)
@@ -1141,7 +1190,7 @@ VectorTools::project_boundary_values (const Mapping<dim>       &mapping,
                                         dof_to_boundary_mapping);
   
                                   // set up sparsity structure
-  SparsityPattern sparsity(dof.n_boundary_dofs(boundary_functions),
+  SparsityPattern sparsity(dof.n_boundary_dofs (boundary_functions),
                           dof.max_couplings_between_boundary_dofs());
   DoFTools::make_boundary_sparsity_pattern (dof,
                                            boundary_functions,
index ab04e058a1c3134185e2b410d81dc2cafa7cb340..83ccdb4cccb1b564a2302812c5d83e02db9af050 100644 (file)
@@ -22,6 +22,7 @@
 #include <dofs/dof_accessor.templates.h>
 #include <dofs/dof_handler.h>
 #include <dofs/dof_levels.h>
+#include <dofs/hp_dof_handler.h>
 #include <grid/tria_boundary.h>
 #include <grid/tria_iterator.h>
 #include <grid/tria_iterator.templates.h>
 /*------------------------- Functions: DoFObjectAccessor<1,dim> -----------------------*/
 
 
-template <int dim>
-void DoFObjectAccessor<1, dim>::set_dof_index (const unsigned int i,
-                                              const unsigned int index) const
+template <int dim, template <int> class DH>
+void DoFObjectAccessor<1, dim, DH>::set_dof_index (const unsigned int i,
+                                                  const unsigned int index) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
                                   // and enough room was reserved
   Assert (&this->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (i<this->get_fe().dofs_per_line,
          ExcIndexRange (i, 0, this->get_fe().dofs_per_line));
 
@@ -52,10 +55,10 @@ void DoFObjectAccessor<1, dim>::set_dof_index (const unsigned int i,
 
 
 
-template <int dim>
-void DoFObjectAccessor<1, dim>::set_vertex_dof_index (const unsigned int vertex,
-                                                     const unsigned int i,
-                                                     const unsigned int index) const
+template <int dim, template <int> class DH>
+void DoFObjectAccessor<1, dim, DH>::set_vertex_dof_index (const unsigned int vertex,
+                                                         const unsigned int i,
+                                                         const unsigned int index) const
 
 {
                                   // since the exception classes are
@@ -67,7 +70,7 @@ void DoFObjectAccessor<1, dim>::set_vertex_dof_index (const unsigned int vertex,
                                   // non-template dependent name and
                                   // use that to specify the
                                   // qualified exception names
-  typedef DoFAccessor<dim> BaseClass;
+  typedef DoFAccessor<dim, DH> BaseClass;
   
   Assert (this->dof_handler != 0,
          typename BaseClass::ExcInvalidObject());
@@ -85,24 +88,28 @@ void DoFObjectAccessor<1, dim>::set_vertex_dof_index (const unsigned int vertex,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <class InputVector, typename number>
 void
-DoFObjectAccessor<1,dim>::get_dof_values (const InputVector &values,
-                                         Vector<number>    &local_values) const
+DoFObjectAccessor<1,dim,DH>::get_dof_values (const InputVector &values,
+                                            Vector<number>    &local_values) const
 {
+  typedef DoFAccessor<1, DH> BaseClass;
+
   Assert (dim==1, ExcInternalError());
   
-  Assert (this->dof_handler != 0, DoFAccessor<1>::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<1>::ExcInvalidObject());
-  Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<1>::ExcVectorDoesNotMatch());
+  Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject());
+  Assert (&this->get_fe() != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (local_values.size() == this->get_fe().dofs_per_cell,
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (values.size() == this->dof_handler->n_dofs(),
-         DoFAccessor<1>::ExcVectorDoesNotMatch());
-  Assert (this->has_children() == false, DoFAccessor<1>::ExcNotActive());
+         typename BaseClass::ExcVectorDoesNotMatch());
+  Assert (this->has_children() == false,
+         typename BaseClass::ExcNotActive());
   
-  const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = this->dof_handler->get_fe().dofs_per_line;
+  const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+                    dofs_per_line   = this->get_fe().dofs_per_line;
   typename Vector<number>::iterator next_local_value=local_values.begin();
   for (unsigned int vertex=0; vertex<2; ++vertex)
     for (unsigned int d=0; d<dofs_per_vertex; ++d)
@@ -116,24 +123,28 @@ DoFObjectAccessor<1,dim>::get_dof_values (const InputVector &values,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <class OutputVector, typename number>
 void
-DoFObjectAccessor<1,dim>::set_dof_values (const Vector<number> &local_values,
-                                         OutputVector         &values) const
+DoFObjectAccessor<1,dim,DH>::set_dof_values (const Vector<number> &local_values,
+                                            OutputVector         &values) const
 {
+  typedef DoFAccessor<1, DH> BaseClass;
+
   Assert (dim==1, ExcInternalError());
   
-  Assert (this->dof_handler != 0, DoFAccessor<1>::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<1>::ExcInvalidObject());
-  Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<1>::ExcVectorDoesNotMatch());
+  Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject());
+  Assert (&this->get_fe() != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (local_values.size() == this->get_fe().dofs_per_cell,
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (values.size() == this->dof_handler->n_dofs(),
-         DoFAccessor<1>::ExcVectorDoesNotMatch());
-  Assert (this->has_children() == false, DoFAccessor<1>::ExcNotActive());
+         typename BaseClass::ExcVectorDoesNotMatch());
+  Assert (this->has_children() == false,
+         typename BaseClass::ExcNotActive());
   
-  const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = this->dof_handler->get_fe().dofs_per_line;
+  const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+                    dofs_per_line   = this->get_fe().dofs_per_line;
   typename Vector<number>::const_iterator next_local_value=local_values.begin();
   for (unsigned int vertex=0; vertex<2; ++vertex)
     for (unsigned int d=0; d<dofs_per_vertex; ++d)
@@ -149,16 +160,18 @@ DoFObjectAccessor<1,dim>::set_dof_values (const Vector<number> &local_values,
 /*------------------------- Functions: DoFObjectAccessor<2,dim> -----------------------*/
 
 
-template <int dim>
-void DoFObjectAccessor<2, dim>::set_dof_index (const unsigned int i,
-                                              const unsigned int index) const
+template <int dim, template <int> class DH>
+void DoFObjectAccessor<2, dim, DH>::set_dof_index (const unsigned int i,
+                                                  const unsigned int index) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
                                   // and enough room was reserved
   Assert (&this->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (i<this->get_fe().dofs_per_quad,
          ExcIndexRange (i, 0, this->get_fe().dofs_per_quad));
 
@@ -168,16 +181,18 @@ void DoFObjectAccessor<2, dim>::set_dof_index (const unsigned int i,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 void
-DoFObjectAccessor<2, dim>::set_vertex_dof_index (const unsigned int vertex,
-                                                const unsigned int i,
-                                                const unsigned int index) const
+DoFObjectAccessor<2, dim, DH>::set_vertex_dof_index (const unsigned int vertex,
+                                                    const unsigned int i,
+                                                    const unsigned int index) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (vertex<4, ExcIndexRange (i,0,4));
   Assert (i<this->get_fe().dofs_per_vertex,
          ExcIndexRange (i, 0, this->get_fe().dofs_per_vertex));
@@ -190,28 +205,30 @@ DoFObjectAccessor<2, dim>::set_vertex_dof_index (const unsigned int vertex,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <class InputVector, typename number>
 void
-DoFObjectAccessor<2,dim>::get_dof_values (const InputVector &values,
-                                         Vector<number>    &local_values) const
+DoFObjectAccessor<2,dim,DH>::get_dof_values (const InputVector &values,
+                                            Vector<number>    &local_values) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (dim==2, ExcInternalError());
   
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
-  Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell,
-         typename DoFAccessor<dim>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcInvalidObject());
+  Assert (&this->get_fe() != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (local_values.size() == this->get_fe().dofs_per_cell,
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (values.size() == this->dof_handler->n_dofs(),
-         typename DoFAccessor<dim>::ExcVectorDoesNotMatch());
-  Assert (this->has_children() == false, typename DoFAccessor<dim>::
-         ExcNotActive());
+         typename BaseClass::ExcVectorDoesNotMatch());
+  Assert (this->has_children() == false,
+         typename BaseClass::ExcNotActive());
   
-  const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = this->dof_handler->get_fe().dofs_per_line,
-                    dofs_per_quad   = this->dof_handler->get_fe().dofs_per_quad;
+  const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+                    dofs_per_line   = this->get_fe().dofs_per_line,
+                    dofs_per_quad   = this->get_fe().dofs_per_quad;
   typename Vector<number>::iterator next_local_value=local_values.begin();
   for (unsigned int vertex=0; vertex<4; ++vertex)
     for (unsigned int d=0; d<dofs_per_vertex; ++d)
@@ -228,28 +245,30 @@ DoFObjectAccessor<2,dim>::get_dof_values (const InputVector &values,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <class OutputVector, typename number>
 void
-DoFObjectAccessor<2,dim>::set_dof_values (const Vector<number> &local_values,
-                                         OutputVector         &values) const
+DoFObjectAccessor<2,dim,DH>::set_dof_values (const Vector<number> &local_values,
+                                            OutputVector         &values) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (dim==2, ExcInternalError());
   
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
-  Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell,
-         typename DoFAccessor<dim>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcInvalidObject());
+  Assert (&this->get_fe() != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (local_values.size() == this->get_fe().dofs_per_cell,
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (values.size() == this->dof_handler->n_dofs(),
-         typename DoFAccessor<dim>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (this->has_children() == false,
-         typename DoFAccessor<dim>::ExcNotActive());
+         typename BaseClass::ExcNotActive());
   
-  const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = this->dof_handler->get_fe().dofs_per_line,
-                    dofs_per_quad   = this->dof_handler->get_fe().dofs_per_quad;
+  const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+                    dofs_per_line   = this->get_fe().dofs_per_line,
+                    dofs_per_quad   = this->get_fe().dofs_per_quad;
   typename Vector<number>::const_iterator next_local_value=local_values.begin();
   for (unsigned int vertex=0; vertex<4; ++vertex)
     for (unsigned int d=0; d<dofs_per_vertex; ++d)
@@ -268,16 +287,18 @@ DoFObjectAccessor<2,dim>::set_dof_values (const Vector<number> &local_values,
 /*------------------------- Functions: DoFObjectAccessor<3,dim> -----------------------*/
 
 
-template <int dim>
-void DoFObjectAccessor<3, dim>::set_dof_index (const unsigned int i,
-                                              const unsigned int index) const
+template <int dim, template <int> class DH>
+void DoFObjectAccessor<3, dim, DH>::set_dof_index (const unsigned int i,
+                                                  const unsigned int index) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
                                   // and enough room was reserved
   Assert (&this->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (i<this->get_fe().dofs_per_hex,
          ExcIndexRange (i, 0, this->get_fe().dofs_per_hex));
 
@@ -287,15 +308,17 @@ void DoFObjectAccessor<3, dim>::set_dof_index (const unsigned int i,
 
 
 
-template <int dim>
-void DoFObjectAccessor<3, dim>::set_vertex_dof_index (const unsigned int vertex,
-                                                     const unsigned int i,
-                                                     const unsigned int index) const
+template <int dim, template <int> class DH>
+void DoFObjectAccessor<3, dim, DH>::set_vertex_dof_index (const unsigned int vertex,
+                                                         const unsigned int i,
+                                                         const unsigned int index) const
 {
+  typedef DoFAccessor<dim, DH> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (vertex<8,
          ExcIndexRange (i,0,8));
   Assert (i<this->get_fe().dofs_per_vertex,
@@ -309,27 +332,31 @@ void DoFObjectAccessor<3, dim>::set_vertex_dof_index (const unsigned int vertex,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <class InputVector, typename number>
 void
-DoFObjectAccessor<3,dim>::get_dof_values (const InputVector &values,
-                                         Vector<number>    &local_values) const
+DoFObjectAccessor<3,dim,DH>::get_dof_values (const InputVector &values,
+                                            Vector<number>    &local_values) const
 {
+  typedef DoFAccessor<3, DH> BaseClass;
+
   Assert (dim==3, ExcInternalError());
 
-  Assert (this->dof_handler != 0, DoFAccessor<3>::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<3>::ExcInvalidObject());
-  Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<3>::ExcVectorDoesNotMatch());
+  Assert (this->dof_handler != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (&this->get_fe() != 0, 
+         typename BaseClass::ExcInvalidObject());
+  Assert (local_values.size() == this->get_fe().dofs_per_cell,
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (values.size() == this->dof_handler->n_dofs(),
-         DoFAccessor<3>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (this->has_children() == false,
-         DoFAccessor<3>::ExcNotActive());
+         typename BaseClass::ExcNotActive());
   
-  const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = this->dof_handler->get_fe().dofs_per_line,
-                    dofs_per_quad   = this->dof_handler->get_fe().dofs_per_quad,
-                    dofs_per_hex    = this->dof_handler->get_fe().dofs_per_hex;
+  const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+                    dofs_per_line   = this->get_fe().dofs_per_line,
+                    dofs_per_quad   = this->get_fe().dofs_per_quad,
+                    dofs_per_hex    = this->get_fe().dofs_per_hex;
   typename Vector<number>::iterator next_local_value = local_values.begin();
   for (unsigned int vertex=0; vertex<GeometryInfo<3>::vertices_per_cell; ++vertex)
     for (unsigned int d=0; d<dofs_per_vertex; ++d)
@@ -349,29 +376,31 @@ DoFObjectAccessor<3,dim>::get_dof_values (const InputVector &values,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <class OutputVector, typename number>
 void
-DoFObjectAccessor<3,dim>::set_dof_values (const Vector<number> &local_values,
-                                         OutputVector         &values) const
+DoFObjectAccessor<3,dim,DH>::set_dof_values (const Vector<number> &local_values,
+                                            OutputVector         &values) const
 {
+  typedef DoFAccessor<3, DH> BaseClass;
+
   Assert (dim==3, ExcInternalError());
 
   Assert (this->dof_handler != 0,
-         DoFAccessor<3>::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0,
-         DoFAccessor<3>::ExcInvalidObject());
-  Assert (local_values.size() == this->dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<3>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcInvalidObject());
+  Assert (&this->get_fe() != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (local_values.size() == this->get_fe().dofs_per_cell,
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (values.size() == this->dof_handler->n_dofs(),
-         DoFAccessor<3>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (this->has_children() == false,
-         DoFAccessor<3>::ExcNotActive());
+         typename BaseClass::ExcNotActive());
   
-  const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = this->dof_handler->get_fe().dofs_per_line,
-                    dofs_per_quad   = this->dof_handler->get_fe().dofs_per_quad,
-                    dofs_per_hex    = this->dof_handler->get_fe().dofs_per_hex;
+  const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex,
+                    dofs_per_line   = this->get_fe().dofs_per_line,
+                    dofs_per_quad   = this->get_fe().dofs_per_quad,
+                    dofs_per_hex    = this->get_fe().dofs_per_hex;
   typename Vector<number>::const_iterator next_local_value=local_values.begin();
   for (unsigned int vertex=0; vertex<GeometryInfo<dim>::vertices_per_cell; ++vertex)
     for (unsigned int d=0; d<dofs_per_vertex; ++d)
@@ -390,18 +419,17 @@ DoFObjectAccessor<3,dim>::set_dof_values (const Vector<number> &local_values,
 }
 
 
-
 /*------------------------- Functions: DoFCellAccessor -----------------------*/
 
 
 #if deal_II_dimension == 1
 
 template <>
-TriaIterator<1, DoFObjectAccessor<0,1> >
-DoFCellAccessor<1>::face (const unsigned int) const
+TriaIterator<1, DoFObjectAccessor<0,1,DoFHandler> >
+DoFCellAccessor<1,DoFHandler>::face (const unsigned int) const
 {
   Assert (false, ExcImpossibleInDim(1));
-  return TriaIterator<1, DoFObjectAccessor<0,1> >();
+  return TriaIterator<1, DoFObjectAccessor<0,1, DoFHandler> >();
 }
 
 #endif
@@ -410,8 +438,8 @@ DoFCellAccessor<1>::face (const unsigned int) const
 #if deal_II_dimension == 2
 
 template <>
-TriaIterator<2, DoFObjectAccessor<1,2> >
-DoFCellAccessor<2>::face (const unsigned int i) const
+TriaIterator<2, DoFObjectAccessor<1,2,DoFHandler> >
+DoFCellAccessor<2,DoFHandler>::face (const unsigned int i) const
 {
   return this->line(i);
 }
@@ -422,8 +450,8 @@ DoFCellAccessor<2>::face (const unsigned int i) const
 #if deal_II_dimension == 3
 
 template <>
-TriaIterator<3, DoFObjectAccessor<2, 3> >
-DoFCellAccessor<3>::face (const unsigned int i) const
+TriaIterator<3, DoFObjectAccessor<2, 3, DoFHandler> >
+DoFCellAccessor<3,DoFHandler>::face (const unsigned int i) const
 {
   return this->quad(i);
 }
@@ -431,41 +459,42 @@ DoFCellAccessor<3>::face (const unsigned int i) const
 #endif
 
 
-
-template <int dim>
-TriaIterator<dim,DoFCellAccessor<dim> >
-DoFCellAccessor<dim>::
+template <int dim, template <int> class DH>
+TriaIterator<dim,DoFCellAccessor<dim,DH> >
+DoFCellAccessor<dim,DH>::
 neighbor_child_on_subface (const unsigned int face,
                            const unsigned int subface) const
 {
   const TriaIterator<dim,CellAccessor<dim> > q
     = CellAccessor<dim>::neighbor_child_on_subface (face, subface);
-  return TriaIterator<dim,DoFCellAccessor<dim> > (this->tria,
-                                                  q->level (),
-                                                  q->index (),
-                                                  this->dof_handler);
+  return TriaIterator<dim,DoFCellAccessor<dim,DH> > (this->tria,
+                                                     q->level (),
+                                                     q->index (),
+                                                     this->dof_handler);
 }
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <class InputVector, typename number>
 void
-DoFCellAccessor<dim>::get_interpolated_dof_values (const InputVector &values,
-                                                  Vector<number>    &interpolated_values) const
+DoFCellAccessor<dim,DH>::
+get_interpolated_dof_values (const InputVector &values,
+                            Vector<number>    &interpolated_values) const
 {
-  const FiniteElement<dim> &fe            = this->dof_handler->get_fe();
+  const FiniteElement<dim> &fe            = this->get_fe();
   const unsigned int        dofs_per_cell = fe.dofs_per_cell;
   
+  typedef DoFAccessor<dim, DH> BaseClass;
   
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&fe != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (interpolated_values.size() == dofs_per_cell,
-         typename DoFAccessor<dim>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (values.size() == this->dof_handler->n_dofs(),
-         typename DoFAccessor<dim>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
 
   if (!this->has_children())
                                     // if this cell has no children: simply
@@ -566,22 +595,24 @@ DoFCellAccessor<dim>::get_interpolated_dof_values (const InputVector &values,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <class OutputVector, typename number>
 void
-DoFCellAccessor<dim>::set_dof_values_by_interpolation (const Vector<number> &local_values,
-                                                      OutputVector         &values) const
+DoFCellAccessor<dim,DH>::
+set_dof_values_by_interpolation (const Vector<number> &local_values,
+                                OutputVector         &values) const
 {
-  const unsigned int dofs_per_cell = this->dof_handler->get_fe().dofs_per_cell;
+  const unsigned int dofs_per_cell = this->get_fe().dofs_per_cell;
+  typedef DoFAccessor<dim, DH> BaseClass;
   
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
+  Assert (&this->get_fe() != 0,
+         typename BaseClass::ExcInvalidObject());
   Assert (local_values.size() == dofs_per_cell,
-         typename DoFAccessor<dim>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (values.size() == this->dof_handler->n_dofs(),
-         typename DoFAccessor<dim>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
 
   if (!this->has_children())
                                      // if this cell has no children: simply
@@ -597,7 +628,7 @@ DoFCellAccessor<dim>::set_dof_values_by_interpolation (const Vector<number> &loc
        {
                                           // prolong the given data
                                           // to the present cell
-         this->dof_handler->get_fe().get_prolongation_matrix(child)
+         this->get_fe().get_prolongation_matrix(child)
             .vmult (tmp, local_values);
          this->child(child)->set_dof_values_by_interpolation (tmp, values);
        };
@@ -607,255 +638,725 @@ DoFCellAccessor<dim>::set_dof_values_by_interpolation (const Vector<number> &loc
 
 
 // --------------------------------------------------------------------------
-// explicit instantiations
+// explicit instantiations (for DoFHandler)
 
 
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<Vector<double>,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<Vector<double>,double>
 (const Vector<double>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<Vector<double>,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<Vector<double>,double>
 (const Vector<double>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<Vector<double>,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<Vector<double>,float>
 (const Vector<double>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<Vector<float>,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<Vector<float>,double>
 (const Vector<double>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<Vector<float>,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<Vector<float>,double>
 (const Vector<float>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<Vector<double>,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<Vector<double>,float>
 (const Vector<float>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<Vector<float>,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<Vector<float>,float>
 (const Vector<float>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<Vector<float>,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<Vector<float>,float>
 (const Vector<float>&, Vector<float>&) const;
 
 
 // for block vector
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<BlockVector<double>,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<double>,double>
 (const BlockVector<double> &, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<BlockVector<double>,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<double>,double>
 (const Vector<double>&, BlockVector<double>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<BlockVector<double>,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<double>,float>
 (const BlockVector<double> &, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<BlockVector<float>,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<float>,double>
 (const Vector<double>&, BlockVector<float>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<BlockVector<float>,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<float>,double>
 (const BlockVector<float> &, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<BlockVector<double>,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<double>,float>
 (const Vector<float>&, BlockVector<double>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<BlockVector<float>,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<float>,float>
 (const BlockVector<float>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<BlockVector<float>,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<float>,float>
 (const Vector<float>&, BlockVector<float>&) const;
 
 // for Petsc vectors
 #ifdef DEAL_II_USE_PETSC
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<PETScWrappers::Vector,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::Vector,double>
 (const PETScWrappers::Vector &, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<PETScWrappers::Vector,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::Vector,float>
 (const PETScWrappers::Vector &, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<PETScWrappers::Vector,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::Vector,double>
 (const Vector<double> &, PETScWrappers::Vector&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<PETScWrappers::Vector,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::Vector,float>
 (const Vector<float>&, PETScWrappers::Vector&) const;
 
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<PETScWrappers::BlockVector,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::BlockVector,double>
 (const PETScWrappers::BlockVector &, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::get_dof_values<PETScWrappers::BlockVector,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::BlockVector,float>
 (const PETScWrappers::BlockVector &, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<PETScWrappers::BlockVector,double>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::BlockVector,double>
 (const Vector<double> &, PETScWrappers::BlockVector&) const;
 template
 void
-DoFObjectAccessor<1,deal_II_dimension>::set_dof_values<PETScWrappers::BlockVector,float>
+DoFObjectAccessor<1,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::BlockVector,float>
 (const Vector<float>&, PETScWrappers::BlockVector&) const;
 #endif
 
 #if deal_II_dimension >= 2
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<Vector<double>,double>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<Vector<double>,double>
 (const Vector<double>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<Vector<double>,double>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<Vector<double>,double>
 (const Vector<double>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<Vector<double>,float>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<Vector<double>,float>
 (const Vector<double>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<Vector<float>,double>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<Vector<float>,double>
 (const Vector<double>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<Vector<float>,double>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<Vector<float>,double>
 (const Vector<float>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<Vector<double>,float>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<Vector<double>,float>
 (const Vector<float>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<Vector<float>,float>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<Vector<float>,float>
 (const Vector<float>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<Vector<float>,float>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<Vector<float>,float>
 (const Vector<float>&, Vector<float>&) const;
 
 
 // for block vector
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<BlockVector<double>,double>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<double>,double>
 (const BlockVector<double>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<BlockVector<double>,double>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<double>,double>
 (const Vector<double>&, BlockVector<double>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<BlockVector<double>,float>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<double>,float>
 (const BlockVector<double>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<BlockVector<float>,double>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<float>,double>
 (const Vector<double>&, BlockVector<float>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<BlockVector<float>,double>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<float>,double>
 (const BlockVector<float>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<BlockVector<double>,float>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<double>,float>
 (const Vector<float>&, BlockVector<double>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<BlockVector<float>,float>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<float>,float>
 (const BlockVector<float>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<BlockVector<float>,float>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<float>,float>
 (const Vector<float>&, BlockVector<float>&) const;
 
 // for Petsc vectors
 #ifdef DEAL_II_USE_PETSC
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<PETScWrappers::Vector,double>
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::Vector,double>
+(const PETScWrappers::Vector &, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::Vector,float>
+(const PETScWrappers::Vector &, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::Vector,double>
+(const Vector<double> &, PETScWrappers::Vector&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::Vector,float>
+(const Vector<float>&, PETScWrappers::Vector&) const;
+
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::BlockVector,double>
+(const PETScWrappers::BlockVector &, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::BlockVector,float>
+(const PETScWrappers::BlockVector &, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::BlockVector,double>
+(const Vector<double> &, PETScWrappers::BlockVector&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::BlockVector,float>
+(const Vector<float>&, PETScWrappers::BlockVector&) const;
+#endif
+#endif
+
+#if deal_II_dimension >= 3
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<Vector<double>,double>
+(const Vector<double>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<Vector<double>,double>
+(const Vector<double>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<Vector<double>,float>
+(const Vector<double>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<Vector<float>,double>
+(const Vector<double>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<Vector<float>,double>
+(const Vector<float>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<Vector<double>,float>
+(const Vector<float>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<Vector<float>,float>
+(const Vector<float>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<Vector<float>,float>
+(const Vector<float>&, Vector<float>&) const;
+
+
+
+// for block vector
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<double>,double>
+(const BlockVector<double>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<double>,double>
+(const Vector<double>&, BlockVector<double>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<double>,float>
+(const BlockVector<double>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<float>,double>
+(const Vector<double>&, BlockVector<float>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<float>,double>
+(const BlockVector<float>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<double>,float>
+(const Vector<float>&, BlockVector<double>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<BlockVector<float>,float>
+(const BlockVector<float>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<BlockVector<float>,float>
+(const Vector<float>&, BlockVector<float>&) const;
+
+// for Petsc vectors
+#if DEAL_II_USE_PETSC
+template
+void
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::Vector,double>
 (const PETScWrappers::Vector &, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<PETScWrappers::Vector,float>
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::Vector,float>
 (const PETScWrappers::Vector &, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<PETScWrappers::Vector,double>
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::Vector,double>
 (const Vector<double> &, PETScWrappers::Vector&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<PETScWrappers::Vector,float>
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::Vector,float>
 (const Vector<float>&, PETScWrappers::Vector&) const;
 
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<PETScWrappers::BlockVector,double>
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::BlockVector,double>
 (const PETScWrappers::BlockVector &, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::get_dof_values<PETScWrappers::BlockVector,float>
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::get_dof_values<PETScWrappers::BlockVector,float>
 (const PETScWrappers::BlockVector &, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<PETScWrappers::BlockVector,double>
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::BlockVector,double>
 (const Vector<double> &, PETScWrappers::BlockVector&) const;
 template
 void
-DoFObjectAccessor<2,deal_II_dimension>::set_dof_values<PETScWrappers::BlockVector,float>
+DoFObjectAccessor<3,deal_II_dimension,DoFHandler>::set_dof_values<PETScWrappers::BlockVector,float>
 (const Vector<float>&, PETScWrappers::BlockVector&) const;
 #endif
 #endif
 
 
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<Vector<double>,double>
+(const Vector<double>&, Vector<double>&) const;
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<Vector<double>,double>
+(const Vector<double>&, Vector<double>&) const;
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<Vector<double>,float>
+(const Vector<double>&, Vector<float>&) const;
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<Vector<float>,double>
+(const Vector<double>&, Vector<float>&) const;
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<Vector<float>,double>
+(const Vector<float>&, Vector<double>&) const;
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<Vector<double>,float>
+(const Vector<float>&, Vector<double>&) const;
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<Vector<float>,float>
+(const Vector<float>&, Vector<float>&) const;
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<Vector<float>,float>
+(const Vector<float>&, Vector<float>&) const;
+
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<BlockVector<double>,double>
+(const BlockVector<double>&, Vector<double>&) const;
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<BlockVector<double>,double>
+(const Vector<double>&, BlockVector<double>&) const;
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<BlockVector<double>,float>
+(const BlockVector<double>&, Vector<float>&) const;
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<BlockVector<float>,double>
+(const Vector<double>&, BlockVector<float>&) const;
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<BlockVector<float>,double>
+(const BlockVector<float>&, Vector<double>&) const;
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<BlockVector<double>,float>
+(const Vector<float>&, BlockVector<double>&) const;
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<BlockVector<float>,float>
+(const BlockVector<float>&, Vector<float>&) const;
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<BlockVector<float>,float>
+(const Vector<float>&, BlockVector<float>&) const;
+
+// for Petsc vectors
+#if DEAL_II_USE_PETSC
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<PETScWrappers::Vector,double>
+(const PETScWrappers::Vector&, Vector<double>&) const;
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<PETScWrappers::Vector,double>
+(const Vector<double>&, PETScWrappers::Vector&) const;
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<PETScWrappers::Vector,float>
+(const PETScWrappers::Vector&, Vector<float>&) const;
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<PETScWrappers::Vector,float>
+(const Vector<float>&, PETScWrappers::Vector&) const;
+
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<PETScWrappers::BlockVector,double>
+(const PETScWrappers::BlockVector&, Vector<double>&) const;
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<PETScWrappers::BlockVector,double>
+(const Vector<double>&, PETScWrappers::BlockVector&) const;
+
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+get_interpolated_dof_values<PETScWrappers::BlockVector,float>
+(const PETScWrappers::BlockVector&, Vector<float>&) const;
+template
+void
+DoFCellAccessor<deal_II_dimension,DoFHandler>::
+set_dof_values_by_interpolation<PETScWrappers::BlockVector,float>
+(const Vector<float>&, PETScWrappers::BlockVector&) const;
+
+#endif
+
+
+template class DoFAccessor<deal_II_dimension, DoFHandler>;
+
+#if deal_II_dimension == 1
+template class DoFObjectAccessor<1, 1, DoFHandler>;
+#endif
+
+#if deal_II_dimension == 2
+template class DoFObjectAccessor<1, 2, DoFHandler>;
+template class DoFObjectAccessor<2, 2, DoFHandler>;
+
+template class TriaRawIterator   <2,DoFObjectAccessor<1, 2, DoFHandler> >;
+template class TriaIterator      <2,DoFObjectAccessor<1, 2, DoFHandler> >;
+template class TriaActiveIterator<2,DoFObjectAccessor<1, 2, DoFHandler> >;
+#endif
+
+#if deal_II_dimension == 3
+template class DoFObjectAccessor<1, 3, DoFHandler>;
+template class DoFObjectAccessor<2, 3, DoFHandler>;
+template class DoFObjectAccessor<3, 3, DoFHandler>;
+
+template class TriaRawIterator   <3,DoFObjectAccessor<1, 3, DoFHandler> >;
+template class TriaIterator      <3,DoFObjectAccessor<1, 3, DoFHandler> >;
+template class TriaActiveIterator<3,DoFObjectAccessor<1, 3, DoFHandler> >;
+template class TriaRawIterator   <3,DoFObjectAccessor<2, 3, DoFHandler> >;
+template class TriaIterator      <3,DoFObjectAccessor<2, 3, DoFHandler> >;
+template class TriaActiveIterator<3,DoFObjectAccessor<2, 3, DoFHandler> >;
+#endif
+
+
+template class DoFCellAccessor<deal_II_dimension, DoFHandler>;
+
+template class TriaRawIterator   <deal_II_dimension,DoFCellAccessor<deal_II_dimension, DoFHandler> >;
+template class TriaIterator      <deal_II_dimension,DoFCellAccessor<deal_II_dimension, DoFHandler> >;
+template class TriaActiveIterator<deal_II_dimension,DoFCellAccessor<deal_II_dimension, DoFHandler> >;
+
+
+// --------------------------------------------------------------------------
+// explicit instantiations (for hpDoFHandler)
+
+
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<double>,double>
+(const Vector<double>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<double>,double>
+(const Vector<double>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<double>,float>
+(const Vector<double>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<float>,double>
+(const Vector<double>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<float>,double>
+(const Vector<float>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<double>,float>
+(const Vector<float>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<float>,float>
+(const Vector<float>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<float>,float>
+(const Vector<float>&, Vector<float>&) const;
+
+
+// for block vector
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<double>,double>
+(const BlockVector<double> &, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<double>,double>
+(const Vector<double>&, BlockVector<double>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<double>,float>
+(const BlockVector<double> &, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<float>,double>
+(const Vector<double>&, BlockVector<float>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<float>,double>
+(const BlockVector<float> &, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<double>,float>
+(const Vector<float>&, BlockVector<double>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<float>,float>
+(const BlockVector<float>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<float>,float>
+(const Vector<float>&, BlockVector<float>&) const;
+
+// for Petsc vectors
+#if DEAL_II_USE_PETSC
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::get_dof_values<PETScWrappers::Vector,double>
+(const PETScWrappers::Vector &, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::get_dof_values<PETScWrappers::Vector,float>
+(const PETScWrappers::Vector &, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::set_dof_values<PETScWrappers::Vector,double>
+(const Vector<double> &, PETScWrappers::Vector&) const;
+template
+void
+DoFObjectAccessor<1,deal_II_dimension,hpDoFHandler>::set_dof_values<PETScWrappers::Vector,float>
+(const Vector<float>&, PETScWrappers::Vector&) const;
+#endif
+
+
+#if deal_II_dimension >= 2
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<double>,double>
+(const Vector<double>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<double>,double>
+(const Vector<double>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<double>,float>
+(const Vector<double>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<float>,double>
+(const Vector<double>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<float>,double>
+(const Vector<float>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<double>,float>
+(const Vector<float>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<float>,float>
+(const Vector<float>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<float>,float>
+(const Vector<float>&, Vector<float>&) const;
+
+
+// for block vector
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<double>,double>
+(const BlockVector<double>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<double>,double>
+(const Vector<double>&, BlockVector<double>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<double>,float>
+(const BlockVector<double>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<float>,double>
+(const Vector<double>&, BlockVector<float>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<float>,double>
+(const BlockVector<float>&, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<double>,float>
+(const Vector<float>&, BlockVector<double>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<float>,float>
+(const BlockVector<float>&, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<float>,float>
+(const Vector<float>&, BlockVector<float>&) const;
+
+// for Petsc vectors
+#if DEAL_II_USE_PETSC
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::get_dof_values<PETScWrappers::Vector,double>
+(const PETScWrappers::Vector &, Vector<double>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::get_dof_values<PETScWrappers::Vector,float>
+(const PETScWrappers::Vector &, Vector<float>&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::set_dof_values<PETScWrappers::Vector,double>
+(const Vector<double> &, PETScWrappers::Vector&) const;
+template
+void
+DoFObjectAccessor<2,deal_II_dimension,hpDoFHandler>::set_dof_values<PETScWrappers::Vector,float>
+(const Vector<float>&, PETScWrappers::Vector&) const;
+#endif
+
+#endif
+
 #if deal_II_dimension >= 3
 // for double
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<Vector<double>,double>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<double>,double>
 (const Vector<double>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<Vector<double>,double>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<double>,double>
 (const Vector<double>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<Vector<double>,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<double>,float>
 (const Vector<double>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<Vector<float>,double>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<float>,double>
 (const Vector<double>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<Vector<float>,double>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<float>,double>
 (const Vector<float>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<Vector<double>,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<double>,float>
 (const Vector<float>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<Vector<float>,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<Vector<float>,float>
 (const Vector<float>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<Vector<float>,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<Vector<float>,float>
 (const Vector<float>&, Vector<float>&) const;
 
 
@@ -863,71 +1364,72 @@ DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<Vector<float>,float>
 // for block vector
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<BlockVector<double>,double>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<double>,double>
 (const BlockVector<double>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<BlockVector<double>,double>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<double>,double>
 (const Vector<double>&, BlockVector<double>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<BlockVector<double>,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<double>,float>
 (const BlockVector<double>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<BlockVector<float>,double>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<float>,double>
 (const Vector<double>&, BlockVector<float>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<BlockVector<float>,double>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<float>,double>
 (const BlockVector<float>&, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<BlockVector<double>,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<double>,float>
 (const Vector<float>&, BlockVector<double>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<BlockVector<float>,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<BlockVector<float>,float>
 (const BlockVector<float>&, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<BlockVector<float>,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<BlockVector<float>,float>
 (const Vector<float>&, BlockVector<float>&) const;
 
+
 // for Petsc vectors
 #ifdef DEAL_II_USE_PETSC
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<PETScWrappers::Vector,double>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<PETScWrappers::Vector,double>
 (const PETScWrappers::Vector &, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<PETScWrappers::Vector,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<PETScWrappers::Vector,float>
 (const PETScWrappers::Vector &, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<PETScWrappers::Vector,double>
-(const Vector<double>&, PETScWrappers::Vector &) const;
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<PETScWrappers::Vector,double>
+(const Vector<double> &, PETScWrappers::Vector&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<PETScWrappers::Vector,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<PETScWrappers::Vector,float>
 (const Vector<float>&, PETScWrappers::Vector&) const;
 
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<PETScWrappers::BlockVector,double>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<PETScWrappers::BlockVector,double>
 (const PETScWrappers::BlockVector &, Vector<double>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::get_dof_values<PETScWrappers::BlockVector,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::get_dof_values<PETScWrappers::BlockVector,float>
 (const PETScWrappers::BlockVector &, Vector<float>&) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<PETScWrappers::BlockVector,double>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<PETScWrappers::BlockVector,double>
 (const Vector<double>&, PETScWrappers::BlockVector &) const;
 template
 void
-DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<PETScWrappers::BlockVector,float>
+DoFObjectAccessor<3,deal_II_dimension,hpDoFHandler>::set_dof_values<PETScWrappers::BlockVector,float>
 (const Vector<float>&, PETScWrappers::BlockVector&) const;
 #endif
 #endif
@@ -936,92 +1438,92 @@ DoFObjectAccessor<3,deal_II_dimension>::set_dof_values<PETScWrappers::BlockVecto
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<Vector<double>,double>
 (const Vector<double>&, Vector<double>&) const;
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<Vector<double>,double>
 (const Vector<double>&, Vector<double>&) const;
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<Vector<double>,float>
 (const Vector<double>&, Vector<float>&) const;
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<Vector<float>,double>
 (const Vector<double>&, Vector<float>&) const;
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<Vector<float>,double>
 (const Vector<float>&, Vector<double>&) const;
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<Vector<double>,float>
 (const Vector<float>&, Vector<double>&) const;
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<Vector<float>,float>
 (const Vector<float>&, Vector<float>&) const;
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<Vector<float>,float>
 (const Vector<float>&, Vector<float>&) const;
 
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<BlockVector<double>,double>
 (const BlockVector<double>&, Vector<double>&) const;
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<BlockVector<double>,double>
 (const Vector<double>&, BlockVector<double>&) const;
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<BlockVector<double>,float>
 (const BlockVector<double>&, Vector<float>&) const;
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<BlockVector<float>,double>
 (const Vector<double>&, BlockVector<float>&) const;
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<BlockVector<float>,double>
 (const BlockVector<float>&, Vector<double>&) const;
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<BlockVector<double>,float>
 (const Vector<float>&, BlockVector<double>&) const;
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<BlockVector<float>,float>
 (const BlockVector<float>&, Vector<float>&) const;
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<BlockVector<float>,float>
 (const Vector<float>&, BlockVector<float>&) const;
 
@@ -1029,82 +1531,84 @@ set_dof_values_by_interpolation<BlockVector<float>,float>
 #ifdef DEAL_II_USE_PETSC
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<PETScWrappers::Vector,double>
 (const PETScWrappers::Vector&, Vector<double>&) const;
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<PETScWrappers::Vector,double>
 (const Vector<double>&, PETScWrappers::Vector&) const;
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<PETScWrappers::Vector,float>
 (const PETScWrappers::Vector&, Vector<float>&) const;
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<PETScWrappers::Vector,float>
 (const Vector<float>&, PETScWrappers::Vector&) const;
 
+
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<PETScWrappers::BlockVector,double>
 (const PETScWrappers::BlockVector&, Vector<double>&) const;
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<PETScWrappers::BlockVector,double>
 (const Vector<double>&, PETScWrappers::BlockVector&) const;
 
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 get_interpolated_dof_values<PETScWrappers::BlockVector,float>
 (const PETScWrappers::BlockVector&, Vector<float>&) const;
 template
 void
-DoFCellAccessor<deal_II_dimension>::
+DoFCellAccessor<deal_II_dimension,hpDoFHandler>::
 set_dof_values_by_interpolation<PETScWrappers::BlockVector,float>
 (const Vector<float>&, PETScWrappers::BlockVector&) const;
 #endif
 
 
-template class DoFAccessor<deal_II_dimension>;
+template class DoFAccessor<deal_II_dimension, hpDoFHandler>;
 
 #if deal_II_dimension == 1
-template class DoFObjectAccessor<1, 1>;
+template class DoFObjectAccessor<1, 1, hpDoFHandler>;
 #endif
 
 #if deal_II_dimension == 2
-template class DoFObjectAccessor<1, 2>;
-template class DoFObjectAccessor<2, 2>;
+template class DoFObjectAccessor<1, 2, hpDoFHandler>;
+template class DoFObjectAccessor<2, 2, hpDoFHandler>;
 
-template class TriaRawIterator   <2,DoFObjectAccessor<1, 2> >;
-template class TriaIterator      <2,DoFObjectAccessor<1, 2> >;
-template class TriaActiveIterator<2,DoFObjectAccessor<1, 2> >;
+template class TriaRawIterator   <2,DoFObjectAccessor<1, 2, hpDoFHandler> >;
+template class TriaIterator      <2,DoFObjectAccessor<1, 2, hpDoFHandler> >;
+template class TriaActiveIterator<2,DoFObjectAccessor<1, 2, hpDoFHandler> >;
 #endif
 
 
 #if deal_II_dimension == 3
-template class DoFObjectAccessor<1, 3>;
-template class DoFObjectAccessor<2, 3>;
-template class DoFObjectAccessor<3, 3>;
-
-template class TriaRawIterator   <3,DoFObjectAccessor<1, 3> >;
-template class TriaIterator      <3,DoFObjectAccessor<1, 3> >;
-template class TriaActiveIterator<3,DoFObjectAccessor<1, 3> >;
-template class TriaRawIterator   <3,DoFObjectAccessor<2, 3> >;
-template class TriaIterator      <3,DoFObjectAccessor<2, 3> >;
-template class TriaActiveIterator<3,DoFObjectAccessor<2, 3> >;
+template class DoFObjectAccessor<1, 3, hpDoFHandler>;
+template class DoFObjectAccessor<2, 3, hpDoFHandler>;
+template class DoFObjectAccessor<3, 3, hpDoFHandler>;
+
+template class TriaRawIterator   <3,DoFObjectAccessor<1, 3, hpDoFHandler> >;
+template class TriaIterator      <3,DoFObjectAccessor<1, 3, hpDoFHandler> >;
+template class TriaActiveIterator<3,DoFObjectAccessor<1, 3, hpDoFHandler> >;
+template class TriaRawIterator   <3,DoFObjectAccessor<2, 3, hpDoFHandler> >;
+template class TriaIterator      <3,DoFObjectAccessor<2, 3, hpDoFHandler> >;
+template class TriaActiveIterator<3,DoFObjectAccessor<2, 3, hpDoFHandler> >;
 #endif
 
 
-template class DoFCellAccessor<deal_II_dimension>;
+template class DoFCellAccessor<deal_II_dimension, hpDoFHandler>;
+
+template class TriaRawIterator   <deal_II_dimension,DoFCellAccessor<deal_II_dimension, hpDoFHandler> >;
+template class TriaIterator      <deal_II_dimension,DoFCellAccessor<deal_II_dimension, hpDoFHandler> >;
+template class TriaActiveIterator<deal_II_dimension,DoFCellAccessor<deal_II_dimension, hpDoFHandler> >;
 
-template class TriaRawIterator   <deal_II_dimension,DoFCellAccessor<deal_II_dimension> >;
-template class TriaIterator      <deal_II_dimension,DoFCellAccessor<deal_II_dimension> >;
-template class TriaActiveIterator<deal_II_dimension,DoFCellAccessor<deal_II_dimension> >;
index 05f666fb7b1bead3c78800b883d8b1f32861bab1..705b3e54d1e2966b94a78814ce3d9958a51d9f62 100644 (file)
@@ -132,7 +132,7 @@ DoFHandler<1>::last_active (const unsigned int level) const
 
 
 template <>
-DoFDimensionInfo<1>::raw_face_iterator
+DoFHandler<1>::raw_face_iterator
 DoFHandler<1>::begin_raw_face (const unsigned int) const
 {
   Assert (false, ExcImpossibleInDim(1));
@@ -141,7 +141,7 @@ DoFHandler<1>::begin_raw_face (const unsigned int) const
 
 
 template <>
-DoFDimensionInfo<1>::face_iterator
+DoFHandler<1>::face_iterator
 DoFHandler<1>::begin_face (const unsigned int) const
 {
   Assert (false, ExcImpossibleInDim(1));
@@ -150,7 +150,7 @@ DoFHandler<1>::begin_face (const unsigned int) const
 
 
 template <>
-DoFDimensionInfo<1>::active_face_iterator
+DoFHandler<1>::active_face_iterator
 DoFHandler<1>::begin_active_face (const unsigned int) const
 {
   Assert (false, ExcImpossibleInDim(1));
@@ -159,7 +159,7 @@ DoFHandler<1>::begin_active_face (const unsigned int) const
 
 
 template <>
-DoFDimensionInfo<1>::raw_face_iterator
+DoFHandler<1>::raw_face_iterator
 DoFHandler<1>::end_face () const
 {
   Assert (false, ExcImpossibleInDim(1));
@@ -168,8 +168,8 @@ DoFHandler<1>::end_face () const
 
 
 template <>
-DoFDimensionInfo<1>::raw_face_iterator
-DoFHandler<1>::last_raw_face () const
+DoFHandler<1>::raw_face_iterator
+DoFHandler<1>::last_raw_face () const 
 {
   Assert (false, ExcImpossibleInDim(1));
   return 0;
@@ -177,7 +177,7 @@ DoFHandler<1>::last_raw_face () const
 
 
 template <>
-DoFDimensionInfo<1>::raw_face_iterator
+DoFHandler<1>::raw_face_iterator
 DoFHandler<1>::last_raw_face (const unsigned int) const
 {
   Assert (false, ExcImpossibleInDim(1));
@@ -186,7 +186,7 @@ DoFHandler<1>::last_raw_face (const unsigned int) const
 
 
 template <>
-DoFDimensionInfo<1>::face_iterator
+DoFHandler<1>::face_iterator
 DoFHandler<1>::last_face () const
 {
   Assert (false, ExcImpossibleInDim(1));
@@ -195,7 +195,7 @@ DoFHandler<1>::last_face () const
 
 
 template <>
-DoFDimensionInfo<1>::face_iterator
+DoFHandler<1>::face_iterator
 DoFHandler<1>::last_face (const unsigned int) const
 {
   Assert (false, ExcImpossibleInDim(1));
@@ -204,7 +204,7 @@ DoFHandler<1>::last_face (const unsigned int) const
 
 
 template <>
-DoFDimensionInfo<1>::active_face_iterator
+DoFHandler<1>::active_face_iterator
 DoFHandler<1>::last_active_face () const
 {
   Assert (false, ExcImpossibleInDim(1));
@@ -213,7 +213,7 @@ DoFHandler<1>::last_active_face () const
 
 
 template <>
-DoFDimensionInfo<1>::active_face_iterator
+DoFHandler<1>::active_face_iterator
 DoFHandler<1>::last_active_face (const unsigned int) const
 {
   return 0;
@@ -485,7 +485,7 @@ DoFHandler<2>::last_active (const unsigned int level) const
 
 
 template <>
-DoFDimensionInfo<2>::raw_face_iterator
+DoFHandler<2>::raw_face_iterator
 DoFHandler<2>::begin_raw_face (const unsigned int level) const
 {
   return begin_raw_line (level);
@@ -493,7 +493,7 @@ DoFHandler<2>::begin_raw_face (const unsigned int level) const
 
 
 template <>
-DoFDimensionInfo<2>::face_iterator
+DoFHandler<2>::face_iterator
 DoFHandler<2>::begin_face (const unsigned int level) const
 {
   return begin_line (level);
@@ -501,7 +501,7 @@ DoFHandler<2>::begin_face (const unsigned int level) const
 
 
 template <>
-DoFDimensionInfo<2>::active_face_iterator
+DoFHandler<2>::active_face_iterator
 DoFHandler<2>::begin_active_face (const unsigned int level) const
 {
   return begin_active_line (level);
@@ -509,7 +509,7 @@ DoFHandler<2>::begin_active_face (const unsigned int level) const
 
 
 template <>
-DoFDimensionInfo<2>::raw_face_iterator
+DoFHandler<2>::raw_face_iterator
 DoFHandler<2>::end_face () const
 {
   return end_line ();
@@ -517,7 +517,7 @@ DoFHandler<2>::end_face () const
 
 
 template <>
-DoFDimensionInfo<2>::raw_face_iterator
+DoFHandler<2>::raw_face_iterator
 DoFHandler<2>::last_raw_face () const
 {
   return last_raw_line ();
@@ -525,7 +525,7 @@ DoFHandler<2>::last_raw_face () const
 
 
 template <>
-DoFDimensionInfo<2>::raw_face_iterator
+DoFHandler<2>::raw_face_iterator
 DoFHandler<2>::last_raw_face (const unsigned int level) const
 {
   return last_raw_line (level);
@@ -533,7 +533,7 @@ DoFHandler<2>::last_raw_face (const unsigned int level) const
 
 
 template <>
-DoFDimensionInfo<2>::face_iterator
+DoFHandler<2>::face_iterator
 DoFHandler<2>::last_face () const
 {
   return last_line ();
@@ -541,7 +541,7 @@ DoFHandler<2>::last_face () const
 
 
 template <>
-DoFDimensionInfo<2>::face_iterator
+DoFHandler<2>::face_iterator
 DoFHandler<2>::last_face (const unsigned int level) const
 {
   return last_line (level);
@@ -549,7 +549,7 @@ DoFHandler<2>::last_face (const unsigned int level) const
 
 
 template <>
-DoFDimensionInfo<2>::active_face_iterator
+DoFHandler<2>::active_face_iterator
 DoFHandler<2>::last_active_face () const
 {
   return last_active_line ();
@@ -557,7 +557,7 @@ DoFHandler<2>::last_active_face () const
 
 
 template <>
-DoFDimensionInfo<2>::active_face_iterator
+DoFHandler<2>::active_face_iterator
 DoFHandler<2>::last_active_face (const unsigned int level) const
 {
   return last_active_line (level);
@@ -946,7 +946,7 @@ DoFHandler<dim>::end_hex () const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::raw_cell_iterator
+typename DoFHandler<dim>::raw_cell_iterator
 DoFHandler<dim>::end_raw (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -956,7 +956,7 @@ DoFHandler<dim>::end_raw (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::cell_iterator
+typename DoFHandler<dim>::cell_iterator
 DoFHandler<dim>::end (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -966,7 +966,7 @@ DoFHandler<dim>::end (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::active_cell_iterator
+typename DoFHandler<dim>::active_cell_iterator
 DoFHandler<dim>::end_active (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -976,7 +976,7 @@ DoFHandler<dim>::end_active (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::raw_face_iterator
+typename DoFHandler<dim>::raw_face_iterator
 DoFHandler<dim>::end_raw_face (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -986,7 +986,7 @@ DoFHandler<dim>::end_raw_face (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::face_iterator
+typename DoFHandler<dim>::face_iterator
 DoFHandler<dim>::end_face (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -996,7 +996,7 @@ DoFHandler<dim>::end_face (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::active_face_iterator
+typename DoFHandler<dim>::active_face_iterator
 DoFHandler<dim>::end_active_face (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -1006,7 +1006,7 @@ DoFHandler<dim>::end_active_face (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::raw_line_iterator
+typename DoFHandler<dim>::raw_line_iterator
 DoFHandler<dim>::end_raw_line (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -1016,7 +1016,7 @@ DoFHandler<dim>::end_raw_line (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::line_iterator
+typename DoFHandler<dim>::line_iterator
 DoFHandler<dim>::end_line (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -1026,7 +1026,7 @@ DoFHandler<dim>::end_line (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::active_line_iterator
+typename DoFHandler<dim>::active_line_iterator
 DoFHandler<dim>::end_active_line (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -1036,7 +1036,7 @@ DoFHandler<dim>::end_active_line (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::raw_quad_iterator
+typename DoFHandler<dim>::raw_quad_iterator
 DoFHandler<dim>::end_raw_quad (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -1046,7 +1046,7 @@ DoFHandler<dim>::end_raw_quad (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::quad_iterator
+typename DoFHandler<dim>::quad_iterator
 DoFHandler<dim>::end_quad (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -1056,7 +1056,7 @@ DoFHandler<dim>::end_quad (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::active_quad_iterator
+typename DoFHandler<dim>::active_quad_iterator
 DoFHandler<dim>::end_active_quad (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -1066,7 +1066,7 @@ DoFHandler<dim>::end_active_quad (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::raw_hex_iterator
+typename DoFHandler<dim>::raw_hex_iterator
 DoFHandler<dim>::end_raw_hex (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -1076,7 +1076,7 @@ DoFHandler<dim>::end_raw_hex (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::hex_iterator
+typename DoFHandler<dim>::hex_iterator
 DoFHandler<dim>::end_hex (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -1086,7 +1086,7 @@ DoFHandler<dim>::end_hex (const unsigned int level) const
 
 
 template <int dim>
-typename DoFDimensionInfo<dim>::active_hex_iterator
+typename DoFHandler<dim>::active_hex_iterator
 DoFHandler<dim>::end_active_hex (const unsigned int level) const
 {
   return (level == levels.size()-1 ?
@@ -1406,15 +1406,6 @@ DoFHandler<dim>::n_boundary_dofs (const std::set<unsigned char> &boundary_indica
 }
 
 
-
-template <int dim>
-const Triangulation<dim> & DoFHandler<dim>::get_tria () const
-{
-  return *tria;
-}
-
-
-
 template <int dim>
 unsigned int
 DoFHandler<dim>::memory_consumption () const
@@ -1482,8 +1473,10 @@ void DoFHandler<dim>::clear () {
 #if deal_II_dimension == 1
 
 template <>
-unsigned int DoFHandler<1>::distribute_dofs_on_cell (active_cell_iterator &cell,
-                                                    unsigned int          next_free_dof) {
+unsigned int
+DoFHandler<1>::distribute_dofs_on_cell (active_cell_iterator &cell,
+                                       unsigned int          next_free_dof)
+{
 
                                   // distribute dofs of vertices
   for (unsigned int v=0; v<GeometryInfo<1>::vertices_per_cell; ++v)
@@ -1536,8 +1529,10 @@ unsigned int DoFHandler<1>::distribute_dofs_on_cell (active_cell_iterator &cell,
 #if deal_II_dimension == 2
 
 template <>
-unsigned int DoFHandler<2>::distribute_dofs_on_cell (active_cell_iterator &cell,
-                                                    unsigned int          next_free_dof) {
+unsigned int
+DoFHandler<2>::distribute_dofs_on_cell (active_cell_iterator &cell,
+                                       unsigned int          next_free_dof)
+{
   if (selected_fe->dofs_per_vertex > 0)
                                     // number dofs on vertices
     for (unsigned int vertex=0; vertex<GeometryInfo<2>::vertices_per_cell; ++vertex)
@@ -1582,8 +1577,10 @@ unsigned int DoFHandler<2>::distribute_dofs_on_cell (active_cell_iterator &cell,
 #if deal_II_dimension == 3
 
 template <>
-unsigned int DoFHandler<3>::distribute_dofs_on_cell (active_cell_iterator &cell,
-                                                    unsigned int          next_free_dof) {
+unsigned int
+DoFHandler<3>::distribute_dofs_on_cell (active_cell_iterator &cell,
+                                       unsigned int          next_free_dof)
+{
   if (selected_fe->dofs_per_vertex > 0)
                                     // number dofs on vertices
     for (unsigned int vertex=0; vertex<GeometryInfo<3>::vertices_per_cell; ++vertex)
@@ -1803,7 +1800,8 @@ void DoFHandler<3>::renumber_dofs (const std::vector<unsigned int> &new_numbers)
 #if deal_II_dimension == 1
 
 template <>
-unsigned int DoFHandler<1>::max_couplings_between_dofs () const
+unsigned int
+DoFHandler<1>::max_couplings_between_dofs () const
 {
   Assert (selected_fe != 0, ExcNoFESelected());
   return std::min(3*selected_fe->dofs_per_vertex +
@@ -1813,7 +1811,8 @@ unsigned int DoFHandler<1>::max_couplings_between_dofs () const
 
 
 template <>
-unsigned int DoFHandler<1>::max_couplings_between_boundary_dofs () const
+unsigned int
+DoFHandler<1>::max_couplings_between_boundary_dofs () const
 {
   Assert (selected_fe != 0, ExcNoFESelected());
   return selected_fe->dofs_per_vertex;
@@ -1825,7 +1824,8 @@ unsigned int DoFHandler<1>::max_couplings_between_boundary_dofs () const
 #if deal_II_dimension == 2
 
 template <>
-unsigned int DoFHandler<2>::max_couplings_between_dofs () const
+unsigned int
+DoFHandler<2>::max_couplings_between_dofs () const
 {
   Assert (selected_fe != 0, ExcNoFESelected());
 
@@ -1888,7 +1888,8 @@ unsigned int DoFHandler<2>::max_couplings_between_dofs () const
 
 
 template <>
-unsigned int DoFHandler<2>::max_couplings_between_boundary_dofs () const
+unsigned int
+DoFHandler<2>::max_couplings_between_boundary_dofs () const
 {
   Assert (selected_fe != 0, ExcNoFESelected());
   return 3*selected_fe->dofs_per_vertex + 2*selected_fe->dofs_per_line;
@@ -1900,7 +1901,8 @@ unsigned int DoFHandler<2>::max_couplings_between_boundary_dofs () const
 #if deal_II_dimension == 3
 
 template <>
-unsigned int DoFHandler<3>::max_couplings_between_dofs () const
+unsigned int
+DoFHandler<3>::max_couplings_between_dofs () const
 {
 //TODO:[?] Invent significantly better estimates than the ones in this function  
   Assert (selected_fe != 0, ExcNoFESelected());
@@ -1933,7 +1935,9 @@ unsigned int DoFHandler<3>::max_couplings_between_dofs () const
 
 
 template <>
-unsigned int DoFHandler<3>::max_couplings_between_boundary_dofs () const {
+unsigned int
+DoFHandler<3>::max_couplings_between_boundary_dofs () const
+{
   Assert (selected_fe != 0, ExcNoFESelected());
                                   // we need to take refinement of
                                   // one boundary face into consideration
index e7221017057ca06ef5644b680f804229fb4005ca..6136da7494d3aa0645e9e1f15059016f0e00f43a 100644 (file)
 #include <dofs/dof_levels.h>
 
 
-unsigned int
-DoFLevel<1>::memory_consumption () const
+namespace internal
 {
-  return MemoryConsumption::memory_consumption (line_dofs);
-}
+  
+  unsigned int
+  DoFLevel<1>::memory_consumption () const
+  {
+    return MemoryConsumption::memory_consumption (line_dofs);
+  }
 
 
 
-unsigned int
-DoFLevel<2>::memory_consumption () const
-{
-  return (DoFLevel<1>::memory_consumption () +
-         MemoryConsumption::memory_consumption (quad_dofs));
-}
+  unsigned int
+  DoFLevel<2>::memory_consumption () const
+  {
+    return (DoFLevel<1>::memory_consumption () +
+            MemoryConsumption::memory_consumption (quad_dofs));
+  }
 
 
 
-unsigned int
-DoFLevel<3>::memory_consumption () const
-{
-  return (DoFLevel<2>::memory_consumption () +
-         MemoryConsumption::memory_consumption (hex_dofs));
+  unsigned int
+  DoFLevel<3>::memory_consumption () const
+  {
+    return (DoFLevel<2>::memory_consumption () +
+            MemoryConsumption::memory_consumption (hex_dofs));
+  }
 }
index f171a12cf85bf775c276d0a22a8a101e7e761dab..0fc9d0a0428d3ff1f6b3b4bfa5c373a24cd3acba 100644 (file)
@@ -137,10 +137,10 @@ struct CompareDownstream
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 void
 DoFRenumbering::
-Cuthill_McKee (DoFHandler<dim> &dof_handler,
+Cuthill_McKee (DH<dim>         &dof_handler,
                const bool       reversed_numbering,
                const bool       use_constraints,
                const std::vector<unsigned int> &starting_indices)
@@ -158,11 +158,11 @@ Cuthill_McKee (DoFHandler<dim> &dof_handler,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 void
 DoFRenumbering::
 compute_Cuthill_McKee (std::vector<unsigned int>& new_indices,
-                       const DoFHandler<dim>&     dof_handler,
+                       const DH<dim>&             dof_handler,
                        const bool                 reversed_numbering,
                        const bool                 use_constraints,
                        const std::vector<unsigned int>& starting_indices)
@@ -663,7 +663,7 @@ compute_component_wise (std::vector<unsigned int>& new_indices,
                         const ENDITERATOR& end,
                         const std::vector<unsigned int> &component_order_arg)
 {
-// Modify for hp
+//TODO: Modify for hp
   const FiniteElement<dim>& fe = start->get_fe();
   const unsigned int dofs_per_cell = fe.dofs_per_cell;
 
@@ -1245,7 +1245,7 @@ compute_subdomain_wise (std::vector<unsigned int> &new_dof_indices,
 
 // explicit instantiations
 template
-void DoFRenumbering::Cuthill_McKee<deal_II_dimension>
+void DoFRenumbering::Cuthill_McKee<deal_II_dimension, DoFHandler>
 (DoFHandler<deal_II_dimension>&,
  const bool,
  const bool,
@@ -1253,13 +1253,31 @@ void DoFRenumbering::Cuthill_McKee<deal_II_dimension>
 
 template
 void
-DoFRenumbering::compute_Cuthill_McKee<deal_II_dimension>
+DoFRenumbering::compute_Cuthill_McKee<deal_II_dimension, DoFHandler>
 (std::vector<unsigned int>&,
  const DoFHandler<deal_II_dimension>&,
  const bool,
  const bool,
  const std::vector<unsigned int>&);
 
+
+template
+void DoFRenumbering::Cuthill_McKee<deal_II_dimension, hpDoFHandler>
+(hpDoFHandler<deal_II_dimension>&,
+ const bool,
+ const bool,
+ const std::vector<unsigned int>&);
+
+template
+void
+DoFRenumbering::compute_Cuthill_McKee<deal_II_dimension, hpDoFHandler>
+(std::vector<unsigned int>&,
+ const hpDoFHandler<deal_II_dimension>&,
+ const bool,
+ const bool,
+ const std::vector<unsigned int>&);
+
+
 template
 void DoFRenumbering::component_wise<deal_II_dimension>
 (DoFHandler<deal_II_dimension>&,
index 55c071e6bcb4c17c2dcf72e9e6d25e031450f787..4a0fa4f1dac957a5a7f8b066f6699fd4a2eb2dfa 100644 (file)
 #include <numeric>
 
 
+namespace 
+{
+  // Functions for the DoFHandler
+  template <int dim>
+  unsigned int
+  max_dofs_per_cell (const DoFHandler<dim> &dh)
+  {
+    return dh.get_fe().dofs_per_cell;
+  }
+
+
+
+  template <int dim>
+  unsigned int
+  max_dofs_per_face (const DoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().dofs_per_face;
+  }
+
+
+
+  template <int dim>
+  unsigned int
+  max_dofs_per_vertex (const DoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().dofs_per_vertex;
+  }
+
+
+
+  template <int dim>
+  unsigned int
+  n_components (const DoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().n_components();
+  }
+
+
+
+  template <int dim>
+  unsigned int
+  fe_is_primitive (const DoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().is_primitive();
+  }
+
+  // Functions for the hpDoFHandler
+  template <int dim>
+  unsigned int
+  max_dofs_per_cell (const hpDoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().max_dofs_per_cell ();
+  }
+
+
+
+  template <int dim>
+  unsigned int
+  max_dofs_per_face (const hpDoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().max_dofs_per_face ();
+  }
+
+
+
+  template <int dim>
+  unsigned int
+  max_dofs_per_vertex (const hpDoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().max_dofs_per_vertex ();
+  }
+
+
+
+  template <int dim>
+  unsigned int
+  n_components (const hpDoFHandler<dim> &dh) 
+  {
+//TODO:[?] Verify that this is really correct
+    return dh.get_fe().get_fe(0).n_components();
+  }
+
+
+
+  template <int dim>
+  unsigned int
+  fe_is_primitive (const hpDoFHandler<dim> &dh) 
+  {
+//TODO:[?] Verify that this is really correct
+    return dh.get_fe().get_fe(0).is_primitive();
+  }
+}
+
+
 
 #if  deal_II_dimension == 1
 
@@ -545,11 +639,11 @@ DoFTools::compute_row_length_vector(
 
 
 
-template <int dim, class SparsityPattern>
+template <int dim, class SparsityPattern, template <int> class DH>
 void
 DoFTools::make_sparsity_pattern (
-  const DoFHandler<dim> &dof,
-  SparsityPattern       &sparsity)
+  const DH<dim>   &dof,
+  SparsityPattern &sparsity)
 {
   const unsigned int n_dofs = dof.n_dofs();
 
@@ -558,12 +652,14 @@ DoFTools::make_sparsity_pattern (
   Assert (sparsity.n_cols() == n_dofs,
          ExcDimensionMismatch (sparsity.n_cols(), n_dofs));
 
-  const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell;
-  std::vector<unsigned int> dofs_on_this_cell(dofs_per_cell);
-  typename DoFHandler<dim>::active_cell_iterator cell = dof.begin_active(),
-                                                endc = dof.end();
+  std::vector<unsigned int> dofs_on_this_cell;
+  dofs_on_this_cell.reserve (max_dofs_per_cell(dof));
+  typename DH<dim>::active_cell_iterator cell = dof.begin_active(),
+                                         endc = dof.end();
   for (; cell!=endc; ++cell) 
     {
+      const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell;
+      dofs_on_this_cell.resize (dofs_per_cell);
       cell->get_dof_indices (dofs_on_this_cell);
                                       // make sparsity pattern for this cell
       for (unsigned int i=0; i<dofs_per_cell; ++i)
@@ -652,17 +748,14 @@ DoFTools::make_sparsity_pattern (
 
 #if deal_II_dimension == 1
 
-template <class SparsityPattern>
+template <class SparsityPattern, template <int> class DH>
 void
 DoFTools::make_boundary_sparsity_pattern (
-  const DoFHandler<1>             &dof_handler,
+  const DH<1>                     &dof_handler,
   const FunctionMap<1>::type      &function_map,
   const std::vector<unsigned int> &dof_to_boundary_mapping,
   SparsityPattern                 &sparsity)
 {
-  const unsigned int dofs_per_vertex = dof_handler.get_fe().dofs_per_vertex;
-  std::vector<unsigned int> boundary_dof_boundary_indices (dofs_per_vertex);
-  
                                   // first check left, the right
                                   // boundary point
   for (unsigned int direction=0; direction<2; ++direction)
@@ -676,12 +769,15 @@ DoFTools::make_boundary_sparsity_pattern (
                                       // find active cell at that
                                       // boundary: first go to
                                       // left/right, then to children
-      DoFHandler<1>::cell_iterator cell = dof_handler.begin(0);
+      typename DH<1>::cell_iterator cell = dof_handler.begin(0);
       while (!cell->at_boundary(direction))
        cell = cell->neighbor(direction);
       while (!cell->active())
        cell = cell->child(direction);
 
+      const unsigned int dofs_per_vertex = cell->get_fe().dofs_per_vertex;
+      std::vector<unsigned int> boundary_dof_boundary_indices (dofs_per_vertex);
+  
                                       // next get boundary mapped dof
                                       // indices of boundary dofs
       for (unsigned int i=0; i<dofs_per_vertex; ++i)
@@ -697,32 +793,34 @@ DoFTools::make_boundary_sparsity_pattern (
 
 
 
-template <class SparsityPattern>
+template <class SparsityPattern, template <int> class DH>
 void DoFTools::make_boundary_sparsity_pattern (
-  const DoFHandler<1> &dof_handler,
-  const std::vector<unsigned int>  &dof_to_boundary_mapping,
+  const DH<1>                     &dof_handler,
+  const std::vector<unsigned int> &dof_to_boundary_mapping,
   SparsityPattern    &sparsity)
 {
                                   // there are only 2 boundary
                                   // indicators in 1d, so it is no
                                   // performance problem to call the
                                   // other function
-  DoFHandler<1>::FunctionMap boundary_indicators;
+  typename DH<1>::FunctionMap boundary_indicators;
   boundary_indicators[0] = 0;
   boundary_indicators[1] = 0;
-  make_boundary_sparsity_pattern (dof_handler, boundary_indicators,
-                                 dof_to_boundary_mapping, sparsity);
+  make_boundary_sparsity_pattern<SparsityPattern> (dof_handler,
+                                                   boundary_indicators,
+                                                   dof_to_boundary_mapping,
+                                                   sparsity);
 }
 
 
 #endif
 
 
-template <int dim, class SparsityPattern>
+template <int dim, class SparsityPattern, template <int> class DH>
 void
 DoFTools::make_boundary_sparsity_pattern (
-  const DoFHandler<dim>& dof,
-  const std::vector<unsigned int>  &dof_to_boundary_mapping,
+  const DH<dim>                   &dof,
+  const std::vector<unsigned int> &dof_to_boundary_mapping,
   SparsityPattern    &sparsity)
 {
   const unsigned int n_dofs = dof.n_dofs();
@@ -738,7 +836,7 @@ DoFTools::make_boundary_sparsity_pattern (
       unsigned int max_element = 0;
       for (std::vector<unsigned int>::const_iterator i=dof_to_boundary_mapping.begin();
           i!=dof_to_boundary_mapping.end(); ++i)
-       if ((*i != DoFHandler<dim>::invalid_dof_index) &&
+       if ((*i != DH<dim>::invalid_dof_index) &&
            (*i > max_element))
          max_element = *i;
       Assert (max_element  == sparsity.n_rows()-1,
@@ -746,8 +844,8 @@ DoFTools::make_boundary_sparsity_pattern (
     };
 #endif
 
-  const unsigned int dofs_per_face = dof.get_fe().dofs_per_face;
-  std::vector<unsigned int> dofs_on_this_face(dofs_per_face);
+  std::vector<unsigned int> dofs_on_this_face;
+  dofs_on_this_face.reserve (max_dofs_per_face(dof));
 
                                   // loop over all faces to check
                                   // whether they are at a
@@ -759,11 +857,13 @@ DoFTools::make_boundary_sparsity_pattern (
                                   // boundaries of dimension dim-2,
                                   // and so every boundary line is
                                   // also part of a boundary face.
-  typename DoFHandler<dim>::active_face_iterator face = dof.begin_active_face(),
-                                                endf = dof.end_face();
+  typename DH<dim>::active_face_iterator face = dof.begin_active_face(),
+                                         endf = dof.end_face();
   for (; face!=endf; ++face)
     if (face->at_boundary())
       {
+        const unsigned int dofs_per_face = face->get_fe().dofs_per_face;
+        dofs_on_this_face.resize (dofs_per_face);
        face->get_dof_indices (dofs_on_this_face);
 
                                         // make sparsity pattern for this cell
@@ -776,9 +876,9 @@ DoFTools::make_boundary_sparsity_pattern (
 
 
 
-template <int dim, class SparsityPattern>
+template <int dim, class SparsityPattern, template <int> class DH>
 void DoFTools::make_boundary_sparsity_pattern (
-  const DoFHandler<dim>& dof,
+  const DH<dim>                    &dof,
   const typename FunctionMap<dim>::type  &boundary_indicators,
   const std::vector<unsigned int>  &dof_to_boundary_mapping,
   SparsityPattern    &sparsity)
@@ -788,17 +888,17 @@ void DoFTools::make_boundary_sparsity_pattern (
   Assert (dof_to_boundary_mapping.size() == n_dofs, ExcInternalError());
   Assert (boundary_indicators.find(255) == boundary_indicators.end(),
          typename DoFHandler<dim>::ExcInvalidBoundaryIndicator());
-  Assert (sparsity.n_rows() == dof.n_boundary_dofs(boundary_indicators),
-         ExcDimensionMismatch (sparsity.n_rows(), dof.n_boundary_dofs(boundary_indicators)));
-  Assert (sparsity.n_cols() == dof.n_boundary_dofs(boundary_indicators),
-         ExcDimensionMismatch (sparsity.n_cols(), dof.n_boundary_dofs(boundary_indicators)));
+  Assert (sparsity.n_rows() == dof.n_boundary_dofs (boundary_indicators),
+         ExcDimensionMismatch (sparsity.n_rows(), dof.n_boundary_dofs (boundary_indicators)));
+  Assert (sparsity.n_cols() == dof.n_boundary_dofs (boundary_indicators),
+         ExcDimensionMismatch (sparsity.n_cols(), dof.n_boundary_dofs (boundary_indicators)));
 #ifdef DEBUG
   if (true)
     {
       unsigned int max_element = 0;
       for (std::vector<unsigned int>::const_iterator i=dof_to_boundary_mapping.begin();
           i!=dof_to_boundary_mapping.end(); ++i)
-       if ((*i != DoFHandler<dim>::invalid_dof_index) &&
+       if ((*i != DH<dim>::invalid_dof_index) &&
            (*i > max_element))
          max_element = *i;
       Assert (max_element  == sparsity.n_rows()-1,
@@ -806,14 +906,16 @@ void DoFTools::make_boundary_sparsity_pattern (
     };
 #endif
 
-  const unsigned int dofs_per_face = dof.get_fe().dofs_per_face;
-  std::vector<unsigned int> dofs_on_this_face(dofs_per_face);
-  typename DoFHandler<dim>::active_face_iterator face = dof.begin_active_face(),
-                                                endf = dof.end_face();
+  std::vector<unsigned int> dofs_on_this_face;
+  dofs_on_this_face.reserve (max_dofs_per_face(dof));
+  typename DH<dim>::active_face_iterator face = dof.begin_active_face(),
+                                         endf = dof.end_face();
   for (; face!=endf; ++face)
     if (boundary_indicators.find(face->boundary_indicator()) !=
        boundary_indicators.end())
       {
+        const unsigned int dofs_per_face = face->get_fe().dofs_per_face;
+        dofs_on_this_face.resize (dofs_per_face);
        face->get_dof_indices (dofs_on_this_face);
 
                                         // make sparsity pattern for this cell
@@ -826,11 +928,11 @@ void DoFTools::make_boundary_sparsity_pattern (
 
 
 
-template <int dim, class SparsityPattern>
+template <int dim, class SparsityPattern, template <int> class DH>
 void
 DoFTools::make_flux_sparsity_pattern (
-  const DoFHandler<dim> &dof,
-  SparsityPattern       &sparsity)
+  const DH<dim>   &dof,
+  SparsityPattern &sparsity)
 {
   const unsigned int n_dofs = dof.n_dofs();
   
@@ -839,11 +941,12 @@ DoFTools::make_flux_sparsity_pattern (
   Assert (sparsity.n_cols() == n_dofs,
          ExcDimensionMismatch (sparsity.n_cols(), n_dofs));
 
-  const unsigned int total_dofs = dof.get_fe().dofs_per_cell;
-  std::vector<unsigned int> dofs_on_this_cell(total_dofs);
-  std::vector<unsigned int> dofs_on_other_cell(total_dofs);
-  typename DoFHandler<dim>::active_cell_iterator cell = dof.begin_active(),
-                                                endc = dof.end();
+  std::vector<unsigned int> dofs_on_this_cell;
+  std::vector<unsigned int> dofs_on_other_cell;
+  dofs_on_this_cell.reserve (max_dofs_per_cell(dof));
+  dofs_on_other_cell.reserve (max_dofs_per_cell(dof));
+  typename DH<dim>::active_cell_iterator cell = dof.begin_active(),
+                                         endc = dof.end();
 
                                   // Clear user flags because we will
                                   // need them. But first we save
@@ -859,10 +962,12 @@ DoFTools::make_flux_sparsity_pattern (
   
   for (; cell!=endc; ++cell)
     {
+      const unsigned int n_dofs_on_this_cell = cell->get_fe().dofs_per_cell;
+      dofs_on_this_cell.resize (n_dofs_on_this_cell);
       cell->get_dof_indices (dofs_on_this_cell);
                                       // make sparsity pattern for this cell
-      for (unsigned int i=0; i<total_dofs; ++i)
-       for (unsigned int j=0; j<total_dofs; ++j)
+      for (unsigned int i=0; i<n_dofs_on_this_cell; ++i)
+       for (unsigned int j=0; j<n_dofs_on_this_cell; ++j)
          sparsity.add (dofs_on_this_cell[i],
                        dofs_on_this_cell[j]);
 
@@ -871,14 +976,13 @@ DoFTools::make_flux_sparsity_pattern (
           face < GeometryInfo<dim>::faces_per_cell;
           ++face)
        {
-         typename DoFHandler<dim>::face_iterator cell_face = cell->face(face);
+         typename DH<dim>::face_iterator cell_face = cell->face(face);
          if (cell_face->user_flag_set ())
            continue;
 
          if (! cell->at_boundary (face) )
            {
-             typename DoFHandler<dim>::cell_iterator
-               neighbor = cell->neighbor(face);
+             typename DH<dim>::cell_iterator neighbor = cell->neighbor(face);
                                               // Refinement edges are
                                               // taken care of by
                                               // coarser cells
@@ -894,35 +998,41 @@ DoFTools::make_flux_sparsity_pattern (
                       sub_nr != GeometryInfo<dim>::subfaces_per_face;
                       ++sub_nr)
                    {
-                     const typename DoFHandler<dim>::cell_iterator
+                     const typename DH<dim>::cell_iterator
                         sub_neighbor
                        = cell->neighbor_child_on_subface (face, sub_nr);
 
+                      const unsigned int n_dofs_on_neighbor
+                        = sub_neighbor->get_fe().dofs_per_cell;
+                      dofs_on_other_cell.resize (n_dofs_on_neighbor);
                      sub_neighbor->get_dof_indices (dofs_on_other_cell);
-                     for (unsigned int i=0; i<total_dofs; ++i)
-                        for (unsigned int j=0; j<total_dofs; ++j)
+
+                      for (unsigned int i=0; i<n_dofs_on_this_cell; ++i)
+                        for (unsigned int j=0; j<n_dofs_on_neighbor; ++j)
                           {
                             sparsity.add (dofs_on_this_cell[i],
                                           dofs_on_other_cell[j]);
-                            sparsity.add (dofs_on_other_cell[i],
-                                          dofs_on_this_cell[j]);
+                            sparsity.add (dofs_on_other_cell[j],
+                                          dofs_on_this_cell[i]);
                           }
-                       
                      sub_neighbor->face(neighbor_face)->set_user_flag ();
                    }
                }
               else
                 {
-                 neighbor->get_dof_indices (dofs_on_other_cell);
-                 for (unsigned int i=0; i<total_dofs; ++i)
-                    for (unsigned int j=0; j<total_dofs; ++j)
+                  const unsigned int n_dofs_on_neighbor
+                    = neighbor->get_fe().dofs_per_cell;
+                  dofs_on_other_cell.resize (n_dofs_on_neighbor);
+
+                  neighbor->get_dof_indices (dofs_on_other_cell);
+                 for (unsigned int i=0; i<n_dofs_on_this_cell; ++i)
+                    for (unsigned int j=0; j<n_dofs_on_neighbor; ++j)
                       {
                         sparsity.add (dofs_on_this_cell[i],
                                       dofs_on_other_cell[j]);
-                        sparsity.add (dofs_on_other_cell[i],
-                                      dofs_on_this_cell[j]);
+                        sparsity.add (dofs_on_other_cell[j],
+                                      dofs_on_this_cell[i]);
                       }
-               
                  neighbor->face(neighbor_face)->set_user_flag (); 
                }
            } 
@@ -936,18 +1046,19 @@ DoFTools::make_flux_sparsity_pattern (
 
 #if deal_II_dimension == 1
 
-template <class SparsityPattern>
+template <class SparsityPattern, template <int> class DH>
 void
 DoFTools::make_flux_sparsity_pattern (
-  const DoFHandler<1> &dof,
+  const DH<1>         &dof,
   SparsityPattern     &sparsity)
 {
-  typedef DoFHandler<1>::cell_iterator        cell_iterator;
-  typedef DoFHandler<1>::active_cell_iterator active_cell_iterator;
+  typedef typename DH<1>::cell_iterator        cell_iterator;
+  typedef typename DH<1>::active_cell_iterator active_cell_iterator;
 
-  const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell;
-  std::vector<unsigned int> local_dof_indices (dofs_per_cell);
-  std::vector<unsigned int> neighbor_dof_indices (dofs_per_cell);
+  std::vector<unsigned int> local_dof_indices;
+  std::vector<unsigned int> neighbor_dof_indices;
+  local_dof_indices.reserve (max_dofs_per_cell(dof));
+  neighbor_dof_indices.reserve (max_dofs_per_cell(dof));
   
   active_cell_iterator cell = dof.begin_active(),
                       endc = dof.end();
@@ -955,9 +1066,11 @@ DoFTools::make_flux_sparsity_pattern (
     {
                                       // first do couplings of dofs
                                       // locally on this cell
+      const unsigned int n_dofs_on_this_cell = cell->get_fe().dofs_per_cell;
+      local_dof_indices.resize (n_dofs_on_this_cell);
       cell->get_dof_indices (local_dof_indices);
-      for (unsigned int i=0; i<dofs_per_cell; ++i)
-       for (unsigned int j=0; j<dofs_per_cell; ++j)
+      for (unsigned int i=0; i<n_dofs_on_this_cell; ++i)
+       for (unsigned int j=0; j<n_dofs_on_this_cell; ++j)
          sparsity.add (local_dof_indices[i], local_dof_indices[j]);
 
                                       // then do the same for the up
@@ -971,11 +1084,14 @@ DoFTools::make_flux_sparsity_pattern (
              neighbor = neighbor->child(nb==0 ? 1 : 0);
 
                                             // get dofs on it
+            const unsigned int n_dofs_on_neighbor
+              = neighbor->get_fe().dofs_per_cell;
+            neighbor_dof_indices.resize (n_dofs_on_neighbor);
            neighbor->get_dof_indices (neighbor_dof_indices);
 
                                             // compute couplings
-           for (unsigned int i=0; i<dofs_per_cell; ++i)
-             for (unsigned int j=0; j<dofs_per_cell; ++j)
+           for (unsigned int i=0; i<n_dofs_on_this_cell; ++i)
+             for (unsigned int j=0; j<n_dofs_on_neighbor; ++j)
                sparsity.add (local_dof_indices[i], neighbor_dof_indices[j]);
          };
     };
@@ -1255,6 +1371,14 @@ void DoFTools::make_hanging_node_constraints (
                                   // nothing to be done here
 }
 
+
+void DoFTools::make_hanging_node_constraints (
+  const hpDoFHandler<1> &,
+  ConstraintMatrix &)
+{
+                                  // nothing to be done here
+}
+
 #endif
 
 
@@ -1343,6 +1467,15 @@ void DoFTools::make_hanging_node_constraints (
        };
 }
 
+
+void DoFTools::make_hanging_node_constraints (
+    const hpDoFHandler<2> &/*dof_handler*/,
+    ConstraintMatrix    &/*constraints*/)
+{
+//TODO[?]: Implement (required for continuous elements)
+    Assert (false, ExcNotImplemented());
+}
+
 #endif
 
 
@@ -1485,27 +1618,35 @@ void DoFTools::make_hanging_node_constraints (
        };
 }
 
+
+void DoFTools::make_hanging_node_constraints (
+    const hpDoFHandler<3> &/*dof_handler*/,
+    ConstraintMatrix    &/*constraints*/)
+{
+//TODO:[?] Implement (required for continuous elements)
+    Assert (false, ExcNotImplemented());
+}
+
 #endif
 
 
 
-template <int dim, typename Number>
+template <int dim, typename Number, template <int> class DH>
 void DoFTools::distribute_cell_to_dof_vector (
-  const DoFHandler<dim> &dof_handler,
-  const Vector<Number>  &cell_data,
-  Vector<double>        &dof_data,
-  const unsigned int     component)
+  const DH<dim>        &dof_handler,
+  const Vector<Number> &cell_data,
+  Vector<double>       &dof_data,
+  const unsigned int    component)
 {
   const Triangulation<dim> &tria = dof_handler.get_tria();
-  const FiniteElement<dim> &fe   = dof_handler.get_fe();
   
   Assert (cell_data.size()==tria.n_active_cells(),
          ExcWrongSize (cell_data.size(), tria.n_active_cells()));
   Assert (dof_data.size()==dof_handler.n_dofs(),
          ExcWrongSize (dof_data.size(), dof_handler.n_dofs()));
-  Assert (component < fe.n_components(),
-         ExcInvalidComponent(component, fe.n_components()));
-  Assert (fe.is_primitive() == true,
+  Assert (component < n_components(dof_handler),
+         ExcInvalidComponent(component, n_components(dof_handler)));
+  Assert (fe_is_primitive(dof_handler) == true,
           ExcFENotPrimitive());
   
                                   // store a flag whether we should care
@@ -1513,29 +1654,30 @@ void DoFTools::distribute_cell_to_dof_vector (
                                   // just a simplification, we could ask
                                   // for this at every single place
                                   // equally well
-  const bool consider_components = (fe.n_components() != 1);
+  const bool consider_components = (n_components(dof_handler) != 1);
   
                                   // count how often we have added a value
                                   // in the sum for each dof
   std::vector<unsigned char> touch_count (dof_handler.n_dofs(), 0);
 
-  typename DoFHandler<dim>::active_cell_iterator
-    cell = dof_handler.begin_active(),
-    endc = dof_handler.end();
-  unsigned int present_cell = 0;
-  const unsigned int dofs_per_cell = fe.dofs_per_cell;
-  std::vector<unsigned int> dof_indices (dofs_per_cell);
+  typename DH<dim>::active_cell_iterator cell = dof_handler.begin_active(),
+                                         endc = dof_handler.end();
+  std::vector<unsigned int> dof_indices;
+  dof_indices.reserve (max_dofs_per_cell(dof_handler));
 
-  for (; cell!=endc; ++cell, ++present_cell) 
+  for (unsigned int present_cell = 0; cell!=endc; ++cell, ++present_cell) 
     {
+      const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell;
+      dof_indices.resize (dofs_per_cell);
       cell->get_dof_indices (dof_indices);
+      
       for (unsigned int i=0; i<dofs_per_cell; ++i)
                                         // consider this dof only if it
                                         // is the right component. if there
                                         // is only one component, short cut
                                         // the test
        if (!consider_components ||
-           (fe.system_to_component_index(i).first == component))
+           (cell->get_fe().system_to_component_index(i).first == component))
          {
                                             // sum up contribution of the
                                             // present_cell to this dof
@@ -1563,21 +1705,21 @@ void DoFTools::distribute_cell_to_dof_vector (
 }
 
 
-template<int dim>
+
+template <int dim>
 void
-DoFTools::extract_dofs (const DoFHandler<dim>      &dof,
-                       const std::vector<bool>    &component_select,
-                       std::vector<bool>          &selected_dofs)
+DoFTools::extract_dofs (const DoFHandler<dim>   &dof,
+                       const std::vector<bool> &component_select,
+                       std::vector<bool>       &selected_dofs)
 {
-  const FiniteElement<dim> &fe = dof.get_fe();
-  Assert(component_select.size() == fe.n_components(),
-        ExcDimensionMismatch(component_select.size(), fe.n_components()));
+  Assert(component_select.size() == n_components(dof),
+        ExcDimensionMismatch(component_select.size(), n_components(dof)));
   Assert(selected_dofs.size() == dof.n_dofs(),
         ExcDimensionMismatch(selected_dofs.size(), dof.n_dofs()));
 
                                    // two special cases: no component
                                    // is selected, and all components
-                                   // are selected, both rather
+                                   // are selected; both rather
                                    // stupid, but easy to catch
   if (std::count (component_select.begin(), component_select.end(), true)
       == 0)
@@ -1592,6 +1734,8 @@ DoFTools::extract_dofs (const DoFHandler<dim>      &dof,
       return;
     };
   
+
+  const FiniteElement<dim> &fe = dof.get_fe();
   
                                   // preset all values by false
   std::fill_n (selected_dofs.begin(), dof.n_dofs(), false);
@@ -1759,18 +1903,16 @@ DoFTools::extract_level_dofs(const unsigned int       level,
 
 #if deal_II_dimension != 1
 
-template <int dim>
+template <int dim, template <int> class DH>
 void
-DoFTools::extract_boundary_dofs (const DoFHandler<dim>         &dof_handler,
+DoFTools::extract_boundary_dofs (const DH<dim>                 &dof_handler,
                                 const std::vector<bool>       &component_select,
                                 std::vector<bool>             &selected_dofs,
                                 const std::set<unsigned char> &boundary_indicators)
 {
-  const FiniteElement<dim> &fe = dof_handler.get_fe();
-  
-  Assert (component_select.size() == fe.n_components(),
+  Assert (component_select.size() == n_components(dof_handler),
          ExcWrongSize (component_select.size(),
-                       fe.n_components()));
+                       n_components(dof_handler)));
   Assert (boundary_indicators.find (255) == boundary_indicators.end(),
          ExcInvalidBoundaryIndicator());
 
@@ -1791,7 +1933,8 @@ DoFTools::extract_boundary_dofs (const DoFHandler<dim>         &dof_handler,
                                   // values
   selected_dofs.clear ();
   selected_dofs.resize (dof_handler.n_dofs(), false);
-  std::vector<unsigned int> face_dof_indices (fe.dofs_per_face);
+  std::vector<unsigned int> face_dof_indices;
+  face_dof_indices.reserve (max_dofs_per_face(dof_handler));
 
                                   // now loop over all cells and
                                   // check whether their faces are at
@@ -1815,11 +1958,15 @@ DoFTools::extract_boundary_dofs (const DoFHandler<dim>         &dof_handler,
            (boundary_indicators.find (cell->face(face)->boundary_indicator())
             != boundary_indicators.end()))
          {
+            const FiniteElement<dim> &fe = cell->get_fe();
+            
+            const unsigned int dofs_per_face = fe.dofs_per_face;
+            face_dof_indices.resize (dofs_per_face);
            cell->face(face)->get_dof_indices (face_dof_indices);
 
-           for (unsigned int i=0; i<fe.dofs_per_face; ++i)
-             if (!check_vector_component)
-               selected_dofs[face_dof_indices[i]] = true;
+           for (unsigned int i=0; i<fe.dofs_per_face; ++i)
+             if (!check_vector_component)
+               selected_dofs[face_dof_indices[i]] = true;
               else
                                                  // check for
                                                  // component is
@@ -1869,7 +2016,7 @@ DoFTools::extract_boundary_dofs (const DoFHandler<dim>         &dof_handler,
                            fe.get_nonzero_components(cell_index).begin());
                       Assert (first_nonzero_comp < fe.n_components(),
                               ExcInternalError());
-                      
+                       
                       selected_dofs[face_dof_indices[i]]
                         = (component_select[first_nonzero_comp]
                            == true);
@@ -1879,29 +2026,25 @@ DoFTools::extract_boundary_dofs (const DoFHandler<dim>         &dof_handler,
 }
 
 
-#else
+#else  // 1d
 
 
+template <template <int> class DH>
 void
-DoFTools::extract_boundary_dofs (const DoFHandler<1>      &dof_handler,
+DoFTools::extract_boundary_dofs (const DH<1>              &dof_handler,
                                 const std::vector<bool>  &component_select,
                                 std::vector<bool>        &selected_dofs,
                                 const std::set<unsigned char> &boundary_indicators)
 {
-  const FiniteElement<1> &fe = dof_handler.get_fe();
-  
-  Assert (component_select.size() == fe.n_components(),
+  Assert (component_select.size() == n_components(dof_handler),
          ExcWrongSize (component_select.size(),
-                       fe.n_components()));
+                       n_components(dof_handler)));
          
                                   // clear and reset array by default
                                   // values
   selected_dofs.clear ();
   selected_dofs.resize (dof_handler.n_dofs(), false);
 
-  Assert (fe.dofs_per_face == fe.dofs_per_vertex,
-         ExcInternalError());
-
                                   // let's see whether we have to
                                   // check for certain boundary
                                   // indicators or whether we can
@@ -1921,69 +2064,87 @@ DoFTools::extract_boundary_dofs (const DoFHandler<1>      &dof_handler,
                                              true));
   
                                   // loop over coarse grid cells
-  for (DoFHandler<1>::cell_iterator cell=dof_handler.begin(0);
+  for (typename DH<1>::cell_iterator cell=dof_handler.begin(0);
        cell!=dof_handler.end(0); ++cell)
     {
+      const FiniteElement<1> &fe = cell->get_fe();
+            
                                       // check left-most vertex
       if (check_left_vertex)
        if (cell->neighbor(0) == dof_handler.end())
-         for (unsigned int i=0; i<fe.dofs_per_face; ++i)
-           if (!check_vector_component)
-              selected_dofs[cell->vertex_dof_index(0,i)] = true;
-            else
-                                               // check
-                                               // component. make sure
-                                               // we don't ask the
-                                               // wrong question
-                                               // (leading to an
-                                               // exception) in case
-                                               // the shape function
-                                               // is non-primitive. note
-                                               // that the face dof
-                                               // index i is also the
-                                               // cell dof index of a
-                                               // corresponding dof in 1d
-              {
-                const unsigned int component =
-                  (fe.is_primitive(i) ?
-                   fe.face_system_to_component_index(i).first :
-                   (std::find (fe.get_nonzero_components(i).begin(),
-                               fe.get_nonzero_components(i).end(),
-                               true)
-                    -
-                    fe.get_nonzero_components(i).begin()));
-                Assert (component < fe.n_components(),
-                        ExcInternalError());
-                
-                if (component_select[component] == true)
-                  selected_dofs[cell->vertex_dof_index(0,i)] = true;
-              }
+          {
+                                                // In 1D the number of DoFs
+                                                // on the faces should be
+                                                 // equal to the number of DoFs
+                                                 // on the vertices.
+            Assert (fe.dofs_per_face == 
+                   fe.dofs_per_vertex,
+                    ExcInternalError());
+            
+            for (unsigned int i=0; i<fe.dofs_per_face; ++i)
+              if (!check_vector_component)
+                selected_dofs[cell->vertex_dof_index(0,i)] = true;
+              else
+                                                 // check
+                                                 // component. make sure
+                                                 // we don't ask the
+                                                 // wrong question
+                                                 // (leading to an
+                                                 // exception) in case
+                                                 // the shape function
+                                                 // is non-primitive. note
+                                                 // that the face dof
+                                                 // index i is also the
+                                                 // cell dof index of a
+                                                 // corresponding dof in 1d
+                {
+                  const unsigned int component =
+                    (fe.is_primitive(i) ?
+                     fe.face_system_to_component_index(i).first :
+                     (std::find (fe.get_nonzero_components(i).begin(),
+                                 fe.get_nonzero_components(i).end(),
+                                 true)
+                      -
+                      fe.get_nonzero_components(i).begin()));
+                  Assert (component < fe.n_components(),
+                          ExcInternalError());
+                 
+                  if (component_select[component] == true)
+                    selected_dofs[cell->vertex_dof_index(0,i)] = true;
+                }
+          }
       
-                                      // check right-most
-                                      // vertex. same procedure here
-                                      // as above
+                                             // check right-most
+                                             // vertex. same procedure here
+                                             // as above
       if (check_right_vertex)
        if (cell->neighbor(1) == dof_handler.end())
-         for (unsigned int i=0; i<fe.dofs_per_face; ++i)
-           if (!check_vector_component)
-              selected_dofs[cell->vertex_dof_index(1,i)] = true;
-            else
-              {
-                const unsigned int component =
-                  (fe.is_primitive(i) ?
-                   fe.face_system_to_component_index(i).first :
-                   (std::find (fe.get_nonzero_components(i).begin(),
-                               fe.get_nonzero_components(i).end(),
-                               true)
-                    -
-                    fe.get_nonzero_components(i).begin()));
-                Assert (component < fe.n_components(),
-                        ExcInternalError());
-                
-                if (component_select[component] == true)
-                  selected_dofs[cell->vertex_dof_index(1,i)] = true;
-              }
-    };
+          {
+            Assert (fe.dofs_per_face ==
+                    fe.dofs_per_vertex,
+                    ExcInternalError());
+            
+            for (unsigned int i=0; i<fe.dofs_per_face; ++i)
+              if (!check_vector_component)
+                selected_dofs[cell->vertex_dof_index(1,i)] = true;
+              else
+                {
+                  const unsigned int component =
+                    (fe.is_primitive(i) ?
+                     fe.face_system_to_component_index(i).first :
+                     (std::find (fe.get_nonzero_components(i).begin(),
+                                 fe.get_nonzero_components(i).end(),
+                                 true)
+                      -
+                      fe.get_nonzero_components(i).begin()));
+                  Assert (component < fe.n_components(),
+                          ExcInternalError());
+                 
+                  if (component_select[component] == true)
+                    selected_dofs[cell->vertex_dof_index(1,i)] = true;
+                }
+          }
+    }
 }
 
 
@@ -2114,11 +2275,11 @@ DoFTools::extract_hanging_node_dofs (const DoFHandler<3> &dof_handler,
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 void
-DoFTools::extract_subdomain_dofs (const DoFHandler<dim> &dof_handler,
-                                 const unsigned int     subdomain_id,
-                                 std::vector<bool>     &selected_dofs)
+DoFTools::extract_subdomain_dofs (const DH<dim>      &dof_handler,
+                                 const unsigned int  subdomain_id,
+                                 std::vector<bool>  &selected_dofs)
 {
   Assert(selected_dofs.size() == dof_handler.n_dofs(),
         ExcDimensionMismatch(selected_dofs.size(), dof_handler.n_dofs()));
@@ -2126,15 +2287,20 @@ DoFTools::extract_subdomain_dofs (const DoFHandler<dim> &dof_handler,
                                    // preset all values by false
   std::fill_n (selected_dofs.begin(), dof_handler.n_dofs(), false);
 
-  const unsigned int dofs_per_cell = dof_handler.get_fe().dofs_per_cell;
-  std::vector<unsigned int> local_dof_indices (dofs_per_cell);
+  std::vector<unsigned int> local_dof_indices;
+  local_dof_indices.reserve (max_dofs_per_cell(dof_handler));
   
-  typename DoFHandler<dim>::active_cell_iterator
+                                  // this function is similar to the
+                                  // make_sparsity_pattern function,
+                                  // see there for more information
+  typename DH<dim>::active_cell_iterator 
     cell = dof_handler.begin_active(),
     endc = dof_handler.end();
   for (; cell!=endc; ++cell)
     if (cell->subdomain_id() == subdomain_id)
       {
+        const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell;
+        local_dof_indices.resize (dofs_per_cell);
        cell->get_dof_indices (local_dof_indices);
        for (unsigned int i=0; i<dofs_per_cell; ++i)
          selected_dofs[local_dof_indices[i]] = true;
@@ -2273,9 +2439,9 @@ DoFTools::count_dofs_per_component (
   Threads::ThreadGroup<> threads;
   for (unsigned int i=0; i<n_components; ++i)
     {
-      void (*fun_ptr) (const DoFHandler<dim>      &,
-                      const std::vector<bool>    &,
-                      std::vector<bool>          &)
+      void (*fun_ptr) (const DoFHandler<dim>   &,
+                      const std::vector<bool> &,
+                      std::vector<bool>       &)
         = &DoFTools::template extract_dofs<dim>;
       component_select[i][i] = true;
       threads += Threads::spawn (fun_ptr)(dof_handler, component_select[i],
@@ -2315,11 +2481,9 @@ DoFTools::count_dofs_per_component (
                             dofs_per_component.end(), 0U)
            == dof_handler.n_dofs()),
          ExcInternalError());
-         
 }
 
 
-
 template <int dim>
 void
 DoFTools::count_dofs_per_component (
@@ -3103,7 +3267,7 @@ DoFTools::compute_intergrid_weights_3 (
                                             // weights, have only one
                                             // mutex for all of them
            static Threads::ThreadMutex mutex;
-           mutex.acquire ();
+            Threads::ThreadMutex::ScopedLock lock (mutex);
            for (unsigned int i=0; i<global_parameter_representation.size(); ++i)
                                               // set this weight if it belongs
                                               // to a parameter dof.
@@ -3122,8 +3286,6 @@ DoFTools::compute_intergrid_weights_3 (
              else
                Assert (global_parameter_representation(i) == 0,
                        ExcInternalError());
-           
-           mutex.release ();
          };
     };
 }
@@ -3134,8 +3296,9 @@ DoFTools::compute_intergrid_weights_3 (
 #if deal_II_dimension == 1
 
 
+template <template <int> class DH>
 void DoFTools::map_dof_to_boundary_indices (
-  const DoFHandler<1> &dof_handler,
+  const DH<1>                   &dof_handler,
   const std::set<unsigned char> &boundary_indicators,
   std::vector<unsigned int> &mapping)
 {
@@ -3143,7 +3306,7 @@ void DoFTools::map_dof_to_boundary_indices (
 
   mapping.clear ();
   mapping.insert (mapping.end(), dof_handler.n_dofs(),
-                 DoFHandler<1>::invalid_dof_index);
+                 DH<1>::invalid_dof_index);
 
   unsigned int next_free_index = 0;
   
@@ -3160,7 +3323,7 @@ void DoFTools::map_dof_to_boundary_indices (
                                       // find active cell at that
                                       // boundary: first go to
                                       // left/right, then to children
-      DoFHandler<1>::cell_iterator cell = dof_handler.begin(0);
+      typename DH<1>::cell_iterator cell = dof_handler.begin(0);
       while (!cell->at_boundary(direction))
        cell = cell->neighbor(direction);
       while (!cell->active())
@@ -3168,15 +3331,16 @@ void DoFTools::map_dof_to_boundary_indices (
 
                                       // next enumerate these degrees
                                       // of freedom
-      for (unsigned int i=0; i<dof_handler.get_fe().dofs_per_vertex; ++i)
+      for (unsigned int i=0; i<cell->get_fe().dofs_per_vertex; ++i)
        mapping[cell->vertex_dof_index(direction,i)] = next_free_index++;
     };
 }
 
 
 
-void DoFTools::map_dof_to_boundary_indices (const DoFHandler<1> &dof_handler,
-                                           std::vector<unsigned int> &mapping)
+void
+DoFTools::map_dof_to_boundary_indices (const DoFHandler<1>       &dof_handler,
+                                       std::vector<unsigned int> &mapping)
 {
   Assert (&dof_handler.get_fe() != 0, ExcNoFESelected());
 
@@ -3187,24 +3351,26 @@ void DoFTools::map_dof_to_boundary_indices (const DoFHandler<1> &dof_handler,
   std::set<unsigned char> boundary_indicators;
   boundary_indicators.insert (0U);
   boundary_indicators.insert (1U);
-  map_dof_to_boundary_indices (dof_handler, boundary_indicators, mapping);
+
+  map_dof_to_boundary_indices<DoFHandler> (dof_handler, boundary_indicators, mapping);
 }
 
 #else
 
 
-template <int dim>
-void DoFTools::map_dof_to_boundary_indices (const DoFHandler<dim>     &dof_handler,
-                                           std::vector<unsigned int> &mapping)
+template <int dim, template <int> class DH>
+void
+DoFTools::map_dof_to_boundary_indices (const DH<dim>             &dof_handler,
+                                       std::vector<unsigned int> &mapping)
 {
   Assert (&dof_handler.get_fe() != 0, ExcNoFESelected());
 
   mapping.clear ();
   mapping.insert (mapping.end(), dof_handler.n_dofs(),
-                 DoFHandler<dim>::invalid_dof_index);
+                 DH<dim>::invalid_dof_index);
   
-  const unsigned int dofs_per_face = dof_handler.get_fe().dofs_per_face;
-  std::vector<unsigned int> dofs_on_face(dofs_per_face);
+  std::vector<unsigned int> dofs_on_face;
+  dofs_on_face.reserve (max_dofs_per_face(dof_handler));
   unsigned int next_boundary_index = 0;
   
                                   // now loop over all cells and
@@ -3220,14 +3386,16 @@ void DoFTools::map_dof_to_boundary_indices (const DoFHandler<dim>     &dof_handl
                                   // line is also part of a boundary
                                   // face which we will be visiting
                                   // sooner or later
-  typename DoFHandler<dim>::active_face_iterator face = dof_handler.begin_active_face(),
-                                                endf = dof_handler.end_face();
+  typename DH<dim>::active_face_iterator face = dof_handler.begin_active_face(),
+                                         endf = dof_handler.end_face();
   for (; face!=endf; ++face)
     if (face->at_boundary()) 
       {
+        const unsigned int dofs_per_face = face->get_fe().dofs_per_face;
+        dofs_on_face.resize (dofs_per_face);
        face->get_dof_indices (dofs_on_face);
        for (unsigned int i=0; i<dofs_per_face; ++i)
-         if (mapping[dofs_on_face[i]] == DoFHandler<dim>::invalid_dof_index)
+         if (mapping[dofs_on_face[i]] == DH<dim>::invalid_dof_index)
            mapping[dofs_on_face[i]] = next_boundary_index++;
       };
 
@@ -3237,9 +3405,9 @@ void DoFTools::map_dof_to_boundary_indices (const DoFHandler<dim>     &dof_handl
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 void DoFTools::map_dof_to_boundary_indices (
-  const DoFHandler<dim>         &dof_handler,
+  const DH<dim>                 &dof_handler,
   const std::set<unsigned char> &boundary_indicators,
   std::vector<unsigned int>     &mapping)
 {
@@ -3249,29 +3417,31 @@ void DoFTools::map_dof_to_boundary_indices (
 
   mapping.clear ();
   mapping.insert (mapping.end(), dof_handler.n_dofs(),
-                 DoFHandler<dim>::invalid_dof_index);
+                 DH<dim>::invalid_dof_index);
 
                                   // return if there is nothing to do
   if (boundary_indicators.size() == 0)
     return;
   
-  const unsigned int dofs_per_face = dof_handler.get_fe().dofs_per_face;
-  std::vector<unsigned int> dofs_on_face(dofs_per_face);
+  std::vector<unsigned int> dofs_on_face;
+  dofs_on_face.reserve (max_dofs_per_face(dof_handler));
   unsigned int next_boundary_index = 0;
   
-  typename DoFHandler<dim>::active_face_iterator face = dof_handler.begin_active_face(),
-                                                endf = dof_handler.end_face();
+  typename DH<dim>::active_face_iterator face = dof_handler.begin_active_face(),
+                                         endf = dof_handler.end_face();
   for (; face!=endf; ++face)
     if (boundary_indicators.find (face->boundary_indicator()) !=
        boundary_indicators.end())
       {
+        const unsigned int dofs_per_face = face->get_fe().dofs_per_face;
+        dofs_on_face.resize (dofs_per_face);
        face->get_dof_indices (dofs_on_face);
        for (unsigned int i=0; i<dofs_per_face; ++i)
-         if (mapping[dofs_on_face[i]] == DoFHandler<dim>::invalid_dof_index)
+         if (mapping[dofs_on_face[i]] == DH<dim>::invalid_dof_index)
            mapping[dofs_on_face[i]] = next_boundary_index++;
       };
 
-  Assert (next_boundary_index == dof_handler.n_boundary_dofs(boundary_indicators),
+  Assert (next_boundary_index == dof_handler.n_boundary_dofs (boundary_indicators),
          ExcInternalError());
 }
 
@@ -3395,23 +3565,40 @@ DoFTools::compute_row_length_vector(
   const Table<2,Coupling>& couplings, const Table<2,Coupling>& flux_couplings);
 
 template void
-DoFTools::make_sparsity_pattern<deal_II_dimension,SparsityPattern>
+DoFTools::make_sparsity_pattern<deal_II_dimension,SparsityPattern,DoFHandler>
 (const DoFHandler<deal_II_dimension> &dof,
  SparsityPattern    &sparsity);
+template void
+DoFTools::make_sparsity_pattern<deal_II_dimension,SparsityPattern,hpDoFHandler>
+(const hpDoFHandler<deal_II_dimension> &dof,
+ SparsityPattern    &sparsity);
 
 template void
-DoFTools::make_sparsity_pattern<deal_II_dimension,CompressedSparsityPattern>
+DoFTools::make_sparsity_pattern<deal_II_dimension,CompressedSparsityPattern,DoFHandler>
 (const DoFHandler<deal_II_dimension> &dof,
  CompressedSparsityPattern    &sparsity);
+template void
+DoFTools::make_sparsity_pattern<deal_II_dimension,CompressedSparsityPattern,hpDoFHandler>
+(const hpDoFHandler<deal_II_dimension> &dof,
+ CompressedSparsityPattern    &sparsity);
 
 template void
-DoFTools::make_sparsity_pattern<deal_II_dimension,BlockSparsityPattern>
+DoFTools::make_sparsity_pattern<deal_II_dimension,BlockSparsityPattern,DoFHandler>
 (const DoFHandler<deal_II_dimension> &dof,
  BlockSparsityPattern                &sparsity);
 template void
-DoFTools::make_sparsity_pattern<deal_II_dimension,CompressedBlockSparsityPattern>
+DoFTools::make_sparsity_pattern<deal_II_dimension,BlockSparsityPattern,hpDoFHandler>
+(const hpDoFHandler<deal_II_dimension> &dof,
+ BlockSparsityPattern                &sparsity);
+
+template void
+DoFTools::make_sparsity_pattern<deal_II_dimension,CompressedBlockSparsityPattern,DoFHandler>
 (const DoFHandler<deal_II_dimension> &dof,
  CompressedBlockSparsityPattern      &sparsity);
+template void
+DoFTools::make_sparsity_pattern<deal_II_dimension,CompressedBlockSparsityPattern,hpDoFHandler>
+(const hpDoFHandler<deal_II_dimension> &dof,
+ CompressedBlockSparsityPattern      &sparsity);
 
 
 template void 
@@ -3437,20 +3624,40 @@ DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,SparsityPattern>
  const std::vector<unsigned int>  &,
  SparsityPattern    &);
 template void
+DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,SparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int>  &,
+ SparsityPattern    &);
+template void
 DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,CompressedSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const std::vector<unsigned int>  &,
  CompressedSparsityPattern    &);
 template void
+DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,CompressedSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int>  &,
+ CompressedSparsityPattern    &);
+template void
 DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,BlockSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const std::vector<unsigned int>  &,
  BlockSparsityPattern    &);
 template void
+DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,BlockSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int>  &,
+ BlockSparsityPattern    &);
+template void
 DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,CompressedBlockSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const std::vector<unsigned int>  &,
  CompressedBlockSparsityPattern    &);
+template void
+DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,CompressedBlockSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int>  &,
+ CompressedBlockSparsityPattern    &);
 
 template void
 DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,SparsityPattern>
@@ -3459,23 +3666,47 @@ DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,SparsityPattern>
  const std::vector<unsigned int>  &dof_to_boundary_mapping,
  SparsityPattern    &sparsity);
 template void
+DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,SparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
+ const std::vector<unsigned int>  &dof_to_boundary_mapping,
+ SparsityPattern    &sparsity);
+template void
 DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,CompressedSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
  const std::vector<unsigned int>  &dof_to_boundary_mapping,
  CompressedSparsityPattern    &sparsity);
 template void
+DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,CompressedSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
+ const std::vector<unsigned int>  &dof_to_boundary_mapping,
+ CompressedSparsityPattern    &sparsity);
+template void
 DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,BlockSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
  const std::vector<unsigned int>  &dof_to_boundary_mapping,
  BlockSparsityPattern    &sparsity);
 template void
+DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,BlockSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
+ const std::vector<unsigned int>  &dof_to_boundary_mapping,
+ BlockSparsityPattern    &sparsity);
+template void
 DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,CompressedBlockSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
  const std::vector<unsigned int>  &dof_to_boundary_mapping,
  CompressedBlockSparsityPattern    &sparsity);
+template void
+DoFTools::make_boundary_sparsity_pattern<deal_II_dimension,CompressedBlockSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
+ const std::vector<unsigned int>  &dof_to_boundary_mapping,
+ CompressedBlockSparsityPattern    &sparsity);
 #endif
 
 #if deal_II_dimension == 1
@@ -3485,20 +3716,40 @@ DoFTools::make_boundary_sparsity_pattern<SparsityPattern>
  const std::vector<unsigned int>  &,
  SparsityPattern    &);
 template void
+DoFTools::make_boundary_sparsity_pattern<SparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int>  &,
+ SparsityPattern    &);
+template void
 DoFTools::make_boundary_sparsity_pattern<CompressedSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const std::vector<unsigned int>  &,
  CompressedSparsityPattern    &);
 template void
+DoFTools::make_boundary_sparsity_pattern<CompressedSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int>  &,
+ CompressedSparsityPattern    &);
+template void
 DoFTools::make_boundary_sparsity_pattern<BlockSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const std::vector<unsigned int>  &,
  BlockSparsityPattern    &);
 template void
+DoFTools::make_boundary_sparsity_pattern<BlockSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int>  &,
+ BlockSparsityPattern    &);
+template void
 DoFTools::make_boundary_sparsity_pattern<CompressedBlockSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const std::vector<unsigned int>  &,
  CompressedBlockSparsityPattern    &);
+template void
+DoFTools::make_boundary_sparsity_pattern<CompressedBlockSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int>  &,
+ CompressedBlockSparsityPattern    &);
 
 template void
 DoFTools::make_boundary_sparsity_pattern<SparsityPattern>
@@ -3507,23 +3758,47 @@ DoFTools::make_boundary_sparsity_pattern<SparsityPattern>
  const std::vector<unsigned int>  &dof_to_boundary_mapping,
  SparsityPattern    &sparsity);
 template void
+DoFTools::make_boundary_sparsity_pattern<SparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
+ const std::vector<unsigned int>  &dof_to_boundary_mapping,
+ SparsityPattern    &sparsity);
+template void
 DoFTools::make_boundary_sparsity_pattern<CompressedSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
  const std::vector<unsigned int>  &dof_to_boundary_mapping,
  CompressedSparsityPattern    &sparsity);
 template void
+DoFTools::make_boundary_sparsity_pattern<CompressedSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
+ const std::vector<unsigned int>  &dof_to_boundary_mapping,
+ CompressedSparsityPattern    &sparsity);
+template void
 DoFTools::make_boundary_sparsity_pattern<BlockSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
  const std::vector<unsigned int>  &dof_to_boundary_mapping,
  BlockSparsityPattern    &sparsity);
 template void
+DoFTools::make_boundary_sparsity_pattern<BlockSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
+ const std::vector<unsigned int>  &dof_to_boundary_mapping,
+ BlockSparsityPattern    &sparsity);
+template void
 DoFTools::make_boundary_sparsity_pattern<CompressedBlockSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
  const std::vector<unsigned int>  &dof_to_boundary_mapping,
  CompressedBlockSparsityPattern    &sparsity);
+template void
+DoFTools::make_boundary_sparsity_pattern<CompressedBlockSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
+ const std::vector<unsigned int>  &dof_to_boundary_mapping,
+ CompressedBlockSparsityPattern    &sparsity);
 #endif
 
 
@@ -3533,34 +3808,66 @@ DoFTools::make_flux_sparsity_pattern<deal_II_dimension,SparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  SparsityPattern    &sparsity);
 template void
+DoFTools::make_flux_sparsity_pattern<deal_II_dimension,SparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ SparsityPattern    &sparsity);
+template void
 DoFTools::make_flux_sparsity_pattern<deal_II_dimension,CompressedSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  CompressedSparsityPattern    &sparsity);
 template void
+DoFTools::make_flux_sparsity_pattern<deal_II_dimension,CompressedSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ CompressedSparsityPattern    &sparsity);
+template void
 DoFTools::make_flux_sparsity_pattern<deal_II_dimension,BlockSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  BlockSparsityPattern    &sparsity);
 template void
+DoFTools::make_flux_sparsity_pattern<deal_II_dimension,BlockSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ BlockSparsityPattern    &sparsity);
+template void
 DoFTools::make_flux_sparsity_pattern<deal_II_dimension,CompressedBlockSparsityPattern>
 (const DoFHandler<deal_II_dimension>& dof,
  CompressedBlockSparsityPattern    &sparsity);
+template void
+DoFTools::make_flux_sparsity_pattern<deal_II_dimension,CompressedBlockSparsityPattern>
+(const hpDoFHandler<deal_II_dimension>& dof,
+ CompressedBlockSparsityPattern    &sparsity);
 #else
 template void
 DoFTools::make_flux_sparsity_pattern<SparsityPattern>
 (const DoFHandler<1>& dof,
  SparsityPattern    &sparsity);
 template void
+DoFTools::make_flux_sparsity_pattern<SparsityPattern>
+(const hpDoFHandler<1>& dof,
+ SparsityPattern    &sparsity);
+template void
 DoFTools::make_flux_sparsity_pattern<CompressedSparsityPattern>
 (const DoFHandler<1>& dof,
  CompressedSparsityPattern    &sparsity);
 template void
+DoFTools::make_flux_sparsity_pattern<CompressedSparsityPattern>
+(const hpDoFHandler<1>& dof,
+ CompressedSparsityPattern    &sparsity);
+template void
 DoFTools::make_flux_sparsity_pattern<BlockSparsityPattern>
 (const DoFHandler<1>& dof,
  BlockSparsityPattern    &sparsity);
 template void
+DoFTools::make_flux_sparsity_pattern<BlockSparsityPattern>
+(const hpDoFHandler<1>& dof,
+ BlockSparsityPattern    &sparsity);
+template void
 DoFTools::make_flux_sparsity_pattern<CompressedBlockSparsityPattern>
 (const DoFHandler<1>& dof,
  CompressedBlockSparsityPattern    &sparsity);
+template void
+DoFTools::make_flux_sparsity_pattern<CompressedBlockSparsityPattern>
+(const hpDoFHandler<1>& dof,
+ CompressedBlockSparsityPattern    &sparsity);
 #endif
 
 #if deal_II_dimension > 1
@@ -3623,20 +3930,37 @@ template void DoFTools::extract_level_dofs<deal_II_dimension>
 #if deal_II_dimension != 1
 template
 void
-DoFTools::extract_boundary_dofs<deal_II_dimension>
+DoFTools::extract_boundary_dofs<deal_II_dimension,DoFHandler>
 (const DoFHandler<deal_II_dimension> &,
  const std::vector<bool>                  &,
  std::vector<bool>                        &,
  const std::set<unsigned char> &);
+
+#else
+
+template
+void
+DoFTools::extract_boundary_dofs<DoFHandler>
+(const DoFHandler<1> &,
+ const std::vector<bool>                  &,
+ std::vector<bool>                        &,
+ const std::set<unsigned char> &);
 #endif 
 
 template
 void
-DoFTools::extract_subdomain_dofs<deal_II_dimension>
+DoFTools::extract_subdomain_dofs<deal_II_dimension, DoFHandler>
 (const DoFHandler<deal_II_dimension> &dof_handler,
  const unsigned int     subdomain_id,
  std::vector<bool>     &selected_dofs);
 
+template
+void
+DoFTools::extract_subdomain_dofs<deal_II_dimension, hpDoFHandler>
+(const hpDoFHandler<deal_II_dimension> &dof_handler,
+ const unsigned int     subdomain_id,
+ std::vector<bool>     &selected_dofs);
+
 template
 void
 DoFTools::get_subdomain_association<deal_II_dimension>
@@ -3680,8 +4004,16 @@ DoFTools::compute_intergrid_transfer_representation<deal_II_dimension>
  std::vector<std::map<unsigned int, float> > &);
 
 
+#if deal_II_dimension == 1
 
-#if deal_II_dimension != 1
+template
+void
+DoFTools::map_dof_to_boundary_indices<DoFHandler>
+(const DoFHandler<deal_II_dimension> &,
+ const std::set<unsigned char> &,
+ std::vector<unsigned int> &);
+
+#else
 
 template
 void
@@ -3696,8 +4028,7 @@ DoFTools::map_dof_to_boundary_indices<deal_II_dimension>
  const std::set<unsigned char> &,
  std::vector<unsigned int> &);
 
-#endif 
-
+#endif
 
 
 template
diff --git a/deal.II/deal.II/source/dofs/hp_dof_accessor.cc b/deal.II/deal.II/source/dofs/hp_dof_accessor.cc
new file mode 100644 (file)
index 0000000..3d1c047
--- /dev/null
@@ -0,0 +1,210 @@
+//----------------------------  hp_dof_accessor.cc  ------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  hp_dof_accessor.cc  ------------------------
+
+
+#include <lac/vector.h>
+#include <lac/block_vector.h>
+#include <lac/sparse_matrix.h>
+
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_accessor.templates.h>
+#include <dofs/dof_levels.h>
+#include <dofs/hp_dof_handler.h>
+#include <dofs/hp_dof_levels.h>
+#include <grid/tria_iterator.h>
+#include <grid/tria_iterator.templates.h>
+#include <fe/fe.h>
+
+#include <vector>
+
+
+/*------------------------- Functions: DoFCellAccessor -----------------------*/
+
+#if deal_II_dimension == 1
+
+template <>
+TriaIterator<1, DoFObjectAccessor<0,1,hpDoFHandler> >
+DoFCellAccessor<1,hpDoFHandler>::face (const unsigned int) const
+{
+  Assert (false, ExcImpossibleInDim(1));
+  return TriaIterator<1, DoFObjectAccessor<0,1, hpDoFHandler> >();
+}
+
+#endif
+
+
+#if deal_II_dimension == 2
+
+template <>
+TriaIterator<2, DoFObjectAccessor<1,2,hpDoFHandler> >
+DoFCellAccessor<2,hpDoFHandler>::face (const unsigned int i) const
+{
+  return this->line(i);
+}
+
+#endif
+
+
+#if deal_II_dimension == 3
+
+template <>
+TriaIterator<3, DoFObjectAccessor<2, 3, hpDoFHandler> >
+DoFCellAccessor<3,hpDoFHandler>::face (const unsigned int i) const
+{
+  return this->quad(i);
+}
+
+#endif
+
+
+/*----------------- Functions: DoFObjectAccessor<1,dim,hpDoFHander> ----------*/
+
+template <>
+void DoFObjectAccessor<1, 1, hpDoFHandler>::set_dof_index (const unsigned int i,
+                                                          const unsigned int index) const
+{
+  typedef DoFAccessor<1, hpDoFHandler> BaseClass;
+
+  Assert (this->dof_handler != 0,
+         BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0,
+         BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_line,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_line));
+
+  unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_line_index_offset[this->present_index];
+  this->dof_handler->levels[this->present_level]
+      ->line_dofs[offset+i] = index;
+}
+
+
+template <>
+void DoFObjectAccessor<1, 2, hpDoFHandler>::set_dof_index (const unsigned int i,
+                                                          const unsigned int index) const
+{
+  typedef DoFAccessor<2, hpDoFHandler> BaseClass;
+
+  Assert (this->dof_handler != 0,
+         BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0,
+         BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_line,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_line));
+
+//TODO:[?] In two dimension it could happen that we have different active_fe_indices
+// on a line between to cells. Hence we have to differentiate between these two cases.
+// Unfortunately, this requires more information then available now.
+
+  unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_line_index_offset[this->present_index];
+  this->dof_handler->levels[this->present_level]
+      ->line_dofs[offset+i] = index;
+}
+
+
+template <>
+void DoFObjectAccessor<1, 3, hpDoFHandler>::set_dof_index (const unsigned int i,
+                                                          const unsigned int index) const
+{
+  typedef DoFAccessor<3, hpDoFHandler> BaseClass;
+
+  Assert (this->dof_handler != 0,
+         BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0,
+         BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_line,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_line));
+
+  unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_line_index_offset[this->present_index];
+  this->dof_handler->levels[this->present_level]
+      ->line_dofs[offset+i] = index;
+}
+
+
+
+/*----------------- Functions: DoFObjectAccessor<2,dim,hpDoFHander> ----------*/
+
+template <>
+void DoFObjectAccessor<2, 2, hpDoFHandler>::set_dof_index (const unsigned int i,
+                                                          const unsigned int index) const
+{
+  typedef DoFAccessor<2, hpDoFHandler> BaseClass;
+
+  Assert (this->dof_handler != 0,
+         BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0,
+         BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_quad,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_quad));
+
+  unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_quad_index_offset[this->present_index];
+  this->dof_handler->levels[this->present_level]
+      ->quad_dofs[offset+i] = index;
+}
+
+
+template <>
+void DoFObjectAccessor<2, 3, hpDoFHandler>::set_dof_index (const unsigned int i,
+                                                          const unsigned int index) const
+{
+  typedef DoFAccessor<3, hpDoFHandler> BaseClass;
+
+  Assert (this->dof_handler != 0,
+         BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0,
+         BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_quad,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_quad));
+
+  unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_quad_index_offset[this->present_index];
+  this->dof_handler->levels[this->present_level]
+      ->quad_dofs[offset+i] = index;
+}
+
+
+/*----------------- Functions: DoFObjectAccessor<3,dim,hpDoFHander> ----------*/
+
+template <>
+void DoFObjectAccessor<3, 3, hpDoFHandler>::set_dof_index (const unsigned int i,
+                                                          const unsigned int index) const
+{
+  typedef DoFAccessor<3, hpDoFHandler> BaseClass;
+    
+  Assert (this->dof_handler != 0,
+         BaseClass::ExcInvalidObject());
+                                  // make sure a FE has been selected
+                                  // and enough room was reserved
+  Assert (&this->get_fe() != 0,
+         BaseClass::ExcInvalidObject());
+  Assert (i<this->get_fe().dofs_per_hex,
+         ExcIndexRange (i, 0, this->get_fe().dofs_per_hex));
+
+  unsigned int offset = this->dof_handler->levels[this->present_level]
+      ->dof_hex_index_offset[this->present_index];
+  this->dof_handler->levels[this->present_level]
+      ->hex_dofs[offset+i] = index;
+}
diff --git a/deal.II/deal.II/source/dofs/hp_dof_handler.cc b/deal.II/deal.II/source/dofs/hp_dof_handler.cc
new file mode 100644 (file)
index 0000000..517ec57
--- /dev/null
@@ -0,0 +1,2413 @@
+//----------------------------  hp_dof_handler.cc  ------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003, 2004 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  hp_dof_handler.cc  ------------------------
+
+
+#include <base/memory_consumption.h>
+#include <dofs/hp_dof_handler.h>
+#include <dofs/hp_dof_levels.h>
+#include <dofs/dof_accessor.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/tria_levels.h>
+#include <grid/tria.h>
+#include <grid/geometry_info.h>
+#include <fe/fe.h>
+
+#include <set>
+#include <algorithm>
+#include <functional>
+
+
+
+template <int dim>
+const unsigned int hpDoFHandler<dim>::invalid_dof_index;
+
+
+
+template <int dim>
+hpDoFHandler<dim>::hpDoFHandler (const Triangulation<dim> &tria)
+                :
+                tria(&tria),
+                used_dofs (0)
+{
+  tria.add_refinement_listener (*this);
+}
+
+
+template <int dim>
+hpDoFHandler<dim>::~hpDoFHandler ()
+{
+                                   // unsubscribe as a listener to refinement
+                                   // of the underlying triangulation
+  tria->remove_refinement_listener (*this);
+  
+                                  // ...and release allocated memory
+  clear ();
+}
+
+
+#if deal_II_dimension == 1
+
+template <>
+hpDoFHandler<1>::raw_cell_iterator
+hpDoFHandler<1>::begin_raw (const unsigned int level) const {
+  return begin_raw_line (level);
+}
+
+
+template <>
+hpDoFHandler<1>::cell_iterator
+hpDoFHandler<1>::begin (const unsigned int level) const {
+  return begin_line (level);
+}
+
+
+template <>
+hpDoFHandler<1>::active_cell_iterator
+hpDoFHandler<1>::begin_active (const unsigned int level) const {
+  return begin_active_line (level);
+}
+
+
+template <>
+hpDoFHandler<1>::raw_cell_iterator
+hpDoFHandler<1>::end () const {
+  return end_line ();
+}
+
+
+template <>
+hpDoFHandler<1>::raw_cell_iterator
+hpDoFHandler<1>::last_raw () const {
+  return last_raw_line ();
+}
+
+
+template <>
+hpDoFHandler<1>::raw_cell_iterator
+hpDoFHandler<1>::last_raw (const unsigned int level) const {
+  return last_raw_line (level);
+}
+
+
+template <>
+hpDoFHandler<1>::cell_iterator
+hpDoFHandler<1>::last () const {
+  return last_line ();
+}
+
+
+template <>
+hpDoFHandler<1>::cell_iterator
+hpDoFHandler<1>::last (const unsigned int level) const {
+  return last_line (level);
+}
+
+
+template <>
+hpDoFHandler<1>::active_cell_iterator
+hpDoFHandler<1>::last_active () const {
+  return last_active_line ();
+}
+
+
+template <>
+hpDoFHandler<1>::active_cell_iterator
+hpDoFHandler<1>::last_active (const unsigned int level) const {
+  return last_active_line (level);
+}
+
+
+template <>
+hpDoFHandler<1>::raw_face_iterator
+hpDoFHandler<1>::begin_raw_face (const unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::face_iterator
+hpDoFHandler<1>::begin_face (const unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::active_face_iterator
+hpDoFHandler<1>::begin_active_face (const unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::raw_face_iterator
+hpDoFHandler<1>::end_face () const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::raw_face_iterator
+hpDoFHandler<1>::last_raw_face () const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::raw_face_iterator
+hpDoFHandler<1>::last_raw_face (const unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::face_iterator
+hpDoFHandler<1>::last_face () const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::face_iterator
+hpDoFHandler<1>::last_face (const unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::active_face_iterator
+hpDoFHandler<1>::last_active_face () const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::active_face_iterator
+hpDoFHandler<1>::last_active_face (const unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::raw_quad_iterator
+hpDoFHandler<1>::begin_raw_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::quad_iterator
+hpDoFHandler<1>::begin_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::active_quad_iterator
+hpDoFHandler<1>::begin_active_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::raw_quad_iterator
+hpDoFHandler<1>::end_quad () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::raw_quad_iterator
+hpDoFHandler<1>::last_raw_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::quad_iterator
+hpDoFHandler<1>::last_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::active_quad_iterator
+hpDoFHandler<1>::last_active_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::raw_quad_iterator
+hpDoFHandler<1>::last_raw_quad () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::quad_iterator
+hpDoFHandler<1>::last_quad () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::active_quad_iterator
+hpDoFHandler<1>::last_active_quad () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::raw_hex_iterator
+hpDoFHandler<1>::begin_raw_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::hex_iterator
+hpDoFHandler<1>::begin_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::active_hex_iterator
+hpDoFHandler<1>::begin_active_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::raw_hex_iterator
+hpDoFHandler<1>::end_hex () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::raw_hex_iterator
+hpDoFHandler<1>::last_raw_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::raw_hex_iterator
+hpDoFHandler<1>::last_raw_hex () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::hex_iterator
+hpDoFHandler<1>::last_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::hex_iterator
+hpDoFHandler<1>::last_hex () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::active_hex_iterator
+hpDoFHandler<1>::last_active_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<1>::active_hex_iterator
+hpDoFHandler<1>::last_active_hex () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+#endif
+
+
+#if deal_II_dimension == 2
+
+template <>
+hpDoFHandler<2>::raw_cell_iterator
+hpDoFHandler<2>::begin_raw (const unsigned int level) const {
+  return begin_raw_quad (level);
+}
+
+
+template <>
+hpDoFHandler<2>::cell_iterator
+hpDoFHandler<2>::begin (const unsigned int level) const {
+  return begin_quad (level);
+}
+
+
+template <>
+hpDoFHandler<2>::active_cell_iterator
+hpDoFHandler<2>::begin_active (const unsigned int level) const {
+  return begin_active_quad (level);
+}
+
+
+template <>
+hpDoFHandler<2>::raw_cell_iterator
+hpDoFHandler<2>::end () const {
+  return end_quad ();
+}
+
+
+template <>
+hpDoFHandler<2>::raw_cell_iterator
+hpDoFHandler<2>::last_raw () const {
+  return last_raw_quad ();
+}
+
+
+template <>
+hpDoFHandler<2>::raw_cell_iterator
+hpDoFHandler<2>::last_raw (const unsigned int level) const {
+  return last_raw_quad (level);
+}
+
+
+template <>
+hpDoFHandler<2>::cell_iterator
+hpDoFHandler<2>::last () const {
+  return last_quad ();
+}
+
+
+template <>
+hpDoFHandler<2>::cell_iterator
+hpDoFHandler<2>::last (const unsigned int level) const {
+  return last_quad (level);
+}
+
+
+template <>
+hpDoFHandler<2>::active_cell_iterator
+hpDoFHandler<2>::last_active () const {
+  return last_active_quad ();
+}
+
+
+template <>
+hpDoFHandler<2>::active_cell_iterator
+hpDoFHandler<2>::last_active (const unsigned int level) const {
+  return last_active_quad (level);
+}
+
+
+template <>
+hpDoFHandler<2>::raw_face_iterator
+hpDoFHandler<2>::begin_raw_face (const unsigned int level) const {
+  return begin_raw_line (level);
+}
+
+
+template <>
+hpDoFHandler<2>::face_iterator
+hpDoFHandler<2>::begin_face (const unsigned int level) const {
+  return begin_line (level);
+}
+
+
+template <>
+hpDoFHandler<2>::active_face_iterator
+hpDoFHandler<2>::begin_active_face (const unsigned int level) const {
+  return begin_active_line (level);
+}
+
+
+template <>
+hpDoFHandler<2>::raw_face_iterator
+hpDoFHandler<2>::end_face () const {
+  return end_line ();
+}
+
+
+template <>
+hpDoFHandler<2>::raw_face_iterator
+hpDoFHandler<2>::last_raw_face () const {
+  return last_raw_line ();
+}
+
+
+template <>
+hpDoFHandler<2>::raw_face_iterator
+hpDoFHandler<2>::last_raw_face (const unsigned int level) const {
+  return last_raw_line (level);
+}
+
+
+template <>
+hpDoFHandler<2>::face_iterator
+hpDoFHandler<2>::last_face () const {
+  return last_line ();
+}
+
+
+template <>
+hpDoFHandler<2>::face_iterator
+hpDoFHandler<2>::last_face (const unsigned int level) const {
+  return last_line (level);
+}
+
+
+template <>
+hpDoFHandler<2>::active_face_iterator
+hpDoFHandler<2>::last_active_face () const {
+  return last_active_line ();
+}
+
+
+template <>
+hpDoFHandler<2>::active_face_iterator
+hpDoFHandler<2>::last_active_face (const unsigned int level) const {
+  return last_active_line (level);
+}
+
+
+template <>
+hpDoFHandler<2>::raw_hex_iterator
+hpDoFHandler<2>::begin_raw_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<2>::hex_iterator
+hpDoFHandler<2>::begin_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<2>::active_hex_iterator
+hpDoFHandler<2>::begin_active_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<2>::raw_hex_iterator
+hpDoFHandler<2>::end_hex () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<2>::raw_hex_iterator
+hpDoFHandler<2>::last_raw_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<2>::raw_hex_iterator
+hpDoFHandler<2>::last_raw_hex () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<2>::hex_iterator
+hpDoFHandler<2>::last_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<2>::hex_iterator
+hpDoFHandler<2>::last_hex () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<2>::active_hex_iterator
+hpDoFHandler<2>::last_active_hex (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+template <>
+hpDoFHandler<2>::active_hex_iterator
+hpDoFHandler<2>::last_active_hex () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+}
+
+
+#endif
+
+
+#if deal_II_dimension == 3
+
+template <>
+hpDoFHandler<3>::raw_cell_iterator
+hpDoFHandler<3>::begin_raw (const unsigned int level) const {
+  return begin_raw_hex (level);
+}
+
+
+template <>
+hpDoFHandler<3>::cell_iterator
+hpDoFHandler<3>::begin (const unsigned int level) const {
+  return begin_hex (level);
+}
+
+
+template <>
+hpDoFHandler<3>::active_cell_iterator
+hpDoFHandler<3>::begin_active (const unsigned int level) const {
+  return begin_active_hex (level);
+}
+
+
+template <>
+hpDoFHandler<3>::raw_cell_iterator
+hpDoFHandler<3>::end () const {
+  return end_hex ();
+}
+
+
+template <>
+hpDoFHandler<3>::raw_cell_iterator
+hpDoFHandler<3>::last_raw () const {
+  return last_raw_hex ();
+}
+
+
+template <>
+hpDoFHandler<3>::raw_cell_iterator
+hpDoFHandler<3>::last_raw (const unsigned int level) const {
+  return last_raw_hex (level);
+}
+
+
+template <>
+hpDoFHandler<3>::cell_iterator
+hpDoFHandler<3>::last () const {
+  return last_hex ();
+}
+
+
+template <>
+hpDoFHandler<3>::cell_iterator
+hpDoFHandler<3>::last (const unsigned int level) const {
+  return last_hex (level);
+}
+
+
+template <>
+hpDoFHandler<3>::active_cell_iterator
+hpDoFHandler<3>::last_active () const {
+  return last_active_hex ();
+}
+
+
+template <>
+hpDoFHandler<3>::active_cell_iterator
+hpDoFHandler<3>::last_active (const unsigned int level) const {
+  return last_active_hex (level);
+}
+
+
+template <>
+hpDoFHandler<3>::raw_face_iterator
+hpDoFHandler<3>::begin_raw_face (const unsigned int level) const {
+  return begin_raw_quad (level);
+}
+
+
+template <>
+hpDoFHandler<3>::face_iterator
+hpDoFHandler<3>::begin_face (const unsigned int level) const {
+  return begin_quad (level);
+}
+
+
+template <>
+hpDoFHandler<3>::active_face_iterator
+hpDoFHandler<3>::begin_active_face (const unsigned int level) const {
+  return begin_active_quad (level);
+}
+
+
+template <>
+hpDoFHandler<3>::raw_face_iterator
+hpDoFHandler<3>::end_face () const {
+  return end_quad ();
+}
+
+
+template <>
+hpDoFHandler<3>::raw_face_iterator
+hpDoFHandler<3>::last_raw_face () const {
+  return last_raw_quad ();
+}
+
+
+template <>
+hpDoFHandler<3>::raw_face_iterator
+hpDoFHandler<3>::last_raw_face (const unsigned int level) const {
+  return last_raw_quad (level);
+}
+
+
+template <>
+hpDoFHandler<3>::face_iterator
+hpDoFHandler<3>::last_face () const {
+  return last_quad ();
+}
+
+
+template <>
+hpDoFHandler<3>::face_iterator
+hpDoFHandler<3>::last_face (const unsigned int level) const {
+  return last_quad (level);
+}
+
+
+template <>
+hpDoFHandler<3>::active_face_iterator
+hpDoFHandler<3>::last_active_face () const {
+  return last_active_quad ();
+}
+
+
+template <>
+hpDoFHandler<3>::active_face_iterator
+hpDoFHandler<3>::last_active_face (const unsigned int level) const {
+  return last_active_quad (level);
+}
+
+
+#endif
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_line_iterator
+hpDoFHandler<dim>::begin_raw_line (const unsigned int level) const {
+  return raw_line_iterator (tria,
+                           tria->begin_raw_line(level)->level(),
+                           tria->begin_raw_line(level)->index(),
+                           this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::line_iterator
+hpDoFHandler<dim>::begin_line (const unsigned int level) const {
+  return line_iterator (tria,
+                       tria->begin_line(level)->level(),
+                       tria->begin_line(level)->index(),
+                       this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_line_iterator
+hpDoFHandler<dim>::begin_active_line (const unsigned int level) const {
+  return active_line_iterator (tria,
+                              tria->begin_active_line(level)->level(),
+                              tria->begin_active_line(level)->index(),
+                              this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_quad_iterator
+hpDoFHandler<dim>::begin_raw_quad (const unsigned int level) const {
+  return raw_quad_iterator (tria,
+                           tria->begin_raw_quad(level)->level(),
+                           tria->begin_raw_quad(level)->index(),
+                           this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::quad_iterator
+hpDoFHandler<dim>::begin_quad (const unsigned int level) const {
+  return quad_iterator (tria,
+                       tria->begin_quad(level)->level(),
+                       tria->begin_quad(level)->index(),
+                       this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_quad_iterator
+hpDoFHandler<dim>::begin_active_quad (const unsigned int level) const {
+  return active_quad_iterator (tria,
+                              tria->begin_active_quad(level)->level(),
+                              tria->begin_active_quad(level)->index(),
+                              this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_hex_iterator
+hpDoFHandler<dim>::begin_raw_hex (const unsigned int level) const {
+  return raw_hex_iterator (tria,
+                          tria->begin_raw_hex(level)->level(),
+                          tria->begin_raw_hex(level)->index(),
+                          this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::hex_iterator
+hpDoFHandler<dim>::begin_hex (const unsigned int level) const {
+  return hex_iterator (tria,
+                      tria->begin_hex(level)->level(),
+                      tria->begin_hex(level)->index(),
+                      this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_hex_iterator
+hpDoFHandler<dim>::begin_active_hex (const unsigned int level) const {
+  return active_hex_iterator (tria,
+                             tria->begin_active_hex(level)->level(),
+                             tria->begin_active_hex(level)->index(),
+                             this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_line_iterator
+hpDoFHandler<dim>::end_line () const {
+  return raw_line_iterator (tria, -1, -1, this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_quad_iterator
+hpDoFHandler<dim>::end_quad () const {
+  return raw_quad_iterator (tria, -1, -1, this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_hex_iterator
+hpDoFHandler<dim>::end_hex () const {
+  return raw_hex_iterator (tria, -1, -1, this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_cell_iterator
+hpDoFHandler<dim>::end_raw (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end() :
+         begin_raw (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::cell_iterator
+hpDoFHandler<dim>::end (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         cell_iterator(end()) :
+         begin (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_cell_iterator
+hpDoFHandler<dim>::end_active (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_cell_iterator(end()) :
+         begin_active (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_face_iterator
+hpDoFHandler<dim>::end_raw_face (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end_face() :
+         begin_raw_face (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::face_iterator
+hpDoFHandler<dim>::end_face (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         face_iterator(end_face()) :
+         begin_face (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_face_iterator
+hpDoFHandler<dim>::end_active_face (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_face_iterator(end_face()) :
+         begin_active_face (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_line_iterator
+hpDoFHandler<dim>::end_raw_line (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end_line() :
+         begin_raw_line (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::line_iterator
+hpDoFHandler<dim>::end_line (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         line_iterator(end_line()) :
+         begin_line (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_line_iterator
+hpDoFHandler<dim>::end_active_line (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_line_iterator(end_line()) :
+         begin_active_line (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_quad_iterator
+hpDoFHandler<dim>::end_raw_quad (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end_quad() :
+         begin_raw_quad (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::quad_iterator
+hpDoFHandler<dim>::end_quad (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         quad_iterator(end_quad()) :
+         begin_quad (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_quad_iterator
+hpDoFHandler<dim>::end_active_quad (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_quad_iterator(end_quad()) :
+         begin_active_quad (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_hex_iterator
+hpDoFHandler<dim>::end_raw_hex (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         end_hex() :
+         begin_raw_hex (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::hex_iterator
+hpDoFHandler<dim>::end_hex (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         hex_iterator(end_hex()) :
+         begin_hex (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_hex_iterator
+hpDoFHandler<dim>::end_active_hex (const unsigned int level) const {
+  return (level == levels.size()-1 ?
+         active_hex_iterator(end_hex()) :
+         begin_active_hex (level+1));
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_line_iterator
+hpDoFHandler<dim>::last_raw_line (const unsigned int level) const {
+  return raw_line_iterator (tria,
+                           tria->last_raw_line(level)->level(),
+                           tria->last_raw_line(level)->index(),
+                           this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::line_iterator
+hpDoFHandler<dim>::last_line (const unsigned int level) const {
+  return line_iterator (tria,
+                       tria->last_line(level)->level(),
+                       tria->last_line(level)->index(),
+                       this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_line_iterator
+hpDoFHandler<dim>::last_active_line (const unsigned int level) const {
+  return active_line_iterator (tria,
+                              tria->last_active_line(level)->level(),
+                              tria->last_active_line(level)->index(),
+                              this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_quad_iterator
+hpDoFHandler<dim>::last_raw_quad (const unsigned int level) const {
+  return raw_quad_iterator (tria,
+                           tria->last_raw_quad(level)->level(),
+                           tria->last_raw_quad(level)->index(),
+                           this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::quad_iterator
+hpDoFHandler<dim>::last_quad (const unsigned int level) const {
+  return quad_iterator (tria,
+                       tria->last_quad(level)->level(),
+                       tria->last_quad(level)->index(),
+                       this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_quad_iterator
+hpDoFHandler<dim>::last_active_quad (const unsigned int level) const {
+  return active_quad_iterator (tria,
+                              tria->last_active_quad(level)->level(),
+                              tria->last_active_quad(level)->index(),
+                              this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_hex_iterator
+hpDoFHandler<dim>::last_raw_hex (const unsigned int level) const {
+  return raw_hex_iterator (tria,
+                          tria->last_raw_hex(level)->level(),
+                          tria->last_raw_hex(level)->index(),
+                          this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::hex_iterator
+hpDoFHandler<dim>::last_hex (const unsigned int level) const {
+  return hex_iterator (tria,
+                      tria->last_hex(level)->level(),
+                      tria->last_hex(level)->index(),
+                      this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_hex_iterator
+hpDoFHandler<dim>::last_active_hex (const unsigned int level) const {
+  return active_hex_iterator (tria,
+                             tria->last_active_hex(level)->level(),
+                             tria->last_active_hex(level)->index(),
+                             this);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_line_iterator
+hpDoFHandler<dim>::last_raw_line () const {
+  return last_raw_line (levels.size()-1);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_quad_iterator
+hpDoFHandler<dim>::last_raw_quad () const {
+  return last_raw_quad (levels.size()-1);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::raw_hex_iterator
+hpDoFHandler<dim>::last_raw_hex () const {
+  return last_raw_hex (levels.size()-1);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::line_iterator
+hpDoFHandler<dim>::last_line () const {
+  return last_line (levels.size()-1);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::quad_iterator
+hpDoFHandler<dim>::last_quad () const {
+  return last_quad (levels.size()-1);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::hex_iterator
+hpDoFHandler<dim>::last_hex () const {
+  return last_hex (levels.size()-1);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_line_iterator
+hpDoFHandler<dim>::last_active_line () const {
+  return last_active_line (levels.size()-1);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_quad_iterator
+hpDoFHandler<dim>::last_active_quad () const {
+  return last_active_quad (levels.size()-1);
+}
+
+
+template <int dim>
+typename hpDoFHandler<dim>::active_hex_iterator
+hpDoFHandler<dim>::last_active_hex () const {
+  return last_active_hex (levels.size()-1);
+}
+
+
+//------------------------------------------------------------------
+
+
+
+#if deal_II_dimension == 1
+
+template <>
+unsigned int hpDoFHandler<1>::n_boundary_dofs () const
+{
+  Assert (finite_elements != 0, ExcNoFESelected());
+
+  hpDoFHandler<1>::cell_iterator cell;
+  unsigned int n = 0;
+  
+                                   // search left-most cell
+  cell = this->begin_active();
+  while (!cell->at_boundary(0))
+    cell = cell->neighbor(0);
+  n += cell->get_fe().dofs_per_vertex;
+  
+                                   // same with right-most cell
+  cell = this->begin_active();
+  while (!cell->at_boundary(1))
+    cell = cell->neighbor(1);
+  n += cell->get_fe().dofs_per_vertex;
+
+  return n;
+}
+
+
+
+template <>
+unsigned int hpDoFHandler<1>::n_boundary_dofs (const FunctionMap &boundary_indicators) const
+{
+  Assert (finite_elements != 0, ExcNoFESelected());
+
+                                  // check that only boundary
+                                  // indicators 0 and 1 are allowed
+                                  // in 1d
+  for (FunctionMap::const_iterator i=boundary_indicators.begin();
+       i!=boundary_indicators.end(); ++i)
+    Assert ((i->first == 0) || (i->first == 1),
+           ExcInvalidBoundaryIndicator());
+  
+  hpDoFHandler<1>::active_cell_iterator cell;
+  unsigned int n = 0;
+  
+                                   // search left-most cell
+  if (boundary_indicators.find (0) != boundary_indicators.end())
+    {
+      cell = this->begin_active();
+      while (!cell->at_boundary(0))
+        cell = cell->neighbor(0);
+      n += cell->get_fe().dofs_per_vertex;
+    }
+  
+                                   // same with right-most cell
+  if (boundary_indicators.find (1) != boundary_indicators.end())
+    {
+      cell = this->begin_active();
+      while (!cell->at_boundary(1))
+        cell = cell->neighbor(1);
+      n += cell->get_fe().dofs_per_vertex;
+    }
+  
+  return n;
+}
+
+
+
+template <>
+unsigned int hpDoFHandler<1>::n_boundary_dofs (const std::set<unsigned char> &boundary_indicators) const
+{
+  Assert (finite_elements != 0, ExcNoFESelected());
+
+                                  // check that only boundary
+                                  // indicators 0 and 1 are allowed
+                                  // in 1d
+  for (std::set<unsigned char>::const_iterator i=boundary_indicators.begin();
+       i!=boundary_indicators.end(); ++i)
+    Assert ((*i == 0) || (*i == 1),
+           ExcInvalidBoundaryIndicator());
+  
+  hpDoFHandler<1>::active_cell_iterator cell;
+  unsigned int n = 0;
+  
+                                   // search left-most cell
+  if (boundary_indicators.find (0) != boundary_indicators.end())
+    {
+      cell = this->begin_active();
+      while (!cell->at_boundary(0))
+        cell = cell->neighbor(0);
+      n += cell->get_fe().dofs_per_vertex;
+    }
+  
+                                   // same with right-most cell
+  if (boundary_indicators.find (1) != boundary_indicators.end())
+    {
+      cell = this->begin_active();
+      while (!cell->at_boundary(1))
+        cell = cell->neighbor(1);
+      n += cell->get_fe().dofs_per_vertex;
+    }
+  
+  return n;
+}
+
+#endif
+
+
+template <int dim>
+unsigned int hpDoFHandler<dim>::n_boundary_dofs () const
+{
+  Assert (finite_elements != 0, ExcNoFESelected());
+
+  std::set<int> boundary_dofs;
+  std::vector<unsigned int> dofs_on_face;
+  dofs_on_face.reserve (this->get_fe ().max_dofs_per_face());
+
+                                  // loop over all faces to check
+                                  // whether they are at a
+                                  // boundary. note that we need not
+                                  // take special care of single
+                                  // lines in 3d (using
+                                  // @p{cell->has_boundary_lines}),
+                                  // since we do not support
+                                  // boundaries of dimension dim-2,
+                                  // and so every boundary line is
+                                  // also part of a boundary face.
+  typename hpDoFHandler<dim>::active_cell_iterator cell = this->begin_active (),
+                                                   endc = this->end();
+  for (; cell!=endc; ++cell)
+    for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+      if (cell->at_boundary(f))
+        {
+          const unsigned int dofs_per_face = cell->get_fe().dofs_per_face;
+          dofs_on_face.resize (dofs_per_face);
+          
+          cell->face(f)->get_dof_indices (dofs_on_face);
+          for (unsigned int i=0; i<dofs_per_face; ++i)
+            boundary_dofs.insert(dofs_on_face[i]);
+        };
+  return boundary_dofs.size();  
+}
+
+
+
+template <int dim>
+unsigned int
+hpDoFHandler<dim>::n_boundary_dofs (const FunctionMap &boundary_indicators) const
+{
+  Assert (finite_elements != 0, ExcNoFESelected());
+  Assert (boundary_indicators.find(255) == boundary_indicators.end(),
+         ExcInvalidBoundaryIndicator());
+  
+                                   // same as above, but with
+                                   // additional checks for set of
+                                   // boundary indicators
+  std::set<int> boundary_dofs;
+  std::vector<unsigned int> dofs_on_face;
+  dofs_on_face.reserve (this->get_fe ().max_dofs_per_face());
+
+  typename hpDoFHandler<dim>::active_cell_iterator cell = this->begin_active (),
+                                                   endc = this->end();
+  for (; cell!=endc; ++cell)
+    for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+      if (cell->at_boundary(f) &&
+          (boundary_indicators.find(cell->face(f)->boundary_indicator()) !=
+           boundary_indicators.end()))
+        {
+          const unsigned int dofs_per_face = cell->get_fe().dofs_per_face;
+          dofs_on_face.resize (dofs_per_face);
+          
+          cell->face(f)->get_dof_indices (dofs_on_face);
+          for (unsigned int i=0; i<dofs_per_face; ++i)
+            boundary_dofs.insert(dofs_on_face[i]);
+        };
+  return boundary_dofs.size();
+}
+
+
+
+template <int dim>
+unsigned int
+hpDoFHandler<dim>::n_boundary_dofs (const std::set<unsigned char> &boundary_indicators) const
+{
+  Assert (finite_elements != 0, ExcNoFESelected());
+  Assert (boundary_indicators.find (255) == boundary_indicators.end(),
+         ExcInvalidBoundaryIndicator());
+
+                                   // same as above, but with
+                                   // additional checks for set of
+                                   // boundary indicators
+  std::set<int> boundary_dofs;
+  std::vector<unsigned int> dofs_on_face;
+  dofs_on_face.reserve (this->get_fe ().max_dofs_per_face());
+
+  typename hpDoFHandler<dim>::active_cell_iterator cell = this->begin_active (),
+                                                   endc = this->end();
+  for (; cell!=endc; ++cell)
+    for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+      if (cell->at_boundary(f) &&
+          (boundary_indicators.find(cell->face(f)->boundary_indicator()) !=
+           boundary_indicators.end()))
+        {
+          const unsigned int dofs_per_face = cell->get_fe().dofs_per_face;
+          dofs_on_face.resize (dofs_per_face);
+          
+          cell->face(f)->get_dof_indices (dofs_on_face);
+          for (unsigned int i=0; i<dofs_per_face; ++i)
+            boundary_dofs.insert(dofs_on_face[i]);
+        };
+  return boundary_dofs.size();
+}
+
+
+template <int dim>
+unsigned int
+hpDoFHandler<dim>::memory_consumption () const
+{
+  unsigned int mem = (MemoryConsumption::memory_consumption (tria) +
+                     MemoryConsumption::memory_consumption (finite_elements) +
+                     MemoryConsumption::memory_consumption (tria) +
+                     MemoryConsumption::memory_consumption (levels) +
+                     MemoryConsumption::memory_consumption (used_dofs) +
+                     MemoryConsumption::memory_consumption (vertex_dofs));
+  for (unsigned int i=0; i<levels.size(); ++i)
+    mem += MemoryConsumption::memory_consumption (*levels[i]);
+  
+  return mem;
+}
+
+
+
+template <int dim>
+void hpDoFHandler<dim>::distribute_dofs (const FECollection<dim> &ff)
+{
+  Assert (tria->n_levels() > 0, ExcInvalidTriangulation());
+
+  finite_elements = &ff;
+  
+                                   // This call ensures, the active_fe_indices
+                                   // vectors are initialized correctly.
+  create_active_fe_table ();
+
+  reserve_space ();
+
+                                  // Clear user flags because we will
+                                  // need them. But first we save
+                                  // them and make sure that we
+                                  // restore them later such that at
+                                  // the end of this function the
+                                  // Triangulation will be in the
+                                  // same state as it was at the
+                                  // beginning of this function.
+  std::vector<bool> user_flags;
+  tria->save_user_flags(user_flags);
+  const_cast<Triangulation<dim> &>(*tria).clear_user_flags ();
+  
+  unsigned int next_free_dof = 0;
+  active_cell_iterator cell = begin_active(),
+                      endc = end();
+
+  for (; cell != endc; ++cell) 
+    next_free_dof = distribute_dofs_on_cell (cell, next_free_dof);
+
+  used_dofs = next_free_dof;
+
+                                  // finally restore the user flags
+  const_cast<Triangulation<dim> &>(*tria).load_user_flags(user_flags);
+}
+
+
+template <int dim>
+void hpDoFHandler<dim>::clear ()
+{
+                                  // release lock to old fe
+  finite_elements = 0;
+
+                                  // release memory
+  clear_space ();
+}
+
+
+#if deal_II_dimension == 1
+
+template <>
+unsigned int
+hpDoFHandler<1>::distribute_dofs_on_cell (active_cell_iterator &cell,
+                                         unsigned int          next_free_dof)
+{
+                                  // get the fe for this cell
+  const FiniteElement<1> &fe = cell->get_fe();
+
+                                  // distribute dofs of vertices
+  for (unsigned int v=0; v<GeometryInfo<1>::vertices_per_cell; ++v)
+    {
+      cell_iterator neighbor = cell->neighbor(v);
+
+      if (neighbor.state() == IteratorState::valid)
+       {
+                                          // find true neighbor; may be its
+                                          // a child of @p{neighbor}
+         while (neighbor->has_children())
+           neighbor = neighbor->child(v==0 ? 1 : 0);
+
+                                          // has neighbor already been processed?
+         if (neighbor->user_flag_set())
+                                            // copy dofs
+           {
+             if (v==0) 
+               for (unsigned int d=0; d<fe.dofs_per_vertex; ++d)
+                 cell->set_vertex_dof_index (0, d,
+                                             neighbor->vertex_dof_index (1, d));
+             else
+               for (unsigned int d=0; d<fe.dofs_per_vertex; ++d)
+                 cell->set_vertex_dof_index (1, d,
+                                             neighbor->vertex_dof_index (0, d));
+
+                                              // next neighbor
+             continue;
+           };
+       };
+            
+                                      // otherwise: create dofs newly
+      for (unsigned int d=0; d<fe.dofs_per_vertex; ++d)
+       cell->set_vertex_dof_index (v, d, next_free_dof++);
+    };
+  
+                                  // dofs of line
+  for (unsigned int d=0; d<fe.dofs_per_line; ++d)
+    cell->set_dof_index (d, next_free_dof++);
+
+                                  // note that this cell has been processed
+  cell->set_user_flag ();
+  
+  return next_free_dof;
+}
+
+#endif
+
+
+#if deal_II_dimension == 2
+
+template <>
+unsigned int
+hpDoFHandler<2>::distribute_dofs_on_cell (active_cell_iterator &cell,
+                                         unsigned int          next_free_dof)
+{
+                                  // get the fe for this cell
+  const FiniteElement<2> &fe = cell->get_fe();
+
+  if (fe.dofs_per_vertex > 0)
+                                    // number dofs on vertices
+    for (unsigned int vertex=0; vertex<GeometryInfo<2>::vertices_per_cell; ++vertex)
+                                      // check whether dofs for this
+                                      // vertex have been distributed
+                                      // (only check the first dof)
+      if (cell->vertex_dof_index(vertex, 0) == invalid_dof_index)
+       for (unsigned int d=0; d<fe.dofs_per_vertex; ++d)
+         cell->set_vertex_dof_index (vertex, d, next_free_dof++);
+    
+                                  // for the four sides
+//TODO[?] Does not work for continuous FEs
+  if (fe.dofs_per_line > 0)
+    for (unsigned int side=0; side<GeometryInfo<2>::faces_per_cell; ++side)
+      {
+       line_iterator line = cell->line(side);
+
+                                        // distribute dofs if necessary:
+                                        // check whether line dof is already
+                                        // numbered (check only first dof)
+       if (line->dof_index(0) == invalid_dof_index)
+                                          // if not: distribute dofs
+         for (unsigned int d=0; d<fe.dofs_per_line; ++d)
+           line->set_dof_index (d, next_free_dof++);
+      };
+
+
+                                  // dofs of quad
+  if (fe.dofs_per_quad > 0)
+    for (unsigned int d=0; d<fe.dofs_per_quad; ++d)
+      cell->set_dof_index (d, next_free_dof++);
+
+
+                                  // note that this cell has been processed
+  cell->set_user_flag ();
+  
+  return next_free_dof;
+}
+
+#endif
+
+
+#if deal_II_dimension == 3
+
+template <>
+unsigned int
+hpDoFHandler<3>::distribute_dofs_on_cell (active_cell_iterator &cell,
+                                         unsigned int          next_free_dof)
+{
+                                  // get the fe for this cell
+  const FiniteElement<3> &fe = cell->get_fe();
+
+  if (fe.dofs_per_vertex > 0)
+                                    // number dofs on vertices
+    for (unsigned int vertex=0; vertex<GeometryInfo<3>::vertices_per_cell; ++vertex)
+                                      // check whether dofs for this
+                                      // vertex have been distributed
+                                      // (only check the first dof)
+      if (cell->vertex_dof_index(vertex, 0) == invalid_dof_index)
+       for (unsigned int d=0; d<fe.dofs_per_vertex; ++d)
+         cell->set_vertex_dof_index (vertex, d, next_free_dof++);
+    
+                                  // for the lines
+  if (fe.dofs_per_line > 0)
+    for (unsigned int l=0; l<GeometryInfo<3>::lines_per_cell; ++l)
+      {
+       line_iterator line = cell->line(l);
+       
+                                        // distribute dofs if necessary:
+                                        // check whether line dof is already
+                                        // numbered (check only first dof)
+       if (line->dof_index(0) == invalid_dof_index)
+                                          // if not: distribute dofs
+         for (unsigned int d=0; d<fe.dofs_per_line; ++d)
+           line->set_dof_index (d, next_free_dof++);       
+      };
+
+                                  // for the quads
+  if (fe.dofs_per_quad > 0)
+    for (unsigned int q=0; q<GeometryInfo<3>::quads_per_cell; ++q)
+      {
+       quad_iterator quad = cell->quad(q);
+       
+                                        // distribute dofs if necessary:
+                                        // check whether quad dof is already
+                                        // numbered (check only first dof)
+       if (quad->dof_index(0) == invalid_dof_index)
+                                          // if not: distribute dofs
+         for (unsigned int d=0; d<fe.dofs_per_quad; ++d)
+           quad->set_dof_index (d, next_free_dof++);       
+      };
+
+
+                                  // dofs of hex
+  if (fe.dofs_per_hex > 0)
+    for (unsigned int d=0; d<fe.dofs_per_hex; ++d)
+      cell->set_dof_index (d, next_free_dof++);
+
+
+                                  // note that this cell has been processed
+  cell->set_user_flag ();
+  
+  return next_free_dof;
+}
+
+#endif
+
+
+#if deal_II_dimension == 1
+
+template <>
+void hpDoFHandler<1>::renumber_dofs (const std::vector<unsigned int> &new_numbers)
+{
+  Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
+#ifdef DEBUG
+                                  // assert that the new indices are
+                                  // consecutively numbered
+  if (true)
+    {
+      std::vector<unsigned int> tmp(new_numbers);
+      std::sort (tmp.begin(), tmp.end());
+      std::vector<unsigned int>::const_iterator p = tmp.begin();
+      unsigned int                         i = 0;
+      for (; p!=tmp.end(); ++p, ++i)
+       Assert (*p == i, ExcNewNumbersNotConsecutive(i));
+    };
+#endif
+
+                                  // note that we can not use cell iterators
+                                  // in this function since then we would
+                                  // renumber the dofs on the interface of
+                                  // two cells more than once. Anyway, this
+                                  // way it's not only more correct but also
+                                  // faster; note, however, that dof numbers
+                                  // may be invalid_dof_index, namely when the appropriate
+                                  // vertex/line/etc is unused
+  for (std::vector<unsigned int>::iterator i=vertex_dofs.begin(); i!=vertex_dofs.end(); ++i)
+    if (*i != invalid_dof_index)
+      *i = new_numbers[*i];
+  
+  for (unsigned int level=0; level<levels.size(); ++level) 
+    for (std::vector<unsigned int>::iterator i=levels[level]->line_dofs.begin();
+        i!=levels[level]->line_dofs.end(); ++i)
+      if (*i != invalid_dof_index)
+       *i = new_numbers[*i];
+}
+
+#endif
+
+
+#if deal_II_dimension == 2
+
+template <>
+void hpDoFHandler<2>::renumber_dofs (const std::vector<unsigned int> &new_numbers)
+{
+  Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
+#ifdef DEBUG
+                                  // assert that the new indices are
+                                  // consecutively numbered
+  if (true)
+    {
+      std::vector<unsigned int> tmp(new_numbers);
+      std::sort (tmp.begin(), tmp.end());
+      std::vector<unsigned int>::const_iterator p = tmp.begin();
+      unsigned int                         i = 0;
+      for (; p!=tmp.end(); ++p, ++i)
+       Assert (*p == i, ExcNewNumbersNotConsecutive(i));
+    };
+#endif
+
+                                  // note that we can not use cell iterators
+                                  // in this function since then we would
+                                  // renumber the dofs on the interface of
+                                  // two cells more than once. Anyway, this
+                                  // way it's not only more correct but also
+                                  // faster; note, however, that dof numbers
+                                  // may be invalid_dof_index, namely when the appropriate
+                                  // vertex/line/etc is unused
+  for (std::vector<unsigned int>::iterator i=vertex_dofs.begin(); i!=vertex_dofs.end(); ++i)
+    if (*i != invalid_dof_index)
+      *i = new_numbers[*i];
+  
+  for (unsigned int level=0; level<levels.size(); ++level) 
+    {
+      for (std::vector<unsigned int>::iterator i=levels[level]->line_dofs.begin();
+          i!=levels[level]->line_dofs.end(); ++i)
+       if (*i != invalid_dof_index)
+         *i = new_numbers[*i];
+      for (std::vector<unsigned int>::iterator i=levels[level]->quad_dofs.begin();
+          i!=levels[level]->quad_dofs.end(); ++i)
+       if (*i != invalid_dof_index)
+         *i = new_numbers[*i];
+    };
+}
+
+#endif
+
+
+#if deal_II_dimension == 3
+
+template <>
+void hpDoFHandler<3>::renumber_dofs (const std::vector<unsigned int> &new_numbers)
+{
+  Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
+#ifdef DEBUG
+                                  // assert that the new indices are
+                                  // consecutively numbered
+  if (true)
+    {
+      std::vector<unsigned int> tmp(new_numbers);
+      std::sort (tmp.begin(), tmp.end());
+      std::vector<unsigned int>::const_iterator p = tmp.begin();
+      unsigned int                              i = 0;
+      for (; p!=tmp.end(); ++p, ++i)
+       Assert (*p == i, ExcNewNumbersNotConsecutive(i));
+    };
+#endif
+
+                                  // note that we can not use cell iterators
+                                  // in this function since then we would
+                                  // renumber the dofs on the interface of
+                                  // two cells more than once. Anyway, this
+                                  // way it's not only more correct but also
+                                  // faster; note, however, that dof numbers
+                                  // may be invalid_dof_index, namely when the appropriate
+                                  // vertex/line/etc is unused
+  for (std::vector<unsigned int>::iterator i=vertex_dofs.begin(); i!=vertex_dofs.end(); ++i)
+    if (*i != invalid_dof_index)
+      *i = new_numbers[*i];
+  
+  for (unsigned int level=0; level<levels.size(); ++level) 
+    {
+      for (std::vector<unsigned int>::iterator i=levels[level]->line_dofs.begin();
+          i!=levels[level]->line_dofs.end(); ++i)
+       if (*i != invalid_dof_index)
+         *i = new_numbers[*i];
+      for (std::vector<unsigned int>::iterator i=levels[level]->quad_dofs.begin();
+          i!=levels[level]->quad_dofs.end(); ++i)
+       if (*i != invalid_dof_index)
+         *i = new_numbers[*i];
+      for (std::vector<unsigned int>::iterator i=levels[level]->hex_dofs.begin();
+          i!=levels[level]->hex_dofs.end(); ++i)
+       if (*i != invalid_dof_index)
+         *i = new_numbers[*i];
+    };
+}
+
+#endif
+
+
+#if deal_II_dimension == 1
+
+template <>
+unsigned int
+hpDoFHandler<1>::max_couplings_between_dofs () const
+{
+  Assert (finite_elements != 0, ExcNoFESelected());
+  return std::min(3*finite_elements->max_dofs_per_vertex() +
+                 2*finite_elements->max_dofs_per_line(), n_dofs());
+}
+
+
+
+template <>
+unsigned int
+hpDoFHandler<1>::max_couplings_between_boundary_dofs () const
+{
+  Assert (finite_elements != 0, ExcNoFESelected());
+  return finite_elements->max_dofs_per_vertex();
+}
+
+#endif
+
+
+#if deal_II_dimension == 2
+
+template <>
+unsigned int
+hpDoFHandler<2>::max_couplings_between_dofs () const
+{
+  Assert (finite_elements != 0, ExcNoFESelected());
+
+                                  // get these numbers by drawing pictures
+                                  // and counting...
+                                  // example:
+                                  //   |     |     |
+                                  // --x-----x--x--X--
+                                  //   |     |  |  |
+                                  //   |     x--x--x
+                                  //   |     |  |  |
+                                  // --x--x--*--x--x--
+                                  //   |  |  |     |
+                                  //   x--x--x     |
+                                  //   |  |  |     |
+                                  // --X--x--x-----x--
+                                  //   |     |     |
+                                  // x = vertices connected with center vertex *;
+                                  //   = total of 19
+                                  // (the X vertices are connected with * if
+                                  // the vertices adjacent to X are hanging
+                                  // nodes)
+                                  // count lines -> 28 (don't forget to count
+                                  // mother and children separately!)
+  unsigned int max_couplings;
+  switch (tria->max_adjacent_cells())
+    {
+      case 4:
+           max_couplings=19*finite_elements->max_dofs_per_vertex() +
+                         28*finite_elements->max_dofs_per_line() +
+                         8*finite_elements->max_dofs_per_quad();
+           break;
+      case 5:
+           max_couplings=21*finite_elements->max_dofs_per_vertex() +
+                         31*finite_elements->max_dofs_per_line() +
+                         9*finite_elements->max_dofs_per_quad();
+           break;
+      case 6:
+           max_couplings=28*finite_elements->max_dofs_per_vertex() +
+                         42*finite_elements->max_dofs_per_line() +
+                         12*finite_elements->max_dofs_per_quad();
+           break;
+      case 7:
+           max_couplings=30*finite_elements->max_dofs_per_vertex() +
+                         45*finite_elements->max_dofs_per_line() +
+                         13*finite_elements->max_dofs_per_quad();
+           break;
+      case 8:
+           max_couplings=37*finite_elements->max_dofs_per_vertex() +
+                         56*finite_elements->max_dofs_per_line() +
+                         16*finite_elements->max_dofs_per_quad();
+           break;
+      default:
+           Assert (false, ExcNotImplemented());
+           max_couplings=0;
+    };
+  return std::min(max_couplings,n_dofs());
+}
+
+
+
+template <>
+unsigned int
+hpDoFHandler<2>::max_couplings_between_boundary_dofs () const
+{
+  Assert (finite_elements != 0, ExcNoFESelected());
+  return (3*finite_elements->max_dofs_per_vertex()
+         +
+         2*finite_elements->max_dofs_per_line());
+}
+
+#endif
+
+
+#if deal_II_dimension == 3
+
+template <>
+unsigned int
+hpDoFHandler<3>::max_couplings_between_dofs () const
+{
+//TODO:[?] Invent significantly better estimates than the ones in this function  
+  Assert (finite_elements != 0, ExcNoFESelected());
+
+                                  // doing the same thing here is a rather
+                                  // complicated thing, compared to the 2d
+                                  // case, since it is hard to draw pictures
+                                  // with several refined hexahedra :-) so I
+                                  // presently only give a coarse estimate
+                                  // for the case that at most 8 hexes meet
+                                  // at each vertex
+                                  //
+                                  // can anyone give better estimate here?
+  const unsigned int max_adjacent_cells = tria->max_adjacent_cells();
+
+  unsigned int max_couplings;
+  if (max_adjacent_cells <= 8)
+    max_couplings=7*7*7*finite_elements->max_dofs_per_vertex() +
+                 7*6*7*3*finite_elements->max_dofs_per_line() +
+                 9*4*7*3*finite_elements->max_dofs_per_quad() +
+                 27*finite_elements->max_dofs_per_hex();
+  else
+    {
+      Assert (false, ExcNotImplemented());
+      max_couplings=0;
+    }
+  
+  return std::min(max_couplings,n_dofs());
+}
+
+
+template <>
+unsigned int
+hpDoFHandler<3>::max_couplings_between_boundary_dofs () const
+{
+  Assert (finite_elements != 0, ExcNoFESelected());
+                                  // we need to take refinement of
+                                  // one boundary face into consideration
+                                  // here; in fact, this function returns
+                                  // what #max_coupling_between_dofs<2>
+                                  // returns
+                                  //
+                                  // we assume here, that only four faces
+                                  // meet at the boundary; this assumption
+                                  // is not justified and needs to be
+                                  // fixed some time. fortunately, ommitting
+                                  // it for now does no harm since the
+                                  // matrix will cry foul if its requirements
+                                  // are not satisfied
+  return (19*finite_elements->max_dofs_per_vertex() +
+         28*finite_elements->max_dofs_per_line() +
+         8*finite_elements->max_dofs_per_quad());
+}
+
+
+#endif
+
+
+
+#if deal_II_dimension == 1
+
+template <>
+void hpDoFHandler<1>::reserve_space ()
+{
+//TODO: This presently works only on the first FE of the FECollection. Fix this
+  Assert (finite_elements != 0, ExcNoFESelected());
+  Assert (tria->n_levels() > 0, ExcInvalidTriangulation());
+  Assert (tria->n_levels() == levels.size (), ExcInternalError ());
+  
+                                   // Backup the active_fe_indices vectors.
+                                   // The user might have put something
+                                   // important in them.
+  std::vector<std::vector<unsigned int> > active_fe_backup(levels.size ());
+  for (unsigned int i = 0; i < levels.size (); ++i)
+      std::swap (levels[i]->active_fe_indices, active_fe_backup[i]);
+
+                                   // delete all levels and set them up
+                                   // newly, since vectors are
+                                   // troublesome if you want to change
+                                   // their size
+  clear_space ();
+
+  vertex_dofs.resize(tria->vertices.size()*finite_elements->get_fe(0).dofs_per_vertex,
+                    invalid_dof_index);
+
+  for (unsigned int i=0; i<tria->n_levels(); ++i) 
+    {
+      levels.push_back (new hpDoFLevel<1>);
+      std::swap (active_fe_backup[i], levels.back()->active_fe_indices);
+
+      levels.back()->dof_line_index_offset = std::vector<unsigned int>
+         (tria->levels[i]->lines.lines.size (),static_cast<unsigned int>(-1));
+      unsigned int dofs_for_lines = 0;
+      for (unsigned int j = 0; j < tria->levels[i]->lines.lines.size(); ++j)
+      {
+         levels.back()->dof_line_index_offset[j] = dofs_for_lines;
+         dofs_for_lines += finite_elements->
+             get_fe (levels.back ()->active_fe_indices[j]).dofs_per_line;
+      }
+
+      levels.back()->line_dofs = std::vector<unsigned int>(dofs_for_lines,
+                                                          invalid_dof_index);
+    };
+}
+
+
+#endif
+
+
+#if deal_II_dimension == 2
+
+template <>
+void hpDoFHandler<2>::reserve_space ()
+{
+//TODO: This presently works only on the first FE of the FECollection. Fix this
+  Assert (finite_elements != 0, ExcNoFESelected());
+  Assert (tria->n_levels() > 0, ExcInvalidTriangulation());
+  Assert (tria->n_levels() == levels.size (), ExcInternalError ());
+  
+                                   // Backup the active_fe_indices vectors.
+                                   // The user might have put something
+                                   // important in them.
+  std::vector<std::vector<unsigned int> > active_fe_backup(levels.size ());
+  for (unsigned int i = 0; i < levels.size (); ++i)
+      std::swap (levels[i]->active_fe_indices, active_fe_backup[i]);
+
+                                   // delete all levels and set them up
+                                   // newly, since vectors are
+                                   // troublesome if you want to change
+                                   // their size
+  clear_space ();
+  
+  vertex_dofs.resize(tria->vertices.size()*finite_elements->get_fe(0).dofs_per_vertex,
+                    invalid_dof_index);
+
+//TODO[?] Does not work for continuous FEs. Problem is at faces, which might have a different
+// number of DoFs due to the different active_fe_index of the adjacent cells.
+  for (unsigned int i=0; i<tria->n_levels(); ++i) 
+    {
+      levels.push_back (new hpDoFLevel<2>);
+      std::swap (active_fe_backup[i], levels.back()->active_fe_indices);
+
+      levels.back()->dof_line_index_offset = std::vector<unsigned int>
+         (tria->levels[i]->lines.lines.size (),static_cast<unsigned int>(-1));
+      levels.back()->dof_quad_index_offset = std::vector<unsigned int>
+         (tria->levels[i]->quads.quads.size (),static_cast<unsigned int>(-1));
+
+                                   // Create table of active_fe_levels of cells
+                                   // adjacent to the lines.
+      std::vector<unsigned int> line_active_fe_indices
+         (tria->levels[i]->lines.lines.size () * 2, 
+          static_cast<unsigned int>(-1));
+
+      for (unsigned int j = 0; j < tria->levels[i]->quads.quads.size (); ++j)
+      {
+         const unsigned int cell_fe_index = levels.back ()->active_fe_indices[j];
+
+                                  // Referring to the following diagram from
+                                  // documentation of the triangulation class,
+                                  // it can be seen where the indices in the
+                                  // following lines of code come from.
+                                  //          2
+                                  //      3--->---2
+                                  //      |       |
+                                  //     3^       ^1
+                                  //      |       |
+                                  //      0--->---1
+                                  //          0
+                                  // Face 0 and 1 have the cell to the left,
+                                  // while Face 2 and 3 have the cell to
+                                  // the right (if the line points upward).
+         line_active_fe_indices[tria->levels[i]->
+                                quads.quads[j].line(0) * 2] = cell_fe_index;
+         line_active_fe_indices[tria->levels[i]->
+                                quads.quads[j].line(1) * 2] = cell_fe_index;
+         line_active_fe_indices[tria->levels[i]->
+                                quads.quads[j].line(2) * 2 + 1] = cell_fe_index;
+         line_active_fe_indices[tria->levels[i]->
+                                quads.quads[j].line(3) * 2 + 1] = cell_fe_index;
+      }
+
+      unsigned int dofs_for_lines = 0;
+      for (unsigned int j = 0; j < tria->levels[i]->lines.lines.size (); ++j)
+      {
+         levels.back()->dof_line_index_offset[j] = dofs_for_lines;
+
+         // The "line_dofs" field in the hpDoFLevel class for 2D gets a
+         // slightly different meaning in 2D. Actually in 2D one line can have
+         // two different active_fe_indices. Therefore it is not sufficient to
+         // reserve some space for the DoFs on one active_fe_index. Instead
+         // the DoF indices for both active_fe_indices will be stored in the
+         // "line_dofs" field. To differentiate between these field later,
+         // a simple linked list based will be maintained to allow access to
+         // the correct DoFs:
+         // 0: active_fe_index of line, to which the following DoFs belong.
+         // 1: index of next active_fe_index for this line. Value: (x + 1)
+         // 2-x: DoFs (will be filled out by distribute_dofs_on_cell
+         // x+1: active_fe_index of line, to which the following DoFs belong.
+         // x+2: index to next active_fe_index for this line. Value: (y + 1)
+         // ...
+         // In 3D, the same datastructure is used but can have up to 4 different
+         // active_fe_indices on one line.
+         unsigned int active_fe1 = line_active_fe_indices[j*2],
+             active_fe2 = line_active_fe_indices[j*2+1];
+
+         // Check for boundary lines, where clearly one of the line indices
+         // is missing.
+         if (active_fe1 == static_cast<unsigned int>(-1))
+             active_fe1 = active_fe2;
+         if (active_fe2 == static_cast<unsigned int>(-1))
+             active_fe2 = active_fe1;
+
+         if (active_fe1 == active_fe2)
+             dofs_for_lines += finite_elements->get_fe (active_fe1).dofs_per_line + 2;
+         else
+             dofs_for_lines += finite_elements->get_fe (active_fe1).dofs_per_line +
+                 finite_elements->get_fe (active_fe2).dofs_per_line + 4;
+      }
+
+      unsigned int dofs_for_quads = 0;
+      for (unsigned int j = 0; j < tria->levels[i]->quads.quads.size (); ++j)
+      {
+         levels.back()->dof_quad_index_offset[j] = dofs_for_quads;
+         dofs_for_quads += finite_elements->
+             get_fe (levels.back ()->active_fe_indices[j]).dofs_per_quad;
+      }
+
+      levels.back()->line_dofs = std::vector<unsigned int> (dofs_for_lines,
+                                                           invalid_dof_index);
+      levels.back()->quad_dofs = std::vector<unsigned int> (dofs_for_quads,
+                                                           invalid_dof_index);
+
+      // As we already have the active_fe_indices for the lines, it is probably
+      // a good idea to directly use those to create the linked list structure
+      // within the line_dofs field.
+      for (unsigned int j = 0; j < tria->levels[i]->lines.lines.size (); ++j)
+      {
+         dofs_for_lines = levels.back()->dof_line_index_offset[j];
+
+         levels.back()->dof_line_index_offset[j] = dofs_for_lines;
+         unsigned int active_fe1 = line_active_fe_indices[j*2],
+             active_fe2 = line_active_fe_indices[j*2+1];
+
+         // Check for boundary lines, where clearly one of the line indices
+         // is missing.
+         if (active_fe1 == static_cast<unsigned int>(-1))
+             active_fe1 = active_fe2;
+         if (active_fe2 == static_cast<unsigned int>(-1))
+             active_fe2 = active_fe1;
+
+         // Now create prepare linked list, with either 1 or two entries.
+         levels.back()->line_dofs[dofs_for_lines] = active_fe1;
+         if (active_fe1 == active_fe2)
+             levels.back()->line_dofs[dofs_for_lines + 1] = 
+                 static_cast<unsigned int>(-1);
+         else
+         {
+             unsigned int start_next_fe = dofs_for_lines + 
+                 finite_elements->get_fe (active_fe1).dofs_per_line + 2;
+
+             levels.back()->line_dofs[dofs_for_lines + 1] = start_next_fe;
+
+             levels.back()->line_dofs[start_next_fe] = active_fe2;
+             levels.back()->line_dofs[start_next_fe + 1] = 
+                 static_cast<unsigned int>(-1);
+         }
+      }
+    };
+}
+
+#endif
+
+
+#if deal_II_dimension == 3
+
+template <>
+void hpDoFHandler<3>::reserve_space ()
+{
+//TODO: This presently works only on the first FE of the FECollection. Fix this
+  Assert (finite_elements != 0, ExcNoFESelected());
+  Assert (tria->n_levels() > 0, ExcInvalidTriangulation());
+  Assert (tria->n_levels() == levels.size (), ExcInternalError ());
+  
+                                   // Backup the active_fe_indices vectors.
+                                   // The user might have put something
+                                   // important in them.
+  std::vector<std::vector<unsigned int> > active_fe_backup(levels.size ());
+  for (unsigned int i = 0; i < levels.size (); ++i)
+      std::swap (levels[i]->active_fe_indices, active_fe_backup[i]);
+
+                                   // delete all levels and set them up
+                                   // newly, since vectors are
+                                   // troublesome if you want to change
+                                   // their size
+  clear_space ();
+  
+  vertex_dofs.resize(tria->vertices.size()*finite_elements->get_fe(0).dofs_per_vertex,
+                    invalid_dof_index);
+
+//TODO[?] Does not work for continuous FEs. Problem is at faces, which might have a different
+// number of DoFs due to the different active_fe_index of the adjacent cells.
+  for (unsigned int i=0; i<tria->n_levels(); ++i) 
+    {
+      levels.push_back (new hpDoFLevel<3>);
+      std::swap (active_fe_backup[i], levels.back()->active_fe_indices);
+
+      levels.back()->dof_line_index_offset = std::vector<unsigned int>
+         (tria->levels[i]->lines.lines.size (),static_cast<unsigned int>(-1));
+      levels.back()->dof_quad_index_offset = std::vector<unsigned int>
+         (tria->levels[i]->quads.quads.size (),static_cast<unsigned int>(-1));
+      levels.back()->dof_hex_index_offset = std::vector<unsigned int>
+         (tria->levels[i]->hexes.hexes.size (),static_cast<unsigned int>(-1));
+
+      unsigned int dofs_for_lines = 0;
+/* Uncommented as we actually need some information about how many DoFs should be reserved
+   for the lines, which could have different active_fe_indices. For DG there should be no
+   DoFs on lines or quads anyway.
+      for (unsigned int j=0; j<tria->levels[i]->lines.lines.size(); ++j)
+      {
+         levels.back()->dof_line_index_offset[j] = dofs_for_lines;
+         dofs_for_lines += finite_elements->
+             get_fe (levels.back ()->active_fe_indices[j]).dofs_per_line;
+      }
+*/
+      unsigned int dofs_for_quads = 0;
+/*
+      for (unsigned int j=0; j<tria->levels[i]->quads.quads.size(); ++j)
+      {
+         levels.back()->dof_quad_index_offset[j] = dofs_for_quads;
+         dofs_for_quads += finite_elements->
+             get_fe (levels.back ()->active_fe_indices[j]).dofs_per_quad;
+      }
+*/
+      unsigned int dofs_for_hexes = 0;
+      for (unsigned int j=0; j<tria->levels[i]->hexes.hexes.size(); ++j)
+      {
+         levels.back()->dof_hex_index_offset[j] = dofs_for_hexes;
+         dofs_for_hexes += finite_elements->
+             get_fe (levels.back ()->active_fe_indices[j]).dofs_per_hex;
+      }
+
+      levels.back()->line_dofs = std::vector<unsigned int> (dofs_for_lines,
+                                                           invalid_dof_index);
+      levels.back()->quad_dofs = std::vector<unsigned int> (dofs_for_quads,
+                                                           invalid_dof_index);
+      levels.back()->hex_dofs = std::vector<unsigned int> (dofs_for_hexes,
+                                                          invalid_dof_index);
+    };
+}
+
+#endif
+
+
+//
+// Method to create a standard table for the active_fe vector.
+// It is called before the Triangulation is refined and before
+// distribute_dofs is called. That are probably the two places,
+// where an incorrect active_fe table can cause some trouble.
+//
+
+template <int dim>
+void hpDoFHandler<dim>::create_active_fe_table ()
+{
+                                   // Create sufficiently many hpDoFLevels.
+  while (levels.size () < tria->n_levels ())
+      levels.push_back (new hpDoFLevel<dim>);
+
+  for (unsigned int i=0; i<levels.size(); ++i)
+  {
+      if (levels[i]->active_fe_indices.size () == 0)
+      {
+                                   // The size of "refine_flags" serves as
+                                   // the number of cells available on that
+                                   // level. The alternative would be to
+                                   // implement this method for each dimension.
+         levels[i]->active_fe_indices.reserve (tria->levels[i]->refine_flags.size ());
+         std::fill (levels[i]->active_fe_indices.begin (),
+                    levels[i]->active_fe_indices.end (),
+                    0);
+      }
+      else
+      {
+                                  // Either the active_fe_indices have size
+                                  // zero, or the correct size. Other sizes
+                                  // indicate that something went wrong.
+         Assert (levels[i]->active_fe_indices.size () ==
+                 tria->levels[i]->refine_flags.size (), ExcInternalError ());
+      }
+  }
+}
+
+
+template <int dim>
+void hpDoFHandler<dim>::pre_refinement_notification (const Triangulation<dim> &)
+{
+    create_active_fe_table ();
+}
+
+
+#if deal_II_dimension == 1
+template <>
+void hpDoFHandler<1>::pre_refinement_notification (const Triangulation<1> &tria)
+{
+    create_active_fe_table ();
+
+                                   // Remember if the cells have already
+                                   // children. That will make the transfer
+                                   // of the active_fe_index to the finer
+                                   // levels easier.
+    Assert (has_children.size () == 0, ExcInternalError ());
+    for (unsigned int i=0; i<levels.size(); ++i)
+    {
+       const unsigned int lines_on_level = tria.levels[i]->lines.lines.size ();
+       std::vector<bool> *has_children_level =
+           new std::vector<bool> (lines_on_level);
+
+                                  // Check for each cell, if it has children.
+       transform (tria.levels[i]->lines.children.begin (),
+                  tria.levels[i]->lines.children.end (),
+                  has_children_level->begin (),
+                  std::bind2nd (std::not_equal_to<int>(), -1));
+
+       has_children.push_back (has_children_level);
+    }
+}
+#endif
+
+#if deal_II_dimension == 2
+template <>
+void hpDoFHandler<2>::pre_refinement_notification (const Triangulation<2> &tria)
+{
+    create_active_fe_table ();
+
+                                   // Remember if the cells have already
+                                   // children. That will make the transfer
+                                   // of the active_fe_index to the finer
+                                   // levels easier.
+    Assert (has_children.size () == 0, ExcInternalError ());
+    for (unsigned int i=0; i<levels.size(); ++i)
+    {
+       const unsigned int quads_on_level = tria.levels[i]->quads.quads.size ();
+       std::vector<bool> *has_children_level =
+           new std::vector<bool> (quads_on_level);
+
+                                  // Check for each cell, if it has children.
+       transform (tria.levels[i]->quads.children.begin (),
+                  tria.levels[i]->quads.children.end (),
+                  has_children_level->begin (),
+                  std::bind2nd (std::not_equal_to<int>(), -1));
+
+       has_children.push_back (has_children_level);
+    }
+}
+#endif
+
+#if deal_II_dimension == 3
+template <>
+void hpDoFHandler<3>::pre_refinement_notification (const Triangulation<3> &tria)
+{
+    create_active_fe_table ();
+
+                                   // Remember if the cells have already
+                                   // children. That will make the transfer
+                                   // of the active_fe_index to the finer
+                                   // levels easier.
+    Assert (has_children.size () == 0, ExcInternalError ());
+    for (unsigned int i=0; i<levels.size(); ++i)
+    {
+       const unsigned int hexes_on_level = tria.levels[i]->hexes.hexes.size ();
+       std::vector<bool> *has_children_level =
+           new std::vector<bool> (hexes_on_level);
+
+                                  // Check for each cell, if it has children.
+       transform (tria.levels[i]->hexes.children.begin (),
+                  tria.levels[i]->hexes.children.end (),
+                  has_children_level->begin (),
+                  std::bind2nd (std::not_equal_to<int>(), -1));
+
+       has_children.push_back (has_children_level);
+    }
+}
+#endif
+
+template <int dim>
+void hpDoFHandler<dim>::post_refinement_notification (const Triangulation<dim> &tria)
+{
+    Assert (has_children.size () == levels.size (), ExcInternalError ());
+
+                                   // In each refinement at most one new
+                                   // new level may appear. If that happened
+                                   // it is appended to the hpDoFHandler
+                                   // levels.
+    if (levels.size () < tria.n_levels ())
+       levels.push_back (new hpDoFLevel<dim>);
+
+                                   // Coarsening can lead to the loss
+                                   // of levels. Hence remove them.
+    while (levels.size () > tria.n_levels ())
+      { 
+       delete levels[levels.size ()-1];
+       levels.pop_back ();
+      }
+
+                                   // Resize active_fe_indices vectors
+    for (unsigned int i=0; i<levels.size(); ++i)
+       levels[i]->active_fe_indices.resize (tria.levels[i]->refine_flags.size ());
+
+    cell_iterator cell = begin(),
+       endc = end ();
+    for (; cell != endc; ++cell)
+    {
+                                  // Look if the cell got children during
+                                  // refinement
+                                  // Note: Although one level is added to
+                                  // the hpDoFHandler levels, when the
+                                  // triangulation got one, for the buffer
+                                  // has_children this new level is not
+                                   // required, because the cells on the
+                                   // finest level never have children. Hence
+                                   // cell->has_children () will always return
+                                  // false on that level, which would cause
+                                  // shortcut evaluation of the following
+                                  // expression. Thus an index error in
+                                  // has_children should never occur.
+       if (cell->has_children () &&
+           !(*has_children [cell->level ()])[cell->index ()])
+       {
+                                  // Set active_fe_index in children to the
+                                   // same value as in the parent cell.
+           for (unsigned int i = 0; i < GeometryInfo<dim>::children_per_cell; ++i)
+               cell->child (i)->set_active_fe_index (cell->active_fe_index ());
+       }
+    }
+
+                                   // Free buffer objects
+    std::vector<std::vector<bool> *>::iterator children_level;
+    for (children_level = has_children.begin ();
+        children_level != has_children.end ();
+        ++children_level)
+       delete (*children_level);
+    /*
+    for_each (has_children.begin (),
+             has_children.end (),
+             delete());
+    */
+    has_children.clear ();
+}
+
+
+template <int dim>
+void hpDoFHandler<dim>::clear_space () {  
+  for (unsigned int i=0; i<levels.size(); ++i)
+    delete levels[i];
+  levels.resize (0);
+
+  std::vector<unsigned int> tmp;
+  std::swap (vertex_dofs, tmp);
+}
+
+
+/*-------------- Explicit Instantiations -------------------------------*/
+template class hpDoFHandler<deal_II_dimension>;
diff --git a/deal.II/deal.II/source/dofs/hp_dof_levels.cc b/deal.II/deal.II/source/dofs/hp_dof_levels.cc
new file mode 100644 (file)
index 0000000..6d81211
--- /dev/null
@@ -0,0 +1,44 @@
+//----------------------------  hp_dof_levels.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  hp_dof_levels.cc  ------------------------
+
+
+#include <base/memory_consumption.h>
+#include <dofs/hp_dof_levels.h>
+
+
+unsigned int
+hpDoFLevel<1>::memory_consumption () const
+{
+  return (MemoryConsumption::memory_consumption (line_dofs) +
+         MemoryConsumption::memory_consumption (dof_line_index_offset));
+}
+
+
+
+unsigned int
+hpDoFLevel<2>::memory_consumption () const
+{
+  return (hpDoFLevel<1>::memory_consumption () +
+         MemoryConsumption::memory_consumption (quad_dofs) +
+         MemoryConsumption::memory_consumption (dof_quad_index_offset));
+}
+
+
+
+unsigned int
+hpDoFLevel<3>::memory_consumption () const
+{
+  return (hpDoFLevel<2>::memory_consumption () +
+         MemoryConsumption::memory_consumption (hex_dofs) +
+         MemoryConsumption::memory_consumption (dof_hex_index_offset));
+}
diff --git a/deal.II/deal.II/source/fe/fe_collection.cc b/deal.II/deal.II/source/fe/fe_collection.cc
new file mode 100644 (file)
index 0000000..0587a09
--- /dev/null
@@ -0,0 +1,67 @@
+//----------------------------  fe_collection.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003, 2004 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  fe_collection.cc  ---------------------------
+
+#include <base/memory_consumption.h>
+#include <fe/fe_collection.h>
+
+
+template <int dim>
+FECollection<dim>::~FECollection ()
+{
+  for (unsigned int i=0; i<finite_elements.size(); ++i)
+    {
+      const FiniteElement<dim> *p = finite_elements[i];
+      finite_elements[i] = 0;
+      delete p;
+    }
+  
+  finite_elements.clear ();
+}
+
+
+
+template <int dim>
+unsigned int FECollection<dim>::add_fe (const FiniteElement<dim> &new_fe)
+{
+                                   // check that the new element has the right
+                                   // number of components. only check with
+                                   // the first element, since all the other
+                                   // elements have already passed the test
+                                   // against the first element
+  if (finite_elements.size() != 0)
+    Assert (new_fe.n_components() == finite_elements[0]->n_components(),
+            ExcMessage ("All elements inside a collection need to have the "
+                        "same number of vector components!"));
+  
+  finite_elements.push_back (new_fe.clone());
+  return (finite_elements.size ());
+}
+
+
+
+template <int dim>
+unsigned int
+FECollection<dim>::memory_consumption () const
+{
+  unsigned int mem
+    = (sizeof(*this) +
+       MemoryConsumption::memory_consumption (finite_elements));
+  for (unsigned int i=0; i<finite_elements.size(); ++i)
+    mem += finite_elements[i]->memory_consumption();
+
+  return mem;
+}
+
+
+// explicit instantiations
+template class FECollection<deal_II_dimension>;
index f2d69ff5c3697bfb8868af672ef7e8ff67dec5c4..b1163d1314643835f71e3d5106019a0a2b823d31 100644 (file)
@@ -842,12 +842,14 @@ FETools::compute_projection_matrices(const FiniteElement<dim>& fe,
 
 
 template <int dim,
+          template <int> class DH1,
+          template <int> class DH2,
           class InVector, class OutVector>
 void
-FETools::interpolate(const DoFHandler<dim> &dof1,
-                     const InVector        &u1,
-                     const DoFHandler<dim> &dof2,
-                     OutVector             &u2)
+FETools::interpolate(const DH1<dim> &dof1,
+                     const InVector &u1,
+                     const DH2<dim> &dof2,
+                     OutVector      &u2)
 {
   ConstraintMatrix dummy;
   dummy.close();
@@ -938,6 +940,128 @@ FETools::interpolate(const DoFHandler<dim>  &dof1,
 
 
 
+template <int dim,
+          template <int> class DH1,
+          template <int> class DH2,              
+          class InVector, class OutVector>
+void
+FETools::interpolate (const DH1<dim>         &dof1,
+                      const InVector         &u1,
+                      const DH2<dim>         &dof2,
+                      const ConstraintMatrix &constraints,
+                      OutVector              &u2)
+{
+  Assert(&dof1.get_tria()==&dof2.get_tria(), ExcTriangulationMismatch());
+
+  Assert(u1.size()==dof1.n_dofs(),
+         ExcDimensionMismatch(u1.size(), dof1.n_dofs()));  
+  Assert(u2.size()==dof2.n_dofs(),
+         ExcDimensionMismatch(u2.size(), dof2.n_dofs()));
+
+                                   // allocate vectors at maximal
+                                   // size. will be reinited in inner
+                                   // cell, but Vector makes sure that
+                                   // this does not lead to
+                                   // reallocation of memory
+  Vector<typename OutVector::value_type> u1_local(max_dofs_per_cell(dof1));
+  Vector<typename OutVector::value_type> u2_local(max_dofs_per_cell(dof2));
+
+                                   // have a map for interpolation
+                                   // matrices. shared_ptr make sure
+                                   // that memory is released again
+  std::map<const FiniteElement<dim> *,
+           std::map<const FiniteElement<dim> *,
+                    boost::shared_ptr<FullMatrix<double> > > >
+    interpolation_matrices;
+  
+  typename DH1<dim>::active_cell_iterator cell1 = dof1.begin_active(),
+                                          endc1 = dof1.end();
+  typename DH2<dim>::active_cell_iterator cell2 = dof2.begin_active(),
+                                          endc2 = dof2.end();
+
+  std::vector<unsigned int> touch_count(dof2.n_dofs(),0);
+  std::vector<unsigned int> dofs;
+  dofs.reserve (max_dofs_per_cell (dof2));
+  u2.clear ();
+
+  for (; cell1!=endc1; ++cell1, ++cell2) 
+    {
+      Assert(cell1->get_fe().n_components() == cell2->get_fe().n_components(),
+             ExcDimensionMismatch (cell1->get_fe().n_components(),
+                                   cell2->get_fe().n_components()));
+
+                                       // for continuous elements on
+                                       // grids with hanging nodes we
+                                       // need hanging node
+                                       // constraints. Consequentely,
+                                       // if there are no constraints
+                                       // then hanging nodes are not
+                                       // allowed.
+      const bool hanging_nodes_not_allowed
+        = ((cell2->get_fe().dofs_per_vertex != 0) &&
+           (constraints.n_constraints() == 0));
+  
+      if (hanging_nodes_not_allowed)
+       for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
+         Assert (cell1->at_boundary(face) ||
+                 cell1->neighbor(face)->level() == cell1->level(),
+                 ExcHangingNodesNotAllowed(0));
+      
+      
+      const unsigned int dofs_per_cell1 = cell1->get_fe().dofs_per_cell;
+      const unsigned int dofs_per_cell2 = cell2->get_fe().dofs_per_cell;
+      u1_local.reinit (dofs_per_cell1);
+      u2_local.reinit (dofs_per_cell2);
+
+                                       // check if interpolation
+                                       // matrix for this particular
+                                       // pair of elements is already
+                                       // there
+      if (interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()] == 0)
+        {
+          boost::shared_ptr<FullMatrix<double> >
+            interpolation_matrix (new FullMatrix<double> (dofs_per_cell2,
+                                                          dofs_per_cell1));
+          interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()]
+            = interpolation_matrix;
+            
+          FETools::get_interpolation_matrix(cell1->get_fe(),
+                                            cell2->get_fe(),
+                                            *interpolation_matrix);
+        }
+      
+      cell1->get_dof_values(u1, u1_local);
+      interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()]
+        ->vmult(u2_local, u1_local);
+
+      dofs.resize (dofs_per_cell2);
+      cell2->get_dof_indices(dofs);
+
+      for (unsigned int i=0; i<dofs_per_cell2; ++i)
+       {
+         u2(dofs[i])+=u2_local(i);
+         ++touch_count[dofs[i]];
+       }
+    }
+                                   // cell1 is at the end, so should
+                                   // be cell2
+  Assert (cell2 == endc2, ExcInternalError());
+
+                                  // when a discontinuous element is
+                                  // interpolated to a continuous
+                                  // one, we take the mean values.
+  for (unsigned int i=0; i<dof2.n_dofs(); ++i)
+    {
+      Assert(touch_count[i]!=0, ExcInternalError());
+      u2(i) /= touch_count[i];
+    }
+
+                                  // Apply hanging node constraints.
+  constraints.distribute(u2);
+}
+
+
+
 template <int dim, class InVector, class OutVector>
 void
 FETools::back_interpolate(const DoFHandler<dim>    &dof1,
@@ -988,6 +1112,78 @@ FETools::back_interpolate(const DoFHandler<dim>    &dof1,
 
 
   
+template <int dim,
+          template <int> class DH,
+          class InVector, class OutVector>
+void
+FETools::back_interpolate(const DH<dim>            &dof1,
+                          const InVector           &u1,
+                          const FiniteElement<dim> &fe2,
+                          OutVector                &u1_interpolated)
+{
+  Assert(u1.size() == dof1.n_dofs(),
+         ExcDimensionMismatch(u1.size(), dof1.n_dofs()));  
+  Assert(u1_interpolated.size() == dof1.n_dofs(),
+        ExcDimensionMismatch(u1_interpolated.size(), dof1.n_dofs()));
+  
+  Vector<typename OutVector::value_type> u1_local(max_dofs_per_cell(dof1));
+  Vector<typename OutVector::value_type> u1_int_local(max_dofs_per_cell(dof1));
+  
+  typename DH<dim>::active_cell_iterator cell = dof1.begin_active(),
+                                         endc = dof1.end();
+
+                                   // map from possible fe objects in
+                                   // dof1 to the back_interpolation
+                                   // matrices
+  std::map<const FiniteElement<dim> *,
+           boost::shared_ptr<FullMatrix<double> > > interpolation_matrices;
+  
+  for (; cell!=endc; ++cell) 
+    {
+      Assert(cell->get_fe().n_components() == fe2.n_components(),
+             ExcDimensionMismatch(cell->get_fe().n_components(),
+                                  fe2.n_components()));
+      
+                                       // For continuous elements on
+                                       // grids with hanging nodes we
+                                       // need hanging node
+                                       // constraints. Consequently,
+                                       // when the elements are
+                                       // continuous no hanging node
+                                       // constraints are allowed.
+      const bool hanging_nodes_not_allowed=
+        (cell->get_fe().dofs_per_vertex != 0) || (fe2.dofs_per_vertex != 0);
+      
+      if (hanging_nodes_not_allowed)
+       for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
+         Assert (cell->at_boundary(face) ||
+                 cell->neighbor(face)->level() == cell->level(),
+                 ExcHangingNodesNotAllowed(0));
+
+      const unsigned int dofs_per_cell1 = cell->get_fe().dofs_per_cell;
+      
+                                       // make sure back_interpolation
+                                       // matrix is available
+      if (interpolation_matrices[&cell->get_fe()] != 0)
+        {
+          interpolation_matrices[&cell->get_fe()] =
+            boost::shared_ptr<FullMatrix<double> >
+            (new FullMatrix<double>(dofs_per_cell1, dofs_per_cell1));
+          get_back_interpolation_matrix(dof1.get_fe(), fe2,
+                                        *interpolation_matrices[&cell->get_fe()]);
+        }      
+      
+      u1_local.reinit (dofs_per_cell1);
+      u1_int_local.reinit (dofs_per_cell1);
+      
+      cell->get_dof_values(u1, u1_local);
+      interpolation_matrices[&cell->get_fe()]->vmult(u1_int_local, u1_local);
+      cell->set_dof_values(u1_int_local, u1_interpolated);
+    }
+}
+
+
+  
 template <int dim, class InVector, class OutVector>
 void FETools::back_interpolate(const DoFHandler<dim> &dof1,
                               const ConstraintMatrix &constraints1,
index e99a1227918d61abf2d5256e1f2c38e83368fff1..17c0a4cc1374dbbae2954c75e07d5923054f1a23 100644 (file)
@@ -1133,6 +1133,37 @@ FEValues<dim>::reinit (const typename DoFHandler<dim>::cell_iterator &cell)
 
 
 
+template <int dim>
+void
+FEValues<dim>::reinit (const typename hpDoFHandler<dim>::cell_iterator &cell)
+{
+                                  // assert that the finite elements
+                                  // passed to the constructor and
+                                  // used by the DoFHandler used by
+                                  // this cell, are the same
+  Assert (static_cast<const FiniteElementData<dim>&>(*this->fe) ==
+         static_cast<const FiniteElementData<dim>&>(cell->get_fe()),
+         typename FEValuesBase<dim>::ExcFEDontMatch());
+
+                                   // set new cell. auto_ptr will take
+                                   // care that old object gets
+                                   // destroyed and also that this
+                                   // object gets destroyed in the
+                                   // destruction of this class
+  this->present_cell.reset 
+    (new typename FEValuesBase<dim>::template
+     CellIterator<typename hpDoFHandler<dim>::cell_iterator> (cell));
+
+                                   // this was the part of the work
+                                   // that is dependent on the actual
+                                   // data type of the iterator. now
+                                   // pass on to the function doing
+                                   // the real work.
+  do_reinit ();
+}
+
+
+
 template <int dim>
 void
 FEValues<dim>::reinit (const typename MGDoFHandler<dim>::cell_iterator &cell)
@@ -1362,6 +1393,43 @@ void FEFaceValues<dim>::reinit (const typename DoFHandler<dim>::cell_iterator &c
 }
 
 
+
+//TODO:[?] Change for real hpDoFHandler
+// Probably the first assertion has to be changed, when the real hpDoFHandler
+// is available.
+template <int dim>
+void FEFaceValues<dim>::reinit (const typename hpDoFHandler<dim>::cell_iterator &cell,
+                               const unsigned int              face_no)
+{
+                                  // assert that the finite elements
+                                  // passed to the constructor and
+                                  // used by the DoFHandler used by
+                                  // this cell, are the same
+  Assert (static_cast<const FiniteElementData<dim>&>(*this->fe) ==
+         static_cast<const FiniteElementData<dim>&>(cell->get_dof_handler().get_fe().get_fe (cell->active_fe_index ())),
+         typename FEValuesBase<dim>::ExcFEDontMatch());
+
+  Assert (face_no < GeometryInfo<dim>::faces_per_cell,
+         ExcIndexRange (face_no, 0, GeometryInfo<dim>::faces_per_cell));
+  
+                                   // set new cell. auto_ptr will take
+                                   // care that old object gets
+                                   // destroyed and also that this
+                                   // object gets destroyed in the
+                                   // destruction of this class
+  this->present_cell.reset 
+    (new typename FEValuesBase<dim>::template
+     CellIterator<typename hpDoFHandler<dim>::cell_iterator> (cell));
+
+                                   // this was the part of the work
+                                   // that is dependent on the actual
+                                   // data type of the iterator. now
+                                   // pass on to the function doing
+                                   // the real work.
+  do_reinit (face_no);
+}
+
+
 template <int dim>
 void FEFaceValues<dim>::reinit (const typename MGDoFHandler<dim>::cell_iterator &cell,
                                const unsigned int              face_no)
@@ -1395,7 +1463,6 @@ void FEFaceValues<dim>::reinit (const typename MGDoFHandler<dim>::cell_iterator
 }
 
 
-
 template <int dim>
 void FEFaceValues<dim>::reinit (const typename Triangulation<dim>::cell_iterator &cell,
                                const unsigned int              face_no)
@@ -1541,18 +1608,20 @@ void FESubfaceValues<dim>::reinit (const typename DoFHandler<dim>::cell_iterator
 }
 
 
-
+//TODO:[?] Change for real hpDoFHandler
+// Probably the first assertion has to be changed, when the real hpDoFHandler
+// is available.
 template <int dim>
-void FESubfaceValues<dim>::reinit (const typename MGDoFHandler<dim>::cell_iterator &cell,
+void FESubfaceValues<dim>::reinit (const typename hpDoFHandler<dim>::cell_iterator &cell,
                                   const unsigned int         face_no,
                                   const unsigned int         subface_no)
 {
                                   // assert that the finite elements
                                   // passed to the constructor and
-                                  // used by the DoFHandler used by
+                                  // used by the hpDoFHandler used by
                                   // this cell, are the same
   Assert (static_cast<const FiniteElementData<dim>&>(*this->fe) ==
-         static_cast<const FiniteElementData<dim>&>(cell->get_dof_handler().get_fe()),
+         static_cast<const FiniteElementData<dim>&>(cell->get_dof_handler().get_fe().get_fe (cell->active_fe_index ())),
          typename FEValuesBase<dim>::ExcFEDontMatch());
   Assert (face_no < GeometryInfo<dim>::faces_per_cell,
          ExcIndexRange (face_no, 0, GeometryInfo<dim>::faces_per_cell));
@@ -1562,7 +1631,42 @@ void FESubfaceValues<dim>::reinit (const typename MGDoFHandler<dim>::cell_iterat
           ExcMessage ("You can't use subface data for cells that are "
                       "already refined. Iterate over their children "
                       "instead in these cases."));
+
+                                   // set new cell. auto_ptr will take
+                                   // care that old object gets
+                                   // destroyed and also that this
+                                   // object gets destroyed in the
+                                   // destruction of this class
+  this->present_cell.reset
+    (new typename FEValuesBase<dim>::template
+     CellIterator<typename hpDoFHandler<dim>::cell_iterator> (cell));
+
+                                   // this was the part of the work
+                                   // that is dependent on the actual
+                                   // data type of the iterator. now
+                                   // pass on to the function doing
+                                   // the real work.
+  do_reinit (face_no, subface_no);
+}
+
   
+template <int dim>
+void FESubfaceValues<dim>::reinit (const typename MGDoFHandler<dim>::cell_iterator &cell,
+                                  const unsigned int         face_no,
+                                  const unsigned int         subface_no)
+{
+   Assert (static_cast<const FiniteElementData<dim>&>(*this->fe) ==
+          static_cast<const FiniteElementData<dim>&>(cell->get_dof_handler().get_fe()),
+          typename FEValuesBase<dim>::ExcFEDontMatch());
+  Assert (face_no < GeometryInfo<dim>::faces_per_cell,
+         ExcIndexRange (face_no, 0, GeometryInfo<dim>::faces_per_cell));
+  Assert (subface_no < GeometryInfo<dim>::subfaces_per_face,
+         ExcIndexRange (subface_no, 0, GeometryInfo<dim>::subfaces_per_face));
+  Assert (cell->has_children() == false,
+          ExcMessage ("You can't use subface data for cells that are "
+                      "already refined. Iterate over their children "
+                      "instead in these cases."));
+
                                    // set new cell. auto_ptr will take
                                    // care that old object gets
                                    // destroyed and also that this
diff --git a/deal.II/deal.II/source/fe/hp_fe_values.cc b/deal.II/deal.II/source/fe/hp_fe_values.cc
new file mode 100644 (file)
index 0000000..e5cae4e
--- /dev/null
@@ -0,0 +1,243 @@
+//----------------------------  hp_fe_values.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  hp_fe_values.cc  ---------------------------
+
+
+#include <fe/hp_fe_values.h>
+#include <fe/mapping_q1.h>
+
+
+// -------------------------- FEValuesMap -------------------------
+
+namespace internal 
+{
+  template <int dim, class FEValues>
+  FEValuesMap<dim,FEValues>::~FEValuesMap () 
+  {}
+  
+  
+  template <int dim, class FEValues>
+  FEValues &
+  FEValuesMap<dim,FEValues>::select_fe_values (const FiniteElement<dim> &fe)
+  {
+                                     // check if the finite element
+                                     // does not exist as a key in the
+                                     // map
+    if (fe_to_fe_values_map.find (&fe) ==
+        fe_to_fe_values_map.end())
+                                       // a-ha! doesn't yet, so let's
+                                       // make it up
+      fe_to_fe_values_map[&fe]
+        = boost::shared_ptr<FEValues> (create_fe_values (fe));
+
+
+                                     // now there definitely is one!
+    present_fe_values = fe_to_fe_values_map[&fe];
+
+    return *present_fe_values;
+  }
+
+
+// -------------------------- hpFEValuesBase -------------------------
+
+  template <int dim, int q_dim>
+  const MappingQ1<dim>
+  hpFEValuesBase<dim,q_dim>::default_mapping;
+
+  
+
+  template <int dim, int q_dim>
+  hpFEValuesBase<dim,q_dim>::hpFEValuesBase (
+      const MappingCollection<dim> &mapping_collection,
+      const QCollection<q_dim>     &qcollection,
+      const UpdateFlags             update_flags)
+      :
+                  mapping_collection (mapping_collection),
+                  qcollection (qcollection),
+                  update_flags (update_flags)
+  {}
+
+
+  template <int dim, int q_dim>
+  hpFEValuesBase<dim,q_dim>::hpFEValuesBase (const QCollection<q_dim> &qcollection,
+                                             const UpdateFlags         update_flags)
+                  :
+                  mapping_collection (default_mapping),
+                  qcollection (qcollection),
+                  update_flags (update_flags)
+  {}
+
+}
+
+
+// -------------------------- hpFEValues -------------------------
+
+
+template <int dim>
+hpFEValues<dim>::hpFEValues (const MappingCollection<dim> &mapping,
+                             const FECollection<dim>      &/*fe_collection*/,
+                             const QCollection<dim>       &qcollection,
+                             const UpdateFlags             update_flags)
+                :
+                internal::hpFEValuesBase<dim,dim> (mapping,
+                                                   qcollection,
+                                                   update_flags)
+{}
+
+
+template <int dim>
+hpFEValues<dim>::hpFEValues (const FECollection<dim> &/*fe_collection*/,
+                             const QCollection<dim>  &qcollection,
+                             const UpdateFlags        update_flags)
+                :
+                internal::hpFEValuesBase<dim,dim> (qcollection,
+                                                   update_flags)
+{}
+
+
+template <int dim>
+void
+hpFEValues<dim>::reinit (const typename hpDoFHandler<dim>::cell_iterator &cell)
+{
+  this->present_fe_index = cell->active_fe_index ();
+  this->select_fe_values (cell->get_fe()).reinit (cell);
+}
+
+
+
+template <int dim>
+FEValues<dim> *
+hpFEValues<dim>::create_fe_values (const FiniteElement<dim> &fe) const
+{
+  return new FEValues<dim> (
+      this->mapping_collection.get_mapping (this->present_fe_index), fe,
+      this->qcollection.get_quadrature (this->present_fe_index),
+      this->update_flags);
+}
+
+
+// -------------------------- hpFEFaceValues -------------------------
+
+
+template <int dim>
+hpFEFaceValues<dim>::hpFEFaceValues (const MappingCollection<dim> &mapping,
+                                     const FECollection<dim>  &/*fe_collection*/,
+                                     const QCollection<dim-1> &qcollection,
+                                     const UpdateFlags         update_flags)
+                :
+                internal::hpFEValuesBase<dim,dim-1> (mapping,
+                                                     qcollection,
+                                                     update_flags)
+{}
+
+
+template <int dim>
+hpFEFaceValues<dim>::hpFEFaceValues (const FECollection<dim>  &/*fe_collection*/,
+                                     const QCollection<dim-1> &qcollection,
+                                     const UpdateFlags         update_flags)
+                :
+                internal::hpFEValuesBase<dim,dim-1> (qcollection,
+                                                     update_flags)
+{}
+
+
+template <int dim>
+void
+hpFEFaceValues<dim>::reinit (const typename hpDoFHandler<dim>::cell_iterator &cell,
+                             const unsigned int face_no)
+{
+  this->present_fe_index = cell->active_fe_index ();
+  this->select_fe_values (cell->get_fe()).reinit (cell, face_no);
+}
+
+
+
+template <int dim>
+FEFaceValues<dim> *
+hpFEFaceValues<dim>::create_fe_values (const FiniteElement<dim> &fe) const
+{
+  return new FEFaceValues<dim> (
+      this->mapping_collection.get_mapping (this->present_fe_index), fe,
+      this->qcollection.get_quadrature (this->present_fe_index),
+      this->update_flags);
+}
+
+
+// -------------------------- hpFESubfaceValues -------------------------
+
+
+template <int dim>
+hpFESubfaceValues<dim>::hpFESubfaceValues (const MappingCollection<dim> &mapping,
+                                           const FECollection<dim>  &/*fe_collection*/,
+                                           const QCollection<dim-1> &qcollection,
+                                           const UpdateFlags         update_flags)
+                :
+                internal::hpFEValuesBase<dim,dim-1> (mapping,
+                                                     qcollection,
+                                                     update_flags)
+{}
+
+
+template <int dim>
+hpFESubfaceValues<dim>::hpFESubfaceValues (const FECollection<dim>  &/*fe_collection*/,
+                                           const QCollection<dim-1> &qcollection,
+                                           const UpdateFlags         update_flags)
+                :
+                internal::hpFEValuesBase<dim,dim-1> (qcollection,
+                                                     update_flags)
+{}
+
+
+template <int dim>
+void
+hpFESubfaceValues<dim>::reinit (const typename hpDoFHandler<dim>::cell_iterator &cell,
+                                const unsigned int face_no,
+                                const unsigned int subface_no)
+{
+  this->present_fe_index = cell->active_fe_index ();
+  this->select_fe_values (cell->get_fe()).reinit (cell, face_no, subface_no);
+}
+
+
+
+template <int dim>
+FESubfaceValues<dim> *
+hpFESubfaceValues<dim>::create_fe_values (const FiniteElement<dim> &fe) const
+{
+  return new FESubfaceValues<dim> (
+      this->mapping_collection.get_mapping (this->present_fe_index), fe,
+      this->qcollection.get_quadrature (this->present_fe_index),
+      this->update_flags);
+}
+
+
+
+
+// explicit instantiations
+namespace internal
+{
+  template class FEValuesMap<deal_II_dimension,FEValues<deal_II_dimension> >;
+  template class FEValuesMap<deal_II_dimension,FEFaceValues<deal_II_dimension> >;
+  template class FEValuesMap<deal_II_dimension,FESubfaceValues<deal_II_dimension> >;
+
+  template class hpFEValuesBase<deal_II_dimension,deal_II_dimension>;
+#if deal_II_dimension >= 2
+  template class hpFEValuesBase<deal_II_dimension,deal_II_dimension-1>;
+#endif
+}
+
+template class hpFEValues<deal_II_dimension>;
+#if deal_II_dimension >= 2
+template class hpFEFaceValues<deal_II_dimension>;
+template class hpFESubfaceValues<deal_II_dimension>;
+#endif
+
diff --git a/deal.II/deal.II/source/fe/mapping_collection.cc b/deal.II/deal.II/source/fe/mapping_collection.cc
new file mode 100644 (file)
index 0000000..a29d3c5
--- /dev/null
@@ -0,0 +1,76 @@
+//-----------------------  mapping_collection.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//-----------------------  mapping_collection.cc  ---------------------------
+
+#include <base/memory_consumption.h>
+#include <fe/mapping_collection.h>
+
+
+template <int dim>
+MappingCollection<dim>::MappingCollection () :
+    single_mapping (false)
+{
+}
+
+
+template <int dim>
+MappingCollection<dim>::MappingCollection (const Mapping<dim> &mapping) :
+    single_mapping (true)
+{
+    mappings.push_back (&mapping);
+}
+
+
+template <int dim>
+inline
+const Mapping<dim> &
+MappingCollection<dim>::get_mapping (const unsigned int active_fe_index) const
+{
+    SmartPointer<const Mapping<dim> > mapping;
+
+    if (single_mapping)
+       mapping = mappings[0];
+    else
+    {
+       Assert (active_fe_index < mappings.size (),
+               ExcIndexRange (active_fe_index, 0, mappings.size ()));
+       mapping = mappings[active_fe_index];
+    }
+
+    return *mapping;
+}
+
+
+template <int dim>
+unsigned int
+MappingCollection<dim>::memory_consumption () const
+{
+    return (sizeof(*this) +
+           MemoryConsumption::memory_consumption (mappings));
+}
+
+
+template <int dim>
+unsigned int MappingCollection<dim>::
+add_mapping (const Mapping<dim> &new_mapping)
+{
+    // A MappingCollection, which was initialized as single 
+    // MappingCollection cannot administrate other Mappings.
+    Assert (!single_mapping,
+           ExcNotInitialized ());
+    mappings.push_back (&new_mapping);
+    return (mappings.size ());
+}
+
+
+// explicit instantiations
+template class MappingCollection<deal_II_dimension>;
diff --git a/deal.II/deal.II/source/fe/q_collection.cc b/deal.II/deal.II/source/fe/q_collection.cc
new file mode 100644 (file)
index 0000000..bdfe0fc
--- /dev/null
@@ -0,0 +1,79 @@
+//----------------------------  q_collection.cc  ----------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  q_collection.cc  ----------------------------
+
+#include <base/memory_consumption.h>
+#include <fe/q_collection.h>
+
+
+template <int dim>
+QCollection<dim>::QCollection () :
+    single_quadrature (false)
+{
+}
+
+
+template <int dim>
+QCollection<dim>::QCollection (const Quadrature<dim> &quadrature) :
+    single_quadrature (true)
+{
+    quadratures.push_back (&quadrature);
+}
+
+
+template <int dim>
+inline
+const Quadrature<dim> &
+QCollection<dim>::get_quadrature (const unsigned int active_fe_index) const
+{
+    SmartPointer<const Quadrature<dim> > quad;
+
+    if (single_quadrature)
+       quad = quadratures[0];
+    else
+    {
+       Assert (active_fe_index < quadratures.size (),
+               ExcIndexRange (active_fe_index, 0, quadratures.size ()));
+       quad = quadratures[active_fe_index];
+    }
+
+    return *quad;
+}
+
+
+template <int dim>
+unsigned int
+QCollection<dim>::memory_consumption () const
+{
+    return (sizeof(*this) +
+           MemoryConsumption::memory_consumption (quadratures));
+}
+
+
+template <int dim>
+unsigned int QCollection<dim>::
+add_quadrature (const Quadrature<dim> &new_quadrature)
+{
+    // A QCollection, which was initialized as single QCollection cannot
+    // administrate other Quadratures.
+    Assert (!single_quadrature,
+           ExcNotInitialized ());
+    quadratures.push_back (&new_quadrature);
+    return (quadratures.size ());
+}
+
+
+// explicit instantiations
+template class QCollection<deal_II_dimension>;
+#if deal_II_dimension >= 2
+template class QCollection<deal_II_dimension-1>;
+#endif
index db8f6e7c38a8a92768e5607778d762aa74c5ca21..a5a82c6a7e182544349eaca12c66d2ff63e0afc7 100644 (file)
@@ -40,14 +40,16 @@ MGDoFObjectAccessor<1, dim>::MGDoFObjectAccessor (const Triangulation<dim> *tria
 template <int dim>
 unsigned int MGDoFObjectAccessor<1, dim>::mg_dof_index (const unsigned int i) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
                                   // and enough room was reserved
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (i<this->dof_handler->get_fe().dofs_per_line,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_line));
 
@@ -60,14 +62,16 @@ template <int dim>
 void MGDoFObjectAccessor<1, dim>::set_mg_dof_index (const unsigned int i,
                                                    const unsigned int index) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
                                   // and enough room was reserved
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (i<this->dof_handler->get_fe().dofs_per_line,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_line));
 
@@ -80,12 +84,14 @@ template <int dim>
 unsigned int MGDoFObjectAccessor<1, dim>::mg_vertex_dof_index (const unsigned int vertex,
                                                               const unsigned int i) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (vertex<2, ExcIndexRange (i,0,2));
   Assert (i<this->dof_handler->get_fe().dofs_per_vertex,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex));
@@ -100,12 +106,14 @@ void MGDoFObjectAccessor<1, dim>::set_mg_vertex_dof_index (const unsigned int ve
                                                           const unsigned int i,
                                                           const unsigned int index) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (vertex<2, ExcIndexRange (i,0,2));
   Assert (i<this->dof_handler->get_fe().dofs_per_vertex,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex));
@@ -119,15 +127,17 @@ template <int dim>
 void
 MGDoFObjectAccessor<1, dim>::get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (dof_indices.size() == (2*this->dof_handler->get_fe().dofs_per_vertex +
                                 this->dof_handler->get_fe().dofs_per_line),
-         typename DoFAccessor<dim>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
 
   const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
                     dofs_per_line   = this->dof_handler->get_fe().dofs_per_line;
@@ -149,13 +159,18 @@ void
 MGDoFObjectAccessor<1,dim>::get_mg_dof_values (const Vector<number> &values,
                                               Vector<number>       &dof_values) const
 {
-  Assert (this->dof_handler != 0, DoFAccessor<1>::ExcInvalidObject());
-  Assert (this->mg_dof_handler != 0, DoFAccessor<1>::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<1>::ExcInvalidObject());
+  typedef DoFAccessor<1, DoFHandler> BaseClass;
+
+  Assert (this->dof_handler != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (this->mg_dof_handler != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (&this->dof_handler->get_fe() != 0,
+         typename BaseClass::ExcInvalidObject());
   Assert (dof_values.size() == this->dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<1>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (values.size() == this->dof_handler->n_dofs(),
-         DoFAccessor<1>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
 
   const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
                     dofs_per_line   = this->dof_handler->get_fe().dofs_per_line;
@@ -192,7 +207,7 @@ template <int dim>
 void
 MGDoFObjectAccessor<1, dim>::copy_from (const MGDoFObjectAccessor<1, dim> &a)
 {
-  DoFObjectAccessor<1, dim>::copy_from (a);
+  DoFObjectAccessor<1, dim, DoFHandler>::copy_from (a);
   this->set_mg_dof_handler (a.mg_dof_handler);
 }
 
@@ -212,14 +227,16 @@ MGDoFObjectAccessor<2, dim>::MGDoFObjectAccessor (const Triangulation<dim> *tria
 template <int dim>
 unsigned int MGDoFObjectAccessor<2, dim>::mg_dof_index (const unsigned int i) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
                                   // and enough room was reserved
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (i<this->dof_handler->get_fe().dofs_per_quad,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_quad));
 
@@ -232,14 +249,16 @@ template <int dim>
 void MGDoFObjectAccessor<2, dim>::set_mg_dof_index (const unsigned int i,
                                                    const unsigned int index) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
                                   // and enough room was reserved
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (i<this->dof_handler->get_fe().dofs_per_quad,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_quad));
 
@@ -252,12 +271,14 @@ template <int dim>
 unsigned int MGDoFObjectAccessor<2, dim>::mg_vertex_dof_index (const unsigned int vertex,
                                                               const unsigned int i) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (vertex<4, ExcIndexRange (i,0,4));
   Assert (i<this->dof_handler->get_fe().dofs_per_vertex,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex));
@@ -272,12 +293,14 @@ void MGDoFObjectAccessor<2, dim>::set_mg_vertex_dof_index (const unsigned int ve
                                                           const unsigned int i,
                                                           const unsigned int index) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (vertex<4, ExcIndexRange (i,0,4));
   Assert (i<this->dof_handler->get_fe().dofs_per_vertex,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex));
@@ -291,16 +314,19 @@ template <int dim>
 void
 MGDoFObjectAccessor<2, dim>::get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+  typedef DoFAccessor<2, DoFHandler> BaseClass2D;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (dof_indices.size() == (4*this->dof_handler->get_fe().dofs_per_vertex +
                                 4*this->dof_handler->get_fe().dofs_per_line +
                                 this->dof_handler->get_fe().dofs_per_quad),
-         DoFAccessor<2>::ExcVectorDoesNotMatch());
+         typename BaseClass2D::ExcVectorDoesNotMatch());
 
   const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
                     dofs_per_line   = this->dof_handler->get_fe().dofs_per_line,
@@ -326,13 +352,18 @@ void
 MGDoFObjectAccessor<2,dim>::get_mg_dof_values (const Vector<number> &values,
                                               Vector<number>       &dof_values) const
 {
-  Assert (this->dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
-  Assert (this->mg_dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<2>::ExcInvalidObject());
+  typedef DoFAccessor<2, DoFHandler> BaseClass;
+
+  Assert (this->dof_handler != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (this->mg_dof_handler != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (&this->dof_handler->get_fe() != 0,
+         typename BaseClass::ExcInvalidObject());
   Assert (dof_values.size() == this->dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<2>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (values.size() == this->mg_dof_handler->n_dofs(this->present_level),
-         DoFAccessor<2>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
 
   const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
                     dofs_per_line   = this->dof_handler->get_fe().dofs_per_line,
@@ -389,7 +420,7 @@ template <int dim>
 void
 MGDoFObjectAccessor<2, dim>::copy_from (const MGDoFObjectAccessor<2, dim> &a)
 {
-  DoFObjectAccessor<2, dim>::copy_from (a);
+  DoFObjectAccessor<2, dim, DoFHandler>::copy_from (a);
   this->set_mg_dof_handler (a.mg_dof_handler);
 }
 
@@ -409,14 +440,16 @@ MGDoFObjectAccessor<3, dim>::MGDoFObjectAccessor (const Triangulation<dim> *tria
 template <int dim>
 unsigned int MGDoFObjectAccessor<3, dim>::mg_dof_index (const unsigned int i) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
                                   // and enough room was reserved
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (i<this->dof_handler->get_fe().dofs_per_hex,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_hex));
 
@@ -429,14 +462,16 @@ template <int dim>
 void MGDoFObjectAccessor<3, dim>::set_mg_dof_index (const unsigned int i,
                                                    const unsigned int index) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
                                   // make sure a FE has been selected
                                   // and enough room was reserved
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (i<this->dof_handler->get_fe().dofs_per_hex,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_hex));
 
@@ -449,12 +484,14 @@ template <int dim>
 unsigned int MGDoFObjectAccessor<3, dim>::mg_vertex_dof_index (const unsigned int vertex,
                                                               const unsigned int i) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (vertex<8, ExcIndexRange (i,0,8));
   Assert (i<this->dof_handler->get_fe().dofs_per_vertex,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex));
@@ -469,12 +506,14 @@ void MGDoFObjectAccessor<3, dim>::set_mg_vertex_dof_index (const unsigned int ve
                                                           const unsigned int i,
                                                           const unsigned int index) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (vertex<8, ExcIndexRange (vertex,0,8));
   Assert (i<this->dof_handler->get_fe().dofs_per_vertex,
          ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex));
@@ -488,17 +527,20 @@ template <int dim>
 void
 MGDoFObjectAccessor<3, dim>::get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const
 {
+  typedef DoFAccessor<dim, DoFHandler> BaseClass;
+  typedef DoFAccessor<3, DoFHandler> BaseClass3D;
+
   Assert (this->dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (this->mg_dof_handler != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (&this->dof_handler->get_fe() != 0,
-         typename DoFAccessor<dim>::ExcInvalidObject());
+         typename BaseClass::ExcInvalidObject());
   Assert (dof_indices.size() == (8*this->dof_handler->get_fe().dofs_per_vertex +
                                 12*this->dof_handler->get_fe().dofs_per_line +
                                 6*this->dof_handler->get_fe().dofs_per_quad +
                                 this->dof_handler->get_fe().dofs_per_hex),
-         DoFAccessor<3>::ExcVectorDoesNotMatch());
+         typename BaseClass3D::ExcVectorDoesNotMatch());
 
   const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
                     dofs_per_line   = this->dof_handler->get_fe().dofs_per_line,
@@ -528,13 +570,18 @@ void
 MGDoFObjectAccessor<3,dim>::get_mg_dof_values (const Vector<number> &values,
                                               Vector<number>       &dof_values) const
 {
-  Assert (this->dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
-  Assert (this->mg_dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
-  Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<2>::ExcInvalidObject());
+  typedef DoFAccessor<3, DoFHandler> BaseClass;
+
+  Assert (this->dof_handler != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (this->mg_dof_handler != 0,
+         typename BaseClass::ExcInvalidObject());
+  Assert (&this->dof_handler->get_fe() != 0,
+         typename BaseClass::ExcInvalidObject());
   Assert (dof_values.size() == this->dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<3>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
   Assert (values.size() == this->mg_dof_handler->n_dofs(this->present_level),
-         DoFAccessor<3>::ExcVectorDoesNotMatch());
+         typename BaseClass::ExcVectorDoesNotMatch());
 
   const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
                     dofs_per_line   = this->dof_handler->get_fe().dofs_per_line,
@@ -607,7 +654,7 @@ MGDoFObjectAccessor<3, dim>::child (const unsigned int i) const {
 template <int dim>
 void
 MGDoFObjectAccessor<3, dim>::copy_from (const MGDoFObjectAccessor<3, dim> &a) {
-  DoFObjectAccessor<3, dim>::copy_from (a);
+  DoFObjectAccessor<3, dim, DoFHandler>::copy_from (a);
   this->set_mg_dof_handler (a.mg_dof_handler);
 }
 
index 52e10b0621b1ef3191cdb6743ce44e06e1d82607..384d12e3a06d2d907bdf2eb6e067189a798b89be 100644 (file)
@@ -71,7 +71,8 @@ void MGDoFHandler<dim>::MGVertexDoFs::init (const unsigned int cl,
 
 
 template <int dim>
-MGDoFHandler<dim>::MGVertexDoFs::~MGVertexDoFs () {
+MGDoFHandler<dim>::MGVertexDoFs::~MGVertexDoFs ()
+{
   delete[] indices;
 }
 
@@ -119,77 +120,88 @@ MGDoFHandler<dim>::~MGDoFHandler ()
 
 template <>
 MGDoFHandler<1>::raw_cell_iterator
-MGDoFHandler<1>::begin_raw (const unsigned int level) const {
+MGDoFHandler<1>::begin_raw (const unsigned int level) const
+{
   return begin_raw_line (level);
 }
 
 
 template <>
 MGDoFHandler<1>::cell_iterator
-MGDoFHandler<1>::begin (const unsigned int level) const {
+MGDoFHandler<1>::begin (const unsigned int level) const
+{
   return begin_line (level);
 }
 
 
 template <>
 MGDoFHandler<1>::active_cell_iterator
-MGDoFHandler<1>::begin_active (const unsigned int level) const {
+MGDoFHandler<1>::begin_active (const unsigned int level) const
+{
   return begin_active_line (level);
 }
 
 
 template <>
 MGDoFHandler<1>::raw_cell_iterator
-MGDoFHandler<1>::end () const {
+MGDoFHandler<1>::end () const
+{
   return end_line ();
 }
 
 
 template <>
 MGDoFHandler<1>::raw_cell_iterator
-MGDoFHandler<1>::last_raw () const {
+MGDoFHandler<1>::last_raw () const
+{
   return last_raw_line ();
 }
 
 
 template <>
 MGDoFHandler<1>::raw_cell_iterator
-MGDoFHandler<1>::last_raw (const unsigned int level) const {
+MGDoFHandler<1>::last_raw (const unsigned int level) const
+{
   return last_raw_line (level);
 }
 
 
 template <>
 MGDoFHandler<1>::cell_iterator
-MGDoFHandler<1>::last () const {
+MGDoFHandler<1>::last () const
+{
   return last_line ();
 }
 
 
 template <>
 MGDoFHandler<1>::cell_iterator
-MGDoFHandler<1>::last (const unsigned int level) const {
+MGDoFHandler<1>::last (const unsigned int level) const
+{
   return last_line (level);
 }
 
 
 template <>
 MGDoFHandler<1>::active_cell_iterator
-MGDoFHandler<1>::last_active () const {
+MGDoFHandler<1>::last_active () const
+{
   return last_active_line ();
 }
 
 
 template <>
 MGDoFHandler<1>::active_cell_iterator
-MGDoFHandler<1>::last_active (const unsigned int level) const {
+MGDoFHandler<1>::last_active (const unsigned int level) const
+{
   return last_active_line (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<1>::raw_face_iterator
-MGDoFHandler<1>::begin_raw_face (const unsigned int) const {
+MGDoFHandler<1>::begin_raw_face (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -197,7 +209,8 @@ MGDoFHandler<1>::begin_raw_face (const unsigned int) const {
 
 template <>
 MGDoFDimensionInfo<1>::face_iterator
-MGDoFHandler<1>::begin_face (const unsigned int) const {
+MGDoFHandler<1>::begin_face (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -205,7 +218,8 @@ MGDoFHandler<1>::begin_face (const unsigned int) const {
 
 template <>
 MGDoFDimensionInfo<1>::active_face_iterator
-MGDoFHandler<1>::begin_active_face (const unsigned int) const {
+MGDoFHandler<1>::begin_active_face (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -213,7 +227,8 @@ MGDoFHandler<1>::begin_active_face (const unsigned int) const {
 
 template <>
 MGDoFDimensionInfo<1>::raw_face_iterator
-MGDoFHandler<1>::end_face () const {
+MGDoFHandler<1>::end_face () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -221,7 +236,8 @@ MGDoFHandler<1>::end_face () const {
 
 template <>
 MGDoFDimensionInfo<1>::raw_face_iterator
-MGDoFHandler<1>::last_raw_face () const {
+MGDoFHandler<1>::last_raw_face () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -229,7 +245,8 @@ MGDoFHandler<1>::last_raw_face () const {
 
 template <>
 MGDoFDimensionInfo<1>::raw_face_iterator
-MGDoFHandler<1>::last_raw_face (const unsigned int) const {
+MGDoFHandler<1>::last_raw_face (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -237,7 +254,8 @@ MGDoFHandler<1>::last_raw_face (const unsigned int) const {
 
 template <>
 MGDoFDimensionInfo<1>::face_iterator
-MGDoFHandler<1>::last_face () const {
+MGDoFHandler<1>::last_face () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -245,7 +263,8 @@ MGDoFHandler<1>::last_face () const {
 
 template <>
 MGDoFDimensionInfo<1>::face_iterator
-MGDoFHandler<1>::last_face (const unsigned int) const {
+MGDoFHandler<1>::last_face (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -253,7 +272,8 @@ MGDoFHandler<1>::last_face (const unsigned int) const {
 
 template <>
 MGDoFDimensionInfo<1>::active_face_iterator
-MGDoFHandler<1>::last_active_face () const {
+MGDoFHandler<1>::last_active_face () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -261,7 +281,8 @@ MGDoFHandler<1>::last_active_face () const {
 
 template <>
 MGDoFDimensionInfo<1>::active_face_iterator
-MGDoFHandler<1>::last_active_face (const unsigned int) const {
+MGDoFHandler<1>::last_active_face (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -269,7 +290,8 @@ MGDoFHandler<1>::last_active_face (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::raw_quad_iterator
-MGDoFHandler<1>::begin_raw_quad (const unsigned int) const {
+MGDoFHandler<1>::begin_raw_quad (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -277,7 +299,8 @@ MGDoFHandler<1>::begin_raw_quad (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::quad_iterator
-MGDoFHandler<1>::begin_quad (const unsigned int) const {
+MGDoFHandler<1>::begin_quad (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -285,7 +308,8 @@ MGDoFHandler<1>::begin_quad (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::active_quad_iterator
-MGDoFHandler<1>::begin_active_quad (const unsigned int) const {
+MGDoFHandler<1>::begin_active_quad (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -293,7 +317,8 @@ MGDoFHandler<1>::begin_active_quad (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::raw_quad_iterator
-MGDoFHandler<1>::end_quad () const {
+MGDoFHandler<1>::end_quad () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -301,7 +326,8 @@ MGDoFHandler<1>::end_quad () const {
 
 template <>
 MGDoFHandler<1>::raw_quad_iterator
-MGDoFHandler<1>::last_raw_quad (const unsigned int) const {
+MGDoFHandler<1>::last_raw_quad (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -309,7 +335,8 @@ MGDoFHandler<1>::last_raw_quad (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::quad_iterator
-MGDoFHandler<1>::last_quad (const unsigned int) const {
+MGDoFHandler<1>::last_quad (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -317,7 +344,8 @@ MGDoFHandler<1>::last_quad (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::active_quad_iterator
-MGDoFHandler<1>::last_active_quad (const unsigned int) const {
+MGDoFHandler<1>::last_active_quad (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -325,7 +353,8 @@ MGDoFHandler<1>::last_active_quad (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::raw_quad_iterator
-MGDoFHandler<1>::last_raw_quad () const {
+MGDoFHandler<1>::last_raw_quad () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -333,7 +362,8 @@ MGDoFHandler<1>::last_raw_quad () const {
 
 template <>
 MGDoFHandler<1>::quad_iterator
-MGDoFHandler<1>::last_quad () const {
+MGDoFHandler<1>::last_quad () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -341,7 +371,8 @@ MGDoFHandler<1>::last_quad () const {
 
 template <>
 MGDoFHandler<1>::active_quad_iterator
-MGDoFHandler<1>::last_active_quad () const {
+MGDoFHandler<1>::last_active_quad () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -349,7 +380,8 @@ MGDoFHandler<1>::last_active_quad () const {
 
 template <>
 MGDoFHandler<1>::raw_hex_iterator
-MGDoFHandler<1>::begin_raw_hex (const unsigned int) const {
+MGDoFHandler<1>::begin_raw_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -357,7 +389,8 @@ MGDoFHandler<1>::begin_raw_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::hex_iterator
-MGDoFHandler<1>::begin_hex (const unsigned int) const {
+MGDoFHandler<1>::begin_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -365,7 +398,8 @@ MGDoFHandler<1>::begin_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::active_hex_iterator
-MGDoFHandler<1>::begin_active_hex (const unsigned int) const {
+MGDoFHandler<1>::begin_active_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -373,7 +407,8 @@ MGDoFHandler<1>::begin_active_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::raw_hex_iterator
-MGDoFHandler<1>::end_hex () const {
+MGDoFHandler<1>::end_hex () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -381,7 +416,8 @@ MGDoFHandler<1>::end_hex () const {
 
 template <>
 MGDoFHandler<1>::raw_hex_iterator
-MGDoFHandler<1>::last_raw_hex (const unsigned int) const {
+MGDoFHandler<1>::last_raw_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -389,7 +425,8 @@ MGDoFHandler<1>::last_raw_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::hex_iterator
-MGDoFHandler<1>::last_hex (const unsigned int) const {
+MGDoFHandler<1>::last_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -397,7 +434,8 @@ MGDoFHandler<1>::last_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::active_hex_iterator
-MGDoFHandler<1>::last_active_hex (const unsigned int) const {
+MGDoFHandler<1>::last_active_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -405,7 +443,8 @@ MGDoFHandler<1>::last_active_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<1>::raw_hex_iterator
-MGDoFHandler<1>::last_raw_hex () const {
+MGDoFHandler<1>::last_raw_hex () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -413,7 +452,8 @@ MGDoFHandler<1>::last_raw_hex () const {
 
 template <>
 MGDoFHandler<1>::hex_iterator
-MGDoFHandler<1>::last_hex () const {
+MGDoFHandler<1>::last_hex () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -421,7 +461,8 @@ MGDoFHandler<1>::last_hex () const {
 
 template <>
 MGDoFHandler<1>::active_hex_iterator
-MGDoFHandler<1>::last_active_hex () const {
+MGDoFHandler<1>::last_active_hex () const
+{
   Assert (false, ExcImpossibleInDim(1));
   return 0;
 }
@@ -433,147 +474,168 @@ MGDoFHandler<1>::last_active_hex () const {
 
 template <>
 MGDoFHandler<2>::raw_cell_iterator
-MGDoFHandler<2>::begin_raw (const unsigned int level) const {
+MGDoFHandler<2>::begin_raw (const unsigned int level) const
+{
   return begin_raw_quad (level);
 }
 
 
 template <>
 MGDoFHandler<2>::cell_iterator
-MGDoFHandler<2>::begin (const unsigned int level) const {
+MGDoFHandler<2>::begin (const unsigned int level) const
+{
   return begin_quad (level);
 }
 
 
 template <>
 MGDoFHandler<2>::active_cell_iterator
-MGDoFHandler<2>::begin_active (const unsigned int level) const {
+MGDoFHandler<2>::begin_active (const unsigned int level) const
+{
   return begin_active_quad (level);
 }
 
 
 template <>
 MGDoFHandler<2>::raw_cell_iterator
-MGDoFHandler<2>::end () const {
+MGDoFHandler<2>::end () const
+{
   return end_quad ();
 }
 
 
 template <>
 MGDoFHandler<2>::raw_cell_iterator
-MGDoFHandler<2>::last_raw () const {
+MGDoFHandler<2>::last_raw () const
+{
   return last_raw_quad ();
 }
 
 
 template <>
 MGDoFHandler<2>::raw_cell_iterator
-MGDoFHandler<2>::last_raw (const unsigned int level) const {
+MGDoFHandler<2>::last_raw (const unsigned int level) const
+{
   return last_raw_quad (level);
 }
 
 
 template <>
 MGDoFHandler<2>::cell_iterator
-MGDoFHandler<2>::last () const {
+MGDoFHandler<2>::last () const
+{
   return last_quad ();
 }
 
 
 template <>
 MGDoFHandler<2>::cell_iterator
-MGDoFHandler<2>::last (const unsigned int level) const {
+MGDoFHandler<2>::last (const unsigned int level) const
+{
   return last_quad (level);
 }
 
 
 template <>
 MGDoFHandler<2>::active_cell_iterator
-MGDoFHandler<2>::last_active () const {
+MGDoFHandler<2>::last_active () const
+{
   return last_active_quad ();
 }
 
 
 template <>
 MGDoFHandler<2>::active_cell_iterator
-MGDoFHandler<2>::last_active (const unsigned int level) const {
+MGDoFHandler<2>::last_active (const unsigned int level) const
+{
   return last_active_quad (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<2>::raw_face_iterator
-MGDoFHandler<2>::begin_raw_face (const unsigned int level) const {
+MGDoFHandler<2>::begin_raw_face (const unsigned int level) const
+{
   return begin_raw_line (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<2>::face_iterator
-MGDoFHandler<2>::begin_face (const unsigned int level) const {
+MGDoFHandler<2>::begin_face (const unsigned int level) const
+{
   return begin_line (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<2>::active_face_iterator
-MGDoFHandler<2>::begin_active_face (const unsigned int level) const {
+MGDoFHandler<2>::begin_active_face (const unsigned int level) const
+{
   return begin_active_line (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<2>::raw_face_iterator
-MGDoFHandler<2>::end_face () const {
+MGDoFHandler<2>::end_face () const
+{
   return end_line ();
 }
 
 
 template <>
 MGDoFDimensionInfo<2>::raw_face_iterator
-MGDoFHandler<2>::last_raw_face () const {
+MGDoFHandler<2>::last_raw_face () const
+{
   return last_raw_line ();
 }
 
 
 template <>
 MGDoFDimensionInfo<2>::raw_face_iterator
-MGDoFHandler<2>::last_raw_face (const unsigned int level) const {
+MGDoFHandler<2>::last_raw_face (const unsigned int level) const
+{
   return last_raw_line (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<2>::face_iterator
-MGDoFHandler<2>::last_face () const {
+MGDoFHandler<2>::last_face () const
+{
   return last_line ();
 }
 
 
 template <>
 MGDoFDimensionInfo<2>::face_iterator
-MGDoFHandler<2>::last_face (const unsigned int level) const {
+MGDoFHandler<2>::last_face (const unsigned int level) const
+{
   return last_line (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<2>::active_face_iterator
-MGDoFHandler<2>::last_active_face () const {
+MGDoFHandler<2>::last_active_face () const
+{
   return last_active_line ();
 }
 
 
 template <>
 MGDoFDimensionInfo<2>::active_face_iterator
-MGDoFHandler<2>::last_active_face (const unsigned int level) const {
+MGDoFHandler<2>::last_active_face (const unsigned int level) const
+{
   return last_active_line (level);
 }
 
 
 template <>
 MGDoFHandler<2>::raw_hex_iterator
-MGDoFHandler<2>::begin_raw_hex (const unsigned int) const {
+MGDoFHandler<2>::begin_raw_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(2));
   return 0;
 }
@@ -581,7 +643,8 @@ MGDoFHandler<2>::begin_raw_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<2>::hex_iterator
-MGDoFHandler<2>::begin_hex (const unsigned int) const {
+MGDoFHandler<2>::begin_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(2));
   return 0;
 }
@@ -589,7 +652,8 @@ MGDoFHandler<2>::begin_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<2>::active_hex_iterator
-MGDoFHandler<2>::begin_active_hex (const unsigned int) const {
+MGDoFHandler<2>::begin_active_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(2));
   return 0;
 }
@@ -597,7 +661,8 @@ MGDoFHandler<2>::begin_active_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<2>::raw_hex_iterator
-MGDoFHandler<2>::end_hex () const {
+MGDoFHandler<2>::end_hex () const
+{
   Assert (false, ExcImpossibleInDim(2));
   return 0;
 }
@@ -605,7 +670,8 @@ MGDoFHandler<2>::end_hex () const {
 
 template <>
 MGDoFHandler<2>::raw_hex_iterator
-MGDoFHandler<2>::last_raw_hex (const unsigned int) const {
+MGDoFHandler<2>::last_raw_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(2));
   return 0;
 }
@@ -613,7 +679,8 @@ MGDoFHandler<2>::last_raw_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<2>::hex_iterator
-MGDoFHandler<2>::last_hex (const unsigned int) const {
+MGDoFHandler<2>::last_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(2));
   return 0;
 }
@@ -621,7 +688,8 @@ MGDoFHandler<2>::last_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<2>::active_hex_iterator
-MGDoFHandler<2>::last_active_hex (const unsigned int) const {
+MGDoFHandler<2>::last_active_hex (const unsigned int) const
+{
   Assert (false, ExcImpossibleInDim(2));
   return 0;
 }
@@ -629,7 +697,8 @@ MGDoFHandler<2>::last_active_hex (const unsigned int) const {
 
 template <>
 MGDoFHandler<2>::raw_hex_iterator
-MGDoFHandler<2>::last_raw_hex () const {
+MGDoFHandler<2>::last_raw_hex () const
+{
   Assert (false, ExcImpossibleInDim(2));
   return 0;
 }
@@ -637,7 +706,8 @@ MGDoFHandler<2>::last_raw_hex () const {
 
 template <>
 MGDoFHandler<2>::hex_iterator
-MGDoFHandler<2>::last_hex () const {
+MGDoFHandler<2>::last_hex () const
+{
   Assert (false, ExcImpossibleInDim(2));
   return 0;
 }
@@ -645,7 +715,8 @@ MGDoFHandler<2>::last_hex () const {
 
 template <>
 MGDoFHandler<2>::active_hex_iterator
-MGDoFHandler<2>::last_active_hex () const {
+MGDoFHandler<2>::last_active_hex () const
+{
   Assert (false, ExcImpossibleInDim(2));
   return 0;
 }
@@ -658,140 +729,160 @@ MGDoFHandler<2>::last_active_hex () const {
 
 template <>
 MGDoFHandler<3>::raw_cell_iterator
-MGDoFHandler<3>::begin_raw (const unsigned int level) const {
+MGDoFHandler<3>::begin_raw (const unsigned int level) const
+{
   return begin_raw_hex (level);
 }
 
 
 template <>
 MGDoFHandler<3>::cell_iterator
-MGDoFHandler<3>::begin (const unsigned int level) const {
+MGDoFHandler<3>::begin (const unsigned int level) const
+{
   return begin_hex (level);
 }
 
 
 template <>
 MGDoFHandler<3>::active_cell_iterator
-MGDoFHandler<3>::begin_active (const unsigned int level) const {
+MGDoFHandler<3>::begin_active (const unsigned int level) const
+{
   return begin_active_hex (level);
 }
 
 
 template <>
 MGDoFHandler<3>::raw_cell_iterator
-MGDoFHandler<3>::end () const {
+MGDoFHandler<3>::end () const
+{
   return end_hex ();
 }
 
 
 template <>
 MGDoFHandler<3>::raw_cell_iterator
-MGDoFHandler<3>::last_raw () const {
+MGDoFHandler<3>::last_raw () const
+{
   return last_raw_hex ();
 }
 
 
 template <>
 MGDoFHandler<3>::raw_cell_iterator
-MGDoFHandler<3>::last_raw (const unsigned int level) const {
+MGDoFHandler<3>::last_raw (const unsigned int level) const
+{
   return last_raw_hex (level);
 }
 
 
 template <>
 MGDoFHandler<3>::cell_iterator
-MGDoFHandler<3>::last () const {
+MGDoFHandler<3>::last () const
+{
   return last_hex ();
 }
 
 
 template <>
 MGDoFHandler<3>::cell_iterator
-MGDoFHandler<3>::last (const unsigned int level) const {
+MGDoFHandler<3>::last (const unsigned int level) const
+{
   return last_hex (level);
 }
 
 
 template <>
 MGDoFHandler<3>::active_cell_iterator
-MGDoFHandler<3>::last_active () const {
+MGDoFHandler<3>::last_active () const
+{
   return last_active_hex ();
 }
 
 
 template <>
 MGDoFHandler<3>::active_cell_iterator
-MGDoFHandler<3>::last_active (const unsigned int level) const {
+MGDoFHandler<3>::last_active (const unsigned int level) const
+{
   return last_active_hex (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<3>::raw_face_iterator
-MGDoFHandler<3>::begin_raw_face (const unsigned int level) const {
+MGDoFHandler<3>::begin_raw_face (const unsigned int level) const
+{
   return begin_raw_quad (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<3>::face_iterator
-MGDoFHandler<3>::begin_face (const unsigned int level) const {
+MGDoFHandler<3>::begin_face (const unsigned int level) const
+{
   return begin_quad (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<3>::active_face_iterator
-MGDoFHandler<3>::begin_active_face (const unsigned int level) const {
+MGDoFHandler<3>::begin_active_face (const unsigned int level) const
+{
   return begin_active_quad (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<3>::raw_face_iterator
-MGDoFHandler<3>::end_face () const {
+MGDoFHandler<3>::end_face () const
+{
   return end_quad ();
 }
 
 
 template <>
 MGDoFDimensionInfo<3>::raw_face_iterator
-MGDoFHandler<3>::last_raw_face () const {
+MGDoFHandler<3>::last_raw_face () const
+{
   return last_raw_quad ();
 }
 
 
 template <>
 MGDoFDimensionInfo<3>::raw_face_iterator
-MGDoFHandler<3>::last_raw_face (const unsigned int level) const {
+MGDoFHandler<3>::last_raw_face (const unsigned int level) const
+{
   return last_raw_quad (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<3>::face_iterator
-MGDoFHandler<3>::last_face () const {
+MGDoFHandler<3>::last_face () const
+{
   return last_quad ();
 }
 
 
 template <>
 MGDoFDimensionInfo<3>::face_iterator
-MGDoFHandler<3>::last_face (const unsigned int level) const {
+MGDoFHandler<3>::last_face (const unsigned int level) const
+{
   return last_quad (level);
 }
 
 
 template <>
 MGDoFDimensionInfo<3>::active_face_iterator
-MGDoFHandler<3>::last_active_face () const {
+MGDoFHandler<3>::last_active_face () const
+{
   return last_active_quad ();
 }
 
 
 template <>
 MGDoFDimensionInfo<3>::active_face_iterator
-MGDoFHandler<3>::last_active_face (const unsigned int level) const {
+MGDoFHandler<3>::last_active_face (const unsigned int level) const
+{
   return last_active_quad (level);
 }
 
@@ -800,7 +891,8 @@ MGDoFHandler<3>::last_active_face (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_line_iterator
-MGDoFHandler<dim>::begin_raw_line (const unsigned int level) const {
+MGDoFHandler<dim>::begin_raw_line (const unsigned int level) const
+{
   return raw_line_iterator (this->tria,
                            this->tria->begin_raw_line(level)->level(),
                            this->tria->begin_raw_line(level)->index(),
@@ -810,7 +902,8 @@ MGDoFHandler<dim>::begin_raw_line (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::line_iterator
-MGDoFHandler<dim>::begin_line (const unsigned int level) const {
+MGDoFHandler<dim>::begin_line (const unsigned int level) const
+{
   return line_iterator (this->tria,
                        this->tria->begin_line(level)->level(),
                        this->tria->begin_line(level)->index(),
@@ -820,7 +913,8 @@ MGDoFHandler<dim>::begin_line (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::active_line_iterator
-MGDoFHandler<dim>::begin_active_line (const unsigned int level) const {
+MGDoFHandler<dim>::begin_active_line (const unsigned int level) const
+{
   return active_line_iterator (this->tria,
                               this->tria->begin_active_line(level)->level(),
                               this->tria->begin_active_line(level)->index(),
@@ -830,7 +924,8 @@ MGDoFHandler<dim>::begin_active_line (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_quad_iterator
-MGDoFHandler<dim>::begin_raw_quad (const unsigned int level) const {
+MGDoFHandler<dim>::begin_raw_quad (const unsigned int level) const
+{
   return raw_quad_iterator (this->tria,
                            this->tria->begin_raw_quad(level)->level(),
                            this->tria->begin_raw_quad(level)->index(),
@@ -840,7 +935,8 @@ MGDoFHandler<dim>::begin_raw_quad (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::quad_iterator
-MGDoFHandler<dim>::begin_quad (const unsigned int level) const {
+MGDoFHandler<dim>::begin_quad (const unsigned int level) const
+{
   return quad_iterator (this->tria,
                        this->tria->begin_quad(level)->level(),
                        this->tria->begin_quad(level)->index(),
@@ -850,7 +946,8 @@ MGDoFHandler<dim>::begin_quad (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::active_quad_iterator
-MGDoFHandler<dim>::begin_active_quad (const unsigned int level) const {
+MGDoFHandler<dim>::begin_active_quad (const unsigned int level) const
+{
   return active_quad_iterator (this->tria,
                               this->tria->begin_active_quad(level)->level(),
                               this->tria->begin_active_quad(level)->index(),
@@ -860,7 +957,8 @@ MGDoFHandler<dim>::begin_active_quad (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_hex_iterator
-MGDoFHandler<dim>::begin_raw_hex (const unsigned int level) const {
+MGDoFHandler<dim>::begin_raw_hex (const unsigned int level) const
+{
   return raw_hex_iterator (this->tria,
                           this->tria->begin_raw_hex(level)->level(),
                           this->tria->begin_raw_hex(level)->index(),
@@ -870,7 +968,8 @@ MGDoFHandler<dim>::begin_raw_hex (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::hex_iterator
-MGDoFHandler<dim>::begin_hex (const unsigned int level) const {
+MGDoFHandler<dim>::begin_hex (const unsigned int level) const
+{
   return hex_iterator (this->tria,
                       this->tria->begin_hex(level)->level(),
                       this->tria->begin_hex(level)->index(),
@@ -880,7 +979,8 @@ MGDoFHandler<dim>::begin_hex (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::active_hex_iterator
-MGDoFHandler<dim>::begin_active_hex (const unsigned int level) const {
+MGDoFHandler<dim>::begin_active_hex (const unsigned int level) const
+{
   return active_hex_iterator (this->tria,
                              this->tria->begin_active_hex(level)->level(),
                              this->tria->begin_active_hex(level)->index(),
@@ -890,28 +990,32 @@ MGDoFHandler<dim>::begin_active_hex (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_line_iterator
-MGDoFHandler<dim>::end_line () const {
+MGDoFHandler<dim>::end_line () const
+{
   return raw_line_iterator (this->tria, -1, -1, this);
 }
 
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_quad_iterator
-MGDoFHandler<dim>::end_quad () const {
+MGDoFHandler<dim>::end_quad () const
+{
   return raw_quad_iterator (this->tria, -1, -1, this);
 }
 
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_hex_iterator
-MGDoFHandler<dim>::end_hex () const {
+MGDoFHandler<dim>::end_hex () const
+{
   return raw_hex_iterator (this->tria, -1, -1, this);
 }
 
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::raw_cell_iterator
-MGDoFHandler<dim>::end_raw (const unsigned int level) const {
+MGDoFHandler<dim>::end_raw (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          end() :
          begin_raw (level+1));
@@ -920,7 +1024,8 @@ MGDoFHandler<dim>::end_raw (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::cell_iterator
-MGDoFHandler<dim>::end (const unsigned int level) const {
+MGDoFHandler<dim>::end (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          cell_iterator(end()) :
          begin (level+1));
@@ -929,7 +1034,8 @@ MGDoFHandler<dim>::end (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::active_cell_iterator
-MGDoFHandler<dim>::end_active (const unsigned int level) const {
+MGDoFHandler<dim>::end_active (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          active_cell_iterator(end()) :
          begin_active (level+1));
@@ -938,7 +1044,8 @@ MGDoFHandler<dim>::end_active (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::raw_face_iterator
-MGDoFHandler<dim>::end_raw_face (const unsigned int level) const {
+MGDoFHandler<dim>::end_raw_face (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          end_face() :
          begin_raw_face (level+1));
@@ -947,7 +1054,8 @@ MGDoFHandler<dim>::end_raw_face (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::face_iterator
-MGDoFHandler<dim>::end_face (const unsigned int level) const {
+MGDoFHandler<dim>::end_face (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          face_iterator(end_face()) :
          begin_face (level+1));
@@ -956,7 +1064,8 @@ MGDoFHandler<dim>::end_face (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::active_face_iterator
-MGDoFHandler<dim>::end_active_face (const unsigned int level) const {
+MGDoFHandler<dim>::end_active_face (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          active_face_iterator(end_face()) :
          begin_active_face (level+1));
@@ -965,7 +1074,8 @@ MGDoFHandler<dim>::end_active_face (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::raw_line_iterator
-MGDoFHandler<dim>::end_raw_line (const unsigned int level) const {
+MGDoFHandler<dim>::end_raw_line (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          end_line() :
          begin_raw_line (level+1));
@@ -974,7 +1084,8 @@ MGDoFHandler<dim>::end_raw_line (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::line_iterator
-MGDoFHandler<dim>::end_line (const unsigned int level) const {
+MGDoFHandler<dim>::end_line (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          line_iterator(end_line()) :
          begin_line (level+1));
@@ -983,7 +1094,8 @@ MGDoFHandler<dim>::end_line (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::active_line_iterator
-MGDoFHandler<dim>::end_active_line (const unsigned int level) const {
+MGDoFHandler<dim>::end_active_line (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          active_line_iterator(end_line()) :
          begin_active_line (level+1));
@@ -992,7 +1104,8 @@ MGDoFHandler<dim>::end_active_line (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::raw_quad_iterator
-MGDoFHandler<dim>::end_raw_quad (const unsigned int level) const {
+MGDoFHandler<dim>::end_raw_quad (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          end_quad() :
          begin_raw_quad (level+1));
@@ -1001,7 +1114,8 @@ MGDoFHandler<dim>::end_raw_quad (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::quad_iterator
-MGDoFHandler<dim>::end_quad (const unsigned int level) const {
+MGDoFHandler<dim>::end_quad (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          quad_iterator(end_quad()) :
          begin_quad (level+1));
@@ -1010,7 +1124,8 @@ MGDoFHandler<dim>::end_quad (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::active_quad_iterator
-MGDoFHandler<dim>::end_active_quad (const unsigned int level) const {
+MGDoFHandler<dim>::end_active_quad (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          active_quad_iterator(end_quad()) :
          begin_active_quad (level+1));
@@ -1019,7 +1134,8 @@ MGDoFHandler<dim>::end_active_quad (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::raw_hex_iterator
-MGDoFHandler<dim>::end_raw_hex (const unsigned int level) const {
+MGDoFHandler<dim>::end_raw_hex (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          end_hex() :
          begin_raw_hex (level+1));
@@ -1028,7 +1144,8 @@ MGDoFHandler<dim>::end_raw_hex (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::hex_iterator
-MGDoFHandler<dim>::end_hex (const unsigned int level) const {
+MGDoFHandler<dim>::end_hex (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          hex_iterator(end_hex()) :
          begin_hex (level+1));
@@ -1037,7 +1154,8 @@ MGDoFHandler<dim>::end_hex (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFDimensionInfo<dim>::active_hex_iterator
-MGDoFHandler<dim>::end_active_hex (const unsigned int level) const {
+MGDoFHandler<dim>::end_active_hex (const unsigned int level) const
+{
   return (level == mg_levels.size()-1 ?
          active_hex_iterator(end_hex()) :
          begin_active_hex (level+1));
@@ -1046,7 +1164,8 @@ MGDoFHandler<dim>::end_active_hex (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_line_iterator
-MGDoFHandler<dim>::last_raw_line (const unsigned int level) const {
+MGDoFHandler<dim>::last_raw_line (const unsigned int level) const
+{
   return raw_line_iterator (this->tria,
                            this->tria->last_raw_line(level)->level(),
                            this->tria->last_raw_line(level)->index(),
@@ -1056,7 +1175,8 @@ MGDoFHandler<dim>::last_raw_line (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::line_iterator
-MGDoFHandler<dim>::last_line (const unsigned int level) const {
+MGDoFHandler<dim>::last_line (const unsigned int level) const
+{
   return line_iterator (this->tria,
                        this->tria->last_line(level)->level(),
                        this->tria->last_line(level)->index(),
@@ -1066,7 +1186,8 @@ MGDoFHandler<dim>::last_line (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::active_line_iterator
-MGDoFHandler<dim>::last_active_line (const unsigned int level) const {
+MGDoFHandler<dim>::last_active_line (const unsigned int level) const
+{
   return active_line_iterator (this->tria,
                               this->tria->last_active_line(level)->level(),
                               this->tria->last_active_line(level)->index(),
@@ -1076,7 +1197,8 @@ MGDoFHandler<dim>::last_active_line (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_quad_iterator
-MGDoFHandler<dim>::last_raw_quad (const unsigned int level) const {
+MGDoFHandler<dim>::last_raw_quad (const unsigned int level) const
+{
   return raw_quad_iterator (this->tria,
                            this->tria->last_raw_quad(level)->level(),
                            this->tria->last_raw_quad(level)->index(),
@@ -1086,7 +1208,8 @@ MGDoFHandler<dim>::last_raw_quad (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::quad_iterator
-MGDoFHandler<dim>::last_quad (const unsigned int level) const {
+MGDoFHandler<dim>::last_quad (const unsigned int level) const
+{
   return quad_iterator (this->tria,
                        this->tria->last_quad(level)->level(),
                        this->tria->last_quad(level)->index(),
@@ -1096,7 +1219,8 @@ MGDoFHandler<dim>::last_quad (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::active_quad_iterator
-MGDoFHandler<dim>::last_active_quad (const unsigned int level) const {
+MGDoFHandler<dim>::last_active_quad (const unsigned int level) const
+{
   return active_quad_iterator (this->tria,
                               this->tria->last_active_quad(level)->level(),
                               this->tria->last_active_quad(level)->index(),
@@ -1106,7 +1230,8 @@ MGDoFHandler<dim>::last_active_quad (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_hex_iterator
-MGDoFHandler<dim>::last_raw_hex (const unsigned int level) const {
+MGDoFHandler<dim>::last_raw_hex (const unsigned int level) const
+{
   return raw_hex_iterator (this->tria,
                           this->tria->last_raw_hex(level)->level(),
                           this->tria->last_raw_hex(level)->index(),
@@ -1116,7 +1241,8 @@ MGDoFHandler<dim>::last_raw_hex (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::hex_iterator
-MGDoFHandler<dim>::last_hex (const unsigned int level) const {
+MGDoFHandler<dim>::last_hex (const unsigned int level) const
+{
   return hex_iterator (this->tria,
                       this->tria->last_hex(level)->level(),
                       this->tria->last_hex(level)->index(),
@@ -1126,7 +1252,8 @@ MGDoFHandler<dim>::last_hex (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::active_hex_iterator
-MGDoFHandler<dim>::last_active_hex (const unsigned int level) const {
+MGDoFHandler<dim>::last_active_hex (const unsigned int level) const
+{
   return active_hex_iterator (this->tria,
                              this->tria->last_active_hex(level)->level(),
                              this->tria->last_active_hex(level)->index(),
@@ -1136,63 +1263,72 @@ MGDoFHandler<dim>::last_active_hex (const unsigned int level) const {
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_line_iterator
-MGDoFHandler<dim>::last_raw_line () const {
+MGDoFHandler<dim>::last_raw_line () const
+{
   return last_raw_line (mg_levels.size()-1);
 }
 
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_quad_iterator
-MGDoFHandler<dim>::last_raw_quad () const {
+MGDoFHandler<dim>::last_raw_quad () const
+{
   return last_raw_quad (mg_levels.size()-1);
 }
 
 
 template <int dim>
 typename MGDoFHandler<dim>::raw_hex_iterator
-MGDoFHandler<dim>::last_raw_hex () const {
+MGDoFHandler<dim>::last_raw_hex () const
+{
   return last_raw_hex (mg_levels.size()-1);
 }
 
 
 template <int dim>
 typename MGDoFHandler<dim>::line_iterator
-MGDoFHandler<dim>::last_line () const {
+MGDoFHandler<dim>::last_line () const
+{
   return last_line (mg_levels.size()-1);
 }
 
 
 template <int dim>
 typename MGDoFHandler<dim>::quad_iterator
-MGDoFHandler<dim>::last_quad () const {
+MGDoFHandler<dim>::last_quad () const
+{
   return last_quad (mg_levels.size()-1);
 }
 
 
 template <int dim>
 typename MGDoFHandler<dim>::hex_iterator
-MGDoFHandler<dim>::last_hex () const {
+MGDoFHandler<dim>::last_hex () const
+{
   return last_hex (mg_levels.size()-1);
 }
 
 
 template <int dim>
 typename MGDoFHandler<dim>::active_line_iterator
-MGDoFHandler<dim>::last_active_line () const {
+MGDoFHandler<dim>::last_active_line () const
+{
   return last_active_line (mg_levels.size()-1);
 }
 
 
 template <int dim>
 typename MGDoFHandler<dim>::active_quad_iterator
-MGDoFHandler<dim>::last_active_quad () const {
+MGDoFHandler<dim>::last_active_quad () const
+{
   return last_active_quad (mg_levels.size()-1);
 }
 
 
 template <int dim>
 typename MGDoFHandler<dim>::active_hex_iterator
-MGDoFHandler<dim>::last_active_hex () const {
+MGDoFHandler<dim>::last_active_hex () const
+{
   return last_active_hex (mg_levels.size()-1);
 }
 
@@ -1205,7 +1341,7 @@ void MGDoFHandler<dim>::distribute_dofs (const FiniteElement<dim> &fe,
                                         const unsigned int        offset)
 {
                                   // first distribute global dofs
-  DoFHandler<dim>::distribute_dofs (fe, offset);
+  DoFHandler<dim>::distribute_dofs (fe);
 
 
                                   // reserve space for the MG dof numbers
@@ -1248,7 +1384,8 @@ void MGDoFHandler<dim>::distribute_dofs (const FiniteElement<dim> &fe,
 template <>
 unsigned int
 MGDoFHandler<1>::distribute_dofs_on_cell (cell_iterator &cell,
-                                         unsigned int   next_free_dof) {
+                                         unsigned int   next_free_dof)
+{
 
                                   // distribute dofs of vertices
   if (this->selected_fe->dofs_per_vertex > 0)
@@ -1691,7 +1828,7 @@ void MGDoFHandler<2>::reserve_space () {
 
        mg_vertex_dofs[vertex].init (min_level[vertex],
                                     max_level[vertex],
-                                    this->selected_fe->dofs_per_vertex);
+                                    this->get_fe().dofs_per_vertex);
       }
     else
       {
index c4bb55cea6a24a2be51ef689db3cf6bdc16874b3..6dc0a77c958adeda99affa9875b09998e524c700 100644 (file)
@@ -410,7 +410,7 @@ void MGTransferSelect<number>::build_matrices (
                                       // by restricting from fine level.
       for (; level_cell!=level_end; ++level_cell)
        {
-         DoFObjectAccessor<dim, dim>& global_cell = *level_cell;
+         DoFObjectAccessor<dim, dim, DoFHandler>& global_cell = *level_cell;
                                           // get the dof numbers of
                                           // this cell for the global
                                           // and the level-wise
index 4229b8b2b432cbda109d23ee695ef758016a1454..4689503339e42962a5ce4cd1d71d30060b524ca1 100644 (file)
 #include <grid/tria.h>
 #include <dofs/dof_handler.h>
 #include <dofs/dof_accessor.h>
+#include <dofs/hp_dof_handler.h>
 #include <grid/tria_iterator.h>
 #include <fe/fe.h>
 #include <fe/fe_values.h>
+#include <fe/hp_fe_values.h>
 #include <fe/mapping_q1.h>
+#include <fe/select_fe_values.h>
 
 #ifdef HAVE_STD_STRINGSTREAM
 #  include <sstream>
@@ -36,8 +39,9 @@
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::DataEntryBase::
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::DataEntryBase::
 DataEntryBase (const std::vector<std::string> &names)
                :
                names(names)
@@ -45,16 +49,18 @@ DataEntryBase (const std::vector<std::string> &names)
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::DataEntryBase::
 DataEntryBase::~DataEntryBase ()
 {}
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim,  template <int> class DH,
+         int patch_dim, int patch_space_dim>
 template <typename VectorType>
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
 DataEntry<VectorType>::
 DataEntry (const VectorType               *data,
           const std::vector<std::string> &names)
@@ -64,11 +70,11 @@ DataEntry (const VectorType               *data,
 {}
 
 
-
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
 template <typename VectorType>
 double
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
 DataEntry<VectorType>::
 get_cell_data_value (const unsigned int cell_number) const
 {
@@ -77,10 +83,11 @@ get_cell_data_value (const unsigned int cell_number) const
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
 template <typename VectorType>
 void
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
 DataEntry<VectorType>::
 get_function_values (const FEValuesBase<dof_handler_dim> &fe_patch_values,
                      std::vector<Vector<double> >    &patch_values_system) const
@@ -90,10 +97,11 @@ get_function_values (const FEValuesBase<dof_handler_dim> &fe_patch_values,
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
 template <typename VectorType>
 void
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
 DataEntry<VectorType>::
 get_function_values (const FEValuesBase<dof_handler_dim> &fe_patch_values,
                      std::vector<double>             &patch_values) const
@@ -103,10 +111,11 @@ get_function_values (const FEValuesBase<dof_handler_dim> &fe_patch_values,
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
 template <typename VectorType>
 unsigned int
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
 DataEntry<VectorType>::memory_consumption () const
 {
   return (sizeof (vector) +
@@ -115,10 +124,11 @@ DataEntry<VectorType>::memory_consumption () const
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim,  template <int> class DH,
+         int patch_dim, int patch_space_dim>
 template <typename VectorType>
 void
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
 DataEntry<VectorType>::clear ()
 {
   vector = 0;
@@ -127,27 +137,29 @@ DataEntry<VectorType>::clear ()
 
 
 
-
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::DataOut_DoFData ()
-               :
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::DataOut_DoFData ()
+                :
                dofs(0,typeid(*this).name())
 {}
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::~DataOut_DoFData ()
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::~DataOut_DoFData ()
 {
   clear ();
 }
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
 void
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
-attach_dof_handler (const DoFHandler<dof_handler_dim> &d)
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
+attach_dof_handler (const DH<dof_handler_dim> &d)
 {
   Assert (dof_data.size() == 0, ExcOldDataStillPresent());
   Assert (cell_data.size() == 0, ExcOldDataStillPresent());
@@ -157,10 +169,11 @@ attach_dof_handler (const DoFHandler<dof_handler_dim> &d)
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
 template <class VECTOR>
 void
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
 add_data_vector (const VECTOR                   &vec,
                 const std::vector<std::string> &names,
                 const DataVectorType            type)
@@ -229,10 +242,12 @@ add_data_vector (const VECTOR                   &vec,
 }
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
 template <class VECTOR>
 void
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
 add_data_vector (const VECTOR         &vec,
                 const std::string    &name,
                 const DataVectorType  type)
@@ -274,8 +289,9 @@ add_data_vector (const VECTOR         &vec,
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
-void DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::clear_data_vectors ()
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
+void DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::clear_data_vectors ()
 {
   dof_data.erase (dof_data.begin(), dof_data.end());
   cell_data.erase (cell_data.begin(), cell_data.end());
@@ -287,9 +303,10 @@ void DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::clear_data_vect
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
 void
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
 clear_input_data_references ()
 {
   for (unsigned int i=0; i<dof_data.size(); ++i)
@@ -304,9 +321,10 @@ clear_input_data_references ()
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+          int patch_dim, int patch_space_dim>
 void
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::clear ()
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::clear ()
 {
   dof_data.erase (dof_data.begin(), dof_data.end());
   cell_data.erase (cell_data.begin(), cell_data.end());
@@ -321,9 +339,10 @@ DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::clear ()
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
 std::vector<std::string>
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::
 get_dataset_names () const 
 {
   std::vector<std::string> names;
@@ -348,18 +367,20 @@ get_dataset_names () const
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
 const std::vector< ::DataOutBase::Patch<patch_dim, patch_space_dim> > &
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::get_patches () const
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::get_patches () const
 {
   return patches;
 }
 
 
 
-template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <int dof_handler_dim, template <int> class DH,
+         int patch_dim, int patch_space_dim>
 unsigned int
-DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::memory_consumption () const
+DataOut_DoFData<dof_handler_dim,DH,patch_dim,patch_space_dim>::memory_consumption () const
 {
   return (DataOutInterface<patch_dim,patch_space_dim>::memory_consumption () +
          MemoryConsumption::memory_consumption (dofs) +
@@ -372,8 +393,8 @@ DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::memory_consumption (
 
 
 
-template <int dim>
-void DataOut<dim>::build_some_patches (Data data)
+template <int dim, template <int> class DH>
+void DataOut<dim,DH>::build_some_patches (Data data)
 {
   QTrapez<1>     q_trapez;
   QIterated<dim> patch_points (q_trapez, data.n_subdivisions);
@@ -384,13 +405,14 @@ void DataOut<dim>::build_some_patches (Data data)
                                   // we don't support anything else
                                   // as well
   static const MappingQ1<dim> mapping;
-  FEValues<dim> fe_patch_values (mapping, this->dofs->get_fe(),
-                                patch_points, update_values);
+  typename SelectFEValues<DH<dim> >::FEValues
+    x_fe_patch_values (mapping, this->dofs->get_fe(),
+                       patch_points, update_values);
 
   const unsigned int n_q_points = patch_points.n_quadrature_points;
   
   typename std::vector< ::DataOutBase::Patch<dim> >::iterator patch = this->patches.begin();
-  typename DoFHandler<dim>::cell_iterator cell = first_cell();
+  cell_iterator cell=first_cell();
   
                                   // get first cell in this thread
   for (unsigned int i=0; (i<data.this_thread)&&(cell != this->dofs->end()); ++i)
@@ -415,7 +437,9 @@ void DataOut<dim>::build_some_patches (Data data)
       
       if (data.n_datasets > 0)
        {
-         fe_patch_values.reinit (cell);
+          x_fe_patch_values.reinit (cell);
+          const FEValues<dim> &fe_patch_values
+            = x_fe_patch_values.get_present_fe_values ();
          
                                           // first fill dof_data
          for (unsigned int dataset=0; dataset<this->dof_data.size(); ++dataset)
@@ -454,7 +478,7 @@ void DataOut<dim>::build_some_patches (Data data)
 //TODO: This introduces a quadratic component into the algorithm. We may be doing better if we always kept track of the cell_number when 'cell' is increased, but we have to make sure that we only do this if cell_number is actually used, since we don't want to enforce the activeness constraints otherwise
               const unsigned int cell_number
                 = std::distance (this->dofs->begin_active(),
-                                 typename DoFHandler<dim>::active_cell_iterator(cell));
+                                 active_cell_iterator (cell));
               
               for (unsigned int dataset=0; dataset<this->cell_data.size(); ++dataset)
                 {
@@ -467,7 +491,7 @@ void DataOut<dim>::build_some_patches (Data data)
             }
        }
 
-                                       // now fill the neighbors fields
+
       for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
         {
                                            // let's look up whether
@@ -502,8 +526,7 @@ void DataOut<dim>::build_some_patches (Data data)
               (cell->neighbor(f)->level() != cell->level()))
             continue;
 
-          const typename DoFHandler<dim>::cell_iterator
-            neighbor = cell->neighbor(f);
+          const cell_iterator neighbor = cell->neighbor(f);
           Assert (static_cast<unsigned int>(neighbor->level()) <
                   data.cell_to_patch_index_map->size(),
                   ExcInternalError());
@@ -535,24 +558,25 @@ void DataOut<dim>::build_some_patches (Data data)
 }
 
 
-template <int dim>
-void DataOut<dim>::build_patches (const unsigned int n_subdivisions,
-                                 const unsigned int n_threads_) 
+
+template <int dim, template <int> class DH>
+void DataOut<dim,DH>::build_patches (const unsigned int n_subdivisions,
+                                    const unsigned int n_threads_) 
 {
   static const MappingQ1<dim> mapping;
   build_patches (mapping, n_subdivisions, n_threads_);
 }
 
 
-template <int dim>
-void DataOut<dim>::build_patches (const Mapping<dim> &mapping,
-                                 const unsigned int n_subdivisions,
-                                 const unsigned int n_threads_) 
+template <int dim, template <int> class DH>
+void DataOut<dim,DH>::build_patches (const Mapping<dim> &mapping,
+                                    const unsigned int n_subdivisions,
+                                    const unsigned int n_threads_) 
 {
   Assert (n_subdivisions >= 1,
          ExcInvalidNumberOfSubdivisions(n_subdivisions));
 
-  typedef DataOut_DoFData<dim,dim> BaseClass;
+  typedef DataOut_DoFData<dim,DH,dim> BaseClass;
   Assert (this->dofs != 0, typename BaseClass::ExcNoDoFHandlerSelected());
 
   const unsigned int n_threads = (DEAL_II_USE_MT ? n_threads_ : 1);
@@ -588,8 +612,7 @@ void DataOut<dim>::build_patches (const Mapping<dim> &mapping,
   for (unsigned int l=0; l<this->dofs->get_tria().n_levels(); ++l) 
     {
       unsigned int max_index = 0;
-      for (typename DoFHandler<dim>::cell_iterator cell=first_cell();
-           cell != this->dofs->end();
+      for (cell_iterator cell=first_cell(); cell != this->dofs->end();
            cell = next_cell(cell))
         if (static_cast<unsigned int>(cell->level()) == l)
           max_index = std::max (max_index,
@@ -600,8 +623,7 @@ void DataOut<dim>::build_patches (const Mapping<dim> &mapping,
     };
                                   
   unsigned int n_patches = 0;
-  for (typename DoFHandler<dim>::cell_iterator cell=first_cell();
-       cell != this->dofs->end();
+  for (cell_iterator cell=first_cell(); cell != this->dofs->end();
        cell = next_cell(cell))
     {
       Assert (static_cast<unsigned int>(cell->level()) <
@@ -655,226 +677,91 @@ void DataOut<dim>::build_patches (const Mapping<dim> &mapping,
 
   Threads::ThreadGroup<> threads;  
   for (unsigned int l=0; l<n_threads; ++l)
-    threads += Threads::spawn (*this, &DataOut<dim>::build_some_patches)(thread_data[l]);
+    threads += Threads::spawn (*this, &DataOut<dim,DH>::build_some_patches)(thread_data[l]);
   threads.join_all();
 }
 
 
-template <int dim>
-typename DoFHandler<dim>::cell_iterator
-DataOut<dim>::first_cell () 
+
+template <int dim, template <int> class DH>
+typename DataOut<dim,DH>::cell_iterator
+DataOut<dim,DH>::first_cell () 
 {
   return this->dofs->begin_active ();
 }
 
 
-template <int dim>
-typename DoFHandler<dim>::cell_iterator
-DataOut<dim>::next_cell (const typename DoFHandler<dim>::cell_iterator &cell) 
+
+template <int dim, template <int> class DH>
+typename DataOut<dim,DH>::cell_iterator
+DataOut<dim,DH>::next_cell (const typename DataOut<dim,DH>::cell_iterator &cell) 
 {
                                   // convert the iterator to an
                                   // active_iterator and advance
                                   // this to the next active cell
-  typename DoFHandler<dim>::active_cell_iterator active_cell = cell;
+  typename DH<dim>::active_cell_iterator active_cell = cell;
   ++active_cell;
   return active_cell;
 }
 
 
-// explicit instantiations
-template class DataOut_DoFData<deal_II_dimension,deal_II_dimension>;
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension>::
-add_data_vector<Vector<double> > (
-  const Vector<double> &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension>::
-add_data_vector<BlockVector<double> > (
-  const BlockVector<double> &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
-
-#ifdef DEAL_II_USE_PETSC
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension>::
-add_data_vector<PETScWrappers::Vector> (
-  const PETScWrappers::Vector &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension>::
-add_data_vector<PETScWrappers::BlockVector> (
-  const PETScWrappers::BlockVector &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
-#endif
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension>::
-add_data_vector<Vector<double> > (
-  const Vector<double> &vec,
-  const std::string    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension>::
-add_data_vector<BlockVector<double> > (
-  const BlockVector<double> &vec,
-  const std::string    &name,
-  const DataVectorType  type);
-
-#ifdef DEAL_II_USE_PETSC
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension>::
-add_data_vector<PETScWrappers::Vector> (
-  const PETScWrappers::Vector &vec,
-  const std::string    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension>::
-add_data_vector<PETScWrappers::BlockVector> (
-  const PETScWrappers::BlockVector &vec,
-  const std::string    &name,
-  const DataVectorType  type);
+// explicit instantiations 
+
+#define INSTANTIATE(D1,DH,D2,D3,V) \
+template void \
+DataOut_DoFData<D1,DH,D2,D3>:: \
+add_data_vector<V > (const V             &, \
+                     const std::string   &, \
+                     const DataVectorType); \
+\
+template void \
+DataOut_DoFData<D1,DH,D2,D3>:: \
+add_data_vector<V > (const V                        &, \
+                     const std::vector<std::string> &, \
+                     const DataVectorType)
+
+#ifndef DEAL_II_USE_PETSC
+# define INSTANTIATE_VECTORS(D1,DH,D2,D3) \
+    INSTANTIATE(D1,DH,D2,D3,Vector<double>); \
+    INSTANTIATE(D1,DH,D2,D3,Vector<float>); \
+    INSTANTIATE(D1,DH,D2,D3,BlockVector<double>) ; \
+    INSTANTIATE(D1,DH,D2,D3,BlockVector<float>)
+#else
+# define INSTANTIATE_VECTORS(D1,DH,D2,D3) \
+    INSTANTIATE(D1,DH,D2,D3,Vector<double>); \
+    INSTANTIATE(D1,DH,D2,D3,Vector<float>); \
+    INSTANTIATE(D1,DH,D2,D3,BlockVector<double>) ; \
+    INSTANTIATE(D1,DH,D2,D3,BlockVector<float>); \
+    INSTANTIATE(D1,DH,D2,D3,PETScWrappers::Vector); \
+    INSTANTIATE(D1,DH,D2,D3,PETScWrappers::BlockVector)
 #endif
 
+// now do actual instantiations, first for DoFHandler...
+template class DataOut_DoFData<deal_II_dimension,DoFHandler,deal_II_dimension>;
+template class DataOut_DoFData<deal_II_dimension,DoFHandler,deal_II_dimension+1>;
+INSTANTIATE_VECTORS(deal_II_dimension,DoFHandler,deal_II_dimension,deal_II_dimension);
+INSTANTIATE_VECTORS(deal_II_dimension,DoFHandler,deal_II_dimension+1,deal_II_dimension+1);
 
-
-template class DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>;
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::
-add_data_vector<Vector<double> > (
-  const Vector<double> &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::
-add_data_vector<BlockVector<double> > (
-  const BlockVector<double> &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
-
-#ifdef DEAL_II_USE_PETSC
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::
-add_data_vector<PETScWrappers::Vector> (
-  const PETScWrappers::Vector &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::
-add_data_vector<PETScWrappers::BlockVector> (
-  const PETScWrappers::BlockVector &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
-#endif
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::
-add_data_vector<Vector<double> > (
-  const Vector<double> &vec,
-  const std::string    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::
-add_data_vector<BlockVector<double> > (
-  const BlockVector<double> &vec,
-  const std::string    &name,
-  const DataVectorType  type);
-
-#ifdef DEAL_II_USE_PETSC
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::
-add_data_vector<PETScWrappers::Vector> (
-  const PETScWrappers::Vector &vec,
-  const std::string    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::
-add_data_vector<PETScWrappers::BlockVector> (
-  const PETScWrappers::BlockVector &vec,
-  const std::string    &name,
-  const DataVectorType  type);
+// for 3d, also generate an extra class
+#if deal_II_dimension >= 2
+template class DataOut_DoFData<deal_II_dimension,DoFHandler,
+                              deal_II_dimension-1,deal_II_dimension>;
+INSTANTIATE_VECTORS(deal_II_dimension,DoFHandler,deal_II_dimension-1,deal_II_dimension);
 #endif
 
+template class DataOut<deal_II_dimension,DoFHandler>;
 
-template class DataOut<deal_II_dimension>;
 
+// ...and now for hpDoFHandler
+template class DataOut_DoFData<deal_II_dimension,hpDoFHandler,deal_II_dimension>;
+template class DataOut_DoFData<deal_II_dimension,hpDoFHandler,deal_II_dimension+1>;
+INSTANTIATE_VECTORS(deal_II_dimension,hpDoFHandler,deal_II_dimension,deal_II_dimension);
+INSTANTIATE_VECTORS(deal_II_dimension,hpDoFHandler,deal_II_dimension+1,deal_II_dimension+1);
 
-
-// for 3d, also generate an extra class
 #if deal_II_dimension >= 2
-template class DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>;
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::
-add_data_vector<Vector<double> > (
-  const Vector<double> &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::
-add_data_vector<BlockVector<double> > (
-  const BlockVector<double> &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
-
-#ifdef DEAL_II_USE_PETSC
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::
-add_data_vector<PETScWrappers::Vector> (
-  const PETScWrappers::Vector &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::
-add_data_vector<PETScWrappers::BlockVector> (
-  const PETScWrappers::BlockVector &vec,
-  const std::vector<std::string>    &name,
-  const DataVectorType  type);
+template class DataOut_DoFData<deal_II_dimension,hpDoFHandler,
+                              deal_II_dimension-1,deal_II_dimension>;
+INSTANTIATE_VECTORS(deal_II_dimension,hpDoFHandler,deal_II_dimension-1,deal_II_dimension);
 #endif
 
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::
-add_data_vector<Vector<double> > (
-  const Vector<double> &vec,
-  const std::string    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::
-add_data_vector<BlockVector<double> > (
-  const BlockVector<double> &vec,
-  const std::string    &name,
-  const DataVectorType  type);
-
-#ifdef DEAL_II_USE_PETSC
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::
-add_data_vector<PETScWrappers::Vector> (
-  const PETScWrappers::Vector &vec,
-  const std::string    &name,
-  const DataVectorType  type);
-
-template void
-DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::
-add_data_vector<PETScWrappers::BlockVector> (
-  const PETScWrappers::BlockVector &vec,
-  const std::string    &name,
-  const DataVectorType  type);
-#endif
-
-#endif
+template class DataOut<deal_II_dimension,hpDoFHandler>;
index fac5eafa54bb866abd814d7afccb9f9f50ffa670..2393155a3440af3ede6f8a9d2abaff02011ba815 100644 (file)
 #include <grid/tria_iterator.h>
 #include <fe/fe.h>
 #include <fe/fe_values.h>
+#include <fe/hp_fe_values.h>
+#include <fe/select_fe_values.h>
 #include <fe/mapping_q1.h>
 
 
 
-template <int dim>
-void DataOutFaces<dim>::build_some_patches (Data data)
+template <int dim, template <int> class DH>
+void DataOutFaces<dim,DH>::build_some_patches (Data data)
 {
   QTrapez<1>        q_trapez;
   QIterated<dim-1>  patch_points (q_trapez, data.n_subdivisions);
@@ -39,8 +41,9 @@ void DataOutFaces<dim>::build_some_patches (Data data)
                                   // we don't support anything else
                                   // as well
   static const MappingQ1<dim> mapping;
-  FEFaceValues<dim> fe_patch_values (mapping, this->dofs->get_fe(),
-                                    patch_points, update_values);
+  typename SelectFEValues<DH<dim> >::FEFaceValues
+    x_fe_patch_values (mapping, this->dofs->get_fe(),
+                       patch_points, update_values);
 
   const unsigned int n_q_points = patch_points.n_quadrature_points;
   
@@ -65,7 +68,9 @@ void DataOutFaces<dim>::build_some_patches (Data data)
       
       if (data.n_datasets > 0)
        {
-         fe_patch_values.reinit (face.first, face.second);
+         x_fe_patch_values.reinit (face.first, face.second);
+          const FEFaceValues<dim> &fe_patch_values
+            = x_fe_patch_values.get_present_fe_values ();
          
                                           // first fill dof_data
          for (unsigned int dataset=0; dataset<this->dof_data.size(); ++dataset)
@@ -108,7 +113,7 @@ void DataOutFaces<dim>::build_some_patches (Data data)
              Assert (face.first->active(), ExcCellNotActiveForCellData());
              const unsigned int cell_number
                = std::distance (this->dofs->begin_active(),
-                                typename DoFHandler<dim>::active_cell_iterator(face.first));
+                                typename DH<dim>::active_cell_iterator(face.first));
 
               const double value
                 = this->cell_data[dataset]->get_cell_data_value (cell_number);
@@ -130,14 +135,14 @@ void DataOutFaces<dim>::build_some_patches (Data data)
 
 
 
-template <int dim>
-void DataOutFaces<dim>::build_patches (const unsigned int n_subdivisions,
-                                      const unsigned int n_threads_) 
+template <int dim, template <int> class DH>
+void DataOutFaces<dim,DH>::build_patches (const unsigned int n_subdivisions,
+                                         const unsigned int n_threads_) 
 {
   Assert (n_subdivisions >= 1,
          ExcInvalidNumberOfSubdivisions(n_subdivisions));
 
-  typedef DataOut_DoFData<dim,dim+1> BaseClass;
+  typedef DataOut_DoFData<dim,DH,dim+1> BaseClass;
   Assert (this->dofs != 0, typename BaseClass::ExcNoDoFHandlerSelected());
 
   const unsigned int n_threads = (DEAL_II_USE_MT ? n_threads_ : 1);
@@ -200,7 +205,7 @@ void DataOutFaces<dim>::build_patches (const unsigned int n_subdivisions,
     {
       Threads::ThreadGroup<> threads;  
       for (unsigned int l=0;l<n_threads;++l)
-        threads += Threads::spawn (*this, &DataOutFaces<dim>::build_some_patches)(thread_data[l]);
+        threads += Threads::spawn (*this, &DataOutFaces<dim,DH>::build_some_patches)(thread_data[l]);
       threads.join_all();
     }
   else
@@ -210,13 +215,13 @@ void DataOutFaces<dim>::build_patches (const unsigned int n_subdivisions,
 
 
 
-template <int dim>
-typename DataOutFaces<dim>::FaceDescriptor
-DataOutFaces<dim>::first_face () 
+template <int dim, template <int> class DH>
+typename DataOutFaces<dim,DH>::FaceDescriptor
+DataOutFaces<dim,DH>::first_face () 
 {
                                   // simply find first active cell
                                   // with a face on the boundary
-  typename DoFHandler<dim>::active_cell_iterator cell = this->dofs->begin_active();
+  typename DH<dim>::active_cell_iterator cell = this->dofs->begin_active();
   for (; cell != this->dofs->end(); ++cell)
     for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
       if (cell->face(f)->at_boundary())
@@ -231,9 +236,9 @@ DataOutFaces<dim>::first_face ()
 
 
 
-template <int dim>
-typename DataOutFaces<dim>::FaceDescriptor
-DataOutFaces<dim>::next_face (const FaceDescriptor &old_face)
+template <int dim, template <int> class DH>
+typename DataOutFaces<dim,DH>::FaceDescriptor
+DataOutFaces<dim,DH>::next_face (const FaceDescriptor &old_face)
 {
   FaceDescriptor face = old_face;
   
@@ -255,7 +260,7 @@ DataOutFaces<dim>::next_face (const FaceDescriptor &old_face)
                                   // convert the iterator to an
                                   // active_iterator and advance
                                   // this to the next active cell
-  typename DoFHandler<dim>::active_cell_iterator active_cell = face.first;
+  typename DH<dim>::active_cell_iterator active_cell = face.first;
 
                                   // increase face pointer by one
   ++active_cell;
@@ -289,5 +294,6 @@ DataOutFaces<dim>::next_face (const FaceDescriptor &old_face)
 // explicit instantiations
 // don't instantiate anything for the 1d and 2d cases
 #if deal_II_dimension >=2
-template class DataOutFaces<deal_II_dimension>;
+template class DataOutFaces<deal_II_dimension,DoFHandler>;
+template class DataOutFaces<deal_II_dimension,hpDoFHandler>;
 #endif
index 4be55feb7db77a21113f425ccdf1b846067f03a0..4584f47d24e1907e731cc2ec9acb174104688e15 100644 (file)
@@ -22,6 +22,8 @@
 #include <grid/tria_iterator.h>
 #include <fe/fe.h>
 #include <fe/fe_values.h>
+#include <fe/hp_fe_values.h>
+#include <fe/select_fe_values.h>
 #include <fe/mapping_q1.h>
 #include <numerics/data_out_rotation.h>
 
@@ -29,8 +31,8 @@
 
 
 
-template <int dim>
-void DataOutRotation<dim>::build_some_patches (Data data)
+template <int dim, template <int> class DH>
+void DataOutRotation<dim,DH>::build_some_patches (Data data)
 {
   QTrapez<1>     q_trapez;
   QIterated<dim> patch_points (q_trapez, data.n_subdivisions);
@@ -41,8 +43,9 @@ void DataOutRotation<dim>::build_some_patches (Data data)
                                   // we don't support anything else
                                   // as well
   static const MappingQ1<dim> mapping;
-  FEValues<dim> fe_patch_values (mapping, this->dofs->get_fe(),
-                                patch_points, update_values);
+  typename SelectFEValues<DH<dim> >::FEValues
+    x_fe_patch_values (mapping, this->dofs->get_fe(),
+                       patch_points, update_values);
 
   const unsigned int n_patches_per_circle = data.n_patches_per_circle;
 
@@ -73,7 +76,7 @@ void DataOutRotation<dim>::build_some_patches (Data data)
   unsigned int cell_number = 0;
   typename std::vector< ::DataOutBase::Patch<dim+1> >::iterator
     patch = this->patches.begin();
-  typename DoFHandler<dim>::cell_iterator cell=first_cell();
+  cell_iterator cell=first_cell();
 
                                   // get first cell in this thread
   for (unsigned int i=0; (i<data.this_thread)&&(cell != this->dofs->end()); ++i)
@@ -152,8 +155,10 @@ void DataOutRotation<dim>::build_some_patches (Data data)
                                           // then fill in data
          if (data.n_datasets > 0)
            {
-             fe_patch_values.reinit (cell);
-             
+             x_fe_patch_values.reinit (cell);
+              const FEValues<dim> &fe_patch_values
+                = x_fe_patch_values.get_present_fe_values ();
+
                                               // first fill dof_data
              for (unsigned int dataset=0; dataset<this->dof_data.size(); ++dataset)
                {
@@ -286,7 +291,7 @@ void DataOutRotation<dim>::build_some_patches (Data data)
 #if deal_II_dimension == 3
 
 template <>
-void DataOutRotation<3>::build_some_patches (Data)
+void DataOutRotation<3,DoFHandler>::build_some_patches (Data)
 {
                                   // would this function make any
                                   // sense after all? who would want
@@ -299,15 +304,15 @@ void DataOutRotation<3>::build_some_patches (Data)
 
 
 
-template <int dim>
-void DataOutRotation<dim>::build_patches (const unsigned int n_patches_per_circle,
-                                         const unsigned int n_subdivisions,
-                                         const unsigned int n_threads_) 
+template <int dim, template <int> class DH>
+void DataOutRotation<dim,DH>::build_patches (const unsigned int n_patches_per_circle,
+                                            const unsigned int n_subdivisions,
+                                            const unsigned int n_threads_) 
 {
   Assert (n_subdivisions >= 1,
          ExcInvalidNumberOfSubdivisions(n_subdivisions));
 
-  typedef DataOut_DoFData<dim,dim+1> BaseClass;
+  typedef DataOut_DoFData<dim,DH,dim+1> BaseClass;
   Assert (this->dofs != 0, typename BaseClass::ExcNoDoFHandlerSelected());
 
   const unsigned int n_threads = (DEAL_II_USE_MT ? n_threads_ : 1);
@@ -335,8 +340,7 @@ void DataOutRotation<dim>::build_patches (const unsigned int n_patches_per_circl
                                   // create patches of and make sure
                                   // there is enough memory for that
   unsigned int n_patches = 0;
-  for (typename DoFHandler<dim>::cell_iterator cell=first_cell();
-       cell != this->dofs->end();
+  for (cell_iterator cell=first_cell(); cell != this->dofs->end();
        cell = next_cell(cell))
     ++n_patches;
                                   // then also take into account that
@@ -376,8 +380,8 @@ void DataOutRotation<dim>::build_patches (const unsigned int n_patches_per_circl
 
   if (DEAL_II_USE_MT)
     {
-      void (DataOutRotation<dim>::*p) (Data)
-        = &DataOutRotation<dim>::build_some_patches;
+      void (DataOutRotation<dim,DH>::*p) (Data)
+        = &DataOutRotation<dim,DH>::build_some_patches;
 
       Threads::ThreadGroup<> threads;
       for (unsigned int l=0;l<n_threads;++l)
@@ -391,26 +395,26 @@ void DataOutRotation<dim>::build_patches (const unsigned int n_patches_per_circl
 
 
 
-template <int dim>
-typename DoFHandler<dim>::cell_iterator
-DataOutRotation<dim>::first_cell () 
+template <int dim, template <int> class DH>
+typename DataOutRotation<dim,DH>::cell_iterator
+DataOutRotation<dim,DH>::first_cell () 
 {
   return this->dofs->begin_active ();
 }
 
 
-template <int dim>
-typename DoFHandler<dim>::cell_iterator
-DataOutRotation<dim>::next_cell (const typename DoFHandler<dim>::cell_iterator &cell) 
+template <int dim, template <int> class DH>
+typename DataOutRotation<dim,DH>::cell_iterator
+DataOutRotation<dim,DH>::next_cell (const cell_iterator &cell) 
 {
                                   // convert the iterator to an
                                   // active_iterator and advance
                                   // this to the next active cell
-  typename DoFHandler<dim>::active_cell_iterator active_cell = cell;
+  typename DH<dim>::active_cell_iterator active_cell = cell;
   ++active_cell;
   return active_cell;
 }
 
 
 // explicit instantiations
-template class DataOutRotation<deal_II_dimension>;
+template class DataOutRotation<deal_II_dimension,DoFHandler>;
index aad6f5c855700dac30a7d2d718ae0189b264e0ef..7170863254993ec0cbcb06e85260eb9493e0e160 100644 (file)
@@ -22,6 +22,8 @@
 #include <grid/tria_iterator.h>
 #include <fe/fe.h>
 #include <fe/fe_values.h>
+#include <fe/hp_fe_values.h>
+#include <fe/select_fe_values.h>
 #include <fe/mapping_q1.h>
 
 #ifdef HAVE_STD_STRINGSTREAM
 #  include <strstream>
 #endif
 
-
-template <int dim>
+template <int dim, template <int> class DH>
 unsigned int
-DataOutStack<dim>::DataVector::memory_consumption () const
+DataOutStack<dim,DH>::DataVector::memory_consumption () const
 {
   return (MemoryConsumption::memory_consumption (data) +
          MemoryConsumption::memory_consumption (names));
@@ -41,14 +42,14 @@ DataOutStack<dim>::DataVector::memory_consumption () const
 
 
 
-template <int dim>
-DataOutStack<dim>::~DataOutStack ()
+template <int dim, template <int> class DH>
+DataOutStack<dim,DH>::~DataOutStack ()
 {}
 
 
-template <int dim>
-void DataOutStack<dim>::new_parameter_value (const double p,
-                                            const double dp)
+template <int dim, template <int> class DH>
+void DataOutStack<dim,DH>::new_parameter_value (const double p,
+                                               const double dp)
 {
   parameter      = p;
   parameter_step = dp;
@@ -70,16 +71,16 @@ void DataOutStack<dim>::new_parameter_value (const double p,
 }
 
 
-template <int dim>
-void DataOutStack<dim>::attach_dof_handler (const DoFHandler<dim> &dof) 
+template <int dim, template <int> class DH>
+void DataOutStack<dim,DH>::attach_dof_handler (const DH<dim> &dof) 
 {
   dof_handler = &dof;
 }
 
 
-template <int dim>
-void DataOutStack<dim>::declare_data_vector (const std::string &name,
-                                            const VectorType   vector_type)
+template <int dim, template <int> class DH>
+void DataOutStack<dim,DH>::declare_data_vector (const std::string &name,
+                                               const VectorType   vector_type)
 {
   std::vector<std::string> names;
   names.push_back (name);
@@ -87,9 +88,9 @@ void DataOutStack<dim>::declare_data_vector (const std::string &name,
 }
 
 
-template <int dim>
-void DataOutStack<dim>::declare_data_vector (const std::vector<std::string> &names,
-                                            const VectorType    vector_type)
+template <int dim, template <int> class DH>
+void DataOutStack<dim,DH>::declare_data_vector (const std::vector<std::string> &names,
+                                               const VectorType    vector_type)
 {
                                   // make sure this function is
                                   // not called after some parameter
@@ -127,10 +128,10 @@ void DataOutStack<dim>::declare_data_vector (const std::vector<std::string> &nam
 }
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <typename number>
-void DataOutStack<dim>::add_data_vector (const Vector<number> &vec,
-                                        const std::string    &name)
+void DataOutStack<dim,DH>::add_data_vector (const Vector<number> &vec,
+                                           const std::string    &name)
 {
   const unsigned int n_components = dof_handler->get_fe().n_components ();
 
@@ -167,10 +168,10 @@ void DataOutStack<dim>::add_data_vector (const Vector<number> &vec,
 }
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 template <typename number>
-void DataOutStack<dim>::add_data_vector (const Vector<number> &vec,
-                                        const std::vector<std::string> &names)
+void DataOutStack<dim,DH>::add_data_vector (const Vector<number> &vec,
+                                           const std::vector<std::string> &names)
 {
   Assert (dof_handler != 0, ExcNoDoFHandlerSelected ());
                                   // either cell data and one name,
@@ -234,8 +235,8 @@ void DataOutStack<dim>::add_data_vector (const Vector<number> &vec,
 }
 
 
-template <int dim>
-void DataOutStack<dim>::build_patches (const unsigned int n_subdivisions) 
+template <int dim, template <int> class DH>
+void DataOutStack<dim,DH>::build_patches (const unsigned int n_subdivisions) 
 {
                                   // this is mostly copied from the
                                   // DataOut class
@@ -251,7 +252,7 @@ void DataOutStack<dim>::build_patches (const unsigned int n_subdivisions)
                                   // create patches of and make sure
                                   // there is enough memory for that
   unsigned int n_patches = 0;
-  for (typename DoFHandler<dim>::active_cell_iterator
+  for (typename DH<dim>::active_cell_iterator
         cell=dof_handler->begin_active();
        cell != dof_handler->end(); ++cell)
     ++n_patches;
@@ -272,8 +273,9 @@ void DataOutStack<dim>::build_patches (const unsigned int n_subdivisions)
                                   // we don't support anything else
                                   // as well
   static const MappingQ1<dim> mapping;
-  FEValues<dim>  fe_patch_values (mapping, dof_handler->get_fe(),
-                                 patch_points, update_values);
+  typename SelectFEValues<DH<dim> >::FEValues
+    x_fe_patch_values (mapping, dof_handler->get_fe(),
+                       patch_points, update_values);
   const unsigned int n_q_points = patch_points.n_quadrature_points;
   std::vector<double>          patch_values (n_q_points);
   std::vector<Vector<double> > patch_values_system (n_q_points,
@@ -294,7 +296,7 @@ void DataOutStack<dim>::build_patches (const unsigned int n_subdivisions)
   typename std::vector< ::DataOutBase::Patch<dim+1,dim+1> >::iterator
     patch = patches.begin() + (patches.size()-n_patches);
   unsigned int cell_number = 0;
-  for (typename DoFHandler<dim>::active_cell_iterator cell=dof_handler->begin_active();
+  for (typename DH<dim>::active_cell_iterator cell=dof_handler->begin_active();
        cell != dof_handler->end(); ++cell, ++patch, ++cell_number)
     {
       Assert (patch != patches.end(), ExcInternalError());
@@ -396,7 +398,9 @@ void DataOutStack<dim>::build_patches (const unsigned int n_subdivisions)
                                       // in succession
       if (n_datasets > 0)
        {
-         fe_patch_values.reinit (cell);
+         x_fe_patch_values.reinit (cell);
+          const FEValues<dim> &fe_patch_values
+            = x_fe_patch_values.get_present_fe_values ();
          
                                           // first fill dof_data
          for (unsigned int dataset=0; dataset<dof_data.size(); ++dataset)
@@ -437,8 +441,8 @@ void DataOutStack<dim>::build_patches (const unsigned int n_subdivisions)
 }
 
 
-template <int dim>
-void DataOutStack<dim>::finish_parameter_value ()
+template <int dim, template <int> class DH>
+void DataOutStack<dim,DH>::finish_parameter_value ()
 {
                                   // release lock on dof handler
   dof_handler = 0;
@@ -453,9 +457,9 @@ void DataOutStack<dim>::finish_parameter_value ()
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 unsigned int
-DataOutStack<dim>::memory_consumption () const
+DataOutStack<dim,DH>::memory_consumption () const
 {
   return (DataOutInterface<dim+1>::memory_consumption () +
          MemoryConsumption::memory_consumption (parameter) +
@@ -468,17 +472,17 @@ DataOutStack<dim>::memory_consumption () const
 
 
 
-template <int dim>
+template <int dim, template <int> class DH>
 const std::vector< ::DataOutBase::Patch<dim+1,dim+1> > &
-DataOutStack<dim>::get_patches () const
+DataOutStack<dim,DH>::get_patches () const
 {
   return patches;
 }
 
 
 
-template <int dim>
-std::vector<std::string> DataOutStack<dim>::get_dataset_names () const
+template <int dim, template <int> class DH>
+std::vector<std::string> DataOutStack<dim,DH>::get_dataset_names () const
 {
   std::vector<std::string> names;
   for (typename std::vector<DataVector>::const_iterator dataset=dof_data.begin();
@@ -493,17 +497,21 @@ std::vector<std::string> DataOutStack<dim>::get_dataset_names () const
 
 
 // explicit instantiations
-template class DataOutStack<deal_II_dimension>;
+template class DataOutStack<deal_II_dimension,DoFHandler>;
 
-template void DataOutStack<deal_II_dimension>::
+template void DataOutStack<deal_II_dimension,DoFHandler>::
 add_data_vector<double> (const Vector<double> &vec,
                         const std::string    &name);
 
-template void DataOutStack<deal_II_dimension>::
-add_data_vector<double> (const Vector<double> &vec,
-                        const std::vector<std::string> &names);
+template void DataOutStack<deal_II_dimension,DoFHandler>::
+add_data_vector<float> (const Vector<float>  &vec,
+                       const std::string    &name);
 
-template void DataOutStack<deal_II_dimension>::
+template class DataOutStack<deal_II_dimension,hpDoFHandler>;
+template void DataOutStack<deal_II_dimension,hpDoFHandler>::
+add_data_vector<double> (const Vector<double> &vec,
+                        const std::string    &name);
+template void DataOutStack<deal_II_dimension,hpDoFHandler>::
 add_data_vector<float> (const Vector<float>  &vec,
                        const std::string    &name);
 
index d6e6ab923ecc62956e53751a33159f0d25b10023..2a1413c50348d0bf99e694402abc8e374c40b807 100644 (file)
@@ -24,6 +24,8 @@
 #include <dofs/dof_handler.h>
 #include <fe/fe.h>
 #include <fe/fe_values.h>
+#include <fe/hp_fe_values.h>
+#include <fe/select_fe_values.h>
 #include <fe/mapping_q1.h>
 #include <numerics/derivative_approximation.h>
 
@@ -304,11 +306,11 @@ C DEFINE A TEST MATRIX
   double EE[3] = { 0, 0, 0 };
                                   // the eigenvalues are away from
                                   // @p{am} in the order of R. thus,
-                                  // if R<<AM, then we have
+                                  // if R<<AM, then we have the
                                   // degenerate case with three
                                   // identical eigenvalues. check
                                   // this first
-  if (R < 1e-14*std::fabs(am))
+  if (R <= 1e-14*std::fabs(am))
     EE[0] = EE[1] = EE[2] = am;
   else
     {
@@ -386,27 +388,27 @@ DerivativeApproximation::SecondDerivative<dim>::symmetrize (Derivative &d)
 
 
 
-template <int dim, class InputVector>
+template <int dim, template <int> class DH, class InputVector>
 void 
 DerivativeApproximation::
 approximate_gradient (const Mapping<dim>    &mapping,
-                     const DoFHandler<dim> &dof_handler,
+                     const DH<dim>         &dof_handler,
                      const InputVector     &solution,
                      Vector<float>         &derivative_norm,
                      const unsigned int     component)
 {
   approximate_derivative<Gradient<dim>,dim> (mapping,
-                                            dof_handler,
-                                            solution,
-                                            component,
-                                            derivative_norm);
+                                             dof_handler,
+                                             solution,
+                                             component,
+                                             derivative_norm);
 }
 
 
-template <int dim, class InputVector>
+template <int dim, template <int> class DH, class InputVector>
 void 
 DerivativeApproximation::
-approximate_gradient (const DoFHandler<dim> &dof_handler,
+approximate_gradient (const DH<dim>         &dof_handler,
                      const InputVector     &solution,
                      Vector<float>         &derivative_norm,
                      const unsigned int     component)
@@ -414,18 +416,18 @@ approximate_gradient (const DoFHandler<dim> &dof_handler,
   Assert (DEAL_II_COMPAT_MAPPING, ExcCompatibility("mapping"));
   static const MappingQ1<dim> mapping;
   approximate_derivative<Gradient<dim>,dim> (mapping,
-                                            dof_handler,
-                                            solution,
-                                            component,
-                                            derivative_norm);
+                                             dof_handler,
+                                             solution,
+                                             component,
+                                             derivative_norm);
 }
 
 
-template <int dim, class InputVector>
+template <int dim, template <int> class DH, class InputVector>
 void 
 DerivativeApproximation::
 approximate_second_derivative (const Mapping<dim>    &mapping,
-                              const DoFHandler<dim> &dof_handler,
+                              const DH<dim>         &dof_handler,
                               const InputVector     &solution,
                               Vector<float>         &derivative_norm,
                               const unsigned int     component)
@@ -438,10 +440,10 @@ approximate_second_derivative (const Mapping<dim>    &mapping,
 }
 
 
-template <int dim, class InputVector>
+template <int dim, template <int> class DH, class InputVector>
 void 
 DerivativeApproximation::
-approximate_second_derivative (const DoFHandler<dim> &dof_handler,
+approximate_second_derivative (const DH<dim>         &dof_handler,
                               const InputVector     &solution,
                               Vector<float>         &derivative_norm,
                               const unsigned int     component)
@@ -456,11 +458,36 @@ approximate_second_derivative (const DoFHandler<dim> &dof_handler,
 }
 
 
-template <class DerivativeDescription, int dim, class InputVector>
+namespace WorkAround
+{
+// gcc 2.95 is not happy if we take the address of a template function as in
+//
+//  DerivativeApproximation::template approximate<DerivativeDescription,dim,DH>
+//
+// if one of the template arguments is a template-template
+// parameter. so work around this problem in a rather unnerving and
+// weird way, but at least it works
+  template <template <int> class DH> struct IsHP
+  {
+      static const bool value = false;
+  };
+  template <template <int> class DH> const bool IsHP<DH>::value;
+
+  template <> struct IsHP<hpDoFHandler>
+  {
+      static const bool value = true;
+  };
+  const bool IsHP<hpDoFHandler>::value;  
+}
+
+
+
+template <class DerivativeDescription, int dim,
+          template <int> class DH, class InputVector>
 void 
 DerivativeApproximation::
 approximate_derivative (const Mapping<dim>    &mapping,
-                       const DoFHandler<dim> &dof_handler,
+                       const DH<dim>         &dof_handler,
                        const InputVector     &solution,
                        const unsigned int     component,
                        Vector<float>         &derivative_norm)
@@ -473,14 +500,25 @@ approximate_derivative (const Mapping<dim>    &mapping,
   std::vector<IndexInterval> index_intervals
     = Threads::split_interval (0, dof_handler.get_tria().n_active_cells(),
                               n_threads);
+
   Threads::ThreadGroup<> threads;
-  void (*fun_ptr) (const Mapping<dim>    &,
-                  const DoFHandler<dim> &,
-                  const InputVector     &,
-                  const unsigned int     ,
-                  const IndexInterval   &,
-                  Vector<float>         &)
-    = &DerivativeApproximation::template approximate<DerivativeDescription,dim,InputVector>;
+  
+  typedef void (*FunPtr) (const Mapping<dim>    &,
+                          const DH<dim>         &,
+                          const InputVector     &,
+                          const unsigned int     ,
+                          const IndexInterval   &,
+                          Vector<float>         &);
+
+#ifdef DEAL_II_FUNPTR_TEMPLATE_TEMPLATE_BUG
+  const FunPtr fun_ptr
+    = (WorkAround::IsHP<DH>::value ?
+       &DerivativeApproximation::template approximate<DerivativeDescription,dim,hpDoFHandler,InputVector> :
+       &DerivativeApproximation::template approximate<DerivativeDescription,dim,DoFHandler,InputVector>);
+#else
+  const FunPtr fun_ptr
+    = &DerivativeApproximation::template approximate<DerivativeDescription,dim,DH,InputVector>;
+#endif
   for (unsigned int i=0; i<n_threads; ++i)
     threads += Threads::spawn (fun_ptr)(mapping, dof_handler, solution, component,
                                         index_intervals[i],
@@ -490,20 +528,22 @@ approximate_derivative (const Mapping<dim>    &mapping,
 
 
 
-template <class DerivativeDescription, int dim, class InputVector>
+template <class DerivativeDescription, int dim,
+          template <int> class DH, class InputVector>
 void 
 DerivativeApproximation::approximate (const Mapping<dim>    &mapping,
-                                     const DoFHandler<dim> &dof_handler,
+                                     const DH<dim>         &dof_handler,
                                      const InputVector     &solution,
                                      const unsigned int     component,
                                      const IndexInterval   &index_interval,
                                      Vector<float>         &derivative_norm)
 {
   QMidpoint<dim> midpoint_rule;
-  FEValues<dim>  fe_midpoint_value (mapping, dof_handler.get_fe(),
-                                   midpoint_rule,
-                                   UpdateFlags(DerivativeDescription::update_flags |
-                                               update_q_points));
+  typename SelectFEValues<DH<dim> >::FEValues
+    x_fe_midpoint_value (mapping, dof_handler.get_fe(),
+                         midpoint_rule,
+                         UpdateFlags(DerivativeDescription::update_flags |
+                                     update_q_points));
   
                                   // matrix Y=sum_i y_i y_i^T
   Tensor<2,dim> Y;
@@ -515,18 +555,18 @@ DerivativeApproximation::approximate (const Mapping<dim>    &mapping,
     derivative_norm_on_this_cell
     = derivative_norm.begin() + index_interval.first;
   
-  typename DoFHandler<dim>::active_cell_iterator cell, endc;
+  typename DH<dim>::active_cell_iterator cell, endc;
   cell = endc = dof_handler.begin_active();
                                   // (static_cast to avoid warnings
                                   // about unsigned always >=0)
-  advance (cell, static_cast<int>(index_interval.first));
-  advance (endc, static_cast<int>(index_interval.second));
+  std::advance (cell, static_cast<int>(index_interval.first));
+  std::advance (endc, static_cast<int>(index_interval.second));
 
                                   // vector to hold iterators to all
                                   // active neighbors of a cell
                                   // reserve the maximal number of
                                   // active neighbors
-  std::vector<typename DoFHandler<dim>::active_cell_iterator> active_neighbors;
+  std::vector<typename DH<dim>::active_cell_iterator> active_neighbors;
   active_neighbors.reserve (GeometryInfo<dim>::faces_per_cell *
                            GeometryInfo<dim>::subfaces_per_face);
 
@@ -540,7 +580,9 @@ DerivativeApproximation::approximate (const Mapping<dim>    &mapping,
       typename DerivativeDescription::Derivative projected_derivative;
 
                                       // reinit fe values object...
-      fe_midpoint_value.reinit (cell);
+      x_fe_midpoint_value.reinit (cell);
+      const FEValues<dim> &fe_midpoint_value
+        = x_fe_midpoint_value.get_present_fe_values();
 
                                       // ...and get the value of the
                                       // projected derivative...
@@ -569,7 +611,7 @@ DerivativeApproximation::approximate (const Mapping<dim>    &mapping,
       for (unsigned int n=0; n<GeometryInfo<dim>::faces_per_cell; ++n)
        if (! cell->at_boundary(n))
          {
-           typename DoFHandler<dim>::cell_iterator
+           typename DH<dim>::cell_iterator
              neighbor = cell->neighbor(n);
            if (neighbor->active())
              active_neighbors.push_back (neighbor);
@@ -594,7 +636,7 @@ DerivativeApproximation::approximate (const Mapping<dim>    &mapping,
                                                 // present cell
                if (dim == 1)
                  {
-                   typename DoFHandler<dim>::cell_iterator
+                   typename DH<dim>::cell_iterator
                      neighbor_child = neighbor;
                    while (neighbor_child->has_children())
                      neighbor_child = neighbor_child->child (n==0 ? 1 : 0);
@@ -619,15 +661,17 @@ DerivativeApproximation::approximate (const Mapping<dim>    &mapping,
                                       // now loop over all active
                                       // neighbors and collect the
                                       // data we need
-      typename std::vector<typename DoFHandler<dim>::active_cell_iterator>::const_iterator
+      typename std::vector<typename DH<dim>::active_cell_iterator>::const_iterator
        neighbor_ptr = active_neighbors.begin();
       for (; neighbor_ptr!=active_neighbors.end(); ++neighbor_ptr)
        {
-         const typename DoFHandler<dim>::active_cell_iterator
+         const typename DH<dim>::active_cell_iterator
            neighbor = *neighbor_ptr;
            
                                           // reinit fe values object...
-         fe_midpoint_value.reinit (neighbor);
+          x_fe_midpoint_value.reinit (neighbor);
+          const FEValues<dim> &fe_midpoint_value
+            = x_fe_midpoint_value.get_present_fe_values();
          
                                           // ...and get the value of the
                                           // solution...
@@ -708,16 +752,16 @@ DerivativeApproximation::approximate (const Mapping<dim>    &mapping,
 }
 
 
-
+// --------------------------------------------------------------------
 
 // explicit instantiations
-#define INSTANTIATE(InputVector)                   \
+#define INSTANTIATE(InputVector,DH)                \
 template                                           \
 void                                               \
 DerivativeApproximation::                          \
 approximate_gradient<deal_II_dimension>            \
 (const Mapping<deal_II_dimension> &mapping,        \
- const DoFHandler<deal_II_dimension> &dof_handler, \
+ const DH<deal_II_dimension> &dof_handler,         \
  const InputVector  &solution,                     \
  Vector<float>         &derivative_norm,           \
  const unsigned int     component);                \
@@ -726,7 +770,7 @@ template                                           \
 void                                               \
 DerivativeApproximation::                          \
 approximate_gradient<deal_II_dimension>            \
-(const DoFHandler<deal_II_dimension> &dof_handler, \
+(const DH<deal_II_dimension> &dof_handler,         \
  const InputVector     &solution,                  \
  Vector<float>         &derivative_norm,           \
  const unsigned int     component);                \
@@ -736,7 +780,7 @@ void                                               \
 DerivativeApproximation::                          \
 approximate_second_derivative<deal_II_dimension>   \
 (const Mapping<deal_II_dimension> &mapping,        \
- const DoFHandler<deal_II_dimension> &dof_handler, \
+ const DH<deal_II_dimension> &dof_handler,         \
  const InputVector  &solution,                     \
  Vector<float>         &derivative_norm,           \
  const unsigned int     component);                \
@@ -745,19 +789,27 @@ template                                           \
 void                                               \
 DerivativeApproximation::                          \
 approximate_second_derivative<deal_II_dimension>   \
-(const DoFHandler<deal_II_dimension> &dof_handler, \
+(const DH<deal_II_dimension> &dof_handler,         \
  const InputVector     &solution,                  \
  Vector<float>         &derivative_norm,           \
  const unsigned int     component)
 
-INSTANTIATE(Vector<double>);
-INSTANTIATE(Vector<float>);
-INSTANTIATE(BlockVector<double>);
-INSTANTIATE(BlockVector<float>);
+INSTANTIATE(Vector<double>, DoFHandler);
+INSTANTIATE(Vector<float>, DoFHandler);
+INSTANTIATE(BlockVector<double>, DoFHandler);
+INSTANTIATE(BlockVector<float>, DoFHandler);
+
+INSTANTIATE(Vector<double>, hpDoFHandler);
+INSTANTIATE(Vector<float>, hpDoFHandler);
+INSTANTIATE(BlockVector<double>, hpDoFHandler);
+INSTANTIATE(BlockVector<float>, hpDoFHandler);
 
 #ifdef DEAL_II_USE_PETSC
-INSTANTIATE(PETScWrappers::Vector);
-INSTANTIATE(PETScWrappers::BlockVector);
+INSTANTIATE(PETScWrappers::Vector, DoFHandler);
+INSTANTIATE(PETScWrappers::BlockVector, DoFHandler);
+
+INSTANTIATE(PETScWrappers::Vector, hpDoFHandler);
+INSTANTIATE(PETScWrappers::BlockVector, hpDoFHandler);
 #endif
 
 
index 7282cc0305929039b4a623e574ed423212165300..e681960f9320d43d44c8e5e93df201710c7282bb 100644 (file)
 
 
 #include <base/function.h>
+#include <base/quadrature.h>
 #include <base/thread_management.h>
 #include <base/multithread_info.h>
+#include <grid/tria_iterator.h>
+#include <grid/geometry_info.h>
 #include <dofs/dof_handler.h>
 #include <dofs/dof_accessor.h>
+#include <dofs/dof_tools.h>
 #include <grid/tria_iterator.h>
 #include <base/geometry_info.h>
 #include <base/quadrature.h>
@@ -471,8 +475,9 @@ MatrixCreator::create_mass_matrix_2 (const Mapping<dim>       &mapping,
          }
 
                                       // transfer everything into the
-                                      // global object
-      mutex.acquire ();
+                                      // global object. lock the
+                                      // matrix meanwhile
+      Threads::ThreadMutex::ScopedLock lock (mutex);
       for (unsigned int i=0; i<dofs_per_cell; ++i)
        for (unsigned int j=0; j<dofs_per_cell; ++j)
          if ((n_components==1) ||
@@ -482,7 +487,6 @@ MatrixCreator::create_mass_matrix_2 (const Mapping<dim>       &mapping,
                        cell_matrix(i,j));
       for (unsigned int i=0; i<dofs_per_cell; ++i)
        rhs_vector(dof_indices[i]) += local_rhs(i);
-      mutex.release ();
     };
 }
 
@@ -587,9 +591,10 @@ create_boundary_mass_matrix_1 (const Mapping<dim>        &mapping,
 {
   const FiniteElement<dim> &fe = dof.get_fe();
   const unsigned int n_components  = fe.n_components();
-  const bool         fe_is_system  = (n_components != 1);  
+  const bool         fe_is_system  = (n_components != 1);
 
-  Assert (matrix.n() == dof.n_boundary_dofs(boundary_functions), ExcInternalError());
+  Assert (matrix.n() == dof.n_boundary_dofs(boundary_functions),
+          ExcInternalError());
   Assert (matrix.n() == matrix.m(), ExcInternalError());
   Assert (matrix.n() == rhs_vector.size(), ExcInternalError());
   Assert (boundary_functions.size() != 0, ExcInternalError());
@@ -845,7 +850,6 @@ create_boundary_mass_matrix_1 (const Mapping<dim>        &mapping,
                                 !=
                                 dofs_on_face_vector.end());
          
-#ifdef DEBUG
                                           // in debug mode: compute an element
                                           // in the matrix which is
                                           // guaranteed to belong to a boundary
@@ -868,13 +872,15 @@ create_boundary_mass_matrix_1 (const Mapping<dim>        &mapping,
                                           // must be an element belonging to
                                           // the boundary. we take the maximum
                                           // diagonal entry.
+#ifdef DEBUG
          double max_diag_entry = 0;
          for (unsigned int i=0; i<dofs_per_cell; ++i)
            if (std::fabs(cell_matrix(i,i)) > max_diag_entry)
              max_diag_entry = std::fabs(cell_matrix(i,i));
 #endif  
 
-         mutex.acquire ();
+                                           // lock the matrix
+          Threads::ThreadMutex::ScopedLock lock (mutex);
          for (unsigned int i=0; i<dofs_per_cell; ++i)
            for (unsigned int j=0; j<dofs_per_cell; ++j)
              if (dof_is_on_face[i] && dof_is_on_face[j])
@@ -926,7 +932,6 @@ create_boundary_mass_matrix_1 (const Mapping<dim>        &mapping,
                Assert (std::fabs(cell_vector(j)) <= 1e-10 * max_diag_entry,
                        ExcInternalError());
              };
-         mutex.release ();
        };
 }
 
@@ -1099,8 +1104,9 @@ void MatrixCreator::create_laplace_matrix_1 (const Mapping<dim>       &mapping,
          }
     
                                       // transfer everything into the
-                                      // global object
-      mutex.acquire ();
+                                      // global object. lock the
+                                      // matrix meanwhile
+      Threads::ThreadMutex::ScopedLock lock (mutex);
       for (unsigned int i=0; i<dofs_per_cell; ++i)
        for (unsigned int j=0; j<dofs_per_cell; ++j)
          if ((n_components==1) ||
@@ -1108,7 +1114,6 @@ void MatrixCreator::create_laplace_matrix_1 (const Mapping<dim>       &mapping,
               fe.system_to_component_index(j).first))
            matrix.add (dof_indices[i], dof_indices[j],
                        cell_matrix(i,j));
-      mutex.release ();
     }
 }
 
@@ -1298,8 +1303,9 @@ MatrixCreator::create_laplace_matrix_2 (const Mapping<dim>       &mapping,
          }
 
                                       // transfer everything into the
-                                      // global object
-      mutex.acquire ();
+                                      // global object. lock the
+                                      // matrix meanwhile
+      Threads::ThreadMutex::ScopedLock lock (mutex);
       for (unsigned int i=0; i<dofs_per_cell; ++i)
        for (unsigned int j=0; j<dofs_per_cell; ++j)
          if ((n_components==1) ||
@@ -1309,7 +1315,6 @@ MatrixCreator::create_laplace_matrix_2 (const Mapping<dim>       &mapping,
                        cell_matrix(i,j));
       for (unsigned int i=0; i<dofs_per_cell; ++i)
        rhs_vector(dof_indices[i]) += local_rhs(i);
-      mutex.release ();
     };
 }
 
index c25045dfc4b49431af7335a6762109bad2914a66..d6bc5bc22ccd954440497455b2bfd79a6b4b032b 100644 (file)
 //
 //---------------------------------------------------------------------------
 
+#include <dofs/dof_handler.h>
+#include <dofs/hp_dof_handler.h>
+
+namespace 
+{
+  // Functions for the DoFHandler
+  template <int dim>
+  unsigned int
+  max_dofs_per_cell (const DoFHandler<dim> &dh)
+  {
+    return dh.get_fe().dofs_per_cell;
+  }
+
+
+  template <int dim>
+  unsigned int
+  max_dofs_per_face (const DoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().dofs_per_face;
+  }
+
+
+  template <int dim>
+  unsigned int
+  get_n_components (const DoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().n_components();
+  }
+
+
+  // Functions for the hpDoFHandler
+  template <int dim>
+  unsigned int
+  max_dofs_per_cell (const hpDoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().max_dofs_per_cell ();
+  }
+
+
+  template <int dim>
+  unsigned int
+  max_dofs_per_face (const hpDoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().max_dofs_per_face ();
+  }
+
+
+
+  template <int dim>
+  unsigned int
+  get_n_components (const hpDoFHandler<dim> &dh) 
+  {
+    return dh.get_fe().n_components();
+  }
+}
+
+
 #include<numerics/vectors.templates.h>
 
 // explicit instantiations
@@ -102,6 +159,20 @@ void VectorTools::project_boundary_values<deal_II_dimension>
  std::map<unsigned int,double>        &);
 
 
+
+// Due to introducing the DoFHandler as a template parameter,
+// the following instantiations are required in 1d
+#if deal_II_dimension == 1
+template
+void VectorTools::interpolate_boundary_values<deal_II_dimension> 
+(const Mapping<1>         &,
+ const DoFHandler<1>      &,
+ const unsigned char,
+ const Function<1>        &,
+ std::map<unsigned int,double> &,
+ const std::vector<bool>       &);
+#endif
+
 // the following two functions are not derived from a template in 1d
 // and thus need no explicit instantiation
 #if deal_II_dimension > 1

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.