]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move the get/set_dof_values functions from the cell accessors to the object accessors...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 18 Jan 2000 09:15:43 +0000 (09:15 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 18 Jan 2000 09:15:43 +0000 (09:15 +0000)
git-svn-id: https://svn.dealii.org/trunk@2245 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/Todo
deal.II/deal.II/include/dofs/dof_accessor.h
deal.II/deal.II/include/dofs/mg_dof_accessor.h
deal.II/deal.II/include/multigrid/mg_dof_accessor.h
deal.II/deal.II/source/dofs/dof_accessor.cc
deal.II/deal.II/source/dofs/mg_dof_accessor.cc
deal.II/deal.II/source/multigrid/mg_dof_accessor.cc

index 31f5b0042db5f5bc197416387131623187a1c7e6..830b0ea27b8a8c71b43e369f7870f08ad37c8a08 100644 (file)
@@ -31,10 +31,6 @@ Look at the fill_fe_values functions for possible optimizations
   since this is one of the most often called functions.
 
 
-Use a correct strategy to output the reduction rate for adaptively
-  refined grids in examples/error-estimation
-
-
 In VectorTools::project_boundary_values, no condensation of sparsity
   structures, matrices and right hand sides or distribution of
   solution vectors is performed. This is ok for dim<3 because then
@@ -51,11 +47,6 @@ Check all places where condensation of matrices/vectors and
   of the 3D library.
 
 
-I suppose the [mg_]get_dof_values really belongs to the
-  [MG]Line/QuadAccessor classes, but now it is in the
-  [MG]CellAccessor. Correct this some time.
-
-
 No support points for non-Lagrangian elements? Check for Langrange in
 interpolation?
 
@@ -103,15 +94,6 @@ Change the vector<int> in 'void DoFQuadAccessor::get_dof_indices(
        catch the Error dof_index==-1 inside of this function
 
 
-Remove that pseudo-template clutter in the lower parts of
-        dof_accessor.[templates.]cc marked by comments.
-
-
-Add support for MGTransferPrebuilt and MGSmoother if a user wants
-  to solve exactly on another than the coarsest grid. In this case,
-  some matrices and other arrays need not be computed.
-
-
 Unify lots of code of the two Cuthill-McKee dof renumbering functions
   in numerics/dof_renumbering.cc. This should be rather
   straightforward, since all the unified code needs to get is a
@@ -122,6 +104,11 @@ Unify lots of code of the two Cuthill-McKee dof renumbering functions
 Update documentation on Boundaries in Triangulation<dim> (Guido!)
 
 
+Add support for MGTransferPrebuilt and MGSmoother if a user wants
+  to solve exactly on another than the coarsest grid. In this case,
+  some matrices and other arrays need not be computed.
+
+
 Fix MGTransferPrebuilt::build_matrices, think about diagonals in
 square sparse matrices.
 
@@ -149,3 +136,9 @@ Remove the hack in Make_forward_declarations when using gcc2.95. See
 
 Move the TriaNumberCache into the Triangulation class once the
   compiler supports this (gcc2.95 does not allow this at present)
+
+
+Use a correct strategy to output the reduction rate for adaptively
+  refined grids in examples/error-estimation
+
+
index 85f8d8b48814fec63b273db538079d3751b08f1c..52da7ff0ec41684708bfd558b7c3cb11c69a619a 100644 (file)
@@ -44,7 +44,8 @@
  * @author Wolfgang Bangerth, 1998
  */
 template <int dim>
-class DoFAccessor {
+class DoFAccessor
+{
   public:
                                     /**
                                      * Constructor
@@ -98,6 +99,10 @@ class DoFAccessor {
                                      * Exception
                                      */
     DeclException0 (ExcMatrixDoesNotMatch);
+                                    /**
+                                     * Exception
+                                     */
+    DeclException0 (ExcNotActive);
 
   protected:
                                     /**
@@ -310,6 +315,49 @@ class DoFObjectAccessor<1, dim> :  public DoFAccessor<dim>,
                                      */
     void get_dof_indices (vector<int> &dof_indices) const;
 
+                                    /**
+                                     * Return the values of the given vector
+                                     * restricted to the dofs of this
+                                     * cell in the standard ordering: dofs
+                                     * on vertex 0, dofs on vertex 1, etc,
+                                     * dofs on line 0, dofs on line 1, etc,
+                                     * dofs on quad 0, etc.
+                                     *
+                                     * It is assumed that the vector already
+                                     * has the right size beforehand. This
+                                     * function is only callable for active
+                                     * cells.
+                                     */
+    template <typename number>
+    void get_dof_values (const Vector<number> &values,
+                        Vector<number>       &local_values) const;
+
+                                    /**
+                                     * This function is the counterpart to
+                                     * #get_dof_values#: it takes a vector
+                                     * of values for the degrees of freedom
+                                     * of the cell pointed to by this iterator
+                                     * and writes these values into the global
+                                     * data vector #values#. This function
+                                     * is only callable for active cells.
+                                     *
+                                     * Note that for continuous finite
+                                     * elements, calling this function affects
+                                     * the dof values on neighboring cells as
+                                     * well. It may also violate continuity
+                                     * requirements for hanging nodes, if
+                                     * neighboring cells are less refined than
+                                     * the present one. These requirements
+                                     * are not taken care of and must be
+                                     * enforced by the user afterwards.
+                                     *
+                                     * It is assumed that both vectors already
+                                     * have the right size beforehand.
+                                     */
+    template <typename number>
+    void set_dof_values (const Vector<number> &local_values,
+                        Vector<number>       &values) const;
+
                                     /**
                                      * Return the #i#th child as a DoF line
                                      * iterator. This function is needed since
@@ -434,6 +482,49 @@ class DoFObjectAccessor<2, dim> :  public DoFAccessor<dim>,
                                      */
     void get_dof_indices (vector<int> &dof_indices) const;
 
+                                    /**
+                                     * Return the values of the given vector
+                                     * restricted to the dofs of this
+                                     * cell in the standard ordering: dofs
+                                     * on vertex 0, dofs on vertex 1, etc,
+                                     * dofs on line 0, dofs on line 1, etc,
+                                     * dofs on quad 0, etc.
+                                     *
+                                     * It is assumed that the vector already
+                                     * has the right size beforehand. This
+                                     * function is only callable for active
+                                     * cells.
+                                     */
+    template <typename number>
+    void get_dof_values (const Vector<number> &values,
+                        Vector<number>       &local_values) const;
+
+                                    /**
+                                     * This function is the counterpart to
+                                     * #get_dof_values#: it takes a vector
+                                     * of values for the degrees of freedom
+                                     * of the cell pointed to by this iterator
+                                     * and writes these values into the global
+                                     * data vector #values#. This function
+                                     * is only callable for active cells.
+                                     *
+                                     * Note that for continuous finite
+                                     * elements, calling this function affects
+                                     * the dof values on neighboring cells as
+                                     * well. It may also violate continuity
+                                     * requirements for hanging nodes, if
+                                     * neighboring cells are less refined than
+                                     * the present one. These requirements
+                                     * are not taken care of and must be
+                                     * enforced by the user afterwards.
+                                     *
+                                     * It is assumed that both vectors already
+                                     * have the right size beforehand.
+                                     */
+    template <typename number>
+    void set_dof_values (const Vector<number> &local_values,
+                        Vector<number>       &values) const;
+
                                     /**
                                      *  Return a pointer to the #i#th line
                                      *  bounding this #Quad#.
@@ -568,6 +659,49 @@ class DoFObjectAccessor<3, dim> :  public DoFAccessor<dim>,
                                      */
     void get_dof_indices (vector<int> &dof_indices) const;
 
+                                    /**
+                                     * Return the values of the given vector
+                                     * restricted to the dofs of this
+                                     * cell in the standard ordering: dofs
+                                     * on vertex 0, dofs on vertex 1, etc,
+                                     * dofs on line 0, dofs on line 1, etc,
+                                     * dofs on quad 0, etc.
+                                     *
+                                     * It is assumed that the vector already
+                                     * has the right size beforehand. This
+                                     * function is only callable for active
+                                     * cells.
+                                     */
+    template <typename number>
+    void get_dof_values (const Vector<number> &values,
+                        Vector<number>       &local_values) const;
+
+                                    /**
+                                     * This function is the counterpart to
+                                     * #get_dof_values#: it takes a vector
+                                     * of values for the degrees of freedom
+                                     * of the cell pointed to by this iterator
+                                     * and writes these values into the global
+                                     * data vector #values#. This function
+                                     * is only callable for active cells.
+                                     *
+                                     * Note that for continuous finite
+                                     * elements, calling this function affects
+                                     * the dof values on neighboring cells as
+                                     * well. It may also violate continuity
+                                     * requirements for hanging nodes, if
+                                     * neighboring cells are less refined than
+                                     * the present one. These requirements
+                                     * are not taken care of and must be
+                                     * enforced by the user afterwards.
+                                     *
+                                     * It is assumed that both vectors already
+                                     * have the right size beforehand.
+                                     */
+    template <typename number>
+    void set_dof_values (const Vector<number> &local_values,
+                        Vector<number>       &values) const;
+
                                     /**
                                      *  Return a pointer to the #i#th line
                                      *  bounding this #Hex#.
@@ -693,23 +827,6 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim> {
     TriaIterator<dim, DoFObjectAccessor<dim-1, dim> >
     face (const unsigned int i) const;
 
-                                    /**
-                                     * Return the values of the given vector
-                                     * restricted to the dofs of this
-                                     * cell in the standard ordering: dofs
-                                     * on vertex 0, dofs on vertex 1, etc,
-                                     * dofs on line 0, dofs on line 1, etc,
-                                     * dofs on quad 0, etc.
-                                     *
-                                     * It is assumed that the vector already
-                                     * has the right size beforehand. This
-                                     * function is only callable for active
-                                     * cells.
-                                     */
-    template <typename number>
-    void get_dof_values (const Vector<number> &values,
-                        Vector<number>       &local_values) const;
-
                                     /**
                                      * Return the interpolation of the given
                                      * finite element function to the present
@@ -748,37 +865,20 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim> {
                                      * of each child. It is not yet decided
                                      * what the this function does in these
                                      * cases.
+                                     *
+                                     * Unlike the #get_dof_values#
+                                     * function, this function is
+                                     * associated to cells rather
+                                     * than to lines, quads, and
+                                     * hexes, since interpolation is
+                                     * presently only provided for
+                                     * cells by the finite element
+                                     * objects.
                                      */
     template <typename number>
     void get_interpolated_dof_values (const Vector<number> &values,
                                      Vector<number>       &interpolated_values) const;
 
-                                    /**
-                                     * This function is the counterpart to
-                                     * #get_dof_values#: it takes a vector
-                                     * of values for the degrees of freedom
-                                     * of the cell pointed to by this iterator
-                                     * and writes these values into the global
-                                     * data vector #values#. This function
-                                     * is only callable for active cells.
-                                     *
-                                     * Note that for continuous finite
-                                     * elements, calling this function affects
-                                     * the dof values on neighboring cells as
-                                     * well. It may also violate continuity
-                                     * requirements for hanging nodes, if
-                                     * neighboring cells are less refined than
-                                     * the present one. These requirements
-                                     * are not taken care of and must be
-                                     * enforced by the user afterwards.
-                                     *
-                                     * It is assumed that both vectors already
-                                     * have the right size beforehand.
-                                     */
-    template <typename number>
-    void set_dof_values (const Vector<number> &local_values,
-                        Vector<number>       &values) const;
-
                                     /**
                                      * This, again, is the counterpart to
                                      * #get_interpolated_dof_values#: you
@@ -831,6 +931,15 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim> {
                                      * element class for a description of what
                                      * the prolongation matrices represent in
                                      * this case.
+                                     *
+                                     * Unlike the #set_dof_values#
+                                     * function, this function is
+                                     * associated to cells rather
+                                     * than to lines, quads, and
+                                     * hexes, since interpolation is
+                                     * presently only provided for
+                                     * cells by the finite element
+                                     * objects.
                                      */
     template <typename number>
     void set_dof_values_by_interpolation (const Vector<number> &local_values,
@@ -840,10 +949,6 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim> {
                                      *  Exception
                                      */
     DeclException0 (ExcNotUsefulForThisDimension);
-                                    /**
-                                     * Exception
-                                     */
-    DeclException0 (ExcNotActive);
 };
 
 
index 7e94014b42084f8e21296e020da168a733ca20b3..4b30be0c8a28209f758e5b071cb003f7f6ecb279 100644 (file)
@@ -287,6 +287,27 @@ class MGDoFObjectAccessor<1, dim> :  public MGDoFAccessor<dim>,
                                      */
     void get_mg_dof_indices (vector<int> &dof_indices) const;
 
+                                    /**
+                                     * Return the value of the given vector
+                                     * restricted to the dofs of this
+                                     * cell in the standard ordering: dofs
+                                     * on vertex 0, dofs on vertex 1, etc,
+                                     * dofs on line 0, dofs on line 1, etc,
+                                     * dofs on quad 0, etc.
+                                     *
+                                     * It is assumed that the vector already
+                                     * has the right size beforehand. The
+                                     * indices refer to the multilevel
+                                     * numbering local to the present
+                                     * level of this cell. The vector shall
+                                     * therefore have the same number of
+                                     * entries as there are degrees of
+                                     * freedom on this level.
+                                     */
+    template <typename number>
+    void get_mg_dof_values (const Vector<number> &values,
+                           Vector<number>       &dof_values) const;
+
                                     /**
                                      * Return the #i#th child as a MGDoF line
                                      * iterator. This function is needed since
@@ -385,8 +406,29 @@ class MGDoFObjectAccessor<2, dim> :  public MGDoFAccessor<dim>,
                                      * for the level this quad lives on.
                                      */
     void get_mg_dof_indices (vector<int> &dof_indices) const;
-
                                     /**
+                                     * Return the value of the given vector
+                                     * restricted to the dofs of this
+                                     * cell in the standard ordering: dofs
+                                     * on vertex 0, dofs on vertex 1, etc,
+                                     * dofs on line 0, dofs on line 1, etc,
+                                     * dofs on quad 0, etc.
+                                     *
+                                     * It is assumed that the vector already
+                                     * has the right size beforehand. The
+                                     * indices refer to the multilevel
+                                     * numbering local to the present
+                                     * level of this cell. The vector shall
+                                     * therefore have the same number of
+                                     * entries as there are degrees of
+                                     * freedom on this level.
+                                     */
+    template <typename number>
+    void get_mg_dof_values (const Vector<number> &values,
+                           Vector<number>       &dof_values) const;
+
+                                    /**
                                      * Return a pointer to the #i#th line
                                      * bounding this #Quad#.
                                      */
@@ -491,6 +533,27 @@ class MGDoFObjectAccessor<3, dim> :  public MGDoFAccessor<dim>,
                                      */
     void get_mg_dof_indices (vector<int> &dof_indices) const;
 
+                                    /**
+                                     * Return the value of the given vector
+                                     * restricted to the dofs of this
+                                     * cell in the standard ordering: dofs
+                                     * on vertex 0, dofs on vertex 1, etc,
+                                     * dofs on line 0, dofs on line 1, etc,
+                                     * dofs on quad 0, etc.
+                                     *
+                                     * It is assumed that the vector already
+                                     * has the right size beforehand. The
+                                     * indices refer to the multilevel
+                                     * numbering local to the present
+                                     * level of this cell. The vector shall
+                                     * therefore have the same number of
+                                     * entries as there are degrees of
+                                     * freedom on this level.
+                                     */
+    template <typename number>
+    void get_mg_dof_values (const Vector<number> &values,
+                           Vector<number>       &dof_values) const;
+
                                     /**
                                      * Return a pointer to the #i#th line
                                      * bounding this #Hex#.
@@ -589,27 +652,6 @@ class MGDoFCellAccessor :  public MGDoFObjectAccessor<dim, dim> {
     face_iterator
     face (const unsigned int i) const;
 
-                                    /**
-                                     * Return the value of the given vector
-                                     * restricted to the dofs of this
-                                     * cell in the standard ordering: dofs
-                                     * on vertex 0, dofs on vertex 1, etc,
-                                     * dofs on line 0, dofs on line 1, etc,
-                                     * dofs on quad 0, etc.
-                                     *
-                                     * It is assumed that the vector already
-                                     * has the right size beforehand. The
-                                     * indices refer to the multilevel
-                                     * numbering local to the present
-                                     * level of this cell. The vector shall
-                                     * therefore have the same number of
-                                     * entries as there are degrees of
-                                     * freedom on this level.
-                                     */
-    void get_mg_dof_values (const Vector<double> &values,
-                           Vector<double>       &dof_values) const;
-
-
                                     /**
                                      *  Exception
                                      */
index 7e94014b42084f8e21296e020da168a733ca20b3..4b30be0c8a28209f758e5b071cb003f7f6ecb279 100644 (file)
@@ -287,6 +287,27 @@ class MGDoFObjectAccessor<1, dim> :  public MGDoFAccessor<dim>,
                                      */
     void get_mg_dof_indices (vector<int> &dof_indices) const;
 
+                                    /**
+                                     * Return the value of the given vector
+                                     * restricted to the dofs of this
+                                     * cell in the standard ordering: dofs
+                                     * on vertex 0, dofs on vertex 1, etc,
+                                     * dofs on line 0, dofs on line 1, etc,
+                                     * dofs on quad 0, etc.
+                                     *
+                                     * It is assumed that the vector already
+                                     * has the right size beforehand. The
+                                     * indices refer to the multilevel
+                                     * numbering local to the present
+                                     * level of this cell. The vector shall
+                                     * therefore have the same number of
+                                     * entries as there are degrees of
+                                     * freedom on this level.
+                                     */
+    template <typename number>
+    void get_mg_dof_values (const Vector<number> &values,
+                           Vector<number>       &dof_values) const;
+
                                     /**
                                      * Return the #i#th child as a MGDoF line
                                      * iterator. This function is needed since
@@ -385,8 +406,29 @@ class MGDoFObjectAccessor<2, dim> :  public MGDoFAccessor<dim>,
                                      * for the level this quad lives on.
                                      */
     void get_mg_dof_indices (vector<int> &dof_indices) const;
-
                                     /**
+                                     * Return the value of the given vector
+                                     * restricted to the dofs of this
+                                     * cell in the standard ordering: dofs
+                                     * on vertex 0, dofs on vertex 1, etc,
+                                     * dofs on line 0, dofs on line 1, etc,
+                                     * dofs on quad 0, etc.
+                                     *
+                                     * It is assumed that the vector already
+                                     * has the right size beforehand. The
+                                     * indices refer to the multilevel
+                                     * numbering local to the present
+                                     * level of this cell. The vector shall
+                                     * therefore have the same number of
+                                     * entries as there are degrees of
+                                     * freedom on this level.
+                                     */
+    template <typename number>
+    void get_mg_dof_values (const Vector<number> &values,
+                           Vector<number>       &dof_values) const;
+
+                                    /**
                                      * Return a pointer to the #i#th line
                                      * bounding this #Quad#.
                                      */
@@ -491,6 +533,27 @@ class MGDoFObjectAccessor<3, dim> :  public MGDoFAccessor<dim>,
                                      */
     void get_mg_dof_indices (vector<int> &dof_indices) const;
 
+                                    /**
+                                     * Return the value of the given vector
+                                     * restricted to the dofs of this
+                                     * cell in the standard ordering: dofs
+                                     * on vertex 0, dofs on vertex 1, etc,
+                                     * dofs on line 0, dofs on line 1, etc,
+                                     * dofs on quad 0, etc.
+                                     *
+                                     * It is assumed that the vector already
+                                     * has the right size beforehand. The
+                                     * indices refer to the multilevel
+                                     * numbering local to the present
+                                     * level of this cell. The vector shall
+                                     * therefore have the same number of
+                                     * entries as there are degrees of
+                                     * freedom on this level.
+                                     */
+    template <typename number>
+    void get_mg_dof_values (const Vector<number> &values,
+                           Vector<number>       &dof_values) const;
+
                                     /**
                                      * Return a pointer to the #i#th line
                                      * bounding this #Hex#.
@@ -589,27 +652,6 @@ class MGDoFCellAccessor :  public MGDoFObjectAccessor<dim, dim> {
     face_iterator
     face (const unsigned int i) const;
 
-                                    /**
-                                     * Return the value of the given vector
-                                     * restricted to the dofs of this
-                                     * cell in the standard ordering: dofs
-                                     * on vertex 0, dofs on vertex 1, etc,
-                                     * dofs on line 0, dofs on line 1, etc,
-                                     * dofs on quad 0, etc.
-                                     *
-                                     * It is assumed that the vector already
-                                     * has the right size beforehand. The
-                                     * indices refer to the multilevel
-                                     * numbering local to the present
-                                     * level of this cell. The vector shall
-                                     * therefore have the same number of
-                                     * entries as there are degrees of
-                                     * freedom on this level.
-                                     */
-    void get_mg_dof_values (const Vector<double> &values,
-                           Vector<double>       &dof_values) const;
-
-
                                     /**
                                      *  Exception
                                      */
index b69afa068c0900c87ad1dd67e227169e88c6f0bd..674bbdacb808e52f9caac92593023a4343997418 100644 (file)
@@ -115,6 +115,68 @@ distribute_local_to_global (const FullMatrix<double> &local_source,
 
 
 
+template <int dim>
+template <typename number>
+void
+DoFObjectAccessor<1,dim>::get_dof_values (const Vector<number> &values,
+                                         Vector<number>       &local_values) const
+{
+  Assert (dim==1, ExcInternalError());
+  
+  Assert (dof_handler != 0, DoFAccessor<1>::ExcInvalidObject());
+  Assert (&dof_handler->get_fe() != 0, DoFAccessor<1>::ExcInvalidObject());
+  Assert (local_values.size() == dof_handler->get_fe().dofs_per_cell,
+         DoFAccessor<1>::ExcVectorDoesNotMatch());
+  Assert (values.size() == dof_handler->n_dofs(),
+         DoFAccessor<1>::ExcVectorDoesNotMatch());
+  Assert (has_children() == false, ExcNotActive());
+  
+  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
+                    dofs_per_line   = dof_handler->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)
+      *next_local_value++ = values(vertex_dof_index(vertex,d));
+  for (unsigned int d=0; d<dofs_per_line; ++d)
+    *next_local_value++ = values(dof_index(d));
+
+  Assert (next_local_value == local_values.end(),
+         ExcInternalError());
+};
+
+
+
+template <int dim>
+template <typename number>
+void
+DoFObjectAccessor<1,dim>::set_dof_values (const Vector<number> &local_values,
+                                         Vector<number>       &values) const {
+  Assert (dim==1, ExcInternalError());
+  
+  Assert (dof_handler != 0, DoFAccessor<1>::ExcInvalidObject());
+  Assert (&dof_handler->get_fe() != 0, DoFAccessor<1>::ExcInvalidObject());
+  Assert (local_values.size() == dof_handler->get_fe().dofs_per_cell,
+         DoFAccessor<1>::ExcVectorDoesNotMatch());
+  Assert (values.size() == dof_handler->n_dofs(),
+         DoFAccessor<1>::ExcVectorDoesNotMatch());
+  Assert (has_children() == false, ExcNotActive());
+  
+  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
+                    dofs_per_line   = dof_handler->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)
+       values(vertex_dof_index(vertex,d)) = *next_local_value++;
+  for (unsigned int d=0; d<dofs_per_line; ++d)
+    values(dof_index(d)) = *next_local_value++;
+
+  Assert (next_local_value == local_values.end(),
+         ExcInternalError());
+};
+
+
+
+
 /*------------------------- Functions: DoFQuadAccessor -----------------------*/
 
 
@@ -209,8 +271,80 @@ distribute_local_to_global (const FullMatrix<double> &local_source,
 
 
 
+template <int dim>
+template <typename number>
+void
+DoFObjectAccessor<2,dim>::get_dof_values (const Vector<number> &values,
+                                         Vector<number>       &local_values) const
+{
+  Assert (dim==2, ExcInternalError());
+  
+  Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
+  Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
+  Assert (local_values.size() == dof_handler->get_fe().dofs_per_cell,
+         DoFAccessor<dim>::ExcVectorDoesNotMatch());
+  Assert (values.size() == dof_handler->n_dofs(),
+         DoFAccessor<dim>::ExcVectorDoesNotMatch());
+  Assert (has_children() == false, ExcNotActive());
+  
+  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
+                    dofs_per_line   = dof_handler->get_fe().dofs_per_line,
+                    dofs_per_quad   = dof_handler->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)
+      *next_local_value++ = values(vertex_dof_index(vertex,d));
+  for (unsigned int line=0; line<4; ++line)
+    for (unsigned int d=0; d<dofs_per_line; ++d)
+      *next_local_value++ = values(this->line(line)->dof_index(d));
+  for (unsigned int d=0; d<dofs_per_quad; ++d)
+    *next_local_value++ = values(dof_index(d));
+
+  Assert (next_local_value == local_values.end(),
+         ExcInternalError());
+};
 
-/*------------------------- Functions: DoFObjectAccessor -----------------------*/
+
+
+template <int dim>
+template <typename number>
+void
+DoFObjectAccessor<2,dim>::set_dof_values (const Vector<number> &local_values,
+                                         Vector<number>       &values) const
+{
+  Assert (dim==2, ExcInternalError());
+  
+  Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
+  Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
+  Assert (local_values.size() == dof_handler->get_fe().dofs_per_cell,
+         DoFAccessor<dim>::ExcVectorDoesNotMatch());
+  Assert (values.size() == dof_handler->n_dofs(),
+         DoFAccessor<dim>::ExcVectorDoesNotMatch());
+  Assert (has_children() == false, ExcNotActive());
+  
+  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
+                    dofs_per_line   = dof_handler->get_fe().dofs_per_line,
+                    dofs_per_quad   = dof_handler->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)
+      values(vertex_dof_index(vertex,d)) = *next_local_value++;
+  for (unsigned int line=0; line<4; ++line)
+    for (unsigned int d=0; d<dofs_per_line; ++d)
+      values(this->line(line)->dof_index(d)) = *next_local_value++;
+  for (unsigned int d=0; d<dofs_per_quad; ++d)
+    values(dof_index(d)) = *next_local_value++;
+
+  Assert (next_local_value == local_values.end(),
+         ExcInternalError());
+};
+
+
+
+
+
+
+/*------------------------- Functions: DoFHexAccessor -----------------------*/
 
 
 template <int dim>
@@ -277,7 +411,8 @@ distribute_local_to_global (const Vector<double> &local_source,
 template <int dim>
 void DoFObjectAccessor<3, dim>::
 distribute_local_to_global (const FullMatrix<double> &local_source,
-                           SparseMatrix<double>     &global_destination) const {
+                           SparseMatrix<double>     &global_destination) const
+{
   Assert (dof_handler != 0, ExcInvalidObject());
   Assert (dof_handler->selected_fe != 0, ExcInvalidObject());
   Assert (local_source.m() == (8*dof_handler->get_fe().dofs_per_vertex +
@@ -306,265 +441,12 @@ distribute_local_to_global (const FullMatrix<double> &local_source,
 
 
 
-
-
-
-/*------------------------- Functions: DoFCellAccessor -----------------------*/
-
-
-
-#if deal_II_dimension == 1
-
-template <>
-TriaIterator<1, DoFObjectAccessor<0,1> >
-DoFCellAccessor<1>::face (const unsigned int) const
-{
-  Assert (false, ExcNotUsefulForThisDimension());
-  return TriaIterator<1, DoFObjectAccessor<0,1> >();
-};
-
-
-
-/* this function looks like a template, but actually isn't one, it
-   will only work for the dimension selected by the preprocessor
-   guard above.
-   
-   the correct thing to do would be
-
-   template <>
-   template <typename number>
-   void
-   DoFCellAccessor<1>::get... (vector<number>...)
-
-   but this does not work, at least not at present using egcs1.1.1. we therefore
-   separate the different implementations for the different dimensions using
-   the preprocessor and double check using an assertion in the function body.
-
-//TODO: correct the pseudo-template thing   
-*/
-template <int dim>
-template <typename number>
-void
-DoFCellAccessor<dim>::get_dof_values (const Vector<number> &values,
-                                     Vector<number>       &local_values) const {
-  Assert (dim==1, ExcInternalError());
-  
-  Assert (dof_handler != 0, DoFAccessor<1>::ExcInvalidObject());
-  Assert (&dof_handler->get_fe() != 0, DoFAccessor<1>::ExcInvalidObject());
-  Assert (local_values.size() == dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<1>::ExcVectorDoesNotMatch());
-  Assert (values.size() == dof_handler->n_dofs(),
-         DoFAccessor<1>::ExcVectorDoesNotMatch());
-  Assert (active(), ExcNotActive());
-  
-  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = dof_handler->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)
-      *next_local_value++ = values(vertex_dof_index(vertex,d));
-  for (unsigned int d=0; d<dofs_per_line; ++d)
-    *next_local_value++ = values(dof_index(d));
-
-  Assert (next_local_value == local_values.end(),
-         ::ExcInternalError());
-};
-
-
-
-/* this function looks like a template, but actually isn't one, it
-   will only work for the dimension selected by the preprocessor
-   guard above.
-   
-   the correct thing to do would be
-
-   template <>
-   template <typename number>
-   void
-   DoFCellAccessor<1>::get... (vector<number>...)
-
-   but this does not work, at least not at present using egcs1.1.1. we therefore
-   separate the different implementations for the different dimensions using
-   the preprocecssor and double check using an assertion in the function body.
-*/
 template <int dim>
 template <typename number>
 void
-DoFCellAccessor<dim>::set_dof_values (const Vector<number> &local_values,
-                                     Vector<number>       &values) const {
-  Assert (dim==1, ExcInternalError());
-  
-  Assert (dof_handler != 0, DoFAccessor<1>::ExcInvalidObject());
-  Assert (&dof_handler->get_fe() != 0, DoFAccessor<1>::ExcInvalidObject());
-  Assert (local_values.size() == dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<1>::ExcVectorDoesNotMatch());
-  Assert (values.size() == dof_handler->n_dofs(),
-         DoFAccessor<1>::ExcVectorDoesNotMatch());
-  Assert (active(), ExcNotActive());
-  
-  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = dof_handler->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)
-       values(vertex_dof_index(vertex,d)) = *next_local_value++;
-  for (unsigned int d=0; d<dofs_per_line; ++d)
-    values(dof_index(d)) = *next_local_value++;
-
-  Assert (next_local_value == local_values.end(),
-         ::ExcInternalError());
-};
-
-
-
-#endif
-
-
-
-#if deal_II_dimension == 2
-
-template <>
-TriaIterator<2, DoFObjectAccessor<1,2> >
-DoFCellAccessor<2>::face (const unsigned int i) const
-{
-  return line(i);
-};
-
-
-
-/* this function looks like a template, but actually isn't one, it
-   will only work for the dimension selected by the preprocessor
-   guard above.
-   
-   the correct thing to do would be
-
-   template <>
-   template <typename number>
-   void
-   DoFCellAccessor<1>::get... (vector<number>...)
-
-   but this does not work, at least not at present using egcs1.1.1. we therefore
-   separate the different implementations for the different dimensions using
-   the preprocecssor and double check using an assertion in the function body.
-*/
-template <int dim>
-template <typename number>
-void
-DoFCellAccessor<dim>::get_dof_values (const Vector<number> &values,
-                                     Vector<number>       &local_values) const
-{
-  Assert (dim==2, ExcInternalError());
-  
-  Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
-  Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
-  Assert (local_values.size() == dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<dim>::ExcVectorDoesNotMatch());
-  Assert (values.size() == dof_handler->n_dofs(),
-         DoFAccessor<dim>::ExcVectorDoesNotMatch());
-  Assert (active(), ExcNotActive());
-  
-  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = dof_handler->get_fe().dofs_per_line,
-                    dofs_per_quad   = dof_handler->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)
-      *next_local_value++ = values(vertex_dof_index(vertex,d));
-  for (unsigned int line=0; line<4; ++line)
-    for (unsigned int d=0; d<dofs_per_line; ++d)
-      *next_local_value++ = values(this->line(line)->dof_index(d));
-  for (unsigned int d=0; d<dofs_per_quad; ++d)
-    *next_local_value++ = values(dof_index(d));
-
-  Assert (next_local_value == local_values.end(),
-         ::ExcInternalError());
-};
-
-
-
-/* this function looks like a template, but actually isn't one, it
-   will only work for the dimension selected by the preprocessor
-   guard above.
-   
-   the correct thing to do would be
-
-   template <>
-   template <typename number>
-   void
-   DoFCellAccessor<1>::get... (vector<number>...)
-
-   but this does not work, at least not at present using egcs1.1.1. we therefore
-   separate the different implementations for the different dimensions using
-   the preprocecssor and double check using an assertion in the function body.
-*/
-template <int dim>
-template <typename number>
-void
-DoFCellAccessor<dim>::set_dof_values (const Vector<number> &local_values,
-                                     Vector<number>       &values) const {
-  Assert (dim==2, ExcInternalError());
-  
-  Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
-  Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
-  Assert (local_values.size() == dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<dim>::ExcVectorDoesNotMatch());
-  Assert (values.size() == dof_handler->n_dofs(),
-         DoFAccessor<dim>::ExcVectorDoesNotMatch());
-  Assert (active(), ExcNotActive());
-  
-  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = dof_handler->get_fe().dofs_per_line,
-                    dofs_per_quad   = dof_handler->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)
-      values(vertex_dof_index(vertex,d)) = *next_local_value++;
-  for (unsigned int line=0; line<4; ++line)
-    for (unsigned int d=0; d<dofs_per_line; ++d)
-      values(this->line(line)->dof_index(d)) = *next_local_value++;
-  for (unsigned int d=0; d<dofs_per_quad; ++d)
-    values(dof_index(d)) = *next_local_value++;
-
-  Assert (next_local_value == local_values.end(),
-         ::ExcInternalError());
-};
-
-
-#endif
-
-
-
-#if deal_II_dimension == 3
-
-template <>
-TriaIterator<3, DoFObjectAccessor<2, 3> >
-DoFCellAccessor<3>::face (const unsigned int i) const
+DoFObjectAccessor<3,dim>::get_dof_values (const Vector<number> &values,
+                                         Vector<number>       &local_values) const
 {
-  return quad(i);
-};
-
-
-
-/* this function looks like a template, but actually isn't one, it
-   will only work for the dimension selected by the preprocessor
-   guard above.
-   
-   the correct thing to do would be
-
-   template <>
-   template <typename number>
-   void
-   DoFCellAccessor<1>::get... (vector<number>...)
-
-   but this does not work, at least not at present using egcs1.1.1. we therefore
-   separate the different implementations for the different dimensions using
-   the preprocecssor and double check using an assertion in the function body.
-*/
-template <int dim>
-template <typename number>
-void
-DoFCellAccessor<dim>::get_dof_values (const Vector<number> &values,
-                                     Vector<number>       &local_values) const {
   Assert (dim==3, ExcInternalError());
 
   Assert (dof_handler != 0, DoFAccessor<3>::ExcInvalidObject());
@@ -573,51 +455,37 @@ DoFCellAccessor<dim>::get_dof_values (const Vector<number> &values,
          DoFAccessor<3>::ExcVectorDoesNotMatch());
   Assert (values.size() == dof_handler->n_dofs(),
          DoFAccessor<3>::ExcVectorDoesNotMatch());
-  Assert (active(), ExcNotActive());
+  Assert (has_children() == false, ExcNotActive());
   
   const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
                     dofs_per_line   = dof_handler->get_fe().dofs_per_line,
                     dofs_per_quad   = dof_handler->get_fe().dofs_per_quad,
                     dofs_per_hex    = dof_handler->get_fe().dofs_per_hex;
   typename vector<number>::iterator next_local_value = local_values.begin();
-  for (unsigned int vertex=0; vertex<GeometryInfo<dim>::vertices_per_cell; ++vertex)
+  for (unsigned int vertex=0; vertex<GeometryInfo<3>::vertices_per_cell; ++vertex)
     for (unsigned int d=0; d<dofs_per_vertex; ++d)
       *next_local_value++ = values(vertex_dof_index(vertex,d));
-  for (unsigned int line=0; line<GeometryInfo<dim>::lines_per_cell; ++line)
+  for (unsigned int line=0; line<GeometryInfo<3>::lines_per_cell; ++line)
     for (unsigned int d=0; d<dofs_per_line; ++d)
       *next_local_value++ = values(this->line(line)->dof_index(d));
-  for (unsigned int quad=0; quad<GeometryInfo<dim>::quads_per_cell; ++quad)
+  for (unsigned int quad=0; quad<GeometryInfo<3>::quads_per_cell; ++quad)
     for (unsigned int d=0; d<dofs_per_quad; ++d)
       *next_local_value++ = values(this->quad(quad)->dof_index(d));
   for (unsigned int d=0; d<dofs_per_hex; ++d)
     *next_local_value++ = values(dof_index(d));
 
   Assert (next_local_value == local_values.end(),
-         ::ExcInternalError());
+         ExcInternalError());
 };
 
 
 
-/* this function looks like a template, but actually isn't one, it
-   will only work for the dimension selected by the preprocessor
-   guard above.
-   
-   the correct thing to do would be
-
-   template <>
-   template <typename number>
-   void
-   DoFCellAccessor<1>::get... (vector<number>...)
-
-   but this does not work, at least not at present using egcs1.1.1. we therefore
-   separate the different implementations for the different dimensions using
-   the preprocecssor and double check using an assertion in the function body.
-*/
 template <int dim>
 template <typename number>
 void
-DoFCellAccessor<dim>::set_dof_values (const Vector<number> &local_values,
-                                     Vector<number>       &values) const {
+DoFObjectAccessor<3,dim>::set_dof_values (const Vector<number> &local_values,
+                                         Vector<number>       &values) const
+{
   Assert (dim==3, ExcInternalError());
 
   Assert (dof_handler != 0, DoFAccessor<3>::ExcInvalidObject());
@@ -626,7 +494,7 @@ DoFCellAccessor<dim>::set_dof_values (const Vector<number> &local_values,
          DoFAccessor<3>::ExcVectorDoesNotMatch());
   Assert (values.size() == dof_handler->n_dofs(),
          DoFAccessor<3>::ExcVectorDoesNotMatch());
-  Assert (active(), ExcNotActive());
+  Assert (has_children() == false, ExcNotActive());
   
   const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
                     dofs_per_line   = dof_handler->get_fe().dofs_per_line,
@@ -646,10 +514,52 @@ DoFCellAccessor<dim>::set_dof_values (const Vector<number> &local_values,
     values(dof_index(d)) = *next_local_value++;
 
   Assert (next_local_value == local_values.end(),
-         ::ExcInternalError());
+         ExcInternalError());
+};
+
+
+
+
+
+/*------------------------- Functions: DoFCellAccessor -----------------------*/
+
+
+
+#if deal_II_dimension == 1
+
+template <>
+TriaIterator<1, DoFObjectAccessor<0,1> >
+DoFCellAccessor<1>::face (const unsigned int) const
+{
+  Assert (false, ExcNotUsefulForThisDimension());
+  return TriaIterator<1, DoFObjectAccessor<0,1> >();
+};
+
+#endif
+
+
+
+#if deal_II_dimension == 2
+
+template <>
+TriaIterator<2, DoFObjectAccessor<1,2> >
+DoFCellAccessor<2>::face (const unsigned int i) const
+{
+  return line(i);
 };
 
+#endif
+
+
 
+#if deal_II_dimension == 3
+
+template <>
+TriaIterator<3, DoFObjectAccessor<2, 3> >
+DoFCellAccessor<3>::face (const unsigned int i) const
+{
+  return quad(i);
+};
 
 #endif
 
@@ -660,7 +570,8 @@ template <int dim>
 template <typename number>
 void
 DoFCellAccessor<dim>::get_interpolated_dof_values (const Vector<number> &values,
-                                                  Vector<number>       &interpolated_values) const {
+                                                  Vector<number>       &interpolated_values) const
+{
   const unsigned int dofs_per_cell = dof_handler->get_fe().dofs_per_cell;
   
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -722,7 +633,8 @@ template <int dim>
 template <typename number>
 void
 DoFCellAccessor<dim>::set_dof_values_by_interpolation (const Vector<number> &local_values,
-                                                      Vector<number>       &values) const {
+                                                      Vector<number>       &values) const
+{
   const unsigned int dofs_per_cell = dof_handler->get_fe().dofs_per_cell;
   
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -764,37 +676,115 @@ DoFCellAccessor<dim>::set_dof_values_by_interpolation (const Vector<number> &loc
 // for double
 template
 void
-DoFCellAccessor<deal_II_dimension>::get_dof_values (const Vector<double> &,
-                                                   Vector<double>       &) const;
+DoFObjectAccessor<1,deal_II_dimension>::
+get_dof_values (const Vector<double> &,
+               Vector<double>       &) const;
+
+template
+void
+DoFObjectAccessor<1,deal_II_dimension>::
+set_dof_values (const Vector<double> &,
+               Vector<double>       &) const;
+
+
+// for float
+template
+void
+DoFObjectAccessor<1,deal_II_dimension>::
+get_dof_values (const Vector<float> &,
+               Vector<float>       &) const;
+
+template
+void
+DoFObjectAccessor<1,deal_II_dimension>::
+set_dof_values (const Vector<float> &,
+               Vector<float>       &) const;
+
+
+#if deal_II_dimension >= 2
+// for double
+template
+void
+DoFObjectAccessor<2,deal_II_dimension>::
+get_dof_values (const Vector<double> &,
+               Vector<double>       &) const;
+
+template
+void
+DoFObjectAccessor<2,deal_II_dimension>::
+set_dof_values (const Vector<double> &,
+               Vector<double>       &) const;
+
+// for float
+template
+void
+DoFObjectAccessor<2,deal_II_dimension>::
+get_dof_values (const Vector<float> &,
+               Vector<float>       &) const;
+
 template
 void
-DoFCellAccessor<deal_II_dimension>::get_interpolated_dof_values (const Vector<double> &,
-                                                                Vector<double>       &) const;
+DoFObjectAccessor<2,deal_II_dimension>::
+set_dof_values (const Vector<float> &,
+               Vector<float>       &) const;
+
+#endif
+
+
+#if deal_II_dimension >= 3
+// for double
 template
 void
-DoFCellAccessor<deal_II_dimension>::set_dof_values (const Vector<double> &,
-                                                   Vector<double>       &) const;
+DoFObjectAccessor<3,deal_II_dimension>::
+get_dof_values (const Vector<double> &,
+               Vector<double>       &) const;
+
 template
 void
-DoFCellAccessor<deal_II_dimension>::set_dof_values_by_interpolation(const Vector<double> &,
-                                                                   Vector<double>       &) const;
+DoFObjectAccessor<3,deal_II_dimension>::
+set_dof_values (const Vector<double> &,
+               Vector<double>       &) const;
+
 // for float
 template
 void
-DoFCellAccessor<deal_II_dimension>::get_dof_values (const Vector<float> &,
-                                                   Vector<float>       &) const;
+DoFObjectAccessor<3,deal_II_dimension>::
+get_dof_values (const Vector<float> &,
+               Vector<float>       &) const;
+
+template
+void
+DoFObjectAccessor<3,deal_II_dimension>::
+set_dof_values (const Vector<float> &,
+               Vector<float>       &) const;
+
+#endif
+
+
+template
+void
+DoFCellAccessor<deal_II_dimension>::
+get_interpolated_dof_values (const Vector<double> &,
+                            Vector<double>       &) const;
+
 template
 void
-DoFCellAccessor<deal_II_dimension>::get_interpolated_dof_values (const Vector<float> &,
-                                                                Vector<float>       &) const;
+DoFCellAccessor<deal_II_dimension>::
+set_dof_values_by_interpolation(const Vector<double> &,
+                               Vector<double>       &) const;
+
+
 template
 void
-DoFCellAccessor<deal_II_dimension>::set_dof_values (const Vector<float> &,
-                                                   Vector<float>       &) const;
+DoFCellAccessor<deal_II_dimension>::
+get_interpolated_dof_values (const Vector<float> &,
+                            Vector<float>       &) const;
+
 template
 void
-DoFCellAccessor<deal_II_dimension>::set_dof_values_by_interpolation(const Vector<float> &,
-                                                                   Vector<float>       &) const;
+DoFCellAccessor<deal_II_dimension>::
+set_dof_values_by_interpolation(const Vector<float> &,
+                               Vector<float>       &) const;
 
 
 
index 96dab7eaa894e6c87938df34fd77b96562f6b7e5..27cc111a4dcc338f091f191e55480099cfd06474 100644 (file)
 
 template <int dim>
 MGDoFObjectAccessor<1, dim>::MGDoFObjectAccessor (Triangulation<dim> *tria,
-                                                    const int           level,
-                                                    const int           index,
-                                                    const AccessorData *local_data) :
+                                                 const int           level,
+                                                 const int           index,
+                                                 const AccessorData *local_data) :
                MGDoFAccessor<dim> (local_data),
-               MGDoFObjectAccessor_Inheritance<1,dim>::BaseClass(tria,level,index,local_data) {};
+               MGDoFObjectAccessor_Inheritance<1,dim>::BaseClass(tria,level,index,local_data)
+{};
 
 
 
 template <int dim>
-int MGDoFObjectAccessor<1, dim>::mg_dof_index (const unsigned int i) const {
+int MGDoFObjectAccessor<1, dim>::mg_dof_index (const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -51,7 +53,8 @@ int MGDoFObjectAccessor<1, dim>::mg_dof_index (const unsigned int i) const {
 
 template <int dim>
 void MGDoFObjectAccessor<1, dim>::set_mg_dof_index (const unsigned int i,
-                                                        const int index) const {
+                                                   const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -69,7 +72,8 @@ void MGDoFObjectAccessor<1, dim>::set_mg_dof_index (const unsigned int i,
 
 template <int dim>
 int MGDoFObjectAccessor<1, dim>::mg_vertex_dof_index (const unsigned int vertex,
-                                                          const unsigned int i) const {
+                                                     const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -85,8 +89,9 @@ int MGDoFObjectAccessor<1, dim>::mg_vertex_dof_index (const unsigned int vertex,
   
 template <int dim>
 void MGDoFObjectAccessor<1, dim>::set_mg_vertex_dof_index (const unsigned int vertex,
-                                                               const unsigned int i,
-                                                               const int index) const {
+                                                          const unsigned int i,
+                                                          const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -102,7 +107,8 @@ void MGDoFObjectAccessor<1, dim>::set_mg_vertex_dof_index (const unsigned int ve
 
 template <int dim>
 void
-MGDoFObjectAccessor<1, dim>::get_mg_dof_indices (vector<int> &dof_indices) const {
+MGDoFObjectAccessor<1, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -118,17 +124,50 @@ MGDoFObjectAccessor<1, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
       *next++ = mg_vertex_dof_index(vertex,d);
   for (unsigned int d=0; d<dofs_per_line; ++d)
     *next++ = mg_dof_index(d);
+  
+  Assert (next == dof_indices.end(),
+         ExcInternalError());
+};
+
+
+
+template <int dim>
+template <typename number>
+void
+MGDoFObjectAccessor<1,dim>::get_mg_dof_values (const Vector<number> &values,
+                                              Vector<number>       &dof_values) const
+{
+  Assert (dof_handler != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
+  Assert (mg_dof_handler != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
+  Assert (&dof_handler->get_fe() != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
+  Assert (dof_values.size() == dof_handler->get_fe().dofs_per_cell,
+         DoFAccessor<1>::ExcVectorDoesNotMatch());
+  Assert (values.size() == dof_handler->n_dofs(),
+         DoFAccessor<1>::ExcVectorDoesNotMatch());
+
+  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
+                    dofs_per_line   = dof_handler->get_fe().dofs_per_line;
+  vector<number>::iterator next_dof_value=dof_values.begin();
+  for (unsigned int vertex=0; vertex<2; ++vertex)
+    for (unsigned int d=0; d<dofs_per_vertex; ++d)
+      *next_dof_value++ = values(mg_vertex_dof_index(vertex,d));
+  for (unsigned int d=0; d<dofs_per_line; ++d)
+    *next_dof_value++ = values(mg_dof_index(d));
+  
+  Assert (next_dof_value == dof_values.end(),
+         ExcInternalError());
 };
 
 
 
 template <int dim>
 TriaIterator<dim,MGDoFObjectAccessor<1, dim> >
-MGDoFObjectAccessor<1, dim>::child (const unsigned int i) const {
+MGDoFObjectAccessor<1, dim>::child (const unsigned int i) const
+{
   TriaIterator<dim,MGDoFObjectAccessor<1, dim> > q (tria,
-                                                        present_level+1,
-                                                        child_index (i),
-                                                        mg_dof_handler);
+                                                   present_level+1,
+                                                   child_index (i),
+                                                   mg_dof_handler);
   
 #ifdef DEBUG
   if (q.state() != past_the_end)
@@ -165,7 +204,8 @@ MGDoFObjectAccessor<2, dim>::MGDoFObjectAccessor (Triangulation<dim> *tria,
 
 template <int dim>
 inline
-int MGDoFObjectAccessor<2, dim>::mg_dof_index (const unsigned int i) const {
+int MGDoFObjectAccessor<2, dim>::mg_dof_index (const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -182,7 +222,8 @@ int MGDoFObjectAccessor<2, dim>::mg_dof_index (const unsigned int i) const {
 
 template <int dim>
 void MGDoFObjectAccessor<2, dim>::set_mg_dof_index (const unsigned int i,
-                                                        const int index) const {
+                                                   const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -200,7 +241,8 @@ void MGDoFObjectAccessor<2, dim>::set_mg_dof_index (const unsigned int i,
 template <int dim>
 inline
 int MGDoFObjectAccessor<2, dim>::mg_vertex_dof_index (const unsigned int vertex,
-                                                          const unsigned int i) const {
+                                                     const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -216,8 +258,9 @@ int MGDoFObjectAccessor<2, dim>::mg_vertex_dof_index (const unsigned int vertex,
   
 template <int dim>
 void MGDoFObjectAccessor<2, dim>::set_mg_vertex_dof_index (const unsigned int vertex,
-                                                               const unsigned int i,
-                                                               const int index) const {
+                                                          const unsigned int i,
+                                                          const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -233,7 +276,8 @@ void MGDoFObjectAccessor<2, dim>::set_mg_vertex_dof_index (const unsigned int ve
 
 template <int dim>
 void
-MGDoFObjectAccessor<2, dim>::get_mg_dof_indices (vector<int> &dof_indices) const {
+MGDoFObjectAccessor<2, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -254,13 +298,50 @@ MGDoFObjectAccessor<2, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
       *next++ = this->line(line)->mg_dof_index(d);
   for (unsigned int d=0; d<dofs_per_quad; ++d)
     *next++ = mg_dof_index(d);
+  
+  Assert (next == dof_indices.end(),
+         ExcInternalError());
+};
+
+
+
+template <int dim>
+template <typename number>
+void
+MGDoFObjectAccessor<2,dim>::get_mg_dof_values (const Vector<number> &values,
+                                              Vector<number>       &dof_values) const
+{
+  Assert (dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (mg_dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (&dof_handler->get_fe() != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (dof_values.size() == dof_handler->get_fe().dofs_per_cell,
+         DoFAccessor<2>::ExcVectorDoesNotMatch());
+  Assert (values.size() == mg_dof_handler->n_dofs(present_level),
+         DoFAccessor<2>::ExcVectorDoesNotMatch());
+
+  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
+                    dofs_per_line   = dof_handler->get_fe().dofs_per_line,
+                    dofs_per_quad   = dof_handler->get_fe().dofs_per_quad;
+  vector<number>::iterator next_dof_value=dof_values.begin();
+  for (unsigned int vertex=0; vertex<4; ++vertex)
+    for (unsigned int d=0; d<dofs_per_vertex; ++d)
+      *next_dof_value++ = values(mg_vertex_dof_index(vertex,d));
+  for (unsigned int line=0; line<4; ++line)
+    for (unsigned int d=0; d<dofs_per_line; ++d)
+      *next_dof_value++ = values(this->line(line)->mg_dof_index(d));
+  for (unsigned int d=0; d<dofs_per_quad; ++d)
+    *next_dof_value++ = values(mg_dof_index(d));
+  
+  Assert (next_dof_value == dof_values.end(),
+         ExcInternalError());
 };
 
 
 
 template <int dim>
 TriaIterator<dim,MGDoFObjectAccessor<1, dim> >
-MGDoFObjectAccessor<2, dim>::line (const unsigned int i) const {
+MGDoFObjectAccessor<2, dim>::line (const unsigned int i) const
+{
   Assert (i<4, ExcIndexRange (i, 0, 4));
 
   return TriaIterator<dim,MGDoFObjectAccessor<1, dim> >
@@ -276,11 +357,12 @@ MGDoFObjectAccessor<2, dim>::line (const unsigned int i) const {
 
 template <int dim>
 TriaIterator<dim,MGDoFObjectAccessor<2, dim> >
-MGDoFObjectAccessor<2, dim>::child (const unsigned int i) const {
+MGDoFObjectAccessor<2, dim>::child (const unsigned int i) const
+{
   TriaIterator<dim,MGDoFObjectAccessor<2, dim> > q (tria,
-                                                        present_level+1,
-                                                        child_index (i),
-                                                        mg_dof_handler);
+                                                   present_level+1,
+                                                   child_index (i),
+                                                   mg_dof_handler);
   
 #ifdef DEBUG
   if (q.state() != past_the_end)
@@ -293,7 +375,8 @@ MGDoFObjectAccessor<2, dim>::child (const unsigned int i) const {
 
 template <int dim>
 void
-MGDoFObjectAccessor<2, dim>::copy_from (const MGDoFObjectAccessor<2, dim> &a) {
+MGDoFObjectAccessor<2, dim>::copy_from (const MGDoFObjectAccessor<2, dim> &a)
+{
   DoFObjectAccessor<2, dim>::copy_from (a);
   set_mg_dof_handler (a.mg_dof_handler);
 };
@@ -305,17 +388,19 @@ MGDoFObjectAccessor<2, dim>::copy_from (const MGDoFObjectAccessor<2, dim> &a) {
 
 template <int dim>
 MGDoFObjectAccessor<3, dim>::MGDoFObjectAccessor (Triangulation<dim> *tria,
-                                                  const int           level,
-                                                  const int           index,
-                                                  const AccessorData *local_data) :
+                                                 const int           level,
+                                                 const int           index,
+                                                 const AccessorData *local_data) :
                MGDoFAccessor<dim> (local_data),
-               MGDoFObjectAccessor_Inheritance<3,dim>::BaseClass(tria,level,index,local_data) {};
+               MGDoFObjectAccessor_Inheritance<3,dim>::BaseClass(tria,level,index,local_data)
+{};
 
 
 
 template <int dim>
 inline
-int MGDoFObjectAccessor<3, dim>::mg_dof_index (const unsigned int i) const {
+int MGDoFObjectAccessor<3, dim>::mg_dof_index (const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -332,7 +417,8 @@ int MGDoFObjectAccessor<3, dim>::mg_dof_index (const unsigned int i) const {
 
 template <int dim>
 void MGDoFObjectAccessor<3, dim>::set_mg_dof_index (const unsigned int i,
-                                                       const int index) const {
+                                                   const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -350,7 +436,8 @@ void MGDoFObjectAccessor<3, dim>::set_mg_dof_index (const unsigned int i,
 template <int dim>
 inline
 int MGDoFObjectAccessor<3, dim>::mg_vertex_dof_index (const unsigned int vertex,
-                                                         const unsigned int i) const {
+                                                     const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -366,8 +453,9 @@ int MGDoFObjectAccessor<3, dim>::mg_vertex_dof_index (const unsigned int vertex,
   
 template <int dim>
 void MGDoFObjectAccessor<3, dim>::set_mg_vertex_dof_index (const unsigned int vertex,
-                                                              const unsigned int i,
-                                                              const int index) const {
+                                                          const unsigned int i,
+                                                          const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -383,7 +471,8 @@ void MGDoFObjectAccessor<3, dim>::set_mg_vertex_dof_index (const unsigned int ve
 
 template <int dim>
 void
-MGDoFObjectAccessor<3, dim>::get_mg_dof_indices (vector<int> &dof_indices) const {
+MGDoFObjectAccessor<3, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -409,6 +498,46 @@ MGDoFObjectAccessor<3, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
       *next++ = this->quad(quad)->mg_dof_index(d);
   for (unsigned int d=0; d<dofs_per_hex; ++d)
     *next++ = mg_dof_index(d);
+  
+  Assert (next == dof_indices.end(),
+         ExcInternalError());
+};
+
+
+
+template <int dim>
+template <typename number>
+void
+MGDoFObjectAccessor<3,dim>::get_mg_dof_values (const Vector<number> &values,
+                                              Vector<number>       &dof_values) const
+{
+  Assert (dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (mg_dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (&dof_handler->get_fe() != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (dof_values.size() == dof_handler->get_fe().dofs_per_cell,
+         DoFAccessor<3>::ExcVectorDoesNotMatch());
+  Assert (values.size() == mg_dof_handler->n_dofs(present_level),
+         DoFAccessor<3>::ExcVectorDoesNotMatch());
+
+  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
+                    dofs_per_line   = dof_handler->get_fe().dofs_per_line,
+                    dofs_per_quad   = dof_handler->get_fe().dofs_per_quad,
+                    dofs_per_hex    = dof_handler->get_fe().dofs_per_hex;
+  vector<number>::iterator next_dof_value=dof_values.begin();
+  for (unsigned int vertex=0; vertex<8; ++vertex)
+    for (unsigned int d=0; d<dofs_per_vertex; ++d)
+      *next_dof_value++ = values(mg_vertex_dof_index(vertex,d));
+  for (unsigned int line=0; line<12; ++line)
+    for (unsigned int d=0; d<dofs_per_line; ++d)
+      *next_dof_value++ = values(this->line(line)->mg_dof_index(d));
+  for (unsigned int quad=0; quad<6; ++quad)
+    for (unsigned int d=0; d<dofs_per_quad; ++d)
+      *next_dof_value++ = values(this->quad(quad)->mg_dof_index(d));
+  for (unsigned int d=0; d<dofs_per_hex; ++d)
+    *next_dof_value++ = values(dof_index(d));
+  
+  Assert (next_dof_value == dof_values.end(),
+         ExcInternalError());
 };
 
 
@@ -519,30 +648,6 @@ MGDoFCellAccessor<1>::face (const unsigned int) const
   return face_iterator();
 };
 
-
-
-template <>
-void
-MGDoFCellAccessor<1>::get_mg_dof_values (const Vector<double> &values,
-                                        Vector<double>       &dof_values) const {
-  Assert (dof_handler != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
-  Assert (mg_dof_handler != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
-  Assert (&dof_handler->get_fe() != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
-  Assert (dof_values.size() == dof_handler->get_fe().dofs_per_cell,
-         ExcVectorDoesNotMatch());
-  Assert (values.size() == dof_handler->n_dofs(),
-         ExcVectorDoesNotMatch());
-
-  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = dof_handler->get_fe().dofs_per_line;
-  vector<double>::iterator next_dof_value=dof_values.begin();
-  for (unsigned int vertex=0; vertex<2; ++vertex)
-    for (unsigned int d=0; d<dofs_per_vertex; ++d)
-      *next_dof_value++ = values(mg_vertex_dof_index(vertex,d));
-  for (unsigned int d=0; d<dofs_per_line; ++d)
-    *next_dof_value++ = values(mg_dof_index(d));
-};
-
 #endif
 
 
@@ -556,41 +661,62 @@ MGDoFCellAccessor<2>::face (const unsigned int i) const
   return line(i);
 };
 
+#endif
+
 
 
-template <>
+
+
+// explicit instantiations
+
+template
 void
-MGDoFCellAccessor<2>::get_mg_dof_values (const Vector<double> &values,
-                                        Vector<double>       &dof_values) const {
-  Assert (dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
-  Assert (mg_dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
-  Assert (&dof_handler->get_fe() != 0, DoFAccessor<2>::ExcInvalidObject());
-  Assert (dof_values.size() == dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<2>::ExcVectorDoesNotMatch());
-  Assert (values.size() == mg_dof_handler->n_dofs(present_level),
-         DoFAccessor<2>::ExcVectorDoesNotMatch());
+MGDoFObjectAccessor<1,deal_II_dimension>::
+get_mg_dof_values (const Vector<double> &values,
+                  Vector<double>       &dof_values) const;
 
-  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = dof_handler->get_fe().dofs_per_line,
-                    dofs_per_quad   = dof_handler->get_fe().dofs_per_quad;
-  vector<double>::iterator next_dof_value=dof_values.begin();
-  for (unsigned int vertex=0; vertex<4; ++vertex)
-    for (unsigned int d=0; d<dofs_per_vertex; ++d)
-      *next_dof_value++ = values(mg_vertex_dof_index(vertex,d));
-  for (unsigned int line=0; line<4; ++line)
-    for (unsigned int d=0; d<dofs_per_line; ++d)
-      *next_dof_value++ = values(this->line(line)->mg_dof_index(d));
-  for (unsigned int d=0; d<dofs_per_quad; ++d)
-    *next_dof_value++ = values(mg_dof_index(d));
-};
+template
+void
+MGDoFObjectAccessor<1,deal_II_dimension>::
+get_mg_dof_values (const Vector<float> &values,
+                  Vector<float>       &dof_values) const;
+
+
+
+#if deal_II_dimension >= 2
+
+template
+void
+MGDoFObjectAccessor<2,deal_II_dimension>::
+get_mg_dof_values (const Vector<double> &values,
+                  Vector<double>       &dof_values) const;
+
+template
+void
+MGDoFObjectAccessor<2,deal_II_dimension>::
+get_mg_dof_values (const Vector<float> &values,
+                  Vector<float>       &dof_values) const;
 
 #endif
 
 
+#if deal_II_dimension >= 3
+
+template
+void
+MGDoFObjectAccessor<3,deal_II_dimension>::
+get_mg_dof_values (const Vector<double> &values,
+                  Vector<double>       &dof_values) const;
 
+template
+void
+MGDoFObjectAccessor<3,deal_II_dimension>::
+get_mg_dof_values (const Vector<float> &values,
+                  Vector<float>       &dof_values) const;
+
+#endif
 
 
-// explicit instantiations
 #if deal_II_dimension == 1
 template class MGDoFObjectAccessor<1, 1>;
 template class MGDoFCellAccessor<1>;
index 96dab7eaa894e6c87938df34fd77b96562f6b7e5..27cc111a4dcc338f091f191e55480099cfd06474 100644 (file)
 
 template <int dim>
 MGDoFObjectAccessor<1, dim>::MGDoFObjectAccessor (Triangulation<dim> *tria,
-                                                    const int           level,
-                                                    const int           index,
-                                                    const AccessorData *local_data) :
+                                                 const int           level,
+                                                 const int           index,
+                                                 const AccessorData *local_data) :
                MGDoFAccessor<dim> (local_data),
-               MGDoFObjectAccessor_Inheritance<1,dim>::BaseClass(tria,level,index,local_data) {};
+               MGDoFObjectAccessor_Inheritance<1,dim>::BaseClass(tria,level,index,local_data)
+{};
 
 
 
 template <int dim>
-int MGDoFObjectAccessor<1, dim>::mg_dof_index (const unsigned int i) const {
+int MGDoFObjectAccessor<1, dim>::mg_dof_index (const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -51,7 +53,8 @@ int MGDoFObjectAccessor<1, dim>::mg_dof_index (const unsigned int i) const {
 
 template <int dim>
 void MGDoFObjectAccessor<1, dim>::set_mg_dof_index (const unsigned int i,
-                                                        const int index) const {
+                                                   const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -69,7 +72,8 @@ void MGDoFObjectAccessor<1, dim>::set_mg_dof_index (const unsigned int i,
 
 template <int dim>
 int MGDoFObjectAccessor<1, dim>::mg_vertex_dof_index (const unsigned int vertex,
-                                                          const unsigned int i) const {
+                                                     const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -85,8 +89,9 @@ int MGDoFObjectAccessor<1, dim>::mg_vertex_dof_index (const unsigned int vertex,
   
 template <int dim>
 void MGDoFObjectAccessor<1, dim>::set_mg_vertex_dof_index (const unsigned int vertex,
-                                                               const unsigned int i,
-                                                               const int index) const {
+                                                          const unsigned int i,
+                                                          const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -102,7 +107,8 @@ void MGDoFObjectAccessor<1, dim>::set_mg_vertex_dof_index (const unsigned int ve
 
 template <int dim>
 void
-MGDoFObjectAccessor<1, dim>::get_mg_dof_indices (vector<int> &dof_indices) const {
+MGDoFObjectAccessor<1, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -118,17 +124,50 @@ MGDoFObjectAccessor<1, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
       *next++ = mg_vertex_dof_index(vertex,d);
   for (unsigned int d=0; d<dofs_per_line; ++d)
     *next++ = mg_dof_index(d);
+  
+  Assert (next == dof_indices.end(),
+         ExcInternalError());
+};
+
+
+
+template <int dim>
+template <typename number>
+void
+MGDoFObjectAccessor<1,dim>::get_mg_dof_values (const Vector<number> &values,
+                                              Vector<number>       &dof_values) const
+{
+  Assert (dof_handler != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
+  Assert (mg_dof_handler != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
+  Assert (&dof_handler->get_fe() != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
+  Assert (dof_values.size() == dof_handler->get_fe().dofs_per_cell,
+         DoFAccessor<1>::ExcVectorDoesNotMatch());
+  Assert (values.size() == dof_handler->n_dofs(),
+         DoFAccessor<1>::ExcVectorDoesNotMatch());
+
+  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
+                    dofs_per_line   = dof_handler->get_fe().dofs_per_line;
+  vector<number>::iterator next_dof_value=dof_values.begin();
+  for (unsigned int vertex=0; vertex<2; ++vertex)
+    for (unsigned int d=0; d<dofs_per_vertex; ++d)
+      *next_dof_value++ = values(mg_vertex_dof_index(vertex,d));
+  for (unsigned int d=0; d<dofs_per_line; ++d)
+    *next_dof_value++ = values(mg_dof_index(d));
+  
+  Assert (next_dof_value == dof_values.end(),
+         ExcInternalError());
 };
 
 
 
 template <int dim>
 TriaIterator<dim,MGDoFObjectAccessor<1, dim> >
-MGDoFObjectAccessor<1, dim>::child (const unsigned int i) const {
+MGDoFObjectAccessor<1, dim>::child (const unsigned int i) const
+{
   TriaIterator<dim,MGDoFObjectAccessor<1, dim> > q (tria,
-                                                        present_level+1,
-                                                        child_index (i),
-                                                        mg_dof_handler);
+                                                   present_level+1,
+                                                   child_index (i),
+                                                   mg_dof_handler);
   
 #ifdef DEBUG
   if (q.state() != past_the_end)
@@ -165,7 +204,8 @@ MGDoFObjectAccessor<2, dim>::MGDoFObjectAccessor (Triangulation<dim> *tria,
 
 template <int dim>
 inline
-int MGDoFObjectAccessor<2, dim>::mg_dof_index (const unsigned int i) const {
+int MGDoFObjectAccessor<2, dim>::mg_dof_index (const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -182,7 +222,8 @@ int MGDoFObjectAccessor<2, dim>::mg_dof_index (const unsigned int i) const {
 
 template <int dim>
 void MGDoFObjectAccessor<2, dim>::set_mg_dof_index (const unsigned int i,
-                                                        const int index) const {
+                                                   const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -200,7 +241,8 @@ void MGDoFObjectAccessor<2, dim>::set_mg_dof_index (const unsigned int i,
 template <int dim>
 inline
 int MGDoFObjectAccessor<2, dim>::mg_vertex_dof_index (const unsigned int vertex,
-                                                          const unsigned int i) const {
+                                                     const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -216,8 +258,9 @@ int MGDoFObjectAccessor<2, dim>::mg_vertex_dof_index (const unsigned int vertex,
   
 template <int dim>
 void MGDoFObjectAccessor<2, dim>::set_mg_vertex_dof_index (const unsigned int vertex,
-                                                               const unsigned int i,
-                                                               const int index) const {
+                                                          const unsigned int i,
+                                                          const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -233,7 +276,8 @@ void MGDoFObjectAccessor<2, dim>::set_mg_vertex_dof_index (const unsigned int ve
 
 template <int dim>
 void
-MGDoFObjectAccessor<2, dim>::get_mg_dof_indices (vector<int> &dof_indices) const {
+MGDoFObjectAccessor<2, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -254,13 +298,50 @@ MGDoFObjectAccessor<2, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
       *next++ = this->line(line)->mg_dof_index(d);
   for (unsigned int d=0; d<dofs_per_quad; ++d)
     *next++ = mg_dof_index(d);
+  
+  Assert (next == dof_indices.end(),
+         ExcInternalError());
+};
+
+
+
+template <int dim>
+template <typename number>
+void
+MGDoFObjectAccessor<2,dim>::get_mg_dof_values (const Vector<number> &values,
+                                              Vector<number>       &dof_values) const
+{
+  Assert (dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (mg_dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (&dof_handler->get_fe() != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (dof_values.size() == dof_handler->get_fe().dofs_per_cell,
+         DoFAccessor<2>::ExcVectorDoesNotMatch());
+  Assert (values.size() == mg_dof_handler->n_dofs(present_level),
+         DoFAccessor<2>::ExcVectorDoesNotMatch());
+
+  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
+                    dofs_per_line   = dof_handler->get_fe().dofs_per_line,
+                    dofs_per_quad   = dof_handler->get_fe().dofs_per_quad;
+  vector<number>::iterator next_dof_value=dof_values.begin();
+  for (unsigned int vertex=0; vertex<4; ++vertex)
+    for (unsigned int d=0; d<dofs_per_vertex; ++d)
+      *next_dof_value++ = values(mg_vertex_dof_index(vertex,d));
+  for (unsigned int line=0; line<4; ++line)
+    for (unsigned int d=0; d<dofs_per_line; ++d)
+      *next_dof_value++ = values(this->line(line)->mg_dof_index(d));
+  for (unsigned int d=0; d<dofs_per_quad; ++d)
+    *next_dof_value++ = values(mg_dof_index(d));
+  
+  Assert (next_dof_value == dof_values.end(),
+         ExcInternalError());
 };
 
 
 
 template <int dim>
 TriaIterator<dim,MGDoFObjectAccessor<1, dim> >
-MGDoFObjectAccessor<2, dim>::line (const unsigned int i) const {
+MGDoFObjectAccessor<2, dim>::line (const unsigned int i) const
+{
   Assert (i<4, ExcIndexRange (i, 0, 4));
 
   return TriaIterator<dim,MGDoFObjectAccessor<1, dim> >
@@ -276,11 +357,12 @@ MGDoFObjectAccessor<2, dim>::line (const unsigned int i) const {
 
 template <int dim>
 TriaIterator<dim,MGDoFObjectAccessor<2, dim> >
-MGDoFObjectAccessor<2, dim>::child (const unsigned int i) const {
+MGDoFObjectAccessor<2, dim>::child (const unsigned int i) const
+{
   TriaIterator<dim,MGDoFObjectAccessor<2, dim> > q (tria,
-                                                        present_level+1,
-                                                        child_index (i),
-                                                        mg_dof_handler);
+                                                   present_level+1,
+                                                   child_index (i),
+                                                   mg_dof_handler);
   
 #ifdef DEBUG
   if (q.state() != past_the_end)
@@ -293,7 +375,8 @@ MGDoFObjectAccessor<2, dim>::child (const unsigned int i) const {
 
 template <int dim>
 void
-MGDoFObjectAccessor<2, dim>::copy_from (const MGDoFObjectAccessor<2, dim> &a) {
+MGDoFObjectAccessor<2, dim>::copy_from (const MGDoFObjectAccessor<2, dim> &a)
+{
   DoFObjectAccessor<2, dim>::copy_from (a);
   set_mg_dof_handler (a.mg_dof_handler);
 };
@@ -305,17 +388,19 @@ MGDoFObjectAccessor<2, dim>::copy_from (const MGDoFObjectAccessor<2, dim> &a) {
 
 template <int dim>
 MGDoFObjectAccessor<3, dim>::MGDoFObjectAccessor (Triangulation<dim> *tria,
-                                                  const int           level,
-                                                  const int           index,
-                                                  const AccessorData *local_data) :
+                                                 const int           level,
+                                                 const int           index,
+                                                 const AccessorData *local_data) :
                MGDoFAccessor<dim> (local_data),
-               MGDoFObjectAccessor_Inheritance<3,dim>::BaseClass(tria,level,index,local_data) {};
+               MGDoFObjectAccessor_Inheritance<3,dim>::BaseClass(tria,level,index,local_data)
+{};
 
 
 
 template <int dim>
 inline
-int MGDoFObjectAccessor<3, dim>::mg_dof_index (const unsigned int i) const {
+int MGDoFObjectAccessor<3, dim>::mg_dof_index (const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -332,7 +417,8 @@ int MGDoFObjectAccessor<3, dim>::mg_dof_index (const unsigned int i) const {
 
 template <int dim>
 void MGDoFObjectAccessor<3, dim>::set_mg_dof_index (const unsigned int i,
-                                                       const int index) const {
+                                                   const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
                                   // make sure a FE has been selected
@@ -350,7 +436,8 @@ void MGDoFObjectAccessor<3, dim>::set_mg_dof_index (const unsigned int i,
 template <int dim>
 inline
 int MGDoFObjectAccessor<3, dim>::mg_vertex_dof_index (const unsigned int vertex,
-                                                         const unsigned int i) const {
+                                                     const unsigned int i) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -366,8 +453,9 @@ int MGDoFObjectAccessor<3, dim>::mg_vertex_dof_index (const unsigned int vertex,
   
 template <int dim>
 void MGDoFObjectAccessor<3, dim>::set_mg_vertex_dof_index (const unsigned int vertex,
-                                                              const unsigned int i,
-                                                              const int index) const {
+                                                          const unsigned int i,
+                                                          const int index) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -383,7 +471,8 @@ void MGDoFObjectAccessor<3, dim>::set_mg_vertex_dof_index (const unsigned int ve
 
 template <int dim>
 void
-MGDoFObjectAccessor<3, dim>::get_mg_dof_indices (vector<int> &dof_indices) const {
+MGDoFObjectAccessor<3, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
+{
   Assert (dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (mg_dof_handler != 0, DoFAccessor<dim>::ExcInvalidObject());
   Assert (&dof_handler->get_fe() != 0, DoFAccessor<dim>::ExcInvalidObject());
@@ -409,6 +498,46 @@ MGDoFObjectAccessor<3, dim>::get_mg_dof_indices (vector<int> &dof_indices) const
       *next++ = this->quad(quad)->mg_dof_index(d);
   for (unsigned int d=0; d<dofs_per_hex; ++d)
     *next++ = mg_dof_index(d);
+  
+  Assert (next == dof_indices.end(),
+         ExcInternalError());
+};
+
+
+
+template <int dim>
+template <typename number>
+void
+MGDoFObjectAccessor<3,dim>::get_mg_dof_values (const Vector<number> &values,
+                                              Vector<number>       &dof_values) const
+{
+  Assert (dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (mg_dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (&dof_handler->get_fe() != 0, DoFAccessor<2>::ExcInvalidObject());
+  Assert (dof_values.size() == dof_handler->get_fe().dofs_per_cell,
+         DoFAccessor<3>::ExcVectorDoesNotMatch());
+  Assert (values.size() == mg_dof_handler->n_dofs(present_level),
+         DoFAccessor<3>::ExcVectorDoesNotMatch());
+
+  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
+                    dofs_per_line   = dof_handler->get_fe().dofs_per_line,
+                    dofs_per_quad   = dof_handler->get_fe().dofs_per_quad,
+                    dofs_per_hex    = dof_handler->get_fe().dofs_per_hex;
+  vector<number>::iterator next_dof_value=dof_values.begin();
+  for (unsigned int vertex=0; vertex<8; ++vertex)
+    for (unsigned int d=0; d<dofs_per_vertex; ++d)
+      *next_dof_value++ = values(mg_vertex_dof_index(vertex,d));
+  for (unsigned int line=0; line<12; ++line)
+    for (unsigned int d=0; d<dofs_per_line; ++d)
+      *next_dof_value++ = values(this->line(line)->mg_dof_index(d));
+  for (unsigned int quad=0; quad<6; ++quad)
+    for (unsigned int d=0; d<dofs_per_quad; ++d)
+      *next_dof_value++ = values(this->quad(quad)->mg_dof_index(d));
+  for (unsigned int d=0; d<dofs_per_hex; ++d)
+    *next_dof_value++ = values(dof_index(d));
+  
+  Assert (next_dof_value == dof_values.end(),
+         ExcInternalError());
 };
 
 
@@ -519,30 +648,6 @@ MGDoFCellAccessor<1>::face (const unsigned int) const
   return face_iterator();
 };
 
-
-
-template <>
-void
-MGDoFCellAccessor<1>::get_mg_dof_values (const Vector<double> &values,
-                                        Vector<double>       &dof_values) const {
-  Assert (dof_handler != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
-  Assert (mg_dof_handler != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
-  Assert (&dof_handler->get_fe() != 0, DoFAccessor<1>::DoFAccessor<1>::ExcInvalidObject());
-  Assert (dof_values.size() == dof_handler->get_fe().dofs_per_cell,
-         ExcVectorDoesNotMatch());
-  Assert (values.size() == dof_handler->n_dofs(),
-         ExcVectorDoesNotMatch());
-
-  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = dof_handler->get_fe().dofs_per_line;
-  vector<double>::iterator next_dof_value=dof_values.begin();
-  for (unsigned int vertex=0; vertex<2; ++vertex)
-    for (unsigned int d=0; d<dofs_per_vertex; ++d)
-      *next_dof_value++ = values(mg_vertex_dof_index(vertex,d));
-  for (unsigned int d=0; d<dofs_per_line; ++d)
-    *next_dof_value++ = values(mg_dof_index(d));
-};
-
 #endif
 
 
@@ -556,41 +661,62 @@ MGDoFCellAccessor<2>::face (const unsigned int i) const
   return line(i);
 };
 
+#endif
+
 
 
-template <>
+
+
+// explicit instantiations
+
+template
 void
-MGDoFCellAccessor<2>::get_mg_dof_values (const Vector<double> &values,
-                                        Vector<double>       &dof_values) const {
-  Assert (dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
-  Assert (mg_dof_handler != 0, DoFAccessor<2>::ExcInvalidObject());
-  Assert (&dof_handler->get_fe() != 0, DoFAccessor<2>::ExcInvalidObject());
-  Assert (dof_values.size() == dof_handler->get_fe().dofs_per_cell,
-         DoFAccessor<2>::ExcVectorDoesNotMatch());
-  Assert (values.size() == mg_dof_handler->n_dofs(present_level),
-         DoFAccessor<2>::ExcVectorDoesNotMatch());
+MGDoFObjectAccessor<1,deal_II_dimension>::
+get_mg_dof_values (const Vector<double> &values,
+                  Vector<double>       &dof_values) const;
 
-  const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex,
-                    dofs_per_line   = dof_handler->get_fe().dofs_per_line,
-                    dofs_per_quad   = dof_handler->get_fe().dofs_per_quad;
-  vector<double>::iterator next_dof_value=dof_values.begin();
-  for (unsigned int vertex=0; vertex<4; ++vertex)
-    for (unsigned int d=0; d<dofs_per_vertex; ++d)
-      *next_dof_value++ = values(mg_vertex_dof_index(vertex,d));
-  for (unsigned int line=0; line<4; ++line)
-    for (unsigned int d=0; d<dofs_per_line; ++d)
-      *next_dof_value++ = values(this->line(line)->mg_dof_index(d));
-  for (unsigned int d=0; d<dofs_per_quad; ++d)
-    *next_dof_value++ = values(mg_dof_index(d));
-};
+template
+void
+MGDoFObjectAccessor<1,deal_II_dimension>::
+get_mg_dof_values (const Vector<float> &values,
+                  Vector<float>       &dof_values) const;
+
+
+
+#if deal_II_dimension >= 2
+
+template
+void
+MGDoFObjectAccessor<2,deal_II_dimension>::
+get_mg_dof_values (const Vector<double> &values,
+                  Vector<double>       &dof_values) const;
+
+template
+void
+MGDoFObjectAccessor<2,deal_II_dimension>::
+get_mg_dof_values (const Vector<float> &values,
+                  Vector<float>       &dof_values) const;
 
 #endif
 
 
+#if deal_II_dimension >= 3
+
+template
+void
+MGDoFObjectAccessor<3,deal_II_dimension>::
+get_mg_dof_values (const Vector<double> &values,
+                  Vector<double>       &dof_values) const;
 
+template
+void
+MGDoFObjectAccessor<3,deal_II_dimension>::
+get_mg_dof_values (const Vector<float> &values,
+                  Vector<float>       &dof_values) const;
+
+#endif
 
 
-// explicit instantiations
 #if deal_II_dimension == 1
 template class MGDoFObjectAccessor<1, 1>;
 template class MGDoFCellAccessor<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.