]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Changed structure in dofs, hp, multigrid and numerics so that these directories are...
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 16 Nov 2010 13:50:47 +0000 (13:50 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 16 Nov 2010 13:50:47 +0000 (13:50 +0000)
git-svn-id: https://svn.dealii.org/trunk@22749 0785d39b-7218-0410-832d-ea1e28bc413d

82 files changed:
deal.II/include/deal.II/dofs/dof_tools.h
deal.II/include/deal.II/fe/fe_dgp.h
deal.II/include/deal.II/fe/fe_q.h
deal.II/include/deal.II/grid/grid_tools.h
deal.II/include/deal.II/hp/dof_handler.h
deal.II/include/deal.II/numerics/vectors.templates.h
deal.II/source/Makefile
deal.II/source/dofs/block_info.cc [moved from deal.II/source/dofs/block_info.all_dimensions.cc with 100% similarity]
deal.II/source/dofs/dof_accessor.cc [moved from deal.II/source/dofs/dof_accessor.all_dimensions.cc with 100% similarity]
deal.II/source/dofs/dof_faces.cc [moved from deal.II/source/dofs/dof_faces.all_dimensions.cc with 100% similarity]
deal.II/source/dofs/dof_handler.cc [moved from deal.II/source/dofs/dof_handler.all_dimensions.cc with 100% similarity]
deal.II/source/dofs/dof_handler_policy.cc
deal.II/source/dofs/dof_handler_policy.inst.in [new file with mode: 0644]
deal.II/source/dofs/dof_levels.cc [moved from deal.II/source/dofs/dof_levels.all_dimensions.cc with 100% similarity]
deal.II/source/dofs/dof_objects.cc [moved from deal.II/source/dofs/dof_objects.all_dimensions.cc with 100% similarity]
deal.II/source/dofs/dof_renumbering.cc
deal.II/source/dofs/dof_renumbering.inst.in [new file with mode: 0644]
deal.II/source/dofs/dof_tools.cc
deal.II/source/dofs/dof_tools.inst.in
deal.II/source/dofs/number_cache.cc [moved from deal.II/source/dofs/number_cache.all_dimensions.cc with 100% similarity]
deal.II/source/hp/dof_faces.cc
deal.II/source/hp/dof_handler.cc
deal.II/source/hp/dof_handler.inst.in [new file with mode: 0644]
deal.II/source/hp/dof_levels.all_dimensions.cc [deleted file]
deal.II/source/hp/dof_levels.cc
deal.II/source/hp/dof_objects.cc [moved from deal.II/source/hp/dof_objects.all_dimensions.cc with 100% similarity]
deal.II/source/hp/fe_collection.cc
deal.II/source/hp/fe_collection.inst.in [new file with mode: 0644]
deal.II/source/hp/fe_values.cc
deal.II/source/hp/fe_values.inst.in [new file with mode: 0644]
deal.II/source/hp/mapping_collection.cc
deal.II/source/hp/mapping_collection.inst.in [new file with mode: 0644]
deal.II/source/multigrid/mg_base.cc [moved from deal.II/source/multigrid/mg_base.all_dimensions.cc with 100% similarity]
deal.II/source/multigrid/mg_dof_accessor.cc
deal.II/source/multigrid/mg_dof_accessor.inst.in [new file with mode: 0644]
deal.II/source/multigrid/mg_dof_handler.cc
deal.II/source/multigrid/mg_dof_handler.inst.in [new file with mode: 0644]
deal.II/source/multigrid/mg_tools.all_dimensions.cc [deleted file]
deal.II/source/multigrid/mg_tools.cc
deal.II/source/multigrid/mg_tools.inst.in [new file with mode: 0644]
deal.II/source/multigrid/mg_tools.pattern.in.h [deleted file]
deal.II/source/multigrid/mg_transfer_block.cc
deal.II/source/multigrid/mg_transfer_block.inst.in [new file with mode: 0644]
deal.II/source/multigrid/mg_transfer_component.cc
deal.II/source/multigrid/mg_transfer_component.inst.in [new file with mode: 0644]
deal.II/source/multigrid/mg_transfer_prebuilt.cc
deal.II/source/multigrid/mg_transfer_prebuilt.inst.in [new file with mode: 0644]
deal.II/source/multigrid/multigrid.cc [moved from deal.II/source/multigrid/multigrid.all_dimensions.cc with 99% similarity]
deal.II/source/numerics/data_out.inst.in
deal.II/source/numerics/data_out_faces.cc
deal.II/source/numerics/data_out_faces.inst.in [new file with mode: 0644]
deal.II/source/numerics/data_out_rotation.cc
deal.II/source/numerics/data_out_rotation.inst.in [new file with mode: 0644]
deal.II/source/numerics/data_out_stack.cc
deal.II/source/numerics/data_out_stack.inst.in [new file with mode: 0644]
deal.II/source/numerics/data_postprocessor.cc
deal.II/source/numerics/data_postprocessor.inst.in [new file with mode: 0644]
deal.II/source/numerics/derivative_approximation.cc
deal.II/source/numerics/derivative_approximation.inst.in [new file with mode: 0644]
deal.II/source/numerics/error_estimator.cc
deal.II/source/numerics/error_estimator.inst.in [new file with mode: 0644]
deal.II/source/numerics/fe_field_function.inst.in
deal.II/source/numerics/histogram.cc [moved from deal.II/source/numerics/histogram.all_dimensions.cc with 100% similarity]
deal.II/source/numerics/matrices.all_dimensions.cc [deleted file]
deal.II/source/numerics/matrices.cc
deal.II/source/numerics/matrices.inst.in [new file with mode: 0644]
deal.II/source/numerics/mesh_worker.cc [moved from deal.II/source/numerics/mesh_worker.all_dimensions.cc with 100% similarity]
deal.II/source/numerics/mesh_worker_info.cc
deal.II/source/numerics/mesh_worker_info.inst.in [new file with mode: 0644]
deal.II/source/numerics/mesh_worker_vector_selector.cc
deal.II/source/numerics/mesh_worker_vector_selector.inst.in
deal.II/source/numerics/operator.inst.in
deal.II/source/numerics/point_value_history.cc
deal.II/source/numerics/point_value_history.inst.in
deal.II/source/numerics/solution_transfer.cc
deal.II/source/numerics/solution_transfer.inst.in [new file with mode: 0644]
deal.II/source/numerics/time_dependent.all_dimensions.cc [deleted file]
deal.II/source/numerics/time_dependent.cc
deal.II/source/numerics/time_dependent.inst.in [new file with mode: 0644]
deal.II/source/numerics/vectors.all_dimensions.cc [deleted file]
deal.II/source/numerics/vectors.cc
deal.II/source/numerics/vectors.inst.in

index bfc15afb6c1533277105ff0898cb51eb4e3244b3..39f8fde9ed0a07bfbd101534eab1846d8c0a053b 100644 (file)
@@ -2132,17 +2132,6 @@ class DoFTools
 
 
 
-/* ------------------------- explicit specializations -------------- */
-
-#ifndef DOXYGEN
-
-template <>
-void
-DoFTools::map_dof_to_boundary_indices (const DoFHandler<1,1>       &dof_handler,
-                                       std::vector<unsigned int> &mapping);
-
-#endif
-
 /* ------------------------- inline functions -------------- */
 
 
index cba751c2748949d0ad5958b6c41250a17b5b7e29..fb1b378d2d00edd334c9e8bf68da26dd28c688f1 100644 (file)
@@ -378,7 +378,6 @@ template <>
 const unsigned int FE_DGP<3>::Matrices::n_projection_matrices;
 
 //codimension 1
-#if deal_II_dimension != 3
 template <>
 const double * const FE_DGP<1,2>::Matrices::projection_matrices[][GeometryInfo<1>::max_children_per_cell];
 
@@ -391,9 +390,6 @@ const double * const FE_DGP<2,3>::Matrices::projection_matrices[][GeometryInfo<2
 template <>
 const unsigned int FE_DGP<2,3>::Matrices::n_projection_matrices;
 
-#endif
-
-
 #endif
 
 #endif // DOXYGEN
index 0903af3dd62cbd6f70845f2f5480afd968398a6f..e88f9682ac566511048443090e01c2de976e524e 100644 (file)
@@ -599,8 +599,6 @@ std::vector<unsigned int>
 FE_Q<1>::face_lexicographic_to_hierarchic_numbering (const unsigned int);
 
 
-#if deal_II_dimension != 3
-
 template <>
 void FE_Q<1,2>::initialize_unit_face_support_points ();
 
@@ -608,7 +606,6 @@ template <>
 std::vector<unsigned int>
 FE_Q<1,2>::face_lexicographic_to_hierarchic_numbering (const unsigned int);
 
-#endif
 
 
 DEAL_II_NAMESPACE_CLOSE
index 15237f947587e2a6d91ccbb91bf6c7651176a079..475fe7e4716e39ef1e9d366e3be55dbe606fc8c6 100644 (file)
@@ -930,67 +930,54 @@ GridTools::get_active_child_cells (const typename DH::cell_iterator& cell)
 
 
 
-#if deal_II_dimension == 1
-
 template <class Container>
 void
 GridTools::get_active_neighbors(const typename Container::active_cell_iterator        &cell,
                                std::vector<typename Container::active_cell_iterator> &active_neighbors)
 {
   active_neighbors.clear ();
-  for (unsigned int n=0; n<GeometryInfo<1>::faces_per_cell; ++n)
+  for (unsigned int n=0; n<GeometryInfo<Container::dimension>::faces_per_cell; ++n)
     if (! cell->at_boundary(n))
       {
+       if (Container::dimension == 1)
+         {
                                         // check children of neighbor. note
                                         // that in 1d children of the neighbor
                                         // may be further refined. In 1d the
                                         // case is simple since we know what
                                         // children bound to the present cell
-       typename Container::cell_iterator
-         neighbor_child = cell->neighbor(n);
-       if (!neighbor_child->active())
-         {
-           while (neighbor_child->has_children())
-             neighbor_child = neighbor_child->child (n==0 ? 1 : 0);
-
-           Assert (neighbor_child->neighbor(n==0 ? 1 : 0)==cell,
-                   ExcInternalError());
+           typename Container::cell_iterator
+             neighbor_child = cell->neighbor(n);
+           if (!neighbor_child->active())
+             {
+               while (neighbor_child->has_children())
+                 neighbor_child = neighbor_child->child (n==0 ? 1 : 0);
+
+               Assert (neighbor_child->neighbor(n==0 ? 1 : 0)==cell,
+                       ExcInternalError());
+             }
+           active_neighbors.push_back (neighbor_child);
          }
-       active_neighbors.push_back (neighbor_child);
-      }
-}
-
-#else
-
-template <class Container>
-void
-GridTools::get_active_neighbors(const typename Container::active_cell_iterator        &cell,
-                               std::vector<typename Container::active_cell_iterator> &active_neighbors)
-{
-  active_neighbors.clear ();
-  for (unsigned int n=0; n<GeometryInfo<Container::dimension>::faces_per_cell; ++n)
-    if (! cell->at_boundary(n))
-      {
-       if (cell->face(n)->has_children())
+       else
+         {
+           if (cell->face(n)->has_children())
                                           // this neighbor has children. find
                                           // out which border to the present
                                           // cell
-         for (unsigned int c=0; c<cell->face(n)->number_of_children(); ++c)
-           active_neighbors.push_back (cell->neighbor_child_on_subface(n,c));
-       else
-         {
+             for (unsigned int c=0; c<cell->face(n)->number_of_children(); ++c)
+               active_neighbors.push_back (cell->neighbor_child_on_subface(n,c));
+           else
+             {
                                             // the neighbor must be active
                                             // himself
-           Assert(cell->neighbor(n)->active(), ExcInternalError());
-           active_neighbors.push_back(cell->neighbor(n));
+               Assert(cell->neighbor(n)->active(), ExcInternalError());
+               active_neighbors.push_back(cell->neighbor(n));
+             }
          }
       }
 }
 
 
-#endif
-
-
 
 
 // declaration of explicit specializations
index b4264ae56ef34ab40473cb73b4bf44934dd4e3e6..8cbb832750f57259368f385b3040d0a4b22b3a08 100644 (file)
@@ -1311,15 +1311,8 @@ namespace hp
 
 
 
-
-/* -------------- declaration of explicit specializations ------------- */
-
 #ifndef DOXYGEN
 
-  template <> unsigned int DoFHandler<1>::n_boundary_dofs () const;
-  template <> unsigned int DoFHandler<1>::n_boundary_dofs (const FunctionMap &) const;
-  template <> unsigned int DoFHandler<1>::n_boundary_dofs (const std::set<unsigned char> &) const;
-
 
 /* ----------------------- Inline functions ---------------------------------- */
 
index b27f75adf4f685d47da4523caeb7c70c630eaf01..6e2dabbf901cd5da59a6fce6fb22de042ded2313 100644 (file)
 #include <lac/filtered_matrix.h>
 #include <lac/constraint_matrix.h>
 #include <grid/tria_iterator.h>
+#include <grid/tria_accessor.h>
 #include <grid/grid_tools.h>
-#include <dofs/dof_handler.h>
-#include <hp/dof_handler.h>
 #include <dofs/dof_accessor.h>
+#include <dofs/dof_handler.h>
 #include <dofs/dof_tools.h>
 #include <fe/fe.h>
 #include <fe/fe_nedelec.h>
 #include <fe/fe_tools.h>
 #include <fe/fe_values.h>
 #include <fe/fe_nedelec.h>
-#include <hp/fe_values.h>
 #include <fe/mapping_q1.h>
+#include <hp/dof_handler.h>
+#include <hp/fe_values.h>
 #include <hp/mapping_collection.h>
 #include <hp/q_collection.h>
 #include <numerics/vectors.h>
@@ -318,12 +319,9 @@ namespace internal
 {
   namespace VectorTools
   {
-#if deal_II_dimension == 1
-
-    template <int dim>
     void
-    interpolate_zero_boundary_values (const dealii::DoFHandler<dim>         &dof_handler,
-                                      std::map<unsigned int,double> &boundary_values)
+    interpolate_zero_boundary_values (const dealii::DoFHandler<1>   &dof_handler,
+                                     std::map<unsigned int,double> &boundary_values)
     {
                                        // we only need to find the
                                        // left-most and right-most
@@ -331,7 +329,7 @@ namespace internal
                                        // dof indices. that's easy :-)
       for (unsigned direction=0; direction<2; ++direction)
         {
-          typename dealii::DoFHandler<dim>::cell_iterator
+          typename dealii::DoFHandler<1>::cell_iterator
               cell = dof_handler.begin(0);
           while (!cell->at_boundary(direction))
             cell = cell->neighbor(direction);
@@ -342,10 +340,11 @@ namespace internal
     }
 
 
-//codimension 1
+
+                               // codimension 1
     void
-      interpolate_zero_boundary_values (const dealii::DoFHandler<1,2>         &dof_handler,
-                                      std::map<unsigned int,double> &boundary_values)
+    interpolate_zero_boundary_values (const dealii::DoFHandler<1,2> &dof_handler,
+                                     std::map<unsigned int,double> &boundary_values)
     {
                                        // we only need to find the
                                        // left-most and right-most
@@ -364,7 +363,6 @@ namespace internal
     }
 
 
-#else
 
     template <int dim, int spacedim>
     void
@@ -412,8 +410,6 @@ namespace internal
              boundary_values[face_dof_indices[i]] = 0.;
          }
     }
-
-#endif
   }
 }
 
@@ -897,7 +893,6 @@ void VectorTools::create_point_source_vector (const hp::DoFHandler<dim,spacedim>
 }
 
 
-#if deal_II_dimension != 1
 
 template <int dim, int spacedim>
 void
@@ -908,6 +903,12 @@ VectorTools::create_boundary_right_hand_side (const Mapping<dim, spacedim>
                                              Vector<double>          &rhs_vector,
                                              const std::set<unsigned char> &boundary_indicators)
 {
+  if (dim == 1)
+    {
+      Assert (false, ExcImpossibleInDim(dim));
+      return;
+    }
+
   const FiniteElement<dim> &fe  = dof_handler.get_fe();
   Assert (fe.n_components() == rhs_function.n_components,
          ExcDimensionMismatch(fe.n_components(), rhs_function.n_components));
@@ -1018,22 +1019,7 @@ VectorTools::create_boundary_right_hand_side (const Mapping<dim, spacedim>
     }
 }
 
-#else
-
-// Implementation for 1D
-template <int dim, int spacedim>
-void
-VectorTools::create_boundary_right_hand_side (const Mapping<dim, spacedim>    &,
-                                             const DoFHandler<dim,spacedim> &,
-                                             const Quadrature<dim-1> &,
-                                             const Function<spacedim>   &,
-                                             Vector<double>      &,
-                                             const std::set<unsigned char> &)
-{
-  Assert (false, ExcImpossibleInDim(dim));
-}
 
-#endif
 
 template <int dim, int spacedim>
 void
@@ -1053,7 +1039,33 @@ VectorTools::create_boundary_right_hand_side (const DoFHandler<dim,spacedim>   &
 
 
 
-#if deal_II_dimension != 1
+template <>
+void
+VectorTools::create_boundary_right_hand_side (const hp::MappingCollection<1,1>      &mapping,
+                                             const hp::DoFHandler<1,1>   &dof_handler,
+                                             const hp::QCollection<0> &quadrature,
+                                             const Function<1>     &rhs_function,
+                                             Vector<double>          &rhs_vector,
+                                             const std::set<unsigned char> &boundary_indicators)
+{
+  Assert (false, ExcImpossibleInDim(1));
+}
+
+
+
+template <>
+void
+VectorTools::create_boundary_right_hand_side (const hp::MappingCollection<1,2>      &mapping,
+                                             const hp::DoFHandler<1,2>   &dof_handler,
+                                             const hp::QCollection<0> &quadrature,
+                                             const Function<2>     &rhs_function,
+                                             Vector<double>          &rhs_vector,
+                                             const std::set<unsigned char> &boundary_indicators)
+{
+  Assert (false, ExcImpossibleInDim(1));
+}
+
+
 
 template <int dim, int spacedim>
 void
@@ -1185,22 +1197,7 @@ VectorTools::create_boundary_right_hand_side (const hp::MappingCollection<dim,sp
     }
 }
 
-#else
-
-// Implementation for 1D
-template <int dim, int spacedim>
-void
-VectorTools::create_boundary_right_hand_side (const hp::MappingCollection<dim,spacedim>    &,
-                                             const hp::DoFHandler<dim,spacedim> &,
-                                             const hp::QCollection<dim-1> &,
-                                             const Function<spacedim>   &,
-                                             Vector<double>      &,
-                                             const std::set<unsigned char> &)
-{
-  Assert (false, ExcImpossibleInDim(1));
-}
 
-#endif
 
 template <int dim, int spacedim>
 void
@@ -1221,37 +1218,42 @@ VectorTools::create_boundary_right_hand_side (const hp::DoFHandler<dim,spacedim>
 
 // ----------- interpolate_boundary_values for std::map --------------------
 
-#if deal_II_dimension == 1
-
-//TODO[?] Actually the Mapping object should be a MappingCollection object for the
-// hp::DoFHandler.
-
-//template <int dim, template <int, int> class DH, int spacedim>
-
-template <class DH>
-void
-VectorTools::interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension> &,
-                                         const DH              &dof,
-                                         const unsigned char    boundary_component,
-                                         const Function<DH::space_dimension> &boundary_function,
-                                         std::map<unsigned int,double> &boundary_values,
-                                         const std::vector<bool>       &component_mask_)
+// TODO: it might be possible to avoid the specialization for 1D if we could
+// have hp::FEFaceValues<1>...
+namespace internal
 {
-  //ConstraintMatrix boundary_constraints();
-  //  interpolate_boundary_values (dof, boundary_component, boundary_function,
-  //                          boundary_constraints, component_mask);
+  namespace VectorTools
+  {
+    template <class DH>
+    static inline
+    void interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension>            &mapping,
+                                     const DH                 &dof,
+                                     const typename FunctionMap<DH::space_dimension>::type &function_map,
+                                     std::map<unsigned int,double> &boundary_values,
+                                     const std::vector<bool>       &component_mask_,
+                                     const internal::int2type<1>)
+    {
+      const unsigned int dim = DH::dimension;
+      const unsigned int spacedim=DH::space_dimension;
 
-  const unsigned int dim=DH::dimension;
-  const unsigned int spacedim=DH::space_dimension;
+      Assert ((component_mask_.size() == 0) ||
+             (component_mask_.size() == dof.get_fe().n_components()),
+             ExcMessage ("The number of components in the mask has to be either "
+                         "zero or equal to the number of components in the finite "
+                         "element."));
 
-  Assert (boundary_component != 255,
-         ExcInvalidBoundaryIndicator());
-  Assert ((component_mask_.size() == 0) ||
-         (component_mask_.size() == dof.get_fe().n_components()),
-         ExcMessage ("The number of components in the mask has to be either "
-                     "zero or equal to the number of components in the finite "
-                     "element."));
+                                  // if for whatever reason we were
+                                  // passed an empty map, return
+                                  // immediately
+      if (function_map.size() == 0)
+       return;
 
+      Assert (function_map.find(255) == function_map.end(),
+             dealii::VectorTools::ExcInvalidBoundaryIndicator());
+
+      for (typename FunctionMap<spacedim>::type::const_iterator i=function_map.begin();
+          i!=function_map.end(); ++i)
+       {
                                   // check whether boundary values at
                                   // the left or right boundary of
                                   // the line are
@@ -1260,34 +1262,37 @@ VectorTools::interpolate_boundary_values (const Mapping<DH::dimension, DH::space
                                   // which we seek the boundary,
                                   // i.e. 0 is left boundary and 1 is
                                   // right.
-  const unsigned int direction = boundary_component;
-  Assert (direction < 2, ExcInvalidBoundaryIndicator());
+         const unsigned int direction = i->first;
+         Assert (direction < 2,
+                 dealii::VectorTools::ExcInvalidBoundaryIndicator());
+
+         const Function<DH::space_dimension> & boundary_function = *(i->second);
 
                                   // first find the outermost active
                                   // cell by first traversing the coarse
                                   // grid to its end and then going
                                   // to the children
-  typename DH::cell_iterator outermost_cell = dof.begin(0);
-  while (outermost_cell->neighbor(direction).state() == IteratorState::valid)
-    outermost_cell = outermost_cell->neighbor(direction);
+         typename DH::cell_iterator outermost_cell = dof.begin(0);
+         while (outermost_cell->neighbor(direction).state() == IteratorState::valid)
+           outermost_cell = outermost_cell->neighbor(direction);
 
-  while (outermost_cell->has_children())
-    outermost_cell = outermost_cell->child(direction);
+         while (outermost_cell->has_children())
+           outermost_cell = outermost_cell->child(direction);
 
                                    // get the FE corresponding to this
                                    // cell
-  const FiniteElement<dim,spacedim> &fe = outermost_cell->get_fe();
-  Assert (fe.n_components() == boundary_function.n_components,
-         ExcDimensionMismatch(fe.n_components(), boundary_function.n_components));
+         const FiniteElement<dim,spacedim> &fe = outermost_cell->get_fe();
+         Assert (fe.n_components() == boundary_function.n_components,
+                 ExcDimensionMismatch(fe.n_components(), boundary_function.n_components));
 
                                   // set the component mask to either
                                   // the original value or a vector
                                   // of trues
-  const std::vector<bool> component_mask ((component_mask_.size() == 0) ?
-                                         std::vector<bool> (fe.n_components(), true) :
-                                         component_mask_);
-  Assert (std::count(component_mask.begin(), component_mask.end(), true) > 0,
-         ExcNoComponentSelected());
+         const std::vector<bool> component_mask ((component_mask_.size() == 0) ?
+                                                 std::vector<bool> (fe.n_components(), true) :
+                                                 component_mask_);
+         Assert (std::count(component_mask.begin(), component_mask.end(), true) > 0,
+                 dealii::VectorTools::ExcNoComponentSelected());
 
                                   // now set the value of the
                                   // outermost degree of
@@ -1300,100 +1305,77 @@ VectorTools::interpolate_boundary_values (const Mapping<DH::dimension, DH::space
                                   // values only once for each point,
                                   // irrespective of the number of
                                   // components of the function
-  Vector<double> function_values (fe.n_components());
-  if (fe.n_components() == 1)
-    function_values(0)
-      = boundary_function.value (outermost_cell->vertex(direction));
-  else
-    boundary_function.vector_value (outermost_cell->vertex(direction),
-                                   function_values);
-
-  for (unsigned int i=0; i<fe.dofs_per_vertex; ++i)
-    if (component_mask[fe.face_system_to_component_index(i).first])
-      boundary_values[outermost_cell->
-                     vertex_dof_index(direction,i,
-                                      outermost_cell->active_fe_index())]
-       = function_values(fe.face_system_to_component_index(i).first);
-}
-
-
-//TODO[?] Actually the Mapping object should be a MappingCollection object for the
-// hp::DoFHandler.
-
-// Implementation for 1D
-template <class DH>
-void
-VectorTools::interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension>              &mapping,
-                                         const DH         &dof,
-                                         const typename FunctionMap<DH::space_dimension>::type    &function_map,
-                                         std::map<unsigned int,double> &boundary_values,
-                                         const std::vector<bool>       &component_mask)
-{
-  for (typename FunctionMap<DH::space_dimension>::type::const_iterator i=function_map.begin();
-       i!=function_map.end(); ++i)
-    interpolate_boundary_values (mapping, dof, i->first, *i->second,
-                                boundary_values, component_mask);
-}
-
-
-//TODO[?] Actually the Mapping object should be a MappingCollection object for the
-// hp::DoFHandler.
-
+         dealii::Vector<double> function_values (fe.n_components());
+         if (fe.n_components() == 1)
+           function_values(0)
+             = boundary_function.value (outermost_cell->vertex(direction));
+         else
+           boundary_function.vector_value (outermost_cell->vertex(direction),
+                                           function_values);
+
+         for (unsigned int i=0; i<fe.dofs_per_vertex; ++i)
+           if (component_mask[fe.face_system_to_component_index(i).first])
+             boundary_values[outermost_cell->
+                             vertex_dof_index(direction,i,
+                                              outermost_cell->active_fe_index())]
+               = function_values(fe.face_system_to_component_index(i).first);
+       }
+    }
 
-#else
 
 
-template <class DH>
-void
-VectorTools::
-interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension>            &mapping,
-                             const DH                 &dof,
-                             const typename FunctionMap<DH::space_dimension>::type &function_map,
-                             std::map<unsigned int,double> &boundary_values,
-                             const std::vector<bool>       &component_mask_)
-{
-  const unsigned int dim=DH::dimension;
-  const unsigned int spacedim=DH::space_dimension;
+    template <class DH>
+    static inline
+    void
+    interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension> &mapping,
+                                const DH                 &dof,
+                                const typename FunctionMap<DH::space_dimension>::type &function_map,
+                                std::map<unsigned int,double> &boundary_values,
+                                const std::vector<bool>       &component_mask_,
+                                const internal::int2type<DH::dimension>)
+    {
+      const unsigned int dim = DH::dimension;
+      const unsigned int spacedim=DH::space_dimension;
 
-  Assert ((component_mask_.size() == 0) ||
-         (component_mask_.size() == dof.get_fe().n_components()),
-         ExcMessage ("The number of components in the mask has to be either "
-                     "zero or equal to the number of components in the finite "
-                     "element."));
+      Assert ((component_mask_.size() == 0) ||
+             (component_mask_.size() == dof.get_fe().n_components()),
+             ExcMessage ("The number of components in the mask has to be either "
+                         "zero or equal to the number of components in the finite "
+                         "element."));
 
 
                                   // if for whatever reason we were
                                   // passed an empty map, return
                                   // immediately
-  if (function_map.size() == 0)
-    return;
+      if (function_map.size() == 0)
+       return;
 
-  Assert (function_map.find(255) == function_map.end(),
-         ExcInvalidBoundaryIndicator());
+      Assert (function_map.find(255) == function_map.end(),
+             dealii::VectorTools::ExcInvalidBoundaryIndicator());
 
-  const unsigned int        n_components = DoFTools::n_components(dof);
-  const bool                fe_is_system = (n_components != 1);
+      const unsigned int        n_components = DoFTools::n_components(dof);
+      const bool                fe_is_system = (n_components != 1);
 
-  for (typename FunctionMap<spacedim>::type::const_iterator i=function_map.begin();
-       i!=function_map.end(); ++i)
-    Assert (n_components == i->second->n_components,
-           ExcDimensionMismatch(n_components, i->second->n_components));
+      for (typename FunctionMap<spacedim>::type::const_iterator i=function_map.begin();
+          i!=function_map.end(); ++i)
+       Assert (n_components == i->second->n_components,
+               ExcDimensionMismatch(n_components, i->second->n_components));
 
                                   // set the component mask to either
                                   // the original value or a vector
                                   // of trues
-  const std::vector<bool> component_mask ((component_mask_.size() == 0) ?
-                                         std::vector<bool> (n_components, true) :
-                                         component_mask_);
-  Assert (std::count(component_mask.begin(), component_mask.end(), true) > 0,
-         ExcNoComponentSelected());
+      const std::vector<bool> component_mask ((component_mask_.size() == 0) ?
+                                             std::vector<bool> (n_components, true) :
+                                             component_mask_);
+      Assert (std::count(component_mask.begin(), component_mask.end(), true) > 0,
+             dealii::VectorTools::ExcNoComponentSelected());
 
                                   // field to store the indices
-  std::vector<unsigned int> face_dofs;
-  face_dofs.reserve (DoFTools::max_dofs_per_face(dof));
+      std::vector<unsigned int> face_dofs;
+      face_dofs.reserve (DoFTools::max_dofs_per_face(dof));
 
-  std::vector<Point<spacedim> >  dof_locations;
-  dof_locations.reserve (DoFTools::max_dofs_per_face(dof));
+      std::vector<Point<spacedim> >  dof_locations;
+      dof_locations.reserve (DoFTools::max_dofs_per_face(dof));
 
                                   // array to store the values of
                                   // the boundary function at the
@@ -1401,10 +1383,10 @@ interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension>
                                   // for scalar and vector functions
                                   // to use the more efficient one
                                   // respectively
-  std::vector<double>          dof_values_scalar;
-  std::vector<Vector<double> > dof_values_system;
-  dof_values_scalar.reserve (DoFTools::max_dofs_per_face (dof));
-  dof_values_system.reserve (DoFTools::max_dofs_per_face (dof));
+      std::vector<double>          dof_values_scalar;
+      std::vector<dealii::Vector<double> > dof_values_system;
+      dof_values_scalar.reserve (DoFTools::max_dofs_per_face (dof));
+      dof_values_system.reserve (DoFTools::max_dofs_per_face (dof));
 
                                   // before we start with the loop
                                   // over all cells create an
@@ -1412,11 +1394,11 @@ interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension>
                                   // the interpolation points of all
                                   // finite elements that may ever be
                                   // in use
-  hp::FECollection<dim,spacedim> finite_elements (dof.get_fe());
-  hp::QCollection<dim-1>  q_collection;
-  for (unsigned int f=0; f<finite_elements.size(); ++f)
-    {
-      const FiniteElement<dim,spacedim> &fe = finite_elements[f];
+      dealii::hp::FECollection<dim,spacedim> finite_elements (dof.get_fe());
+      dealii::hp::QCollection<dim-1>  q_collection;
+      for (unsigned int f=0; f<finite_elements.size(); ++f)
+      {
+        const FiniteElement<dim,spacedim> &fe = finite_elements[f];
 
                                       // generate a quadrature rule
                                       // on the face from the unit
@@ -1428,9 +1410,9 @@ interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension>
                                       // to do this, we check whether
                                       // the FE has support points on
                                       // the face at all:
-      if (fe.has_face_support_points())
-       q_collection.push_back (Quadrature<dim-1>(fe.get_unit_face_support_points()));
-      else
+       if (fe.has_face_support_points())
+         q_collection.push_back (Quadrature<dim-1>(fe.get_unit_face_support_points()));
+       else
        {
                                           // if not, then we should
                                           // try a more clever
@@ -1477,23 +1459,23 @@ interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension>
 
          q_collection.push_back (Quadrature<dim-1>(unit_support_points));
         }
-    }
+      }
                                   // now that we have a q_collection
                                   // object with all the right
                                   // quadrature points, create an
                                   // hp::FEFaceValues object that we
                                   // can use to evaluate the boundary
                                   // values at
-  hp::MappingCollection<dim,spacedim> mapping_collection (mapping);
-  hp::FEFaceValues<dim,spacedim> x_fe_values (mapping_collection, finite_elements, q_collection,
-                                             update_quadrature_points);
+      dealii::hp::MappingCollection<dim,spacedim> mapping_collection (mapping);
+      dealii::hp::FEFaceValues<dim,spacedim> x_fe_values (mapping_collection, finite_elements, q_collection,
+                                                 update_quadrature_points);
 
-  typename DH::active_cell_iterator cell = dof.begin_active(),
-                                   endc = dof.end();
-  for (; cell!=endc; ++cell)
-    if (!cell->is_artificial())
-      for (unsigned int face_no = 0; face_no < GeometryInfo<dim>::faces_per_cell;
-          ++face_no)
+      typename DH::active_cell_iterator cell = dof.begin_active(),
+                                       endc = dof.end();
+      for (; cell!=endc; ++cell)
+       if (!cell->is_artificial())
+       for (unsigned int face_no = 0; face_no < GeometryInfo<dim>::faces_per_cell;
+            ++face_no)
        {
          const FiniteElement<dim,spacedim> &fe = cell->get_fe();
 
@@ -1522,12 +1504,17 @@ interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension>
            }
 
          typename DH::face_iterator face = cell->face(face_no);
+
+                               // cast the face iterator to a DoFHandler
+                               // iterator so that we can access the boundary
+                               // indicators
          const unsigned char boundary_component = face->boundary_indicator();
          if (function_map.find(boundary_component) != function_map.end())
            {
                                               // face is of the right component
              x_fe_values.reinit(cell, face_no);
-             const FEFaceValues<dim,spacedim> &fe_values = x_fe_values.get_present_fe_values();
+             const dealii::FEFaceValues<dim,spacedim> &fe_values =
+               x_fe_values.get_present_fe_values();
 
                                               // get indices, physical location and
                                               // boundary values of dofs on this
@@ -1547,7 +1534,7 @@ interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension>
                                                   // possible
                  if (dof_values_system.size() < fe.dofs_per_face)
                    dof_values_system.resize (fe.dofs_per_face,
-                                             Vector<double>(fe.n_components()));
+                                             dealii::Vector<double>(fe.n_components()));
                  else
                    dof_values_system.resize (fe.dofs_per_face);
 
@@ -1683,6 +1670,25 @@ interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension>
                }
            }
        }
+    } // end of interpolate_boundary_values
+  } // end of namespace VectorTools
+} // end of namespace internal
+
+
+
+template <class DH>
+void
+VectorTools::
+interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension>            &mapping,
+                             const DH                 &dof,
+                             const typename FunctionMap<DH::space_dimension>::type &function_map,
+                             std::map<unsigned int,double> &boundary_values,
+                             const std::vector<bool>       &component_mask_)
+{
+  dealii::internal::VectorTools::
+    interpolate_boundary_values (mapping, dof, function_map, boundary_values,
+                                component_mask_,
+                                dealii::internal::int2type<DH::dimension>());
 }
 
 
@@ -1702,7 +1708,6 @@ VectorTools::interpolate_boundary_values (const Mapping<DH::dimension, DH::space
                               component_mask);
 }
 
-#endif
 
 
 template <class DH>
@@ -1824,37 +1829,25 @@ VectorTools::interpolate_boundary_values
 
 // -------- implementation for project_boundary_values with std::map --------
 
-#if deal_II_dimension == 1
-
-// Implementation for 1D
 template <int dim, int spacedim>
 void
 VectorTools::project_boundary_values (const Mapping<dim, spacedim>       &mapping,
                                      const DoFHandler<dim,spacedim>    &dof,
                                      const typename FunctionMap<spacedim>::type &boundary_functions,
-                                     const Quadrature<dim-1>  &,
+                                     const Quadrature<dim-1>  &q,
                                      std::map<unsigned int,double> &boundary_values,
                                      std::vector<unsigned int> component_mapping)
 {
-  Assert (component_mapping.size() == 0, ExcNotImplemented());
+  if (dim == 1)
+    {
+      Assert (component_mapping.size() == 0, ExcNotImplemented());
                                   // projection in 1d is equivalent
                                   // to interpolation
-  interpolate_boundary_values (mapping, dof, boundary_functions,
-                              boundary_values, std::vector<bool>());
-}
-
-#else
-
+      interpolate_boundary_values (mapping, dof, boundary_functions,
+                                  boundary_values, std::vector<bool>());
+      return;
+    }
 
-template <int dim, int spacedim>
-void
-VectorTools::project_boundary_values (const Mapping<dim, spacedim>       &mapping,
-                                     const DoFHandler<dim,spacedim>    &dof,
-                                     const typename FunctionMap<spacedim>::type &boundary_functions,
-                                     const Quadrature<dim-1>  &q,
-                                     std::map<unsigned int,double> &boundary_values,
-                                     std::vector<unsigned int> component_mapping)
-{
 //TODO:[?] 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
@@ -2010,7 +2003,7 @@ VectorTools::project_boundary_values (const Mapping<dim, spacedim>       &mappin
       }
 }
 
-#endif
+
 
 template <int dim, int spacedim>
 void
index 7b93b2f61fc3dfa37818c10abddc780761769ede..4d1666e8f16c85ed78dab6b0cc653ac2b3484f37 100644 (file)
@@ -16,8 +16,8 @@ default all: debug optimized
 
 
 # list the dimension dependent and dimension independent directories
-dim-dep-dirs   := dofs hp multigrid numerics
-dim-indep-dirs := base lac fe grid distributed
+dim-dep-dirs   := 
+dim-indep-dirs := base lac dofs fe grid hp numerics multigrid distributed
 all-dirs       := $(dim-dep-dirs) $(dim-indep-dirs)
 
 # create lists of file names.
index 62d175ebae725786e9575df6d4d9488e38361dc0..9e151df8396d5daa346ad5c5d38ef7628fdec199 100644 (file)
@@ -1312,7 +1312,7 @@ namespace internal
        Assert (false, ExcNotImplemented());
 #else
 
-       
+
                                         //calculate new IndexSet. First try
                                         //to find out if the new indices are
                                         //contiguous blocks. This avoids
@@ -1566,25 +1566,7 @@ namespace internal
 
 
 /*-------------- Explicit Instantiations -------------------------------*/
-
-namespace internal
-{
-  namespace DoFHandler
-  {
-    namespace Policy
-    {
-      template class PolicyBase<deal_II_dimension,deal_II_dimension>;
-      template class Sequential<deal_II_dimension,deal_II_dimension>;
-      template class ParallelDistributed<deal_II_dimension,deal_II_dimension>;
-
-#if deal_II_dimension==1 || deal_II_dimension==2
-      template class PolicyBase<deal_II_dimension,deal_II_dimension+1>;
-      template class Sequential<deal_II_dimension,deal_II_dimension+1>;
-      template class ParallelDistributed<deal_II_dimension,deal_II_dimension+1>;
-#endif
-    }
-  }
-}
+#include "dof_handler_policy.inst"
 
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/dofs/dof_handler_policy.inst.in b/deal.II/source/dofs/dof_handler_policy.inst.in
new file mode 100644 (file)
index 0000000..0daab42
--- /dev/null
@@ -0,0 +1,35 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+namespace internal
+\{
+  namespace DoFHandler
+  \{
+    namespace Policy
+    \{
+      template class PolicyBase<deal_II_dimension,deal_II_dimension>;
+      template class Sequential<deal_II_dimension,deal_II_dimension>;
+      template class ParallelDistributed<deal_II_dimension,deal_II_dimension>;
+
+#if deal_II_dimension==1 || deal_II_dimension==2
+      template class PolicyBase<deal_II_dimension,deal_II_dimension+1>;
+      template class Sequential<deal_II_dimension,deal_II_dimension+1>;
+      template class ParallelDistributed<deal_II_dimension,deal_II_dimension+1>;
+#endif
+    \}
+  \}
+\}
+
+}
index 5807a0a67a91fb891d005b7004ba8e8bc2a3229e..e2deeffe938c04f7f296431c917003991239c5ec 100644 (file)
@@ -1724,380 +1724,12 @@ namespace DoFRenumbering
            ExcInternalError());
   }
 
+} // namespace DoFRenumbering
 
 
 
-// explicit instantiations
-  namespace boost
-  {
-//TODO[WB]: also implement the following boost for hp DoFHandlers etc.
-    template
-    void
-    Cuthill_McKee (DoFHandler<deal_II_dimension> &, bool, bool);
-
-    template
-    void
-    compute_Cuthill_McKee (std::vector<unsigned int> &,
-                          const DoFHandler<deal_II_dimension> &, bool, bool);
-
-    template
-    void
-    king_ordering (DoFHandler<deal_II_dimension> &, bool, bool);
-
-    template
-    void
-    compute_king_ordering (std::vector<unsigned int> &,
-                          const DoFHandler<deal_II_dimension> &, bool, bool);
-
-    template
-    void
-    minimum_degree (DoFHandler<deal_II_dimension> &, bool, bool);
-
-    template
-    void
-    compute_minimum_degree (std::vector<unsigned int> &,
-                           const DoFHandler<deal_II_dimension> &, bool, bool);
-
-
-    template
-    void
-    Cuthill_McKee (hp::DoFHandler<deal_II_dimension> &, bool, bool);
-
-    template
-    void
-    compute_Cuthill_McKee (std::vector<unsigned int> &,
-                          const hp::DoFHandler<deal_II_dimension> &, bool, bool);
-
-    template
-    void
-    king_ordering (hp::DoFHandler<deal_II_dimension> &, bool, bool);
-
-    template
-    void
-    compute_king_ordering (std::vector<unsigned int> &,
-                          const hp::DoFHandler<deal_II_dimension> &, bool, bool);
-
-    template
-    void
-    minimum_degree (hp::DoFHandler<deal_II_dimension> &, bool, bool);
-
-    template
-    void
-    compute_minimum_degree (std::vector<unsigned int> &,
-                           const hp::DoFHandler<deal_II_dimension> &, bool, bool);
-  }
-
-
-// non-boost functions:
+/*-------------- Explicit Instantiations -------------------------------*/
+#include "dof_renumbering.inst"
 
-  template
-  void Cuthill_McKee<DoFHandler<deal_II_dimension> >
-  (DoFHandler<deal_II_dimension>&,
-   const bool,
-   const bool,
-   const std::vector<unsigned int>&);
-
-  template
-  void
-  compute_Cuthill_McKee<DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,
-   const DoFHandler<deal_II_dimension>&,
-   const bool,
-   const bool,
-   const std::vector<unsigned int>&);
-
-
-  template
-  void Cuthill_McKee<hp::DoFHandler<deal_II_dimension> >
-  (hp::DoFHandler<deal_II_dimension>&,
-   const bool,
-   const bool,
-   const std::vector<unsigned int>&);
-
-  template
-  void
-  compute_Cuthill_McKee<hp::DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,
-   const hp::DoFHandler<deal_II_dimension>&,
-   const bool,
-   const bool,
-   const std::vector<unsigned int>&);
-
-  template
-  void Cuthill_McKee<MGDoFHandler<deal_II_dimension> >
-  (MGDoFHandler<deal_II_dimension>&,
-   const bool,
-   const bool,
-   const std::vector<unsigned int>&);
-
-  template
-  void
-  compute_Cuthill_McKee<MGDoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,
-   const MGDoFHandler<deal_II_dimension>&,
-   const bool,
-   const bool,
-   const std::vector<unsigned int>&);
-
-  template
-  void component_wise<deal_II_dimension>
-  (DoFHandler<deal_II_dimension>&,
-   const std::vector<unsigned int>&);
-
-  template
-  void component_wise<deal_II_dimension>
-  (hp::DoFHandler<deal_II_dimension>&,
-   const std::vector<unsigned int>&);
-
-//  template
-//  void
-//  compute_component_wise<deal_II_dimension>
-//  (std::vector<unsigned int>&,
-//   const DoFHandler<deal_II_dimension>&,
-//   const std::vector<unsigned int>&);
-
-  template
-  void component_wise<deal_II_dimension>
-  (MGDoFHandler<deal_II_dimension>&,
-   unsigned int,
-   const std::vector<unsigned int>&);
-
-  template
-  void component_wise<deal_II_dimension>
-  (MGDoFHandler<deal_II_dimension>&,
-   const std::vector<unsigned int>&);
-
-// DG renumbering for DoFHandler
-
-  template
-  void
-  cell_wise_dg<DoFHandler<deal_II_dimension> >
-  (DoFHandler<deal_II_dimension>&,
-   const std::vector<DoFHandler<deal_II_dimension>::cell_iterator>&);
-
-  template
-  void
-  compute_cell_wise_dg<DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&, std::vector<unsigned int>&,
-   const DoFHandler<deal_II_dimension>&,
-   const std::vector<DoFHandler<deal_II_dimension>::cell_iterator>&);
-
-  template
-  void
-  downstream_dg<DoFHandler<deal_II_dimension> >
-  (DoFHandler<deal_II_dimension>&,
-   const Point<deal_II_dimension>&);
-
-  template
-  void
-  compute_downstream_dg<DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,std::vector<unsigned int>&,
-   const DoFHandler<deal_II_dimension>&,
-   const Point<deal_II_dimension>&);
-  template
-  void
-  compute_downstream_dg<DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,
-   const DoFHandler<deal_II_dimension>&,
-   const Point<deal_II_dimension>&);
-
-  template void
-  cell_wise<DoFHandler<deal_II_dimension> >
-  (DoFHandler<deal_II_dimension>&,
-   const std::vector<DoFHandler<deal_II_dimension>::cell_iterator>&);
-
-  template void
-  compute_cell_wise<DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&, std::vector<unsigned int>&,
-   const DoFHandler<deal_II_dimension>&,
-   const std::vector<DoFHandler<deal_II_dimension>::cell_iterator>&);
-
-  template void
-  downstream<DoFHandler<deal_II_dimension> >
-  (DoFHandler<deal_II_dimension>&, const Point<deal_II_dimension>&,
-   const bool);
-
-  template void
-  compute_downstream<DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,std::vector<unsigned int>&,
-   const DoFHandler<deal_II_dimension>&, const Point<deal_II_dimension>&,
-   const bool);
-
-  template
-  void
-  clockwise_dg<DoFHandler<deal_II_dimension> >
-  (DoFHandler<deal_II_dimension>&, const Point<deal_II_dimension>&, bool);
-
-  template
-  void
-  compute_clockwise_dg<DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&, const DoFHandler<deal_II_dimension>&,
-   const Point<deal_II_dimension>&, const bool);
-
-// Renumbering for hp::DoFHandler
-
-  template void
-  cell_wise_dg<hp::DoFHandler<deal_II_dimension> >
-  (hp::DoFHandler<deal_II_dimension>&,
-   const std::vector<hp::DoFHandler<deal_II_dimension>::cell_iterator>&);
-
-  template void
-  compute_cell_wise_dg<hp::DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&, std::vector<unsigned int>&,
-   const hp::DoFHandler<deal_II_dimension>&,
-   const std::vector<hp::DoFHandler<deal_II_dimension>::cell_iterator>&);
-
-  template void
-  cell_wise<hp::DoFHandler<deal_II_dimension> >
-  (hp::DoFHandler<deal_II_dimension>&,
-   const std::vector<hp::DoFHandler<deal_II_dimension>::cell_iterator>&);
-
-  template void
-  compute_cell_wise<hp::DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&, std::vector<unsigned int>&,
-   const hp::DoFHandler<deal_II_dimension>&,
-   const std::vector<hp::DoFHandler<deal_II_dimension>::cell_iterator>&);
-
-  template void
-  downstream_dg<hp::DoFHandler<deal_II_dimension> >
-  (hp::DoFHandler<deal_II_dimension>&,
-   const Point<deal_II_dimension>&);
-
-  template void
-  compute_downstream_dg<hp::DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,std::vector<unsigned int>&,
-   const hp::DoFHandler<deal_II_dimension>&,
-   const Point<deal_II_dimension>&);
-  template
-  void
-  compute_downstream_dg<hp::DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,
-   const hp::DoFHandler<deal_II_dimension>&,
-   const Point<deal_II_dimension>&);
-
-  template void
-  downstream<hp::DoFHandler<deal_II_dimension> >
-  (hp::DoFHandler<deal_II_dimension>&,
-   const Point<deal_II_dimension>&,
-   const bool);
-
-  template void
-  compute_downstream<hp::DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,std::vector<unsigned int>&,
-   const hp::DoFHandler<deal_II_dimension>&,
-   const Point<deal_II_dimension>&,
-   const bool);
-
-  template
-  void
-  clockwise_dg<hp::DoFHandler<deal_II_dimension> >
-  (hp::DoFHandler<deal_II_dimension>&,
-   const Point<deal_II_dimension>&, bool);
-
-  template
-  void
-  compute_clockwise_dg<hp::DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,
-   const hp::DoFHandler<deal_II_dimension>&,
-   const Point<deal_II_dimension>&,
-   const bool);
-
-// MG
-
-  template
-  void downstream_dg<deal_II_dimension>
-  (MGDoFHandler<deal_II_dimension>&, const unsigned int,
-   const Point<deal_II_dimension>&);
-
-  template
-  void downstream<deal_II_dimension>
-  (MGDoFHandler<deal_II_dimension>&, const unsigned int,
-   const Point<deal_II_dimension>&,
-   const bool);
-
-  template
-  void clockwise_dg<deal_II_dimension>
-  (MGDoFHandler<deal_II_dimension>&,
-   const unsigned int,
-   const Point<deal_II_dimension>&, bool);
-
-// Generic numbering schemes
-
-  template
-  void random<DoFHandler<deal_II_dimension> >
-  (DoFHandler<deal_II_dimension> &);
-
-  template
-  void
-  compute_random<DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,
-   const DoFHandler<deal_II_dimension> &);
-
-  template
-  void sort_selected_dofs_back<DoFHandler<deal_II_dimension> >
-  (DoFHandler<deal_II_dimension> &,
-   const std::vector<bool> &);
-
-  template
-  void
-  compute_sort_selected_dofs_back<DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,
-   const DoFHandler<deal_II_dimension> &,
-   const std::vector<bool> &);
-
-  template
-  void random<hp::DoFHandler<deal_II_dimension> >
-  (hp::DoFHandler<deal_II_dimension> &);
-
-  template
-  void
-  compute_random<hp::DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,
-   const hp::DoFHandler<deal_II_dimension> &);
-
-  template
-  void sort_selected_dofs_back<hp::DoFHandler<deal_II_dimension> >
-  (hp::DoFHandler<deal_II_dimension> &,
-   const std::vector<bool> &);
-
-  template
-  void
-  compute_sort_selected_dofs_back<hp::DoFHandler<deal_II_dimension> >
-  (std::vector<unsigned int>&,
-   const hp::DoFHandler<deal_II_dimension> &,
-   const std::vector<bool> &);
-
-  template
-  void subdomain_wise<DoFHandler<deal_II_dimension> >
-  (DoFHandler<deal_II_dimension> &);
-
-  template
-  void subdomain_wise<hp::DoFHandler<deal_II_dimension> >
-  (hp::DoFHandler<deal_II_dimension> &);
-
-  template
-  void Cuthill_McKee<deal_II_dimension>
-  (MGDoFHandler<deal_II_dimension>&,
-   const unsigned int,
-   const bool,
-   const std::vector<unsigned int>&);
-
-  template
-  void cell_wise_dg<deal_II_dimension>
-  (MGDoFHandler<deal_II_dimension>&,
-   const unsigned int,
-   const std::vector<MGDoFHandler<deal_II_dimension>::cell_iterator>&);
-  template
-  void compute_cell_wise_dg<deal_II_dimension>
-  (std::vector<unsigned int>&, std::vector<unsigned int>&,
-   const MGDoFHandler<deal_II_dimension>&, const unsigned int,
-   const std::vector<MGDoFHandler<deal_II_dimension>::cell_iterator>&);
-  template
-  void compute_downstream_dg<deal_II_dimension>
-  (std::vector<unsigned int>&, std::vector<unsigned int>&,
-   const MGDoFHandler<deal_II_dimension>&, const unsigned int,
-   const Point<deal_II_dimension>&);
-
-}  // namespace DoFRenumbering
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/dofs/dof_renumbering.inst.in b/deal.II/source/dofs/dof_renumbering.inst.in
new file mode 100644 (file)
index 0000000..f831444
--- /dev/null
@@ -0,0 +1,391 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+for (deal_II_dimension : DIMENSIONS)
+  {
+  namespace DoFRenumbering
+  \{
+  namespace boost
+  \{
+//TODO[WB]: also implement the following boost for hp DoFHandlers etc.
+    template
+    void
+    Cuthill_McKee (DoFHandler<deal_II_dimension> &, bool, bool);
+
+    template
+    void
+    compute_Cuthill_McKee (std::vector<unsigned int> &,
+                          const DoFHandler<deal_II_dimension> &, bool, bool);
+
+    template
+    void
+    king_ordering (DoFHandler<deal_II_dimension> &, bool, bool);
+
+    template
+    void
+    compute_king_ordering (std::vector<unsigned int> &,
+                          const DoFHandler<deal_II_dimension> &, bool, bool);
+
+    template
+    void
+    minimum_degree (DoFHandler<deal_II_dimension> &, bool, bool);
+
+    template
+    void
+    compute_minimum_degree (std::vector<unsigned int> &,
+                           const DoFHandler<deal_II_dimension> &, bool, bool);
+
+
+    template
+    void
+    Cuthill_McKee (hp::DoFHandler<deal_II_dimension> &, bool, bool);
+
+    template
+    void
+    compute_Cuthill_McKee (std::vector<unsigned int> &,
+                          const hp::DoFHandler<deal_II_dimension> &, bool, bool);
+
+    template
+    void
+    king_ordering (hp::DoFHandler<deal_II_dimension> &, bool, bool);
+
+    template
+    void
+    compute_king_ordering (std::vector<unsigned int> &,
+                          const hp::DoFHandler<deal_II_dimension> &, bool, bool);
+
+    template
+    void
+    minimum_degree (hp::DoFHandler<deal_II_dimension> &, bool, bool);
+
+    template
+    void
+    compute_minimum_degree (std::vector<unsigned int> &,
+                           const hp::DoFHandler<deal_II_dimension> &, bool, bool);
+  \}
+
+
+// non-boost functions:
+
+  template
+  void Cuthill_McKee<DoFHandler<deal_II_dimension> >
+  (DoFHandler<deal_II_dimension>&,
+   const bool,
+   const bool,
+   const std::vector<unsigned int>&);
+
+  template
+  void
+  compute_Cuthill_McKee<DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,
+   const DoFHandler<deal_II_dimension>&,
+   const bool,
+   const bool,
+   const std::vector<unsigned int>&);
+
+
+  template
+  void Cuthill_McKee<hp::DoFHandler<deal_II_dimension> >
+  (hp::DoFHandler<deal_II_dimension>&,
+   const bool,
+   const bool,
+   const std::vector<unsigned int>&);
+
+  template
+  void
+  compute_Cuthill_McKee<hp::DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,
+   const hp::DoFHandler<deal_II_dimension>&,
+   const bool,
+   const bool,
+   const std::vector<unsigned int>&);
+
+  template
+  void Cuthill_McKee<MGDoFHandler<deal_II_dimension> >
+  (MGDoFHandler<deal_II_dimension>&,
+   const bool,
+   const bool,
+   const std::vector<unsigned int>&);
+
+  template
+  void
+  compute_Cuthill_McKee<MGDoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,
+   const MGDoFHandler<deal_II_dimension>&,
+   const bool,
+   const bool,
+   const std::vector<unsigned int>&);
+
+  template
+  void component_wise<deal_II_dimension>
+  (DoFHandler<deal_II_dimension>&,
+   const std::vector<unsigned int>&);
+
+  template
+  void component_wise<deal_II_dimension>
+  (hp::DoFHandler<deal_II_dimension>&,
+   const std::vector<unsigned int>&);
+
+//  template
+//  void
+//  compute_component_wise<deal_II_dimension>
+//  (std::vector<unsigned int>&,
+//   const DoFHandler<deal_II_dimension>&,
+//   const std::vector<unsigned int>&);
+
+  template
+  void component_wise<deal_II_dimension>
+  (MGDoFHandler<deal_II_dimension>&,
+   unsigned int,
+   const std::vector<unsigned int>&);
+
+  template
+  void component_wise<deal_II_dimension>
+  (MGDoFHandler<deal_II_dimension>&,
+   const std::vector<unsigned int>&);
+
+// DG renumbering for DoFHandler
+
+  template
+  void
+  cell_wise_dg<DoFHandler<deal_II_dimension> >
+  (DoFHandler<deal_II_dimension>&,
+   const std::vector<DoFHandler<deal_II_dimension>::cell_iterator>&);
+
+  template
+  void
+  compute_cell_wise_dg<DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&, std::vector<unsigned int>&,
+   const DoFHandler<deal_II_dimension>&,
+   const std::vector<DoFHandler<deal_II_dimension>::cell_iterator>&);
+
+  template
+  void
+  downstream_dg<DoFHandler<deal_II_dimension> >
+  (DoFHandler<deal_II_dimension>&,
+   const Point<deal_II_dimension>&);
+
+  template
+  void
+  compute_downstream_dg<DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,std::vector<unsigned int>&,
+   const DoFHandler<deal_II_dimension>&,
+   const Point<deal_II_dimension>&);
+  template
+  void
+  compute_downstream_dg<DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,
+   const DoFHandler<deal_II_dimension>&,
+   const Point<deal_II_dimension>&);
+
+  template void
+  cell_wise<DoFHandler<deal_II_dimension> >
+  (DoFHandler<deal_II_dimension>&,
+   const std::vector<DoFHandler<deal_II_dimension>::cell_iterator>&);
+
+  template void
+  compute_cell_wise<DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&, std::vector<unsigned int>&,
+   const DoFHandler<deal_II_dimension>&,
+   const std::vector<DoFHandler<deal_II_dimension>::cell_iterator>&);
+
+  template void
+  downstream<DoFHandler<deal_II_dimension> >
+  (DoFHandler<deal_II_dimension>&, const Point<deal_II_dimension>&,
+   const bool);
+
+  template void
+  compute_downstream<DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,std::vector<unsigned int>&,
+   const DoFHandler<deal_II_dimension>&, const Point<deal_II_dimension>&,
+   const bool);
+
+  template
+  void
+  clockwise_dg<DoFHandler<deal_II_dimension> >
+  (DoFHandler<deal_II_dimension>&, const Point<deal_II_dimension>&, bool);
+
+  template
+  void
+  compute_clockwise_dg<DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&, const DoFHandler<deal_II_dimension>&,
+   const Point<deal_II_dimension>&, const bool);
+
+// Renumbering for hp::DoFHandler
+
+  template void
+  cell_wise_dg<hp::DoFHandler<deal_II_dimension> >
+  (hp::DoFHandler<deal_II_dimension>&,
+   const std::vector<hp::DoFHandler<deal_II_dimension>::cell_iterator>&);
+
+  template void
+  compute_cell_wise_dg<hp::DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&, std::vector<unsigned int>&,
+   const hp::DoFHandler<deal_II_dimension>&,
+   const std::vector<hp::DoFHandler<deal_II_dimension>::cell_iterator>&);
+
+  template void
+  cell_wise<hp::DoFHandler<deal_II_dimension> >
+  (hp::DoFHandler<deal_II_dimension>&,
+   const std::vector<hp::DoFHandler<deal_II_dimension>::cell_iterator>&);
+
+  template void
+  compute_cell_wise<hp::DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&, std::vector<unsigned int>&,
+   const hp::DoFHandler<deal_II_dimension>&,
+   const std::vector<hp::DoFHandler<deal_II_dimension>::cell_iterator>&);
+
+  template void
+  downstream_dg<hp::DoFHandler<deal_II_dimension> >
+  (hp::DoFHandler<deal_II_dimension>&,
+   const Point<deal_II_dimension>&);
+
+  template void
+  compute_downstream_dg<hp::DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,std::vector<unsigned int>&,
+   const hp::DoFHandler<deal_II_dimension>&,
+   const Point<deal_II_dimension>&);
+  template
+  void
+  compute_downstream_dg<hp::DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,
+   const hp::DoFHandler<deal_II_dimension>&,
+   const Point<deal_II_dimension>&);
+
+  template void
+  downstream<hp::DoFHandler<deal_II_dimension> >
+  (hp::DoFHandler<deal_II_dimension>&,
+   const Point<deal_II_dimension>&,
+   const bool);
+
+  template void
+  compute_downstream<hp::DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,std::vector<unsigned int>&,
+   const hp::DoFHandler<deal_II_dimension>&,
+   const Point<deal_II_dimension>&,
+   const bool);
+
+  template
+  void
+  clockwise_dg<hp::DoFHandler<deal_II_dimension> >
+  (hp::DoFHandler<deal_II_dimension>&,
+   const Point<deal_II_dimension>&, bool);
+
+  template
+  void
+  compute_clockwise_dg<hp::DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,
+   const hp::DoFHandler<deal_II_dimension>&,
+   const Point<deal_II_dimension>&,
+   const bool);
+
+// MG
+
+  template
+  void downstream_dg<deal_II_dimension>
+  (MGDoFHandler<deal_II_dimension>&, const unsigned int,
+   const Point<deal_II_dimension>&);
+
+  template
+  void downstream<deal_II_dimension>
+  (MGDoFHandler<deal_II_dimension>&, const unsigned int,
+   const Point<deal_II_dimension>&,
+   const bool);
+
+  template
+  void clockwise_dg<deal_II_dimension>
+  (MGDoFHandler<deal_II_dimension>&,
+   const unsigned int,
+   const Point<deal_II_dimension>&, bool);
+
+// Generic numbering schemes
+
+  template
+  void random<DoFHandler<deal_II_dimension> >
+  (DoFHandler<deal_II_dimension> &);
+
+  template
+  void
+  compute_random<DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,
+   const DoFHandler<deal_II_dimension> &);
+
+  template
+  void sort_selected_dofs_back<DoFHandler<deal_II_dimension> >
+  (DoFHandler<deal_II_dimension> &,
+   const std::vector<bool> &);
+
+  template
+  void
+  compute_sort_selected_dofs_back<DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,
+   const DoFHandler<deal_II_dimension> &,
+   const std::vector<bool> &);
+
+  template
+  void random<hp::DoFHandler<deal_II_dimension> >
+  (hp::DoFHandler<deal_II_dimension> &);
+
+  template
+  void
+  compute_random<hp::DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,
+   const hp::DoFHandler<deal_II_dimension> &);
+
+  template
+  void sort_selected_dofs_back<hp::DoFHandler<deal_II_dimension> >
+  (hp::DoFHandler<deal_II_dimension> &,
+   const std::vector<bool> &);
+
+  template
+  void
+  compute_sort_selected_dofs_back<hp::DoFHandler<deal_II_dimension> >
+  (std::vector<unsigned int>&,
+   const hp::DoFHandler<deal_II_dimension> &,
+   const std::vector<bool> &);
+
+  template
+  void subdomain_wise<DoFHandler<deal_II_dimension> >
+  (DoFHandler<deal_II_dimension> &);
+
+  template
+  void subdomain_wise<hp::DoFHandler<deal_II_dimension> >
+  (hp::DoFHandler<deal_II_dimension> &);
+
+  template
+  void Cuthill_McKee<deal_II_dimension>
+  (MGDoFHandler<deal_II_dimension>&,
+   const unsigned int,
+   const bool,
+   const std::vector<unsigned int>&);
+
+  template
+  void cell_wise_dg<deal_II_dimension>
+  (MGDoFHandler<deal_II_dimension>&,
+   const unsigned int,
+   const std::vector<MGDoFHandler<deal_II_dimension>::cell_iterator>&);
+  template
+  void compute_cell_wise_dg<deal_II_dimension>
+  (std::vector<unsigned int>&, std::vector<unsigned int>&,
+   const MGDoFHandler<deal_II_dimension>&, const unsigned int,
+   const std::vector<MGDoFHandler<deal_II_dimension>::cell_iterator>&);
+  template
+  void compute_downstream_dg<deal_II_dimension>
+  (std::vector<unsigned int>&, std::vector<unsigned int>&,
+   const MGDoFHandler<deal_II_dimension>&, const unsigned int,
+   const Point<deal_II_dimension>&);
+
+   \}  // namespace DoFRenumbering
+  }
+
index 1d6f9cfd431fda614281862335a2dedda950b036..e9eddeeac8e845424b04833f7c87756df91836fe 100644 (file)
@@ -48,7 +48,6 @@
 DEAL_II_NAMESPACE_OPEN
 
 
-//TODO: convert many more of the instantiations at the bottom of this file to the .inst.in mechanism
 
 //#define WOLFGANG
 
@@ -324,83 +323,29 @@ DoFTools::make_sparsity_pattern (
 
 
 
-#if deal_II_dimension == 1
-
 template <class DH, class SparsityPattern>
 void
 DoFTools::make_boundary_sparsity_pattern (
-  const DH                               &dof_handler,
-  const typename FunctionMap<DH::space_dimension>::type &function_map,
-  const std::vector<unsigned int>        &dof_to_boundary_mapping,
-  SparsityPattern                        &sparsity)
-{
-                                  // first check left, the right
-                                  // boundary point
-  for (unsigned int direction=0; direction<2; ++direction)
-    {
-                                      // if this boundary is not
-                                      // requested, then go on with next one
-      if (function_map.find(direction) ==
-         function_map.end())
-       continue;
-
-                                      // find active cell at that
-                                      // boundary: first go to
-                                      // left/right, then to children
-      typename DH::cell_iterator cell = dof_handler.begin(0);
-      while (!cell->at_boundary(direction))
-       cell = cell->neighbor(direction);
-      while (!cell->active())
-       cell = cell->child(direction);
-
-      const unsigned int dofs_per_vertex = cell->get_fe().dofs_per_vertex;
-      std::vector<unsigned int> boundary_dof_boundary_indices (dofs_per_vertex);
-
-                                      // next get boundary mapped dof
-                                      // indices of boundary dofs
-      for (unsigned int i=0; i<dofs_per_vertex; ++i)
-       boundary_dof_boundary_indices[i]
-         = dof_to_boundary_mapping[cell->vertex_dof_index(direction,i)];
-
-      for (unsigned int i=0; i<dofs_per_vertex; ++i)
-       sparsity.add_entries (boundary_dof_boundary_indices[i],
-                             boundary_dof_boundary_indices.begin(),
-                             boundary_dof_boundary_indices.end());
-    };
-}
-
-
-
-template <class DH, class SparsityPattern>
-void DoFTools::make_boundary_sparsity_pattern (
-  const DH                        &dof_handler,
+  const DH                        &dof,
   const std::vector<unsigned int> &dof_to_boundary_mapping,
   SparsityPattern                 &sparsity)
 {
+  if (DH::dimension == 1)
+    {
                                   // there are only 2 boundary
                                   // indicators in 1d, so it is no
                                   // performance problem to call the
                                   // other function
-  typename DH::FunctionMap boundary_indicators;
-  boundary_indicators[0] = 0;
-  boundary_indicators[1] = 0;
-  make_boundary_sparsity_pattern<DH, SparsityPattern> (dof_handler,
-                                                      boundary_indicators,
-                                                      dof_to_boundary_mapping,
-                                                      sparsity);
-}
-
-
-#else
-
+      typename DH::FunctionMap boundary_indicators;
+      boundary_indicators[0] = 0;
+      boundary_indicators[1] = 0;
+      make_boundary_sparsity_pattern<DH, SparsityPattern> (dof,
+                                                          boundary_indicators,
+                                                          dof_to_boundary_mapping,
+                                                          sparsity);
+      return;
+    }
 
-template <class DH, class SparsityPattern>
-void
-DoFTools::make_boundary_sparsity_pattern (
-  const DH                        &dof,
-  const std::vector<unsigned int> &dof_to_boundary_mapping,
-  SparsityPattern                 &sparsity)
-{
   const unsigned int n_dofs = dof.n_dofs();
 
   AssertDimension (dof_to_boundary_mapping.size(), n_dofs);
@@ -460,6 +405,44 @@ void DoFTools::make_boundary_sparsity_pattern (
   const std::vector<unsigned int>                 &dof_to_boundary_mapping,
   SparsityPattern                                 &sparsity)
 {
+  if (DH::dimension == 1)
+    {
+                                  // first check left, then right
+                                  // boundary point
+      for (unsigned int direction=0; direction<2; ++direction)
+       {
+                                      // if this boundary is not
+                                      // requested, then go on with next one
+         if (boundary_indicators.find(direction) ==
+             boundary_indicators.end())
+           continue;
+
+                                      // find active cell at that
+                                      // boundary: first go to
+                                      // left/right, then to children
+         typename DH::cell_iterator cell = dof.begin(0);
+         while (!cell->at_boundary(direction))
+           cell = cell->neighbor(direction);
+         while (!cell->active())
+           cell = cell->child(direction);
+
+         const unsigned int dofs_per_vertex = cell->get_fe().dofs_per_vertex;
+         std::vector<unsigned int> boundary_dof_boundary_indices (dofs_per_vertex);
+
+                                      // next get boundary mapped dof
+                                      // indices of boundary dofs
+         for (unsigned int i=0; i<dofs_per_vertex; ++i)
+           boundary_dof_boundary_indices[i]
+             = dof_to_boundary_mapping[cell->vertex_dof_index(direction,i)];
+
+         for (unsigned int i=0; i<dofs_per_vertex; ++i)
+           sparsity.add_entries (boundary_dof_boundary_indices[i],
+                                 boundary_dof_boundary_indices.begin(),
+                                 boundary_dof_boundary_indices.end());
+       };
+      return;
+    }
+
   const unsigned int n_dofs = dof.n_dofs();
 
   AssertDimension (dof_to_boundary_mapping.size(), n_dofs);
@@ -504,10 +487,8 @@ void DoFTools::make_boundary_sparsity_pattern (
         }
 }
 
-#endif
 
 
-#if deal_II_dimension != 1
 template <class DH, class SparsityPattern>
 void
 DoFTools::make_flux_sparsity_pattern (const DH        &dof,
@@ -528,16 +509,12 @@ DoFTools::make_flux_sparsity_pattern (const DH        &dof,
   typename DH::active_cell_iterator cell = dof.begin_active(),
     endc = dof.end();
 
-                               // Clear user flags because we will
-                               // need them. But first we save them
-                               // and make sure that we restore them
-                               // later such that at the end of this
-                               // function the Triangulation will be
-                               // in the same state as it was at the
-                               // beginning of this function.
-  std::vector<bool> user_flags;
-  dof.get_tria().save_user_flags(user_flags);
-  const_cast<Triangulation<DH::dimension> &>(dof.get_tria()).clear_user_flags ();
+                               // TODO: in an old implementation, we used
+                               // user flags before to tag faces that were
+                               // already touched. this way, we could reduce
+                               // the work a little bit. now, we instead add
+                               // only data from one side. this should be OK,
+                               // but we need to actually verify it.
 
                                // In case we work with a distributed
                                // sparsity pattern of Trilinos type, we
@@ -553,12 +530,6 @@ DoFTools::make_flux_sparsity_pattern (const DH        &dof,
       dofs_on_this_cell.resize (n_dofs_on_this_cell);
       cell->get_dof_indices (dofs_on_this_cell);
 
-                               // make sparsity pattern for this cell
-      // for (unsigned int i=0; i<n_dofs_on_this_cell; ++i)
-      //   for (unsigned int j=0; j<n_dofs_on_this_cell; ++j)
-      //     sparsity.add (dofs_on_this_cell[i],
-      //                   dofs_on_this_cell[j]);
-
                                // make sparsity pattern for this
                                // cell. if no constraints pattern was
                                // given, then the following call acts
@@ -567,21 +538,15 @@ DoFTools::make_flux_sparsity_pattern (const DH        &dof,
                                               sparsity,
                                               keep_constrained_dofs);
 
-                               // Loop over all interior neighbors
       for (unsigned int face = 0;
           face < GeometryInfo<DH::dimension>::faces_per_cell;
           ++face)
        {
          typename DH::face_iterator cell_face = cell->face(face);
-         if (cell_face->user_flag_set ())
-           continue;
-         if (! cell_face->at_boundary() )
+         if (! cell->at_boundary(face) )
            {
              typename DH::cell_iterator neighbor = cell->neighbor(face);
 
-             const unsigned int neighbor_face
-               = cell->neighbor_face_no(face);
-
              if (cell_face->has_children())
                {
                  for (unsigned int sub_nr = 0;
@@ -603,13 +568,17 @@ DoFTools::make_flux_sparsity_pattern (const DH        &dof,
                      constraints.add_entries_local_to_global
                        (dofs_on_other_cell, dofs_on_this_cell,
                         sparsity, keep_constrained_dofs);
-                     sub_neighbor->face(neighbor_face)->set_user_flag ();
                    }
                }
              else
                {
                                // Refinement edges are taken care of
                                // by coarser cells
+
+                               // TODO: in the distributed case, we miss out
+                               // the constraints when the neighbor cell is
+                               // coarser, but only the current cell is owned
+                               // locally!
                  if (cell->neighbor_is_coarser(face))
                    continue;
 
@@ -622,140 +591,22 @@ DoFTools::make_flux_sparsity_pattern (const DH        &dof,
                  constraints.add_entries_local_to_global
                    (dofs_on_this_cell, dofs_on_other_cell,
                     sparsity, keep_constrained_dofs);
-                 constraints.add_entries_local_to_global
-                   (dofs_on_other_cell, dofs_on_this_cell,
-                    sparsity, keep_constrained_dofs);
-                 neighbor->face(neighbor_face)->set_user_flag ();
-               }
-           }
-       }
-    }
-
-                               // finally restore the user flags
-  const_cast<Triangulation<DH::dimension> &>(dof.get_tria()).load_user_flags(user_flags);
-}
-
-
-template <class DH, class SparsityPattern>
-void
-DoFTools::make_flux_sparsity_pattern (
-  const DH        &dof,
-  SparsityPattern &sparsity)
-{
-  const unsigned int n_dofs = dof.n_dofs();
-
-  Assert (sparsity.n_rows() == n_dofs,
-         ExcDimensionMismatch (sparsity.n_rows(), n_dofs));
-  Assert (sparsity.n_cols() == n_dofs,
-         ExcDimensionMismatch (sparsity.n_cols(), n_dofs));
-
-  std::vector<unsigned int> dofs_on_this_cell;
-  std::vector<unsigned int> dofs_on_other_cell;
-  dofs_on_this_cell.reserve (max_dofs_per_cell(dof));
-  dofs_on_other_cell.reserve (max_dofs_per_cell(dof));
-  typename DH::active_cell_iterator cell = dof.begin_active(),
-                                   endc = dof.end();
-
-                                  // Clear user flags because we will
-                                  // need them. But first we save
-                                  // them and make sure that we
-                                  // restore them later such that at
-                                  // the end of this function the
-                                  // Triangulation will be in the
-                                  // same state as it was at the
-                                  // beginning of this function.
-  std::vector<bool> user_flags;
-  dof.get_tria().save_user_flags(user_flags);
-  const_cast<Triangulation<DH::dimension> &>(dof.get_tria()).clear_user_flags ();
-
-  for (; cell!=endc; ++cell)
-    {
-      const unsigned int n_dofs_on_this_cell = cell->get_fe().dofs_per_cell;
-      dofs_on_this_cell.resize (n_dofs_on_this_cell);
-      cell->get_dof_indices (dofs_on_this_cell);
-                                      // make sparsity pattern for this cell
-      for (unsigned int i=0; i<n_dofs_on_this_cell; ++i)
-       for (unsigned int j=0; j<n_dofs_on_this_cell; ++j)
-         sparsity.add (dofs_on_this_cell[i],
-                       dofs_on_this_cell[j]);
-
-                                      // Loop over all interior neighbors
-      for (unsigned int face = 0;
-          face < GeometryInfo<DH::dimension>::faces_per_cell;
-          ++face)
-       {
-         typename DH::face_iterator cell_face = cell->face(face);
-         if (cell_face->user_flag_set ())
-           continue;
-
-         if (! cell_face->at_boundary() )
-           {
-             typename DH::cell_iterator neighbor = cell->neighbor(face);
-
-             const unsigned int neighbor_face
-                = cell->neighbor_face_no(face);
-
-             if (cell_face->has_children())
-               {
-                 for (unsigned int sub_nr = 0;
-                      sub_nr != cell_face->number_of_children();
-                      ++sub_nr)
-                   {
-                     const typename DH::cell_iterator
-                        sub_neighbor
-                       = cell->neighbor_child_on_subface (face, sub_nr);
-
-                      const unsigned int n_dofs_on_neighbor
-                        = sub_neighbor->get_fe().dofs_per_cell;
-                      dofs_on_other_cell.resize (n_dofs_on_neighbor);
-                     sub_neighbor->get_dof_indices (dofs_on_other_cell);
-
-                      for (unsigned int i=0; i<n_dofs_on_this_cell; ++i)
-                       sparsity.add_entries (dofs_on_this_cell[i],
-                                             dofs_on_other_cell.begin(),
-                                             dofs_on_other_cell.end());
-                     for (unsigned int j=0; j<n_dofs_on_neighbor; ++j)
-                       sparsity.add_entries (dofs_on_other_cell[j],
-                                             dofs_on_this_cell.begin(),
-                                             dofs_on_this_cell.end());
 
-                     sub_neighbor->face(neighbor_face)->set_user_flag ();
-                   }
-               }
-              else
-                {
-                                                  // Refinement edges are
-                                                  // taken care of by
-                                                  // coarser cells
-                 if (cell->neighbor_is_coarser(face))
-                   continue;
-
-                 const unsigned int n_dofs_on_neighbor
-                    = neighbor->get_fe().dofs_per_cell;
-                  dofs_on_other_cell.resize (n_dofs_on_neighbor);
-
-                  neighbor->get_dof_indices (dofs_on_other_cell);
-
-                 for (unsigned int i=0; i<n_dofs_on_this_cell; ++i)
-                   sparsity.add_entries (dofs_on_this_cell[i],
-                                         dofs_on_other_cell.begin(),
-                                         dofs_on_other_cell.end());
-                 for (unsigned int j=0; j<n_dofs_on_neighbor; ++j)
-                   sparsity.add_entries (dofs_on_other_cell[j],
-                                         dofs_on_this_cell.begin(),
-                                         dofs_on_this_cell.end());
-                 neighbor->face(neighbor_face)->set_user_flag ();
+                               // only need to add these in case the neighbor
+                               // cell is not locally owned - otherwise, we
+                               // touch each face twice and hence put the
+                               // indices the other way around
+                 if (cell->neighbor(face)->subdomain_id() !=
+                     cell->subdomain_id())
+                   constraints.add_entries_local_to_global
+                     (dofs_on_other_cell, dofs_on_this_cell,
+                      sparsity, keep_constrained_dofs);
                }
            }
        }
     }
-
-                                  // finally restore the user flags
-  const_cast<Triangulation<DH::dimension> &>(dof.get_tria()).load_user_flags(user_flags);
 }
 
-#else // deal_II_dimension == 1
-
 
 template <class DH, class SparsityPattern>
 void
@@ -763,54 +614,10 @@ DoFTools::make_flux_sparsity_pattern (
   const DH        &dof,
   SparsityPattern &sparsity)
 {
-  typedef typename DH::cell_iterator        cell_iterator;
-  typedef typename DH::active_cell_iterator active_cell_iterator;
-
-  std::vector<unsigned int> local_dof_indices;
-  std::vector<unsigned int> neighbor_dof_indices;
-  local_dof_indices.reserve (max_dofs_per_cell(dof));
-  neighbor_dof_indices.reserve (max_dofs_per_cell(dof));
-
-  active_cell_iterator cell = dof.begin_active(),
-                      endc = dof.end();
-  for (; cell!=endc; ++cell)
-    {
-                                      // first do couplings of dofs
-                                      // locally on this cell
-      const unsigned int n_dofs_on_this_cell = cell->get_fe().dofs_per_cell;
-      local_dof_indices.resize (n_dofs_on_this_cell);
-      cell->get_dof_indices (local_dof_indices);
-      for (unsigned int i=0; i<n_dofs_on_this_cell; ++i)
-       sparsity.add_entries (local_dof_indices[i],
-                             local_dof_indices.begin(),
-                             local_dof_indices.end());
-
-                                      // then do the same for the up
-                                      // to 2 neighbors
-      for (unsigned int nb=0; nb<2; ++nb)
-       if (! cell->at_boundary(nb))
-         {
-                                            // find active neighbor
-           cell_iterator neighbor = cell->neighbor(nb);
-           while (neighbor->has_children())
-             neighbor = neighbor->child(nb==0 ? 1 : 0);
-
-                                            // get dofs on it
-            const unsigned int n_dofs_on_neighbor
-              = neighbor->get_fe().dofs_per_cell;
-            neighbor_dof_indices.resize (n_dofs_on_neighbor);
-           neighbor->get_dof_indices (neighbor_dof_indices);
-
-                                            // compute couplings
-           for (unsigned int i=0; i<n_dofs_on_this_cell; ++i)
-             sparsity.add_entries (local_dof_indices[i],
-                                   neighbor_dof_indices.begin(),
-                                   neighbor_dof_indices.end());
-         };
-    };
+  ConstraintMatrix constraints;
+  make_flux_sparsity_pattern (dof, sparsity, constraints);
 }
 
-#endif
 
 
 template <int dim, int spacedim>
@@ -1837,7 +1644,7 @@ namespace internal
     }
 
 
-#if deal_II_dimension == 1
+
     static
     void
     make_hp_hanging_node_constraints (const dealii::DoFHandler<1> &,
@@ -1968,11 +1775,10 @@ namespace internal
 //                                    // that a bit more
 // //TODO[WB]: think about what to do here...
 //     }
-#endif
+//#endif
 
 
 
-#if deal_II_dimension == 2
     template <class DH>
     static
     void
@@ -2127,10 +1933,9 @@ namespace internal
                  }
              }
     }
-#endif
 
 
-#if deal_II_dimension == 3
+
     template <class DH>
     static
     void
@@ -2245,7 +2050,7 @@ namespace internal
                                      12*fe.dofs_per_line+
                                      4*fe.dofs_per_quad);
 //TODO[TL]: think about this and the following in case of anisotropic refinement
-             
+
                dofs_on_mother.resize (n_dofs_on_mother);
                dofs_on_children.resize (n_dofs_on_children);
 
@@ -2368,7 +2173,6 @@ namespace internal
                  }
              }
     }
-#endif
 
 
     template <class DH>
@@ -3669,7 +3473,6 @@ DoFTools::extract_level_dofs(
 }
 
 
-#if deal_II_dimension != 1
 
 template <class DH>
 void
@@ -3902,249 +3705,6 @@ DoFTools::extract_dofs_with_support_on_boundary (const DH                      &
 
 
 
-
-#else  // 1d
-
-
-template <class DH>
-void
-DoFTools::extract_boundary_dofs (const DH                      &dof_handler,
-                                const std::vector<bool>       &component_select,
-                                std::vector<bool>             &selected_dofs,
-                                const std::set<unsigned char> &boundary_indicators)
-{
-  Assert (component_select.size() == n_components(dof_handler),
-         ExcWrongSize (component_select.size(),
-                       n_components(dof_handler)));
-
-                                  // clear and reset array by default
-                                  // values
-  selected_dofs.clear ();
-  selected_dofs.resize (dof_handler.n_dofs(), false);
-
-                                  // let's see whether we have to
-                                  // check for certain boundary
-                                  // indicators or whether we can
-                                  // accept all
-  const bool check_left_vertex  = ((boundary_indicators.size() == 0) ||
-                                  (boundary_indicators.find(0) !=
-                                   boundary_indicators.end()));
-  const bool check_right_vertex = ((boundary_indicators.size() == 0) ||
-                                  (boundary_indicators.find(1) !=
-                                   boundary_indicators.end()));
-
-                                   // see whether we have to check
-                                   // whether a certain vector
-                                   // component is selected, or all
-  const bool check_vector_component
-    = (component_select != std::vector<bool>(component_select.size(),
-                                             true));
-
-                                  // loop over coarse grid cells
-  for (typename DH::cell_iterator cell=dof_handler.begin(0);
-       cell!=dof_handler.end(0); ++cell)
-    {
-      const FiniteElement<1> &fe = cell->get_fe();
-
-                                      // check left-most vertex
-      if (check_left_vertex)
-       if (cell->neighbor(0) == dof_handler.end())
-          {
-                                            // In 1D the number of DoFs
-                                            // on the faces should be
-                                            // equal to the number of DoFs
-                                            // on the vertices.
-            AssertDimension (fe.dofs_per_face, fe.dofs_per_vertex);
-
-            for (unsigned int i=0; i<fe.dofs_per_face; ++i)
-              if (!check_vector_component)
-                selected_dofs[cell->vertex_dof_index(0,i)] = true;
-              else
-                                                 // check
-                                                 // component. make sure
-                                                 // we don't ask the
-                                                 // wrong question
-                                                 // (leading to an
-                                                 // exception) in case
-                                                 // the shape function
-                                                 // is non-primitive. note
-                                                 // that the face dof
-                                                 // index i is also the
-                                                 // cell dof index of a
-                                                 // corresponding dof in 1d
-                {
-                  const unsigned int component =
-                    (fe.is_primitive(i) ?
-                     fe.face_system_to_component_index(i).first :
-                     (std::find (fe.get_nonzero_components(i).begin(),
-                                 fe.get_nonzero_components(i).end(),
-                                 true)
-                      -
-                      fe.get_nonzero_components(i).begin()));
-                  Assert (component < fe.n_components(),
-                          ExcInternalError());
-
-                  if (component_select[component] == true)
-                    selected_dofs[cell->vertex_dof_index(0,i)] = true;
-                }
-          }
-
-                                      // check right-most
-                                      // vertex. same procedure here
-                                      // as above
-      if (check_right_vertex)
-       if (cell->neighbor(1) == dof_handler.end())
-          {
-            AssertDimension (fe.dofs_per_face, fe.dofs_per_vertex);
-
-            for (unsigned int i=0; i<fe.dofs_per_face; ++i)
-              if (!check_vector_component)
-                selected_dofs[cell->vertex_dof_index(1,i)] = true;
-              else
-                {
-                  const unsigned int component =
-                    (fe.is_primitive(i) ?
-                     fe.face_system_to_component_index(i).first :
-                     (std::find (fe.get_nonzero_components(i).begin(),
-                                 fe.get_nonzero_components(i).end(),
-                                 true)
-                      -
-                      fe.get_nonzero_components(i).begin()));
-                  Assert (component < fe.n_components(),
-                          ExcInternalError());
-
-                  if (component_select[component] == true)
-                    selected_dofs[cell->vertex_dof_index(1,i)] = true;
-                }
-          }
-    }
-}
-
-
-
-template <class DH>
-void
-DoFTools::extract_dofs_with_support_on_boundary (const DH                      &dof_handler,
-                                                const std::vector<bool>       &component_select,
-                                                std::vector<bool>             &selected_dofs,
-                                                const std::set<unsigned char> &boundary_indicators)
-{
-  Assert (component_select.size() == n_components(dof_handler),
-         ExcWrongSize (component_select.size(),
-                       n_components(dof_handler)));
-
-                                  // clear and reset array by default
-                                  // values
-  selected_dofs.clear ();
-  selected_dofs.resize (dof_handler.n_dofs(), false);
-
-                                  // let's see whether we have to
-                                  // check for certain boundary
-                                  // indicators or whether we can
-                                  // accept all
-  const bool check_left_vertex  = ((boundary_indicators.size() == 0) ||
-                                  (boundary_indicators.find(0) !=
-                                   boundary_indicators.end()));
-  const bool check_right_vertex = ((boundary_indicators.size() == 0) ||
-                                  (boundary_indicators.find(1) !=
-                                   boundary_indicators.end()));
-
-                                   // see whether we have to check
-                                   // whether a certain vector
-                                   // component is selected, or all
-  const bool check_vector_component
-    = (component_select != std::vector<bool>(component_select.size(),
-                                             true));
-
-  std::vector<unsigned int> dof_indices;
-
-                                  // loop over cells
-  for (typename DH::active_cell_iterator cell=dof_handler.begin_active();
-       cell!=dof_handler.end(); ++cell)
-    {
-      const FiniteElement<1> &fe = cell->get_fe();
-
-                                      // check left-most vertex
-      if (check_left_vertex)
-       if (cell->neighbor(0) == dof_handler.end())
-          {
-           dof_indices.resize (fe.dofs_per_cell);
-           cell->get_dof_indices(dof_indices);
-            for (unsigned int i=0; i<fe.dofs_per_cell; ++i)
-             if (cell->get_fe().has_support_on_face (i,0) == true)
-               {
-                 if (!check_vector_component)
-                   selected_dofs[dof_indices[i]] = true;
-                 else
-                                                    // check
-                                                    // component. make sure
-                                                    // we don't ask the
-                                                    // wrong question
-                                                    // (leading to an
-                                                    // exception) in case
-                                                    // the shape function
-                                                    // is non-primitive. note
-                                                    // that the face dof
-                                                    // index i is also the
-                                                    // cell dof index of a
-                                                    // corresponding dof in 1d
-                   {
-                     const unsigned int component =
-                       (fe.is_primitive(i) ?
-                        fe.system_to_component_index(i).first :
-                        (std::find (fe.get_nonzero_components(i).begin(),
-                                    fe.get_nonzero_components(i).end(),
-                                    true)
-                         -
-                         fe.get_nonzero_components(i).begin()));
-                     Assert (component < fe.n_components(),
-                             ExcInternalError());
-
-                     if (component_select[component] == true)
-                       selected_dofs[dof_indices[i]] = true;
-                   }
-               }
-          }
-
-                                      // check right-most
-                                      // vertex. same procedure here
-                                      // as above
-      if (check_right_vertex)
-       if (cell->neighbor(1) == dof_handler.end())
-          {
-           dof_indices.resize (fe.dofs_per_cell);
-           cell->get_dof_indices (dof_indices);
-            for (unsigned int i=0; i<fe.dofs_per_cell; ++i)
-             if (cell->get_fe().has_support_on_face (i,1) == true)
-               {
-                 if (!check_vector_component)
-                   selected_dofs[dof_indices[i]] = true;
-                 else
-                   {
-                     const unsigned int component =
-                       (fe.is_primitive(i) ?
-                        fe.system_to_component_index(i).first :
-                        (std::find (fe.get_nonzero_components(i).begin(),
-                                    fe.get_nonzero_components(i).end(),
-                                    true)
-                         -
-                         fe.get_nonzero_components(i).begin()));
-                     Assert (component < fe.n_components(),
-                             ExcInternalError());
-
-                     if (component_select[component] == true)
-                       selected_dofs[dof_indices[i]] = true;
-                   }
-               }
-         }
-    }
-}
-
-
-#endif
-
-
-
 namespace internal
 {
   namespace DoFTools
@@ -4581,7 +4141,7 @@ DoFTools::dof_indices_with_subdomain_association (const DH           &dof_handle
                      "associated DoF handler objects, asking for any subdomain other "
                      "than the locally owned one does not make sense."));
 #endif
-  
+
   IndexSet index_set (dof_handler.n_dofs());
 
   std::vector<unsigned int> local_dof_indices;
@@ -4608,9 +4168,6 @@ DoFTools::dof_indices_with_subdomain_association (const DH           &dof_handle
 
 
 
-
-
-
 template <class DH>
 void
 DoFTools::count_dofs_with_subdomain_association (const DH           &dof_handler,
@@ -5376,6 +4933,7 @@ namespace internal
 }
 
 
+
 template <int dim, int spacedim>
 void
 DoFTools::compute_intergrid_constraints (
@@ -5714,72 +5272,6 @@ compute_intergrid_transfer_representation (
 
 
 
-#if deal_II_dimension == 1
-
-
-template <class DH>
-void DoFTools::map_dof_to_boundary_indices (
-  const DH                      &dof_handler,
-  const std::set<unsigned char> &boundary_indicators,
-  std::vector<unsigned int> &mapping)
-{
-  Assert (&dof_handler.get_fe() != 0, ExcNoFESelected());
-
-  mapping.clear ();
-  mapping.insert (mapping.end(), dof_handler.n_dofs(),
-                 DH::invalid_dof_index);
-
-  unsigned int next_free_index = 0;
-
-                                  // first check left, the right
-                                  // boundary point
-  for (unsigned int direction=0; direction<2; ++direction)
-    {
-                                      // if this boundary is not
-                                      // requested, then go on with next one
-      if (boundary_indicators.find(direction) ==
-         boundary_indicators.end())
-       continue;
-
-                                      // find active cell at that
-                                      // boundary: first go to
-                                      // left/right, then to children
-      typename DH::cell_iterator cell = dof_handler.begin(0);
-      while (!cell->at_boundary(direction))
-       cell = cell->neighbor(direction);
-      while (!cell->active())
-       cell = cell->child(direction);
-
-                                      // next enumerate these degrees
-                                      // of freedom
-      for (unsigned int i=0; i<cell->get_fe().dofs_per_vertex; ++i)
-       mapping[cell->vertex_dof_index(direction,i)] = next_free_index++;
-    };
-}
-
-
-
-template <>
-void
-DoFTools::map_dof_to_boundary_indices (const DoFHandler<1>       &dof_handler,
-                                       std::vector<unsigned int> &mapping)
-{
-  Assert (&dof_handler.get_fe() != 0, ExcNoFESelected());
-
-                                  // in 1d, there are only 2 boundary
-                                  // indicators, so enumerate them
-                                  // and pass on to the other
-                                  // function
-  std::set<unsigned char> boundary_indicators;
-  boundary_indicators.insert (0U);
-  boundary_indicators.insert (1U);
-
-  map_dof_to_boundary_indices<DoFHandler<1> > (dof_handler, boundary_indicators, mapping);
-}
-
-#else
-
-
 template <class DH>
 void
 DoFTools::map_dof_to_boundary_indices (const DH                  &dof_handler,
@@ -5868,8 +5360,6 @@ void DoFTools::map_dof_to_boundary_indices (
   AssertDimension (next_boundary_index, dof_handler.n_boundary_dofs (boundary_indicators));
 }
 
-#endif
-
 
 
 template <int dim, int spacedim>
@@ -5974,63 +5464,7 @@ DoFTools::convert_couplings_to_blocks (
     }
 }
 
-#if deal_II_dimension == 1
 
-template <int dim, int spacedim, template <int,int> class DH>
-void
-DoFTools::make_zero_boundary_constraints (const DH<dim, spacedim> &dof,
-                                         ConstraintMatrix        &zero_boundary_constraints,
-                                         const std::vector<bool> &component_mask_)
-{
-  Assert ((component_mask_.size() == 0) ||
-         (component_mask_.size() == dof.get_fe().n_components()),
-         ExcMessage ("The number of components in the mask has to be either "
-                     "zero or equal to the number of components in the finite "
-                     "element."));
-
-                                   // check for boundary cells in both
-                                   // directions to secure indicators
-                                   // for the entire boundary, i.e. 0
-                                   // is left boundary and 1 is right
-                                   // boundary
-  for (unsigned int direction = 0; direction < 2; ++direction)
-    {
-
-                                   // first find the outermost active
-                                   // cell by traversing the coarse
-                                   // grid to its end and then looking
-                                   // for the children
-      typename DH<dim,spacedim>::cell_iterator outermost_cell = dof.begin(0);
-      while (outermost_cell->neighbor(direction).state() == IteratorState::valid)
-       outermost_cell = outermost_cell->neighbor(direction);
-
-      while (outermost_cell->has_children())
-       outermost_cell = outermost_cell->child(direction);
-
-                                   // then get the FE corresponding to
-                                   // this cell
-      const FiniteElement<dim,spacedim> &fe = outermost_cell->get_fe();
-
-                                  // set the component mask to either
-                                  // the original value or a vector
-                                  // of trues
-      const std::vector<bool> component_mask ((component_mask_.size() == 0) ?
-                                             std::vector<bool> (fe.n_components(), true) :
-                                             component_mask_);
-      Assert (std::count(component_mask.begin(), component_mask.end(), true) > 0,
-             VectorTools::ExcNoComponentSelected());
-
-                                   // cast zero boundary constraints
-                                   // onto a matrix if component_mask
-                                   // == true
-      for (unsigned int i=0; i<fe.dofs_per_vertex; ++i)
-       if (component_mask[fe.face_system_to_component_index(i).first])
-         zero_boundary_constraints.add_line (outermost_cell->vertex_dof_index (direction, i));
-
-    }
-}
-
-#else
 
 template <int dim, int spacedim, template <int,int> class DH>
 void
@@ -6104,721 +5538,11 @@ DoFTools::make_zero_boundary_constraints (const DH<dim, spacedim> &dof,
       }
 }
 
-#endif
 
 // explicit instantiations
 
 #include "dof_tools.inst"
 
-// #if deal_II_dimension > 1
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,SparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- SparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- CompressedSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedSetSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- CompressedSetSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedSimpleSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- CompressedSimpleSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- BlockSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- BlockCompressedSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSetSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- BlockCompressedSetSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSimpleSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- BlockCompressedSimpleSparsityPattern    &);
-
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,SparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- SparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- CompressedSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedSetSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- CompressedSetSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedSimpleSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- CompressedSimpleSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- BlockSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- BlockCompressedSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSetSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- BlockCompressedSetSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSimpleSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const std::vector<unsigned int>  &,
- BlockCompressedSimpleSparsityPattern    &);
-
-
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,SparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- SparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- CompressedSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedSetSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- CompressedSetSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedSimpleSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- CompressedSimpleSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- BlockSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- BlockCompressedSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSetSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- BlockCompressedSetSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSimpleSparsityPattern>
-(const DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- BlockCompressedSimpleSparsityPattern    &sparsity);
-
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,SparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- SparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- CompressedSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedSetSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- CompressedSetSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedSimpleSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- CompressedSimpleSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- BlockSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- BlockCompressedSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSetSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- BlockCompressedSetSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSimpleSparsityPattern>
-(const hp::DoFHandler<deal_II_dimension>& dof,
- const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- BlockCompressedSimpleSparsityPattern    &sparsity);
-
-
-
-template
-void
-DoFTools::distribute_cell_to_dof_vector<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &dof_handler,
- const Vector<float> &cell_data,
- Vector<double>      &dof_data,
- const unsigned int   component);
-template
-void
-DoFTools::distribute_cell_to_dof_vector<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &dof_handler,
- const Vector<double> &cell_data,
- Vector<double>       &dof_data,
- const unsigned int    component);
-
-template
-void
-DoFTools::distribute_cell_to_dof_vector<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &dof_handler,
- const Vector<float> &cell_data,
- Vector<double>      &dof_data,
- const unsigned int   component);
-template
-void
-DoFTools::distribute_cell_to_dof_vector<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &dof_handler,
- const Vector<double> &cell_data,
- Vector<double>       &dof_data,
- const unsigned int    component);
-
-
-template void DoFTools::extract_dofs<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>&,
- const std::vector<bool>&, std::vector<bool>&, bool);
-
-template void DoFTools::extract_dofs<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension>&,
- const std::vector<bool>&, std::vector<bool>&, bool);
-
-template void DoFTools::extract_level_dofs<deal_II_dimension>
-(const unsigned int level, const MGDoFHandler<deal_II_dimension>&,
- const std::vector<bool>&, std::vector<bool>&, bool);
-
-template
-void
-DoFTools::extract_boundary_dofs<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &,
- const std::vector<bool>                  &,
- std::vector<bool>                        &,
- const std::set<unsigned char> &);
-template
-void
-DoFTools::extract_boundary_dofs<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &,
- const std::vector<bool>                  &,
- std::vector<bool>                        &,
- const std::set<unsigned char> &);
-
-template
-void
-DoFTools::extract_dofs_with_support_on_boundary<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &,
- const std::vector<bool>                  &,
- std::vector<bool>                        &,
- const std::set<unsigned char> &);
-template
-void
-DoFTools::extract_dofs_with_support_on_boundary<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &,
- const std::vector<bool>                  &,
- std::vector<bool>                        &,
- const std::set<unsigned char> &);
-
-template
-void
-DoFTools::extract_hanging_node_dofs
-(const DoFHandler<deal_II_dimension> &dof_handler,
- std::vector<bool>     &selected_dofs);
-
-template
-void
-DoFTools::extract_subdomain_dofs<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &dof_handler,
- const types::subdomain_id_t  subdomain_id,
- std::vector<bool>     &selected_dofs);
-template
-void
-DoFTools::extract_subdomain_dofs<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &dof_handler,
- const types::subdomain_id_t subdomain_id,
- std::vector<bool>     &selected_dofs);
-
-template
-void
-DoFTools::extract_locally_owned_dofs<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> & dof_handler,
- IndexSet & dof_set);
-
-template
-void
-DoFTools::extract_locally_active_dofs<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> & dof_handler,
- IndexSet & dof_set);
-
-
-template
-void
-DoFTools::extract_locally_relevant_dofs<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> & dof_handler,
- IndexSet & dof_set);
-
-template
-void
-DoFTools::extract_constant_modes<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &dof_handler,
- const std::vector<bool> &selected_components,
- std::vector<std::vector<bool> > &constant_modes);
-
-template
-void
-DoFTools::get_active_fe_indices<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &dof_handler,
- std::vector<unsigned int> &active_fe_indices);
-
-template
-void
-DoFTools::get_active_fe_indices<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &dof_handler,
- std::vector<unsigned int> &active_fe_indices);
-
-template
-void
-DoFTools::get_subdomain_association<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &dof_handler,
- std::vector<types::subdomain_id_t>           &subdomain_association);
-template
-void
-DoFTools::get_subdomain_association<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &dof_handler,
- std::vector<types::subdomain_id_t>           &subdomain_association);
-
-
-template
-unsigned int
-DoFTools::count_dofs_with_subdomain_association<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &,
- const types::subdomain_id_t);
-template
-IndexSet
-DoFTools::dof_indices_with_subdomain_association<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &,
- const types::subdomain_id_t);
-template
-void
-DoFTools::count_dofs_with_subdomain_association<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &,
- const types::subdomain_id_t,
- std::vector<unsigned int> &);
-
-template
-unsigned int
-DoFTools::count_dofs_with_subdomain_association<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &,
- const types::subdomain_id_t);
-template
-IndexSet
-DoFTools::dof_indices_with_subdomain_association<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &,
- const types::subdomain_id_t);
-template
-void
-DoFTools::count_dofs_with_subdomain_association<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &,
- const types::subdomain_id_t,
- std::vector<unsigned int> &);
-
-template
-unsigned int
-DoFTools::count_dofs_with_subdomain_association<MGDoFHandler<deal_II_dimension> >
-(const MGDoFHandler<deal_II_dimension> &,
- const types::subdomain_id_t);
-template
-IndexSet
-DoFTools::dof_indices_with_subdomain_association<MGDoFHandler<deal_II_dimension> >
-(const MGDoFHandler<deal_II_dimension> &,
- const types::subdomain_id_t);
-template
-void
-DoFTools::count_dofs_with_subdomain_association<MGDoFHandler<deal_II_dimension> >
-(const MGDoFHandler<deal_II_dimension> &,
- const types::subdomain_id_t,
- std::vector<unsigned int> &);
-
-
-template
-void
-DoFTools::count_dofs_per_component<deal_II_dimension> (
-  const DoFHandler<deal_II_dimension>&,
-  std::vector<unsigned int>&, bool, std::vector<unsigned int>);
-
-#if deal_II_dimension < 3
-template void DoFTools::extract_level_dofs<deal_II_dimension, deal_II_dimension+1>
-(const unsigned int level, const MGDoFHandler<deal_II_dimension, deal_II_dimension+1>&,
- const std::vector<bool>&, std::vector<bool>&, bool);
-
-template
-void
-DoFTools::count_dofs_per_component<deal_II_dimension, deal_II_dimension+1> (
-  const DoFHandler<deal_II_dimension, deal_II_dimension+1>&,
-  std::vector<unsigned int>&, bool, std::vector<unsigned int>);
-#endif
-
-template
-void
-DoFTools::count_dofs_per_block<deal_II_dimension> (
-  const DoFHandler<deal_II_dimension>&,
-  std::vector<unsigned int>&, std::vector<unsigned int>);
-
-
-template
-void
-DoFTools::count_dofs_per_component<deal_II_dimension> (
-  const DoFHandler<deal_II_dimension>&,
-  std::vector<unsigned int>&, std::vector<unsigned int>);
-
-template
-void
-DoFTools::compute_intergrid_constraints<deal_II_dimension> (
-  const DoFHandler<deal_II_dimension> &, const unsigned int,
-  const DoFHandler<deal_II_dimension> &, const unsigned int,
-  const InterGridMap<DoFHandler<deal_II_dimension> > &,
-  ConstraintMatrix&);
-
-template
-void
-DoFTools::compute_intergrid_transfer_representation<deal_II_dimension>
-(const DoFHandler<deal_II_dimension> &, const unsigned int,
- const DoFHandler<deal_II_dimension> &, const unsigned int,
- const InterGridMap<DoFHandler<deal_II_dimension> > &,
- std::vector<std::map<unsigned int, float> > &);
-
-
-template
-void
-DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &,
- const std::set<unsigned char> &,
- std::vector<unsigned int> &);
-
-#if deal_II_dimension != 1
-
-template
-void
-DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension> >
-(const DoFHandler<deal_II_dimension> &,
- std::vector<unsigned int> &);
-
-#endif
-
-
-
-template
-void
-DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &,
- const std::set<unsigned char> &,
- std::vector<unsigned int> &);
-
-#if deal_II_dimension != 1
-
-template
-void
-DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension> >
-(const hp::DoFHandler<deal_II_dimension> &,
- std::vector<unsigned int> &);
-
-#endif
-
-
-
-
-template
-void
-DoFTools::map_dofs_to_support_points<deal_II_dimension>
-(const Mapping<deal_II_dimension,deal_II_dimension>&,
- const DoFHandler<deal_II_dimension>&,
- std::vector<Point<deal_II_dimension> >&);
-
-#if deal_II_dimension != 3
-
-template
-void
-DoFTools::map_dofs_to_support_points<deal_II_dimension,deal_II_dimension+1>
-(const Mapping<deal_II_dimension,deal_II_dimension+1>&,
- const DoFHandler<deal_II_dimension, deal_II_dimension+1>&,
- std::vector<Point<deal_II_dimension+1> >&);
-
-template
-void
-DoFTools::count_dofs_per_block<deal_II_dimension,deal_II_dimension+1> (
-  const DoFHandler<deal_II_dimension,deal_II_dimension+1>&,
-  std::vector<unsigned int>&, std::vector<unsigned int>);
-
-#endif
-
-template
-void
-DoFTools::convert_couplings_to_blocks (
-  const DoFHandler<deal_II_dimension>&, const Table<2, Coupling>&,
-  std::vector<Table<2,Coupling> >&);
-
-template
-void
-DoFTools::convert_couplings_to_blocks (
-  const hp::DoFHandler<deal_II_dimension>&, const Table<2, Coupling>&,
-  std::vector<Table<2,Coupling> >&);
-
-template
-void
-DoFTools::make_zero_boundary_constraints
-(const DoFHandler<deal_II_dimension> &,
- ConstraintMatrix                    &,
- const std::vector<bool>             &);
-
-template
-void
-DoFTools::make_zero_boundary_constraints
-(const hp::DoFHandler<deal_II_dimension> &,
- ConstraintMatrix                        &,
- const std::vector<bool>                 &);
-
-
-#if deal_II_dimension < 3
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,SparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const std::vector<unsigned int>  &,
- SparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,CompressedSparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const std::vector<unsigned int>  &,
- CompressedSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,CompressedSetSparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const std::vector<unsigned int>  &,
- CompressedSetSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockSparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const std::vector<unsigned int>  &,
- BlockSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockCompressedSparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const std::vector<unsigned int>  &,
- BlockCompressedSparsityPattern    &);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockCompressedSetSparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const std::vector<unsigned int>  &,
- BlockCompressedSetSparsityPattern    &);
-
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,SparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const std::vector<unsigned int>  &,
-//  SparsityPattern    &);
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,CompressedSparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const std::vector<unsigned int>  &,
-//  CompressedSparsityPattern    &);
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,CompressedSetSparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const std::vector<unsigned int>  &,
-//  CompressedSetSparsityPattern    &);
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockSparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const std::vector<unsigned int>  &,
-//  BlockSparsityPattern    &);
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockCompressedSparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const std::vector<unsigned int>  &,
-//  BlockCompressedSparsityPattern    &);
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockCompressedSetSparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const std::vector<unsigned int>  &,
-//  BlockCompressedSetSparsityPattern    &);
-
-
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,SparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- SparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,CompressedSparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- CompressedSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,CompressedSetSparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- CompressedSetSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockSparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- BlockSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockCompressedSparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- BlockCompressedSparsityPattern    &sparsity);
-template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockCompressedSetSparsityPattern>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
- const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
- const std::vector<unsigned int>  &dof_to_boundary_mapping,
- BlockCompressedSetSparsityPattern    &sparsity);
-
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,SparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
-//  const std::vector<unsigned int>  &dof_to_boundary_mapping,
-//  SparsityPattern    &sparsity);
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,CompressedSparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
-//  const std::vector<unsigned int>  &dof_to_boundary_mapping,
-//  CompressedSparsityPattern    &sparsity);
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,CompressedSetSparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
-//  const std::vector<unsigned int>  &dof_to_boundary_mapping,
-//  CompressedSetSparsityPattern    &sparsity);
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockSparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
-//  const std::vector<unsigned int>  &dof_to_boundary_mapping,
-//  BlockSparsityPattern    &sparsity);
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockCompressedSparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
-//  const std::vector<unsigned int>  &dof_to_boundary_mapping,
-//  BlockCompressedSparsityPattern    &sparsity);
-// template void
-// DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,BlockCompressedSetSparsityPattern>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
-//  const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
-//  const std::vector<unsigned int>  &dof_to_boundary_mapping,
-//  BlockCompressedSetSparsityPattern    &sparsity);
-
-
-template
-void
-DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension,deal_II_dimension+1> >
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
- const std::set<unsigned char> &,
- std::vector<unsigned int> &);
-
-#if deal_II_dimension != 1
-
-template
-void
-DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension,deal_II_dimension+1> >
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
- std::vector<unsigned int> &);
-
-#endif
-
-
-template
-void
-DoFTools::extract_hanging_node_dofs
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1> &dof_handler,
- std::vector<bool>     &selected_dofs);
-
-// template
-// void
-// DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> >
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-//  const std::set<unsigned char> &,
-//  std::vector<unsigned int> &);
-
-// #if deal_II_dimension != 1
-
-// template
-// void
-// DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> >
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-//  std::vector<unsigned int> &);
-
-// #endif
-
-
-
-#endif
-
-
-#if deal_II_dimension < 3
-template
-void
-DoFTools::
-make_hanging_node_constraints (const DoFHandler<deal_II_dimension,deal_II_dimension+1> &dof_handler,
-                              ConstraintMatrix &constraints);
-#endif
-
 
 
 DEAL_II_NAMESPACE_CLOSE
index a515e04fdce2863947d7e124e731e8a0fe43adc8..cd3273bb4a357e37c7b187ce0c733a9c2b97c7cc 100644 (file)
@@ -12,7 +12,7 @@
 //---------------------------------------------------------------------------
 
 
-for (SP : SPARSITY_PATTERNS)
+for (SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS)
   {
     template void
     DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension>, SP>
@@ -77,6 +77,33 @@ for (SP : SPARSITY_PATTERNS)
      const hp::DoFHandler<deal_II_dimension,deal_II_dimension> &dof_col,
      SP    &sparsity);
 
+    // #if deal_II_dimension > 1
+    template void
+    DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,SP>
+    (const DoFHandler<deal_II_dimension>& dof,
+     const std::vector<unsigned int>  &,
+     SP    &);
+
+    template void
+    DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,SP>
+    (const hp::DoFHandler<deal_II_dimension>& dof,
+     const std::vector<unsigned int>  &,
+     SP    &);
+
+    template void
+    DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,SP>
+    (const DoFHandler<deal_II_dimension>& dof,
+     const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
+     const std::vector<unsigned int>  &dof_to_boundary_mapping,
+     SP    &sparsity);
+
+    template void
+    DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,SP>
+    (const hp::DoFHandler<deal_II_dimension>& dof,
+     const FunctionMap<deal_II_dimension>::type  &boundary_indicators,
+     const std::vector<unsigned int>  &dof_to_boundary_mapping,
+     SP    &sparsity);
+
     template void
     DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,SP>
     (const DoFHandler<deal_II_dimension> &dof,
@@ -111,10 +138,7 @@ for (SP : SPARSITY_PATTERNS)
      const bool, const unsigned int);
 
 #endif
-  }
 
-for (SP : SPARSITY_PATTERNS)
-  {
 #if deal_II_dimension < 3
 
     template void
@@ -162,16 +186,419 @@ for (SP : SPARSITY_PATTERNS)
     (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &dof_row,
      const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &dof_col,
      SP    &sparsity);
+
+    template void
+    DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,SP>
+    (const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
+     const std::vector<unsigned int>  &,
+     SP    &);
+
+    //template void
+    //DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,SP>
+    //(const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
+    // const std::vector<unsigned int>  &,
+    // SP    &);
+
+    template void
+    DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,SP>
+    (const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
+     const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
+     const std::vector<unsigned int>  &dof_to_boundary_mapping,
+     SP    &sparsity);
+
+    //template void
+    //DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,SP>
+    //(const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof,
+    // const FunctionMap<deal_II_dimension+1>::type  &boundary_indicators,
+    // const std::vector<unsigned int>  &dof_to_boundary_mapping,
+    // SP    &sparsity);
+
 #endif
   }
 
 
 
 
-for (DH : DOFHANDLERS)
+for (DH : DOFHANDLERS; deal_II_dimension : DIMENSIONS)
 {
   template
   void
   DoFTools::make_hanging_node_constraints (const DH &dof_handler,
                                           ConstraintMatrix &constraints);
 }
+
+
+for (deal_II_dimension : DIMENSIONS)
+{
+
+#if deal_II_dimension < 3
+template
+void
+DoFTools::
+make_hanging_node_constraints (const DoFHandler<deal_II_dimension,deal_II_dimension+1> &dof_handler,
+                              ConstraintMatrix &constraints);
+#endif
+
+
+// TODO: can cleanup a bit more to fit into the scheme used above
+
+template
+void
+DoFTools::distribute_cell_to_dof_vector<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &dof_handler,
+ const Vector<float> &cell_data,
+ Vector<double>      &dof_data,
+ const unsigned int   component);
+template
+void
+DoFTools::distribute_cell_to_dof_vector<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &dof_handler,
+ const Vector<double> &cell_data,
+ Vector<double>       &dof_data,
+ const unsigned int    component);
+
+template
+void
+DoFTools::distribute_cell_to_dof_vector<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &dof_handler,
+ const Vector<float> &cell_data,
+ Vector<double>      &dof_data,
+ const unsigned int   component);
+template
+void
+DoFTools::distribute_cell_to_dof_vector<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &dof_handler,
+ const Vector<double> &cell_data,
+ Vector<double>       &dof_data,
+ const unsigned int    component);
+
+
+template void DoFTools::extract_dofs<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>&,
+ const std::vector<bool>&, std::vector<bool>&, bool);
+
+template void DoFTools::extract_dofs<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension>&,
+ const std::vector<bool>&, std::vector<bool>&, bool);
+
+template void DoFTools::extract_level_dofs<deal_II_dimension>
+(const unsigned int level, const MGDoFHandler<deal_II_dimension>&,
+ const std::vector<bool>&, std::vector<bool>&, bool);
+
+template
+void
+DoFTools::extract_boundary_dofs<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &,
+ const std::vector<bool>                  &,
+ std::vector<bool>                        &,
+ const std::set<unsigned char> &);
+template
+void
+DoFTools::extract_boundary_dofs<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &,
+ const std::vector<bool>                  &,
+ std::vector<bool>                        &,
+ const std::set<unsigned char> &);
+
+template
+void
+DoFTools::extract_dofs_with_support_on_boundary<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &,
+ const std::vector<bool>                  &,
+ std::vector<bool>                        &,
+ const std::set<unsigned char> &);
+template
+void
+DoFTools::extract_dofs_with_support_on_boundary<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &,
+ const std::vector<bool>                  &,
+ std::vector<bool>                        &,
+ const std::set<unsigned char> &);
+
+template
+void
+DoFTools::extract_hanging_node_dofs
+(const DoFHandler<deal_II_dimension> &dof_handler,
+ std::vector<bool>     &selected_dofs);
+
+template
+void
+DoFTools::extract_subdomain_dofs<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &dof_handler,
+ const types::subdomain_id_t  subdomain_id,
+ std::vector<bool>     &selected_dofs);
+template
+void
+DoFTools::extract_subdomain_dofs<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &dof_handler,
+ const types::subdomain_id_t subdomain_id,
+ std::vector<bool>     &selected_dofs);
+
+template
+void
+DoFTools::extract_locally_owned_dofs<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> & dof_handler,
+ IndexSet & dof_set);
+
+template
+void
+DoFTools::extract_locally_active_dofs<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> & dof_handler,
+ IndexSet & dof_set);
+
+
+template
+void
+DoFTools::extract_locally_relevant_dofs<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> & dof_handler,
+ IndexSet & dof_set);
+
+template
+void
+DoFTools::extract_constant_modes<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &dof_handler,
+ const std::vector<bool> &selected_components,
+ std::vector<std::vector<bool> > &constant_modes);
+
+template
+void
+DoFTools::get_active_fe_indices<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &dof_handler,
+ std::vector<unsigned int> &active_fe_indices);
+
+template
+void
+DoFTools::get_active_fe_indices<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &dof_handler,
+ std::vector<unsigned int> &active_fe_indices);
+
+template
+void
+DoFTools::get_subdomain_association<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &dof_handler,
+ std::vector<types::subdomain_id_t>           &subdomain_association);
+template
+void
+DoFTools::get_subdomain_association<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &dof_handler,
+ std::vector<types::subdomain_id_t>           &subdomain_association);
+
+
+template
+unsigned int
+DoFTools::count_dofs_with_subdomain_association<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &,
+ const types::subdomain_id_t);
+template
+IndexSet
+DoFTools::dof_indices_with_subdomain_association<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &,
+ const types::subdomain_id_t);
+template
+void
+DoFTools::count_dofs_with_subdomain_association<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &,
+ const types::subdomain_id_t,
+ std::vector<unsigned int> &);
+
+template
+unsigned int
+DoFTools::count_dofs_with_subdomain_association<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &,
+ const types::subdomain_id_t);
+template
+IndexSet
+DoFTools::dof_indices_with_subdomain_association<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &,
+ const types::subdomain_id_t);
+template
+void
+DoFTools::count_dofs_with_subdomain_association<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &,
+ const types::subdomain_id_t,
+ std::vector<unsigned int> &);
+
+template
+unsigned int
+DoFTools::count_dofs_with_subdomain_association<MGDoFHandler<deal_II_dimension> >
+(const MGDoFHandler<deal_II_dimension> &,
+ const types::subdomain_id_t);
+template
+IndexSet
+DoFTools::dof_indices_with_subdomain_association<MGDoFHandler<deal_II_dimension> >
+(const MGDoFHandler<deal_II_dimension> &,
+ const types::subdomain_id_t);
+template
+void
+DoFTools::count_dofs_with_subdomain_association<MGDoFHandler<deal_II_dimension> >
+(const MGDoFHandler<deal_II_dimension> &,
+ const types::subdomain_id_t,
+ std::vector<unsigned int> &);
+
+
+template
+void
+DoFTools::count_dofs_per_component<deal_II_dimension> (
+  const DoFHandler<deal_II_dimension>&,
+  std::vector<unsigned int>&, bool, std::vector<unsigned int>);
+
+#if deal_II_dimension < 3
+template void DoFTools::extract_level_dofs<deal_II_dimension, deal_II_dimension+1>
+(const unsigned int level, const MGDoFHandler<deal_II_dimension, deal_II_dimension+1>&,
+ const std::vector<bool>&, std::vector<bool>&, bool);
+
+template
+void
+DoFTools::count_dofs_per_component<deal_II_dimension, deal_II_dimension+1> (
+  const DoFHandler<deal_II_dimension, deal_II_dimension+1>&,
+  std::vector<unsigned int>&, bool, std::vector<unsigned int>);
+#endif
+
+template
+void
+DoFTools::count_dofs_per_block<deal_II_dimension> (
+  const DoFHandler<deal_II_dimension>&,
+  std::vector<unsigned int>&, std::vector<unsigned int>);
+
+
+template
+void
+DoFTools::count_dofs_per_component<deal_II_dimension> (
+  const DoFHandler<deal_II_dimension>&,
+  std::vector<unsigned int>&, std::vector<unsigned int>);
+
+template
+void
+DoFTools::compute_intergrid_constraints<deal_II_dimension> (
+  const DoFHandler<deal_II_dimension> &, const unsigned int,
+  const DoFHandler<deal_II_dimension> &, const unsigned int,
+  const InterGridMap<DoFHandler<deal_II_dimension> > &,
+  ConstraintMatrix&);
+
+template
+void
+DoFTools::compute_intergrid_transfer_representation<deal_II_dimension>
+(const DoFHandler<deal_II_dimension> &, const unsigned int,
+ const DoFHandler<deal_II_dimension> &, const unsigned int,
+ const InterGridMap<DoFHandler<deal_II_dimension> > &,
+ std::vector<std::map<unsigned int, float> > &);
+
+
+template
+void
+DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &,
+ const std::set<unsigned char> &,
+ std::vector<unsigned int> &);
+
+template
+void
+DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension> >
+(const DoFHandler<deal_II_dimension> &,
+ std::vector<unsigned int> &);
+
+
+
+template
+void
+DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &,
+ const std::set<unsigned char> &,
+ std::vector<unsigned int> &);
+
+template
+void
+DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension> >
+(const hp::DoFHandler<deal_II_dimension> &,
+ std::vector<unsigned int> &);
+
+
+
+template
+void
+DoFTools::map_dofs_to_support_points<deal_II_dimension>
+(const Mapping<deal_II_dimension,deal_II_dimension>&,
+ const DoFHandler<deal_II_dimension>&,
+ std::vector<Point<deal_II_dimension> >&);
+
+#if deal_II_dimension < 3
+
+template
+void
+DoFTools::map_dofs_to_support_points<deal_II_dimension,deal_II_dimension+1>
+(const Mapping<deal_II_dimension,deal_II_dimension+1>&,
+ const DoFHandler<deal_II_dimension, deal_II_dimension+1>&,
+ std::vector<Point<deal_II_dimension+1> >&);
+
+template
+void
+DoFTools::count_dofs_per_block<deal_II_dimension,deal_II_dimension+1> (
+  const DoFHandler<deal_II_dimension,deal_II_dimension+1>&,
+  std::vector<unsigned int>&, std::vector<unsigned int>);
+
+#endif
+
+template
+void
+DoFTools::convert_couplings_to_blocks (
+  const DoFHandler<deal_II_dimension>&, const Table<2, Coupling>&,
+  std::vector<Table<2,Coupling> >&);
+
+template
+void
+DoFTools::convert_couplings_to_blocks (
+  const hp::DoFHandler<deal_II_dimension>&, const Table<2, Coupling>&,
+  std::vector<Table<2,Coupling> >&);
+
+template
+void
+DoFTools::make_zero_boundary_constraints
+(const DoFHandler<deal_II_dimension> &,
+ ConstraintMatrix                    &,
+ const std::vector<bool>             &);
+
+template
+void
+DoFTools::make_zero_boundary_constraints
+(const hp::DoFHandler<deal_II_dimension> &,
+ ConstraintMatrix                        &,
+ const std::vector<bool>                 &);
+
+#if deal_II_dimension < 3
+
+template
+void
+DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension,deal_II_dimension+1> >
+(const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+ const std::set<unsigned char> &,
+ std::vector<unsigned int> &);
+
+template
+void
+DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension,deal_II_dimension+1> >
+(const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+ std::vector<unsigned int> &);
+
+
+template
+void
+DoFTools::extract_hanging_node_dofs
+(const DoFHandler<deal_II_dimension,deal_II_dimension+1> &dof_handler,
+ std::vector<bool>     &selected_dofs);
+
+// template
+// void
+// DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> >
+// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+//  const std::set<unsigned char> &,
+//  std::vector<unsigned int> &);
+
+// template
+// void
+// DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> >
+// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+//  std::vector<unsigned int> &);
+
+#endif
+
+}
\ No newline at end of file
index 930a7560689c779ef7f77342e285f651645bac3c..2b35e74d11e1eb0ce7838db951d5cb3e2efa159c 100644 (file)
@@ -22,28 +22,22 @@ namespace internal
   namespace hp
   {
 
-#if deal_II_dimension == 1
-
     unsigned int
     DoFFaces<1>::memory_consumption () const
     {
       return 0;
     }
 
-#endif
 
-#if deal_II_dimension == 2
-    
+
     unsigned int
     DoFFaces<2>::memory_consumption () const
     {
       return MemoryConsumption::memory_consumption (lines);
     }
 
-#endif
 
-#if deal_II_dimension == 3
+
     unsigned int
     DoFFaces<3>::memory_consumption () const
     {
@@ -51,8 +45,6 @@ namespace internal
              MemoryConsumption::memory_consumption (quads) );
     }
 
-#endif
-
   }
 }
 
index 2995838cdf29de459d9460644aeb1f548b1ad77f..6136a59aef08b44b9571dfe0aabb96ab344fced4 100644 (file)
@@ -1603,7 +1603,7 @@ namespace hp
             == 0),
            ExcMessage ("The given triangulation is parallel distributed but "
                        "this class does not currently support this."));
-    
+
     create_active_fe_table ();
     tria.add_refinement_listener (*this);
   }
@@ -2664,8 +2664,6 @@ namespace hp
 //------------------------------------------------------------------
 
 
-#if deal_II_dimension == 1
-
   template <>
   unsigned int DoFHandler<1>::n_boundary_dofs () const
   {
@@ -2791,9 +2789,6 @@ namespace hp
 
 
 
-#endif
-
-
   template<int dim, int spacedim>
   unsigned int DoFHandler<dim,spacedim>::n_boundary_dofs () const
   {
@@ -2902,7 +2897,6 @@ namespace hp
   }
 
 
-#if deal_II_dimension == 2
 
   template <>
   unsigned int DoFHandler<2,3>::n_boundary_dofs () const
@@ -2911,6 +2905,8 @@ namespace hp
     return 0;
   }
 
+
+
   template <>
   unsigned int DoFHandler<2,3>::n_boundary_dofs (const FunctionMap &) const
   {
@@ -2918,6 +2914,8 @@ namespace hp
     return 0;
   }
 
+
+
   template <>
   unsigned int DoFHandler<2,3>::n_boundary_dofs (const std::set<unsigned char> &) const
   {
@@ -2925,8 +2923,6 @@ namespace hp
     return 0;
   }
 
-#endif
-
 
 
   template<int dim, int spacedim>
@@ -3064,7 +3060,6 @@ namespace hp
   }
 
 
-#if deal_II_dimension == 1
 
   template <>
   void
@@ -3072,13 +3067,15 @@ namespace hp
   compute_line_dof_identities (std::vector<unsigned int> &) const
   {}
 
+
+
   template <>
   void
   DoFHandler<1,2>::
   compute_line_dof_identities (std::vector<unsigned int> &) const
   {}
 
-#endif
+
 
   template<int dim, int spacedim>
   void
@@ -3293,7 +3290,7 @@ namespace hp
       }
   }
 
-#if deal_II_dimension == 1
+
 
   template <>
   void
@@ -3307,10 +3304,7 @@ namespace hp
   compute_quad_dof_identities (std::vector<unsigned int> &) const
   {}
 
-#endif
-
 
-#if deal_II_dimension == 2
 
   template <>
   void
@@ -3319,6 +3313,7 @@ namespace hp
   {}
 
 
+
   template <>
   void
   DoFHandler<2,3>::
@@ -3326,8 +3321,6 @@ namespace hp
   {}
 
 
-#endif
-
 
   template<int dim, int spacedim>
   void
@@ -3693,11 +3686,11 @@ namespace hp
   }
 
 
-#if deal_II_dimension >= 2
 
-  template<int dim, int spacedim>
+                               // TODO: should be simplified a bit
+  template<>
   void
-  DoFHandler<dim,spacedim>::
+  DoFHandler<2,2>::
   renumber_dofs_internal (const std::vector<unsigned int> &new_numbers,
                          internal::int2type<2>)
   {
@@ -3723,13 +3716,69 @@ namespace hp
       }
   }
 
-#endif
 
-#if deal_II_dimension >= 3
 
-  template<int dim, int spacedim>
+  template<>
   void
-  DoFHandler<dim,spacedim>::
+  DoFHandler<2,3>::
+  renumber_dofs_internal (const std::vector<unsigned int> &new_numbers,
+                         internal::int2type<2>)
+  {
+    Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
+
+    renumber_dofs_internal (new_numbers, internal::int2type<1>());
+
+    for (quad_iterator quad=begin_quad(); quad!=end_quad(); ++quad)
+      {
+       const unsigned int n_active_fe_indices
+         = quad->n_active_fe_indices ();
+
+       for (unsigned int f=0; f<n_active_fe_indices; ++f)
+         {
+           const unsigned int fe_index
+             = quad->nth_active_fe_index (f);
+
+           for (unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_quad; ++d)
+             quad->set_dof_index (d,
+                                  new_numbers[quad->dof_index(d,fe_index)],
+                                  fe_index);
+         }
+      }
+  }
+
+
+  template<>
+  void
+  DoFHandler<3,3>::
+  renumber_dofs_internal (const std::vector<unsigned int> &new_numbers,
+                         internal::int2type<2>)
+  {
+    Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
+
+    renumber_dofs_internal (new_numbers, internal::int2type<1>());
+
+    for (quad_iterator quad=begin_quad(); quad!=end_quad(); ++quad)
+      {
+       const unsigned int n_active_fe_indices
+         = quad->n_active_fe_indices ();
+
+       for (unsigned int f=0; f<n_active_fe_indices; ++f)
+         {
+           const unsigned int fe_index
+             = quad->nth_active_fe_index (f);
+
+           for (unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_quad; ++d)
+             quad->set_dof_index (d,
+                                  new_numbers[quad->dof_index(d,fe_index)],
+                                  fe_index);
+         }
+      }
+  }
+
+
+  template<>
+  void
+  DoFHandler<3,3>::
   renumber_dofs_internal (const std::vector<unsigned int> &new_numbers,
                          internal::int2type<3>)
   {
@@ -3755,7 +3804,6 @@ namespace hp
       }
   }
 
-#endif
 
 
   template <int dim, int spacedim>
@@ -3872,7 +3920,6 @@ namespace hp
 
 
 
-#if deal_II_dimension == 1
   template <>
   void DoFHandler<1>::pre_refinement_notification (const Triangulation<1> &tria)
   {
@@ -3931,7 +3978,7 @@ namespace hp
        has_children.push_back (has_children_level);
       }
   }
-#endif
+
 
 
   template<int dim, int spacedim>
@@ -4038,16 +4085,12 @@ namespace hp
       std::swap (vertex_dofs_offsets, tmp);
     }
   }
+}
 
 
-/*-------------- Explicit Instantiations -------------------------------*/
-  template class DoFHandler<deal_II_dimension>;
-
-#if deal_II_dimension != 3
-  template class DoFHandler<deal_II_dimension, deal_II_dimension+1>;
-#endif
 
+/*-------------- Explicit Instantiations -------------------------------*/
+#include "dof_handler.inst"
 
-}
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/hp/dof_handler.inst.in b/deal.II/source/hp/dof_handler.inst.in
new file mode 100644 (file)
index 0000000..3443bdf
--- /dev/null
@@ -0,0 +1,24 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+  namespace hp
+  \{
+    template class DoFHandler<deal_II_dimension>;
+
+#if deal_II_dimension != 3
+    template class DoFHandler<deal_II_dimension, deal_II_dimension+1>;
+#endif
+  \}
+}
diff --git a/deal.II/source/hp/dof_levels.all_dimensions.cc b/deal.II/source/hp/dof_levels.all_dimensions.cc
deleted file mode 100644 (file)
index 0667240..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-//----------------------------  hp_dof_levels.cc  ---------------------------
-//    $Id$
-//    Version: $Name$
-//
-//    Copyright (C) 2003, 2006 by the deal.II authors
-//
-//    This file is subject to QPL and may not be  distributed
-//    without copyright and license information. Please refer
-//    to the file deal.II/doc/license.html for the  text  and
-//    further information on this license.
-//
-//----------------------------  hp_dof_levels.cc  ------------------------
-
-
-#include <base/memory_consumption.h>
-#include <hp/dof_levels.h>
-
-DEAL_II_NAMESPACE_OPEN
-
-namespace internal
-{
-  namespace hp
-  {
-    
-    unsigned int
-    DoFLevel<0>::memory_consumption () const
-    {
-      return MemoryConsumption::memory_consumption (active_fe_indices);
-    }
-    
-  }
-}
-
-DEAL_II_NAMESPACE_CLOSE
index 01f6ffa0327aa291e81d38ac5973386f30f8a8e0..2f7a74cd12748c77c25449af36edde4e5930053b 100644 (file)
@@ -22,8 +22,6 @@ namespace internal
   namespace hp
   {
 
-#if deal_II_dimension == 1
-
     unsigned int
     DoFLevel<1>::memory_consumption () const
     {
@@ -31,10 +29,7 @@ namespace internal
               MemoryConsumption::memory_consumption (lines));
     }
     
-#endif
-
 
-#if deal_II_dimension == 2
 
     unsigned int
     DoFLevel<2>::memory_consumption () const
@@ -43,11 +38,8 @@ namespace internal
               MemoryConsumption::memory_consumption (quads));
     }
 
-#endif
 
 
-#if deal_II_dimension == 3
-
     unsigned int
     DoFLevel<3>::memory_consumption () const
     {
@@ -55,8 +47,14 @@ namespace internal
               MemoryConsumption::memory_consumption (hexes));
     }
 
-#endif
 
+
+    unsigned int
+    DoFLevel<0>::memory_consumption () const
+    {
+      return MemoryConsumption::memory_consumption (active_fe_indices);
+    }
+    
   }
 }
 
index 9d39a53064fa8b51b208717e1e54804d808cbc08..3d79d64c2d943551153edc109fbf737b3629d382 100644 (file)
@@ -21,17 +21,17 @@ namespace hp
   template <int dim, int spacedim>
   FECollection<dim,spacedim>::FECollection ()
   {}
-  
 
-  
+
+
   template <int dim, int spacedim>
   FECollection<dim,spacedim>::FECollection (const FiniteElement<dim,spacedim> &fe)
   {
     push_back (fe);
   }
-  
 
-  
+
+
   template <int dim, int spacedim>
   FECollection<dim,spacedim>::
   FECollection (const FECollection<dim,spacedim> &fe_collection)
@@ -65,14 +65,14 @@ namespace hp
       Assert (new_fe.n_components() == finite_elements[0]->n_components(),
               ExcMessage ("All elements inside a collection need to have the "
                           "same number of vector components!"));
-  
+
     finite_elements
       .push_back (std_cxx1x::shared_ptr<const FiniteElement<dim,spacedim> >(new_fe.clone()));
   }
 
 
 
-  template <int dim, int spacedim> 
+  template <int dim, int spacedim>
   unsigned int
   FECollection<dim,spacedim>::memory_consumption () const
   {
@@ -84,15 +84,12 @@ namespace hp
 
     return mem;
   }
+}
+
 
 
 // explicit instantiations
-  template class FECollection<deal_II_dimension>;
+#include "fe_collection.inst"
 
-#if deal_II_dimension != 3
-  template class FECollection<deal_II_dimension, deal_II_dimension+1>;
-#endif
-  
-}
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/hp/fe_collection.inst.in b/deal.II/source/hp/fe_collection.inst.in
new file mode 100644 (file)
index 0000000..4390931
--- /dev/null
@@ -0,0 +1,24 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+  namespace hp
+  \{
+    template class FECollection<deal_II_dimension>;
+
+#if deal_II_dimension != 3
+    template class FECollection<deal_II_dimension, deal_II_dimension+1>;
+#endif
+  \}
+}
index 372d4b97c0fd6fd28465c474baf4c70a923fc606..30b284914de4f7ef00741b64b2a13ddbd2d12274 100644 (file)
@@ -230,9 +230,9 @@ namespace hp
   template <int dim, int spacedim>
   void
   FEValues<dim,spacedim>::reinit (const typename MGDoFHandler<dim,spacedim>::cell_iterator &cell,
-                         const unsigned int q_index,
-                         const unsigned int mapping_index,
-                         const unsigned int fe_index)
+                                 const unsigned int q_index,
+                                 const unsigned int mapping_index,
+                                 const unsigned int fe_index)
   {
                                      // determine which indices we
                                      // should actually use
@@ -270,9 +270,9 @@ namespace hp
   template <int dim, int spacedim>
   void
   FEValues<dim,spacedim>::reinit (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
-                         const unsigned int q_index,
-                         const unsigned int mapping_index,
-                         const unsigned int fe_index)
+                                 const unsigned int q_index,
+                                 const unsigned int mapping_index,
+                                 const unsigned int fe_index)
   {
                                      // determine which indices we
                                      // should actually use
@@ -336,10 +336,10 @@ namespace hp
   template <int dim, int spacedim>
   void
   FEFaceValues<dim,spacedim>::reinit (const typename hp::DoFHandler<dim,spacedim>::cell_iterator &cell,
-                             const unsigned int face_no,
-                             const unsigned int q_index,
-                             const unsigned int mapping_index,
-                             const unsigned int fe_index)
+                                     const unsigned int face_no,
+                                     const unsigned int q_index,
+                                     const unsigned int mapping_index,
+                                     const unsigned int fe_index)
   {
                                      // determine which indices we
                                      // should actually use
@@ -387,10 +387,10 @@ namespace hp
   template <int dim, int spacedim>
   void
   FEFaceValues<dim,spacedim>::reinit (const typename dealii::DoFHandler<dim,spacedim>::cell_iterator &cell,
-                             const unsigned int face_no,
-                             const unsigned int q_index,
-                             const unsigned int mapping_index,
-                             const unsigned int fe_index)
+                                     const unsigned int face_no,
+                                     const unsigned int q_index,
+                                     const unsigned int mapping_index,
+                                     const unsigned int fe_index)
   {
                                      // determine which indices we
                                      // should actually use
@@ -428,10 +428,10 @@ namespace hp
   template <int dim, int spacedim>
   void
   FEFaceValues<dim,spacedim>::reinit (const typename MGDoFHandler<dim,spacedim>::cell_iterator &cell,
-                             const unsigned int face_no,
-                             const unsigned int q_index,
-                             const unsigned int mapping_index,
-                             const unsigned int fe_index)
+                                     const unsigned int face_no,
+                                     const unsigned int q_index,
+                                     const unsigned int mapping_index,
+                                     const unsigned int fe_index)
   {
                                      // determine which indices we
                                      // should actually use
@@ -469,10 +469,10 @@ namespace hp
   template <int dim, int spacedim>
   void
   FEFaceValues<dim,spacedim>::reinit (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
-                             const unsigned int face_no,
-                             const unsigned int q_index,
-                             const unsigned int mapping_index,
-                             const unsigned int fe_index)
+                                     const unsigned int face_no,
+                                     const unsigned int q_index,
+                                     const unsigned int mapping_index,
+                                     const unsigned int fe_index)
   {
                                      // determine which indices we
                                      // should actually use
@@ -536,11 +536,11 @@ namespace hp
   template <int dim, int spacedim>
   void
   FESubfaceValues<dim,spacedim>::reinit (const typename hp::DoFHandler<dim,spacedim>::cell_iterator &cell,
-                                const unsigned int face_no,
-                                const unsigned int subface_no,
-                                const unsigned int q_index,
-                                const unsigned int mapping_index,
-                                const unsigned int fe_index)
+                                        const unsigned int face_no,
+                                        const unsigned int subface_no,
+                                        const unsigned int q_index,
+                                        const unsigned int mapping_index,
+                                        const unsigned int fe_index)
   {
                                      // determine which indices we
                                      // should actually use
@@ -588,11 +588,11 @@ namespace hp
   template <int dim, int spacedim>
   void
   FESubfaceValues<dim,spacedim>::reinit (const typename dealii::DoFHandler<dim,spacedim>::cell_iterator &cell,
-                                const unsigned int face_no,
-                                const unsigned int subface_no,
-                                const unsigned int q_index,
-                                const unsigned int mapping_index,
-                                const unsigned int fe_index)
+                                        const unsigned int face_no,
+                                        const unsigned int subface_no,
+                                        const unsigned int q_index,
+                                        const unsigned int mapping_index,
+                                        const unsigned int fe_index)
   {
                                      // determine which indices we
                                      // should actually use
@@ -630,11 +630,11 @@ namespace hp
   template <int dim, int spacedim>
   void
   FESubfaceValues<dim,spacedim>::reinit (const typename MGDoFHandler<dim,spacedim>::cell_iterator &cell,
-                                const unsigned int face_no,
-                                const unsigned int subface_no,
-                                const unsigned int q_index,
-                                const unsigned int mapping_index,
-                                const unsigned int fe_index)
+                                        const unsigned int face_no,
+                                        const unsigned int subface_no,
+                                        const unsigned int q_index,
+                                        const unsigned int mapping_index,
+                                        const unsigned int fe_index)
   {
                                      // determine which indices we
                                      // should actually use
@@ -672,11 +672,11 @@ namespace hp
   template <int dim, int spacedim>
   void
   FESubfaceValues<dim,spacedim>::reinit (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
-                                const unsigned int face_no,
-                                const unsigned int subface_no,
-                                const unsigned int q_index,
-                                const unsigned int mapping_index,
-                                const unsigned int fe_index)
+                                        const unsigned int face_no,
+                                        const unsigned int subface_no,
+                                        const unsigned int q_index,
+                                        const unsigned int mapping_index,
+                                        const unsigned int fe_index)
   {
                                      // determine which indices we
                                      // should actually use
@@ -712,60 +712,7 @@ namespace hp
 
 
 // explicit instantiations
-namespace internal
-{
-  namespace hp
-  {
-    template class FEValuesBase<deal_II_dimension,deal_II_dimension,
-                                dealii::FEValues<deal_II_dimension> >;
-#if deal_II_dimension >= 2
-    template class FEValuesBase<deal_II_dimension,deal_II_dimension-1,
-                                dealii::FEFaceValues<deal_II_dimension> >;
-    template class FEValuesBase<deal_II_dimension,deal_II_dimension-1,
-                                dealii::FESubfaceValues<deal_II_dimension> >;
-#endif
-  }
-}
-
-namespace hp
-{
-  template class FEValues<deal_II_dimension>;
-#if deal_II_dimension >= 2
-  template class FEFaceValues<deal_II_dimension>;
-  template class FESubfaceValues<deal_II_dimension>;
-#endif
-}
-
-
-
-#if deal_II_dimension != 3
-
-namespace internal
-{
-  namespace hp
-  {
-    template class FEValuesBase<deal_II_dimension,deal_II_dimension,
-                                dealii::FEValues<deal_II_dimension,deal_II_dimension+1> >;
-#if deal_II_dimension == 2
-    template class FEValuesBase<deal_II_dimension,deal_II_dimension-1,
-                                dealii::FEFaceValues<deal_II_dimension,deal_II_dimension+1> >;
-    template class FEValuesBase<deal_II_dimension,deal_II_dimension-1,
-                                dealii::FESubfaceValues<deal_II_dimension,deal_II_dimension+1> >;
-#endif
-  }
-}
-
-namespace hp
-{
-  template class FEValues<deal_II_dimension, deal_II_dimension+1>;
-
-#if deal_II_dimension == 2
-  template class FEFaceValues<deal_II_dimension, deal_II_dimension+1>;
-  template class FESubfaceValues<deal_II_dimension, deal_II_dimension+1>;
-#endif
-}
-#endif
-
+#include "fe_values.inst"
 
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/hp/fe_values.inst.in b/deal.II/source/hp/fe_values.inst.in
new file mode 100644 (file)
index 0000000..ef3e27d
--- /dev/null
@@ -0,0 +1,68 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+namespace internal
+\{
+  namespace hp
+  \{
+    template class FEValuesBase<deal_II_dimension,deal_II_dimension,
+                                dealii::FEValues<deal_II_dimension> >;
+#if deal_II_dimension >= 2
+    template class FEValuesBase<deal_II_dimension,deal_II_dimension-1,
+                                dealii::FEFaceValues<deal_II_dimension> >;
+    template class FEValuesBase<deal_II_dimension,deal_II_dimension-1,
+                                dealii::FESubfaceValues<deal_II_dimension> >;
+#endif
+  \}
+\}
+
+namespace hp
+\{
+  template class FEValues<deal_II_dimension>;
+#if deal_II_dimension >= 2
+  template class FEFaceValues<deal_II_dimension, deal_II_dimension>;
+  template class FESubfaceValues<deal_II_dimension, deal_II_dimension>;
+#endif
+\}
+
+
+
+#if deal_II_dimension != 3
+
+namespace internal
+\{
+  namespace hp
+  \{
+    template class FEValuesBase<deal_II_dimension,deal_II_dimension,
+                                dealii::FEValues<deal_II_dimension,deal_II_dimension+1> >;
+#if deal_II_dimension >= 2
+    template class FEValuesBase<deal_II_dimension,deal_II_dimension-1,
+                                dealii::FEFaceValues<deal_II_dimension,deal_II_dimension+1> >;
+    template class FEValuesBase<deal_II_dimension,deal_II_dimension-1,
+                                dealii::FESubfaceValues<deal_II_dimension,deal_II_dimension+1> >;
+#endif
+  \}
+\}
+
+namespace hp
+\{
+  template class FEValues<deal_II_dimension, deal_II_dimension+1>;
+#if deal_II_dimension >= 2
+  template class FEFaceValues<deal_II_dimension, deal_II_dimension+1>;
+  template class FESubfaceValues<deal_II_dimension, deal_II_dimension+1>;
+#endif
+\}
+#endif
+}
index 3a9955d308430eedff041f06412edd1e0adbaf71..fde4d682b06b6415fc74feb21aba1d9a178fc988 100644 (file)
@@ -25,7 +25,7 @@ namespace hp
   {}
 
 
-  
+
   template<int dim, int spacedim>
   MappingCollection<dim,spacedim>::
   MappingCollection (const Mapping<dim,spacedim> &mapping)
@@ -54,8 +54,8 @@ namespace hp
                                                    // mappings
                   mappings (mapping_collection.mappings)
   {}
-  
-  
+
+
 
   template<int dim, int spacedim>
   unsigned int
@@ -65,7 +65,7 @@ namespace hp
            MemoryConsumption::memory_consumption (mappings));
   }
 
-  
+
 
   template<int dim, int spacedim>
   void
@@ -82,23 +82,19 @@ namespace hp
   template<int dim, int spacedim>
   MappingQ1<dim,spacedim>
   StaticMappingQ1<dim,spacedim>::mapping_q1;
-  
+
 
   template<int dim, int spacedim>
   MappingCollection<dim,spacedim>
   StaticMappingQ1<dim,spacedim>::mapping_collection
   = MappingCollection<dim,spacedim>(mapping_q1);
 
-// explicit instantiations
-  template class MappingCollection<deal_II_dimension>;
-  template struct StaticMappingQ1<deal_II_dimension>;
+}
 
-#if deal_II_dimension != 3
-  template class MappingCollection<deal_II_dimension,deal_II_dimension+1>;
-  template struct StaticMappingQ1<deal_II_dimension,deal_II_dimension+1>;
 
-#endif
-  
-}
+
+// explicit instantiations
+#include "mapping_collection.inst"
+
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/hp/mapping_collection.inst.in b/deal.II/source/hp/mapping_collection.inst.in
new file mode 100644 (file)
index 0000000..6b76bab
--- /dev/null
@@ -0,0 +1,26 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+  namespace hp
+  \{
+    template class MappingCollection<deal_II_dimension>;
+    template struct StaticMappingQ1<deal_II_dimension>;
+
+#if deal_II_dimension != 3
+    template class MappingCollection<deal_II_dimension,deal_II_dimension+1>;
+    template struct StaticMappingQ1<deal_II_dimension,deal_II_dimension+1>;
+#endif
+  \}
+}
index d76a13a0cf237ac2a49a531ee193ebeab17b8ff7..b5efa2acfc82dce646e06bf28d5363e6f10197ca 100644 (file)
@@ -577,129 +577,8 @@ neighbor_child_on_subface (const unsigned int face,
 
 
 
-
 // explicit instantiations
+#include "mg_dof_accessor.inst"
 
-template
-void
-MGDoFAccessor<1,deal_II_dimension>::
-get_mg_dof_values (const int level,
-                  const Vector<double> &values,
-                  Vector<double>       &dof_values) const;
-
-template
-void
-MGDoFAccessor<1,deal_II_dimension>::
-get_mg_dof_values (const int level,
-                  const Vector<float> &values,
-                  Vector<float>       &dof_values) const;
-
-
-#if deal_II_dimension >= 2
-
-template
-void
-MGDoFAccessor<2,deal_II_dimension>::
-get_mg_dof_values (const int level,
-                  const Vector<double> &values,
-                  Vector<double>       &dof_values) const;
-
-template
-void
-MGDoFAccessor<2,deal_II_dimension>::
-get_mg_dof_values (const int level,
-                  const Vector<float> &values,
-                  Vector<float>       &dof_values) const;
-
-#endif
-
-
-#if deal_II_dimension >= 3
-
-template
-void
-MGDoFAccessor<3,deal_II_dimension>::
-get_mg_dof_values (const int level,
-                  const Vector<double> &values,
-                  Vector<double>       &dof_values) const;
-
-template
-void
-MGDoFAccessor<3,deal_II_dimension>::
-get_mg_dof_values (const int level,
-                  const Vector<float> &values,
-                  Vector<float>       &dof_values) const;
-
-#endif
-template
-void
-MGDoFCellAccessor<deal_II_dimension>::
-get_mg_dof_values (const Vector<double> &values,
-                  Vector<double>       &dof_values) const;
-
-template
-void
-MGDoFCellAccessor<deal_II_dimension>::
-get_mg_dof_values (const Vector<float> &values,
-                  Vector<float>       &dof_values) const;
-
-
-
-
-#if deal_II_dimension == 1
-template class MGDoFAccessor<1, 1, 1>;
-template class MGDoFAccessor<1, 1, 2>;
-
-template class MGDoFCellAccessor<1>;
-template class MGDoFCellAccessor<1,2>;
-
-template class TriaRawIterator<MGDoFCellAccessor<1> >;
-template class TriaIterator<MGDoFCellAccessor<1> >;
-template class TriaActiveIterator<MGDoFCellAccessor<1> >;
-#endif
-
-#if deal_II_dimension == 2
-template class MGDoFAccessor<1, 2, 2>;
-template class MGDoFAccessor<2, 2, 2>;
-
-template class MGDoFAccessor<1, 2, 3>;
-template class MGDoFAccessor<2, 2, 3>;
-
-template class MGDoFCellAccessor<2>;
-template class MGDoFCellAccessor<2,3>;
-
-template class TriaRawIterator   <MGDoFAccessor<1, 2, 2> >;
-template class TriaIterator      <MGDoFAccessor<1, 2, 2> >;
-template class TriaActiveIterator<MGDoFAccessor<1, 2, 2> >;
-
-template class TriaRawIterator   <MGDoFAccessor<1, 2, 3> >;
-template class TriaIterator      <MGDoFAccessor<1, 2, 3> >;
-template class TriaActiveIterator<MGDoFAccessor<1, 2, 3> >;
-
-template class TriaRawIterator   <MGDoFCellAccessor<2> >;
-template class TriaIterator      <MGDoFCellAccessor<2> >;
-template class TriaActiveIterator<MGDoFCellAccessor<2> >;
-#endif
-
-
-#if deal_II_dimension == 3
-template class MGDoFAccessor<1, 3, 3>;
-template class MGDoFAccessor<2, 3, 3>;
-template class MGDoFAccessor<3, 3, 3>;
-
-template class MGDoFCellAccessor<3>;
-
-template class TriaRawIterator   <MGDoFAccessor<1, 3, 3> >;
-template class TriaIterator      <MGDoFAccessor<1, 3, 3> >;
-template class TriaActiveIterator<MGDoFAccessor<1, 3, 3> >;
-
-template class TriaRawIterator   <MGDoFAccessor<2, 3, 3> >;
-template class TriaIterator      <MGDoFAccessor<2, 3, 3> >;
-template class TriaActiveIterator<MGDoFAccessor<2, 3, 3> >;
-
-template class TriaRawIterator   <MGDoFCellAccessor<3> >;
-template class TriaIterator      <MGDoFCellAccessor<3> >;
-template class TriaActiveIterator<MGDoFCellAccessor<3> >;
-#endif
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/multigrid/mg_dof_accessor.inst.in b/deal.II/source/multigrid/mg_dof_accessor.inst.in
new file mode 100644 (file)
index 0000000..4888f59
--- /dev/null
@@ -0,0 +1,140 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+for (deal_II_dimension : DIMENSIONS)
+  {
+  template
+  void
+  MGDoFAccessor<1,deal_II_dimension>::
+  get_mg_dof_values (const int level,
+                    const Vector<double> &values,
+                    Vector<double>       &dof_values) const;
+
+  template
+  void
+  MGDoFAccessor<1,deal_II_dimension>::
+  get_mg_dof_values (const int level,
+                    const Vector<float> &values,
+                    Vector<float>       &dof_values) const;
+
+
+#if deal_II_dimension >= 2
+
+  template
+  void
+  MGDoFAccessor<2,deal_II_dimension>::
+  get_mg_dof_values (const int level,
+                    const Vector<double> &values,
+                    Vector<double>       &dof_values) const;
+
+  template
+  void
+  MGDoFAccessor<2,deal_II_dimension>::
+  get_mg_dof_values (const int level,
+                    const Vector<float> &values,
+                    Vector<float>       &dof_values) const;
+
+#endif
+
+
+#if deal_II_dimension >= 3
+
+  template
+  void
+  MGDoFAccessor<3,deal_II_dimension>::
+  get_mg_dof_values (const int level,
+                    const Vector<double> &values,
+                    Vector<double>       &dof_values) const;
+
+  template
+  void
+  MGDoFAccessor<3,deal_II_dimension>::
+  get_mg_dof_values (const int level,
+                    const Vector<float> &values,
+                    Vector<float>       &dof_values) const;
+
+#endif
+
+  template
+  void
+  MGDoFCellAccessor<deal_II_dimension>::
+  get_mg_dof_values (const Vector<double> &values,
+                    Vector<double>       &dof_values) const;
+
+  template
+  void
+  MGDoFCellAccessor<deal_II_dimension>::
+  get_mg_dof_values (const Vector<float> &values,
+                    Vector<float>       &dof_values) const;
+
+
+
+
+#if deal_II_dimension == 1
+  template class MGDoFAccessor<1, 1, 1>;
+  template class MGDoFAccessor<1, 1, 2>;
+
+  template class MGDoFCellAccessor<1>;
+  template class MGDoFCellAccessor<1,2>;
+
+  template class TriaRawIterator<MGDoFCellAccessor<1> >;
+  template class TriaIterator<MGDoFCellAccessor<1> >;
+  template class TriaActiveIterator<MGDoFCellAccessor<1> >;
+#endif
+
+#if deal_II_dimension == 2
+  template class MGDoFAccessor<1, 2, 2>;
+  template class MGDoFAccessor<2, 2, 2>;
+
+  template class MGDoFAccessor<1, 2, 3>;
+  template class MGDoFAccessor<2, 2, 3>;
+
+  template class MGDoFCellAccessor<2>;
+  template class MGDoFCellAccessor<2,3>;
+
+  template class TriaRawIterator   <MGDoFAccessor<1, 2, 2> >;
+  template class TriaIterator      <MGDoFAccessor<1, 2, 2> >;
+  template class TriaActiveIterator<MGDoFAccessor<1, 2, 2> >;
+
+  template class TriaRawIterator   <MGDoFAccessor<1, 2, 3> >;
+  template class TriaIterator      <MGDoFAccessor<1, 2, 3> >;
+  template class TriaActiveIterator<MGDoFAccessor<1, 2, 3> >;
+
+  template class TriaRawIterator   <MGDoFCellAccessor<2> >;
+  template class TriaIterator      <MGDoFCellAccessor<2> >;
+  template class TriaActiveIterator<MGDoFCellAccessor<2> >;
+#endif
+
+
+#if deal_II_dimension == 3
+  template class MGDoFAccessor<1, 3, 3>;
+  template class MGDoFAccessor<2, 3, 3>;
+  template class MGDoFAccessor<3, 3, 3>;
+
+  template class MGDoFCellAccessor<3>;
+
+  template class TriaRawIterator   <MGDoFAccessor<1, 3, 3> >;
+  template class TriaIterator      <MGDoFAccessor<1, 3, 3> >;
+  template class TriaActiveIterator<MGDoFAccessor<1, 3, 3> >;
+
+  template class TriaRawIterator   <MGDoFAccessor<2, 3, 3> >;
+  template class TriaIterator      <MGDoFAccessor<2, 3, 3> >;
+  template class TriaActiveIterator<MGDoFAccessor<2, 3, 3> >;
+
+  template class TriaRawIterator   <MGDoFCellAccessor<3> >;
+  template class TriaIterator      <MGDoFCellAccessor<3> >;
+  template class TriaActiveIterator<MGDoFCellAccessor<3> >;
+#endif
+  }
+
index cc03d6bdf349d5a829c7fbaa287174973ccd8cb4..a1628dadf1d9bdd3ccc466d0a9229a5940d4d012 100644 (file)
@@ -2034,8 +2034,6 @@ unsigned int MGDoFHandler<dim,spacedim>::n_dofs (const unsigned int level) const
 
 
 
-#if deal_II_dimension == 1
-
 template <>
 void MGDoFHandler<1>::renumber_dofs (const unsigned int level,
                                     const std::vector<unsigned int> &new_numbers) {
@@ -2069,11 +2067,7 @@ void MGDoFHandler<1>::renumber_dofs (const unsigned int level,
     }
 }
 
-#endif
-
-
 
-#if deal_II_dimension == 2
 
 template <>
 void MGDoFHandler<2>::renumber_dofs (const unsigned int  level,
@@ -2134,11 +2128,7 @@ void MGDoFHandler<2>::renumber_dofs (const unsigned int  level,
     }
 }
 
-#endif
-
-
 
-#if deal_II_dimension == 3
 
 template <>
 void MGDoFHandler<3>::renumber_dofs (const unsigned int  level,
@@ -2235,8 +2225,6 @@ void MGDoFHandler<3>::renumber_dofs (const unsigned int  level,
     }
 }
 
-#endif
-
 
 
 template <int dim, int spacedim>
@@ -2269,112 +2257,7 @@ void MGDoFHandler<dim,spacedim>::clear_space ()
 
 
 // explicit instantiations
-template class MGDoFHandler<deal_II_dimension>;
-
-#if deal_II_dimension==1 || deal_II_dimension==2
-template class MGDoFHandler<deal_II_dimension,deal_II_dimension+1>;
-#endif
+#include "mg_dof_handler.inst"
 
 
-template
-unsigned int
-MGDoFHandler<deal_II_dimension,deal_II_dimension>::
-get_dof_index<1> (const unsigned int       obj_level,
-                 const unsigned int       obj_index,
-                 const unsigned int       fe_index,
-                 const unsigned int       local_index) const;
-
-#if deal_II_dimension < 3
-template
-unsigned int
-MGDoFHandler<deal_II_dimension,deal_II_dimension+1>::
-get_dof_index<1> (const unsigned int       obj_level,
-                 const unsigned int       obj_index,
-                 const unsigned int       fe_index,
-                 const unsigned int       local_index) const;
-#endif
-
-#if deal_II_dimension >= 2
-template
-unsigned int
-MGDoFHandler<deal_II_dimension,deal_II_dimension>::
-get_dof_index<2> (const unsigned int       obj_level,
-                 const unsigned int       obj_index,
-                 const unsigned int       fe_index,
-                 const unsigned int       local_index) const;
-
-#if deal_II_dimension < 3
-template
-unsigned int
-MGDoFHandler<deal_II_dimension,deal_II_dimension+1>::
-get_dof_index<2> (const unsigned int       obj_level,
-                 const unsigned int       obj_index,
-                 const unsigned int       fe_index,
-                 const unsigned int       local_index) const;
-#endif
-
-#if deal_II_dimension >= 3
-template
-unsigned int
-MGDoFHandler<deal_II_dimension,deal_II_dimension>::
-get_dof_index<3> (const unsigned int       obj_level,
-                 const unsigned int       obj_index,
-                 const unsigned int       fe_index,
-                 const unsigned int       local_index) const;
-#endif
-#endif
-
-template
-void
-MGDoFHandler<deal_II_dimension,deal_II_dimension>::
-set_dof_index<1> (const unsigned int       obj_level,
-                 const unsigned int       obj_index,
-                 const unsigned int       fe_index,
-                 const unsigned int       local_index,
-                 const unsigned int       global_index) const;
-
-#if deal_II_dimension < 3
-template
-void
-MGDoFHandler<deal_II_dimension,deal_II_dimension+1>::
-set_dof_index<1> (const unsigned int       obj_level,
-                 const unsigned int       obj_index,
-                 const unsigned int       fe_index,
-                 const unsigned int       local_index,
-                 const unsigned int       global_index) const;
-#endif
-
-#if deal_II_dimension >= 2
-template
-void
-MGDoFHandler<deal_II_dimension,deal_II_dimension>::
-set_dof_index<2> (const unsigned int       obj_level,
-                 const unsigned int       obj_index,
-                 const unsigned int       fe_index,
-                 const unsigned int       local_index,
-                 const unsigned int       global_index) const;
-
-#if deal_II_dimension < 3
-template
-void
-MGDoFHandler<deal_II_dimension,deal_II_dimension+1>::
-set_dof_index<2> (const unsigned int       obj_level,
-                 const unsigned int       obj_index,
-                 const unsigned int       fe_index,
-                 const unsigned int       local_index,
-                 const unsigned int       global_index) const;
-#endif
-
-#if deal_II_dimension >= 3
-template
-void
-MGDoFHandler<deal_II_dimension,deal_II_dimension>::
-set_dof_index<3> (const unsigned int       obj_level,
-                 const unsigned int       obj_index,
-                 const unsigned int       fe_index,
-                 const unsigned int       local_index,
-                 const unsigned int       global_index) const;
-#endif
-#endif
-
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/multigrid/mg_dof_handler.inst.in b/deal.II/source/multigrid/mg_dof_handler.inst.in
new file mode 100644 (file)
index 0000000..f6aad8c
--- /dev/null
@@ -0,0 +1,125 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+for (deal_II_dimension : DIMENSIONS)
+  {
+template class MGDoFHandler<deal_II_dimension>;
+
+#if deal_II_dimension==1 || deal_II_dimension==2
+template class MGDoFHandler<deal_II_dimension,deal_II_dimension+1>;
+#endif
+
+
+template
+unsigned int
+MGDoFHandler<deal_II_dimension,deal_II_dimension>::
+get_dof_index<1> (const unsigned int       obj_level,
+                 const unsigned int       obj_index,
+                 const unsigned int       fe_index,
+                 const unsigned int       local_index) const;
+
+#if deal_II_dimension < 3
+template
+unsigned int
+MGDoFHandler<deal_II_dimension,deal_II_dimension+1>::
+get_dof_index<1> (const unsigned int       obj_level,
+                 const unsigned int       obj_index,
+                 const unsigned int       fe_index,
+                 const unsigned int       local_index) const;
+#endif
+
+#if deal_II_dimension >= 2
+template
+unsigned int
+MGDoFHandler<deal_II_dimension,deal_II_dimension>::
+get_dof_index<2> (const unsigned int       obj_level,
+                 const unsigned int       obj_index,
+                 const unsigned int       fe_index,
+                 const unsigned int       local_index) const;
+
+#if deal_II_dimension < 3
+template
+unsigned int
+MGDoFHandler<deal_II_dimension,deal_II_dimension+1>::
+get_dof_index<2> (const unsigned int       obj_level,
+                 const unsigned int       obj_index,
+                 const unsigned int       fe_index,
+                 const unsigned int       local_index) const;
+#endif
+
+#if deal_II_dimension >= 3
+template
+unsigned int
+MGDoFHandler<deal_II_dimension,deal_II_dimension>::
+get_dof_index<3> (const unsigned int       obj_level,
+                 const unsigned int       obj_index,
+                 const unsigned int       fe_index,
+                 const unsigned int       local_index) const;
+#endif
+#endif
+
+template
+void
+MGDoFHandler<deal_II_dimension,deal_II_dimension>::
+set_dof_index<1> (const unsigned int       obj_level,
+                 const unsigned int       obj_index,
+                 const unsigned int       fe_index,
+                 const unsigned int       local_index,
+                 const unsigned int       global_index) const;
+
+#if deal_II_dimension < 3
+template
+void
+MGDoFHandler<deal_II_dimension,deal_II_dimension+1>::
+set_dof_index<1> (const unsigned int       obj_level,
+                 const unsigned int       obj_index,
+                 const unsigned int       fe_index,
+                 const unsigned int       local_index,
+                 const unsigned int       global_index) const;
+#endif
+
+#if deal_II_dimension >= 2
+template
+void
+MGDoFHandler<deal_II_dimension,deal_II_dimension>::
+set_dof_index<2> (const unsigned int       obj_level,
+                 const unsigned int       obj_index,
+                 const unsigned int       fe_index,
+                 const unsigned int       local_index,
+                 const unsigned int       global_index) const;
+
+#if deal_II_dimension < 3
+template
+void
+MGDoFHandler<deal_II_dimension,deal_II_dimension+1>::
+set_dof_index<2> (const unsigned int       obj_level,
+                 const unsigned int       obj_index,
+                 const unsigned int       fe_index,
+                 const unsigned int       local_index,
+                 const unsigned int       global_index) const;
+#endif
+
+#if deal_II_dimension >= 3
+template
+void
+MGDoFHandler<deal_II_dimension,deal_II_dimension>::
+set_dof_index<3> (const unsigned int       obj_level,
+                 const unsigned int       obj_index,
+                 const unsigned int       fe_index,
+                 const unsigned int       local_index,
+                 const unsigned int       global_index) const;
+#endif
+#endif
+  }
+
diff --git a/deal.II/source/multigrid/mg_tools.all_dimensions.cc b/deal.II/source/multigrid/mg_tools.all_dimensions.cc
deleted file mode 100644 (file)
index 8a7fbba..0000000
+++ /dev/null
@@ -1,445 +0,0 @@
-//---------------------------------------------------------------------------
-//    $Id$
-//    Version: $Name$
-//
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2010 by the deal.II authors
-//
-//    This file is subject to QPL and may not be  distributed
-//    without copyright and license information. Please refer
-//    to the file deal.II/doc/license.html for the  text  and
-//    further information on this license.
-//
-//---------------------------------------------------------------------------
-
-
-#include <base/logstream.h>
-#include <lac/sparse_matrix.h>
-#include <lac/block_sparse_matrix.h>
-#include <lac/block_vector.h>
-#include <multigrid/mg_tools.h>
-#include <multigrid/mg_base.h>
-#include <base/mg_level_object.h>
-
-#include <vector>
-#include <algorithm>
-#include <numeric>
-
-DEAL_II_NAMESPACE_OPEN
-
-
-template <typename number>
-void
-MGTools::apply_boundary_values (
-  const std::set<unsigned int> &boundary_dofs,
-  SparseMatrix<number>& matrix,
-  const bool preserve_symmetry,
-  const bool ignore_zeros)
-{
-                                  // if no boundary values are to be applied
-                                  // simply return
-  if (boundary_dofs.size() == 0)
-    return;
-
-
-  const unsigned int n_dofs = matrix.m();
-
-                                  // if a diagonal entry is zero
-                                  // later, then we use another
-                                  // number instead. take it to be
-                                  // the first nonzero diagonal
-                                  // element of the matrix, or 1 if
-                                  // there is no such thing
-  number first_nonzero_diagonal_entry = 1;
-  for (unsigned int i=0; i<n_dofs; ++i)
-    if (matrix.diag_element(i) != 0)
-      {
-       first_nonzero_diagonal_entry = matrix.diag_element(i);
-       break;
-      }
-
-  
-  std::set<unsigned int>::const_iterator dof  = boundary_dofs.begin(),
-                                        endd = boundary_dofs.end();
-  const SparsityPattern    &sparsity    = matrix.get_sparsity_pattern();
-  const std::size_t  *sparsity_rowstart = sparsity.get_rowstart_indices();
-  const unsigned int *sparsity_colnums  = sparsity.get_column_numbers();
-  for (; dof != endd; ++dof)
-    {
-      Assert (*dof < n_dofs, ExcInternalError());
-      
-      const unsigned int dof_number = *dof;
-                                      // for each boundary dof:
-      
-                                      // set entries of this line
-                                      // to zero except for the diagonal
-                                      // entry. Note that the diagonal
-                                      // entry is always the first one
-                                      // for square matrices, i.e.
-                                      // we shall not set
-                                      // matrix.global_entry(
-                                      //     sparsity_rowstart[dof.first])
-      const unsigned int last = sparsity_rowstart[dof_number+1];
-      for (unsigned int j=sparsity_rowstart[dof_number]+1; j<last; ++j)
-       matrix.global_entry(j) = 0.;
-
-
-                                      // set right hand side to
-                                      // wanted value: if main diagonal
-                                      // entry nonzero, don't touch it
-                                      // and scale rhs accordingly. If
-                                      // zero, take the first main
-                                      // diagonal entry we can find, or
-                                      // one if no nonzero main diagonal
-                                      // element exists. Normally, however,
-                                      // the main diagonal entry should
-                                      // not be zero.
-                                      //
-                                      // store the new rhs entry to make
-                                      // the gauss step more efficient
-      if(!ignore_zeros)
-       matrix.set (dof_number, dof_number,
-                   first_nonzero_diagonal_entry);
-                                      // if the user wants to have
-                                      // the symmetry of the matrix
-                                      // preserved, and if the
-                                      // sparsity pattern is
-                                      // symmetric, then do a Gauss
-                                      // elimination step with the
-                                      // present row
-      if (preserve_symmetry)
-       {
-                                          // we have to loop over all
-                                          // rows of the matrix which
-                                          // have a nonzero entry in
-                                          // the column which we work
-                                          // in presently. if the
-                                          // sparsity pattern is
-                                          // symmetric, then we can
-                                          // get the positions of
-                                          // these rows cheaply by
-                                          // looking at the nonzero
-                                          // column numbers of the
-                                          // present row. we need not
-                                          // look at the first entry,
-                                          // since that is the
-                                          // diagonal element and
-                                          // thus the present row
-         for (unsigned int j=sparsity_rowstart[dof_number]+1; j<last; ++j)
-           {
-             const unsigned int row = sparsity_colnums[j];
-
-                                              // find the position of
-                                              // element
-                                              // (row,dof_number)
-             const unsigned int *
-               p = std::lower_bound(&sparsity_colnums[sparsity_rowstart[row]+1],
-                                    &sparsity_colnums[sparsity_rowstart[row+1]],
-                                    dof_number);
-
-                                              // check whether this line has
-                                              // an entry in the regarding column
-                                              // (check for ==dof_number and
-                                              // != next_row, since if
-                                              // row==dof_number-1, *p is a
-                                              // past-the-end pointer but points
-                                              // to dof_number anyway...)
-                                              //
-                                              // there should be such an entry!
-             Assert ((*p == dof_number) &&
-                     (p != &sparsity_colnums[sparsity_rowstart[row+1]]),
-                     ExcInternalError());
-
-             const unsigned int global_entry
-               = (p - &sparsity_colnums[sparsity_rowstart[0]]);
-             
-                                              // correct right hand side
-                                              // set matrix entry to zero
-             matrix.global_entry(global_entry) = 0.;
-           }
-       }
-    }
-}
-
-
-
-template <typename number>
-void
-MGTools::apply_boundary_values (
-  const std::set<unsigned int>& boundary_dofs,
-  BlockSparseMatrix<number>& matrix,
-  const bool preserve_symmetry)
-{
-  const unsigned int blocks = matrix.n_block_rows();
-  
-  Assert (matrix.n_block_rows() == matrix.n_block_cols(),
-         ExcNotQuadratic());
-  Assert (matrix.get_sparsity_pattern().get_row_indices() == 
-         matrix.get_sparsity_pattern().get_column_indices(),
-         ExcNotQuadratic());
-
-  for (unsigned int i=0; i<blocks; ++i)
-    Assert (matrix.block(i,i).get_sparsity_pattern().optimize_diagonal(),
-           SparsityPattern::ExcDiagonalNotOptimized());
-
-  
-                                  // if no boundary values are to be applied
-                                  // simply return
-  if (boundary_dofs.size() == 0)
-    return;
-
-
-  const unsigned int n_dofs = matrix.m();
-
-                                  // if a diagonal entry is zero
-                                  // later, then we use another
-                                  // number instead. take it to be
-                                  // the first nonzero diagonal
-                                  // element of the matrix, or 1 if
-                                  // there is no such thing
-  number first_nonzero_diagonal_entry = 0;
-  for (unsigned int diag_block=0; diag_block<blocks; ++diag_block)
-    {
-      for (unsigned int i=0; i<matrix.block(diag_block,diag_block).n(); ++i)
-       if (matrix.block(diag_block,diag_block).diag_element(i) != 0)
-         {
-           first_nonzero_diagonal_entry 
-             = matrix.block(diag_block,diag_block).diag_element(i);
-           break;
-         }
-                                      // check whether we have found
-                                      // something in the present
-                                      // block
-      if (first_nonzero_diagonal_entry != 0)
-       break;
-    }
-                                  // nothing found on all diagonal
-                                  // blocks? if so, use 1.0 instead
-  if (first_nonzero_diagonal_entry == 0)
-    first_nonzero_diagonal_entry = 1;
-  
-
-  std::set<unsigned int>::const_iterator dof  = boundary_dofs.begin(),
-                                        endd = boundary_dofs.end();
-  const BlockSparsityPattern &
-    sparsity_pattern = matrix.get_sparsity_pattern();
-  
-                                  // pointer to the mapping between
-                                  // global and block indices. since
-                                  // the row and column mappings are
-                                  // equal, store a pointer on only
-                                  // one of them
-  const BlockIndices &
-    index_mapping = sparsity_pattern.get_column_indices();
-  
-                                  // now loop over all boundary dofs
-  for (; dof != endd; ++dof)
-    {
-      Assert (*dof < n_dofs, ExcInternalError());
-
-                                      // get global index and index
-                                      // in the block in which this
-                                      // dof is located
-      const unsigned int dof_number = *dof;
-      const std::pair<unsigned int,unsigned int>
-       block_index = index_mapping.global_to_local (dof_number);
-
-                                      // for each boundary dof:
-      
-                                      // set entries of this line
-                                      // to zero except for the diagonal
-                                      // entry. Note that the diagonal
-                                      // entry is always the first one
-                                      // for square matrices, i.e.
-                                      // we shall not set
-                                      // matrix.global_entry(
-                                      //     sparsity_rowstart[dof.first])
-                                      // of the diagonal block
-      for (unsigned int block_col=0; block_col<blocks; ++block_col)
-       {
-         const SparsityPattern &
-           local_sparsity = sparsity_pattern.block(block_index.first,
-                                                   block_col);
-
-                                          // find first and last
-                                          // entry in the present row
-                                          // of the present
-                                          // block. exclude the main
-                                          // diagonal element, which
-                                          // is the diagonal element
-                                          // of a diagonal block,
-                                          // which must be a square
-                                          // matrix so the diagonal
-                                          // element is the first of
-                                          // this row.
-         const unsigned int 
-           last  = local_sparsity.get_rowstart_indices()[block_index.second+1],
-           first = (block_col == block_index.first ?
-                    local_sparsity.get_rowstart_indices()[block_index.second]+1 :
-                    local_sparsity.get_rowstart_indices()[block_index.second]);
-         
-         for (unsigned int j=first; j<last; ++j)
-           matrix.block(block_index.first,block_col).global_entry(j) = 0.;
-       }
-      
-      matrix.block(block_index.first, block_index.first)
-       .diag_element(block_index.second)
-       = first_nonzero_diagonal_entry;
-
-                                      // if the user wants to have
-                                      // the symmetry of the matrix
-                                      // preserved, and if the
-                                      // sparsity pattern is
-                                      // symmetric, then do a Gauss
-                                      // elimination step with the
-                                      // present row. this is a
-                                      // little more complicated for
-                                      // block matrices.
-      if (preserve_symmetry)
-       {
-                                          // we have to loop over all
-                                          // rows of the matrix which
-                                          // have a nonzero entry in
-                                          // the column which we work
-                                          // in presently. if the
-                                          // sparsity pattern is
-                                          // symmetric, then we can
-                                          // get the positions of
-                                          // these rows cheaply by
-                                          // looking at the nonzero
-                                          // column numbers of the
-                                          // present row.
-                                          //
-                                          // note that if we check
-                                          // whether row @p{row} in
-                                          // block (r,c) is non-zero,
-                                          // then we have to check
-                                          // for the existence of
-                                          // column @p{row} in block
-                                          // (c,r), i.e. of the
-                                          // transpose block
-         for (unsigned int block_row=0; block_row<blocks; ++block_row)
-           {
-                                              // get pointers to the
-                                              // sparsity patterns of
-                                              // this block and of
-                                              // the transpose one
-             const SparsityPattern &this_sparsity
-               = sparsity_pattern.block (block_row, block_index.first);
-             const SparsityPattern &transpose_sparsity
-               = sparsity_pattern.block (block_index.first, block_row);
-             
-                                              // traverse the row of
-                                              // the transpose block
-                                              // to find the
-                                              // interesting rows in
-                                              // the present block.
-                                              // don't use the
-                                              // diagonal element of
-                                              // the diagonal block
-             const unsigned int
-               first = (block_index.first == block_row ?
-                        transpose_sparsity.get_rowstart_indices()[block_index.second]+1 :
-                        transpose_sparsity.get_rowstart_indices()[block_index.second]),
-               last  = transpose_sparsity.get_rowstart_indices()[block_index.second+1];
-             
-             for (unsigned int j=first; j<last; ++j)
-               {
-                                                  // get the number
-                                                  // of the column in
-                                                  // this row in
-                                                  // which a nonzero
-                                                  // entry is. this
-                                                  // is also the row
-                                                  // of the transpose
-                                                  // block which has
-                                                  // an entry in the
-                                                  // interesting row
-                 const unsigned int row = transpose_sparsity.get_column_numbers()[j];
-
-                                                  // find the
-                                                  // position of
-                                                  // element
-                                                  // (row,dof_number)
-                                                  // in this block
-                                                  // (not in the
-                                                  // transpose
-                                                  // one). note that
-                                                  // we have to take
-                                                  // care of special
-                                                  // cases with
-                                                  // square
-                                                  // sub-matrices
-                 const unsigned int *p = 0;
-                 if (this_sparsity.n_rows() == this_sparsity.n_cols())
-                   {
-                     if (this_sparsity.get_column_numbers()
-                         [this_sparsity.get_rowstart_indices()[row]]
-                         ==
-                         block_index.second)
-                       p = &this_sparsity.get_column_numbers()
-                           [this_sparsity.get_rowstart_indices()[row]];
-                     else
-                       p = std::lower_bound(&this_sparsity.get_column_numbers()
-                                            [this_sparsity.get_rowstart_indices()[row]+1],
-                                            &this_sparsity.get_column_numbers()
-                                            [this_sparsity.get_rowstart_indices()[row+1]],
-                                            block_index.second);
-                   }
-                 else
-                   p = std::lower_bound(&this_sparsity.get_column_numbers()
-                                        [this_sparsity.get_rowstart_indices()[row]],
-                                        &this_sparsity.get_column_numbers()
-                                        [this_sparsity.get_rowstart_indices()[row+1]],
-                                        block_index.second);
-
-                                                  // check whether this line has
-                                                  // an entry in the regarding column
-                                                  // (check for ==dof_number and
-                                                  // != next_row, since if
-                                                  // row==dof_number-1, *p is a
-                                                  // past-the-end pointer but points
-                                                  // to dof_number anyway...)
-                                                  //
-                                                  // there should be
-                                                  // such an entry!
-                                                  // note, however,
-                                                  // that this
-                                                  // assertion will
-                                                  // fail sometimes
-                                                  // if the sparsity
-                                                  // pattern is not
-                                                  // symmetric!
-                 Assert ((*p == block_index.second) &&
-                         (p != &this_sparsity.get_column_numbers()
-                          [this_sparsity.get_rowstart_indices()[row+1]]),
-                         ExcInternalError());
-                 
-                 const unsigned int global_entry
-                   = (p
-                      -
-                      &this_sparsity.get_column_numbers()
-                      [this_sparsity.get_rowstart_indices()[0]]);
-
-                                                  // set matrix entry to zero
-                 matrix.block(block_row,block_index.first).global_entry(global_entry) = 0.;
-               }
-           }
-       }
-    }
-}
-
-
-template void MGTools::apply_boundary_values (
-  const std::set<unsigned int>&,
-  SparseMatrix<float>&, const bool, const bool);
-template void MGTools::apply_boundary_values (
-  const std::set<unsigned int>&,
-  SparseMatrix<double>&, const bool, const bool);
-template void MGTools::apply_boundary_values (
-  const std::set<unsigned int>&,
-  BlockSparseMatrix<float>&, const bool);
-template void MGTools::apply_boundary_values (
-  const std::set<unsigned int>&,
-  BlockSparseMatrix<double>&, const bool);
-
-DEAL_II_NAMESPACE_CLOSE
index 825ecbfba92de922206df5e8d60c72a7029b86e9..fd9cd968de5b8349ab4225ebf01c33bbef9b7e49 100644 (file)
@@ -20,6 +20,9 @@
 #include <lac/compressed_sparsity_pattern.h>
 #include <lac/sparsity_pattern.h>
 #include <lac/block_vector.h>
+#include <lac/sparse_matrix.h>
+#include <lac/block_sparse_matrix.h>
+#include <lac/block_vector.h>
 #include <grid/tria.h>
 #include <grid/tria_iterator.h>
 #include <multigrid/mg_dof_handler.h>
 DEAL_II_NAMESPACE_OPEN
 
 
-#if deal_II_dimension == 1
 
-template <int dim, int spacedim>
+                               // specializations for 1D
+template <>
 void
 MGTools::compute_row_length_vector(
-  const MGDoFHandler<dim,spacedim>&,
+  const MGDoFHandler<1,1>&,
   const unsigned int,
   std::vector<unsigned int>&,
   const DoFTools::Coupling)
@@ -51,10 +54,11 @@ MGTools::compute_row_length_vector(
 }
 
 
-template <int dim, int spacedim>
+
+template <>
 void
 MGTools::compute_row_length_vector(
-  const MGDoFHandler<dim,spacedim>&,
+  const MGDoFHandler<1,1>&,
   const unsigned int,
   std::vector<unsigned int>&,
   const Table<2,DoFTools::Coupling>&,
@@ -63,7 +67,33 @@ MGTools::compute_row_length_vector(
   Assert(false, ExcNotImplemented());
 }
 
-#else
+
+
+template <>
+void
+MGTools::compute_row_length_vector(
+  const MGDoFHandler<1,2>&,
+  const unsigned int,
+  std::vector<unsigned int>&,
+  const DoFTools::Coupling)
+{
+  Assert(false, ExcNotImplemented());
+}
+
+
+template <>
+void
+MGTools::compute_row_length_vector(
+  const MGDoFHandler<1,2>&,
+  const unsigned int,
+  std::vector<unsigned int>&,
+  const Table<2,DoFTools::Coupling>&,
+  const Table<2,DoFTools::Coupling>&)
+{
+  Assert(false, ExcNotImplemented());
+}
+
+
 
 // Template for 2D and 3D. For 1D see specialization above
 template <int dim, int spacedim>
@@ -497,7 +527,7 @@ MGTools::compute_row_length_vector(
     }
   user_flags_triangulation.load_user_flags(old_flags);
 }
-#endif
+
 
 
 template <int dim, class SparsityPattern, int spacedim>
@@ -646,9 +676,6 @@ MGTools::make_flux_sparsity_pattern_edge (
 
 
 
-
-
-
 template <int dim, class SparsityPattern, int spacedim>
 void
 MGTools::make_flux_sparsity_pattern (
@@ -905,6 +932,7 @@ MGTools::make_flux_sparsity_pattern_edge (
 }
 
 
+
 template <int dim, int spacedim>
 void
 MGTools::
@@ -1017,6 +1045,7 @@ count_dofs_per_component (const MGDoFHandler<dim,spacedim>        &dof_handler,
 }
 
 
+
 template <int dim, int spacedim>
 void
 MGTools::count_dofs_per_block (
@@ -1097,13 +1126,25 @@ MGTools::count_dofs_per_block (
 }
 
 
-#if deal_II_dimension == 1
 
-template <int dim, int spacedim>
+template <>
+void
+MGTools::make_boundary_list(
+  const MGDoFHandler<1,1>&,
+  const typename FunctionMap<1>::type&,
+  std::vector<std::set<unsigned int> >&,
+  const std::vector<bool>&)
+{
+  Assert(false, ExcNotImplemented());
+}
+
+
+
+template <>
 void
 MGTools::make_boundary_list(
-  const MGDoFHandler<dim,spacedim>&,
-  const typename FunctionMap<dim>::type&,
+  const MGDoFHandler<1,2>&,
+  const typename FunctionMap<1>::type&,
   std::vector<std::set<unsigned int> >&,
   const std::vector<bool>&)
 {
@@ -1111,7 +1152,6 @@ MGTools::make_boundary_list(
 }
 
 
-#else
 
 template <int dim, int spacedim>
 void
@@ -1326,7 +1366,6 @@ MGTools::make_boundary_list(
     }
 }
 
-#endif
 
 
 template <int dim, int spacedim>
@@ -1353,31 +1392,56 @@ make_boundary_list(const MGDoFHandler<dim,spacedim>& dof,
 }
 
 
-#if deal_II_dimension == 1
 
-template <int dim, int spacedim>
+template <>
 void
 MGTools::
 extract_inner_interface_dofs (
-  const MGDoFHandler<dim,spacedim>&,
+  const MGDoFHandler<1,1>&,
   std::vector<std::vector<bool> > &,
   std::vector<std::vector<bool> > &)
 {
   Assert(false, ExcNotImplemented());
 }
 
-template <int dim, int spacedim>
+
+
+template <>
 void
 MGTools::
 extract_inner_interface_dofs (
-  const MGDoFHandler<dim,spacedim>&,
+  const MGDoFHandler<1,1>&,
+  std::vector<std::vector<bool> > &)
+{
+  Assert(false, ExcNotImplemented());
+}
+
+
+
+template <>
+void
+MGTools::
+extract_inner_interface_dofs (
+  const MGDoFHandler<1,2>&,
+  std::vector<std::vector<bool> > &,
+  std::vector<std::vector<bool> > &)
+{
+  Assert(false, ExcNotImplemented());
+}
+
+
+
+template <>
+void
+MGTools::
+extract_inner_interface_dofs (
+  const MGDoFHandler<1,2>&,
   std::vector<std::vector<bool> > &)
 {
   Assert(false, ExcNotImplemented());
 }
 
 
-#else
 
 template <int dim, int spacedim>
 void
@@ -1443,6 +1507,7 @@ extract_inner_interface_dofs (const MGDoFHandler<dim,spacedim> &mg_dof_handler,
 }
 
 
+
 template <int dim, int spacedim>
 void
 MGTools::
@@ -1538,102 +1603,426 @@ extract_inner_interface_dofs (const MGDoFHandler<dim,spacedim> &mg_dof_handler,
     }
 }
 
-#endif
 
 
-DEAL_II_NAMESPACE_CLOSE
-
+template <typename number>
+void
+MGTools::apply_boundary_values (
+  const std::set<unsigned int> &boundary_dofs,
+  SparseMatrix<number>& matrix,
+  const bool preserve_symmetry,
+  const bool ignore_zeros)
+{
+                                  // if no boundary values are to be applied
+                                  // simply return
+  if (boundary_dofs.size() == 0)
+    return;
 
 
-// explicit instantiations
+  const unsigned int n_dofs = matrix.m();
+
+                                  // if a diagonal entry is zero
+                                  // later, then we use another
+                                  // number instead. take it to be
+                                  // the first nonzero diagonal
+                                  // element of the matrix, or 1 if
+                                  // there is no such thing
+  number first_nonzero_diagonal_entry = 1;
+  for (unsigned int i=0; i<n_dofs; ++i)
+    if (matrix.diag_element(i) != 0)
+      {
+       first_nonzero_diagonal_entry = matrix.diag_element(i);
+       break;
+      }
+
+
+  std::set<unsigned int>::const_iterator dof  = boundary_dofs.begin(),
+                                        endd = boundary_dofs.end();
+  const SparsityPattern    &sparsity    = matrix.get_sparsity_pattern();
+  const std::size_t  *sparsity_rowstart = sparsity.get_rowstart_indices();
+  const unsigned int *sparsity_colnums  = sparsity.get_column_numbers();
+  for (; dof != endd; ++dof)
+    {
+      Assert (*dof < n_dofs, ExcInternalError());
+
+      const unsigned int dof_number = *dof;
+                                      // for each boundary dof:
+
+                                      // set entries of this line
+                                      // to zero except for the diagonal
+                                      // entry. Note that the diagonal
+                                      // entry is always the first one
+                                      // for square matrices, i.e.
+                                      // we shall not set
+                                      // matrix.global_entry(
+                                      //     sparsity_rowstart[dof.first])
+      const unsigned int last = sparsity_rowstart[dof_number+1];
+      for (unsigned int j=sparsity_rowstart[dof_number]+1; j<last; ++j)
+       matrix.global_entry(j) = 0.;
+
+
+                                      // set right hand side to
+                                      // wanted value: if main diagonal
+                                      // entry nonzero, don't touch it
+                                      // and scale rhs accordingly. If
+                                      // zero, take the first main
+                                      // diagonal entry we can find, or
+                                      // one if no nonzero main diagonal
+                                      // element exists. Normally, however,
+                                      // the main diagonal entry should
+                                      // not be zero.
+                                      //
+                                      // store the new rhs entry to make
+                                      // the gauss step more efficient
+      if(!ignore_zeros)
+       matrix.set (dof_number, dof_number,
+                   first_nonzero_diagonal_entry);
+                                      // if the user wants to have
+                                      // the symmetry of the matrix
+                                      // preserved, and if the
+                                      // sparsity pattern is
+                                      // symmetric, then do a Gauss
+                                      // elimination step with the
+                                      // present row
+      if (preserve_symmetry)
+       {
+                                          // we have to loop over all
+                                          // rows of the matrix which
+                                          // have a nonzero entry in
+                                          // the column which we work
+                                          // in presently. if the
+                                          // sparsity pattern is
+                                          // symmetric, then we can
+                                          // get the positions of
+                                          // these rows cheaply by
+                                          // looking at the nonzero
+                                          // column numbers of the
+                                          // present row. we need not
+                                          // look at the first entry,
+                                          // since that is the
+                                          // diagonal element and
+                                          // thus the present row
+         for (unsigned int j=sparsity_rowstart[dof_number]+1; j<last; ++j)
+           {
+             const unsigned int row = sparsity_colnums[j];
+
+                                              // find the position of
+                                              // element
+                                              // (row,dof_number)
+             const unsigned int *
+               p = std::lower_bound(&sparsity_colnums[sparsity_rowstart[row]+1],
+                                    &sparsity_colnums[sparsity_rowstart[row+1]],
+                                    dof_number);
+
+                                              // check whether this line has
+                                              // an entry in the regarding column
+                                              // (check for ==dof_number and
+                                              // != next_row, since if
+                                              // row==dof_number-1, *p is a
+                                              // past-the-end pointer but points
+                                              // to dof_number anyway...)
+                                              //
+                                              // there should be such an entry!
+             Assert ((*p == dof_number) &&
+                     (p != &sparsity_colnums[sparsity_rowstart[row+1]]),
+                     ExcInternalError());
+
+             const unsigned int global_entry
+               = (p - &sparsity_colnums[sparsity_rowstart[0]]);
+
+                                              // correct right hand side
+                                              // set matrix entry to zero
+             matrix.global_entry(global_entry) = 0.;
+           }
+       }
+    }
+}
 
-// Functions for building sparsity patterns are in a driver file. We
-// call it for all different patterns known.
-#define PATTERN SparsityPattern
-#include "mg_tools.pattern.in.h"
-#undef PATTERN
 
-#define PATTERN CompressedSparsityPattern
-#include "mg_tools.pattern.in.h"
-#undef PATTERN
 
-#define PATTERN CompressedSetSparsityPattern
-#include "mg_tools.pattern.in.h"
-#undef PATTERN
+template <typename number>
+void
+MGTools::apply_boundary_values (
+  const std::set<unsigned int>& boundary_dofs,
+  BlockSparseMatrix<number>& matrix,
+  const bool preserve_symmetry)
+{
+  const unsigned int blocks = matrix.n_block_rows();
 
-#define PATTERN CompressedSimpleSparsityPattern
-#include "mg_tools.pattern.in.h"
-#undef PATTERN
+  Assert (matrix.n_block_rows() == matrix.n_block_cols(),
+         ExcNotQuadratic());
+  Assert (matrix.get_sparsity_pattern().get_row_indices() ==
+         matrix.get_sparsity_pattern().get_column_indices(),
+         ExcNotQuadratic());
 
-#define PATTERN BlockSparsityPattern
-#include "mg_tools.pattern.in.h"
-#undef PATTERN
+  for (unsigned int i=0; i<blocks; ++i)
+    Assert (matrix.block(i,i).get_sparsity_pattern().optimize_diagonal(),
+           SparsityPattern::ExcDiagonalNotOptimized());
 
-#define PATTERN BlockCompressedSparsityPattern
-#include "mg_tools.pattern.in.h"
-#undef PATTERN
 
-#define PATTERN BlockCompressedSetSparsityPattern
-#include "mg_tools.pattern.in.h"
-#undef PATTERN
+                                  // if no boundary values are to be applied
+                                  // simply return
+  if (boundary_dofs.size() == 0)
+    return;
 
-#define PATTERN BlockCompressedSimpleSparsityPattern
-#include "mg_tools.pattern.in.h"
-#undef PATTERN
 
+  const unsigned int n_dofs = matrix.m();
 
-DEAL_II_NAMESPACE_OPEN
-
-template void
-MGTools::compute_row_length_vector(
-  const MGDoFHandler<deal_II_dimension>&, unsigned int,
-  std::vector<unsigned int>&, const DoFTools::Coupling);
-template void
-MGTools::compute_row_length_vector(
-  const MGDoFHandler<deal_II_dimension>&, unsigned int,
-  std::vector<unsigned int>&,
-  const Table<2,DoFTools::Coupling>&, const Table<2,DoFTools::Coupling>&);
-
-template void MGTools::count_dofs_per_component<deal_II_dimension> (
-  const MGDoFHandler<deal_II_dimension>&, std::vector<std::vector<unsigned int> >&,
-  bool, std::vector<unsigned int>);
-template void MGTools::count_dofs_per_component<deal_II_dimension> (
-  const MGDoFHandler<deal_II_dimension>&, std::vector<std::vector<unsigned int> >&,
-  std::vector<unsigned int>);
-template void MGTools::count_dofs_per_block<deal_II_dimension> (
-  const MGDoFHandler<deal_II_dimension>&, std::vector<std::vector<unsigned int> >&,
-  std::vector<unsigned int>);
-
-template void MGTools::make_boundary_list(
-  const MGDoFHandler<deal_II_dimension>&,
-  const FunctionMap<deal_II_dimension>::type&,
-  std::vector<std::set<unsigned int> >&,
-  const std::vector<bool>&);
+                                  // if a diagonal entry is zero
+                                  // later, then we use another
+                                  // number instead. take it to be
+                                  // the first nonzero diagonal
+                                  // element of the matrix, or 1 if
+                                  // there is no such thing
+  number first_nonzero_diagonal_entry = 0;
+  for (unsigned int diag_block=0; diag_block<blocks; ++diag_block)
+    {
+      for (unsigned int i=0; i<matrix.block(diag_block,diag_block).n(); ++i)
+       if (matrix.block(diag_block,diag_block).diag_element(i) != 0)
+         {
+           first_nonzero_diagonal_entry
+             = matrix.block(diag_block,diag_block).diag_element(i);
+           break;
+         }
+                                      // check whether we have found
+                                      // something in the present
+                                      // block
+      if (first_nonzero_diagonal_entry != 0)
+       break;
+    }
+                                  // nothing found on all diagonal
+                                  // blocks? if so, use 1.0 instead
+  if (first_nonzero_diagonal_entry == 0)
+    first_nonzero_diagonal_entry = 1;
+
+
+  std::set<unsigned int>::const_iterator dof  = boundary_dofs.begin(),
+                                        endd = boundary_dofs.end();
+  const BlockSparsityPattern &
+    sparsity_pattern = matrix.get_sparsity_pattern();
+
+                                  // pointer to the mapping between
+                                  // global and block indices. since
+                                  // the row and column mappings are
+                                  // equal, store a pointer on only
+                                  // one of them
+  const BlockIndices &
+    index_mapping = sparsity_pattern.get_column_indices();
+
+                                  // now loop over all boundary dofs
+  for (; dof != endd; ++dof)
+    {
+      Assert (*dof < n_dofs, ExcInternalError());
+
+                                      // get global index and index
+                                      // in the block in which this
+                                      // dof is located
+      const unsigned int dof_number = *dof;
+      const std::pair<unsigned int,unsigned int>
+       block_index = index_mapping.global_to_local (dof_number);
+
+                                      // for each boundary dof:
+
+                                      // set entries of this line
+                                      // to zero except for the diagonal
+                                      // entry. Note that the diagonal
+                                      // entry is always the first one
+                                      // for square matrices, i.e.
+                                      // we shall not set
+                                      // matrix.global_entry(
+                                      //     sparsity_rowstart[dof.first])
+                                      // of the diagonal block
+      for (unsigned int block_col=0; block_col<blocks; ++block_col)
+       {
+         const SparsityPattern &
+           local_sparsity = sparsity_pattern.block(block_index.first,
+                                                   block_col);
+
+                                          // find first and last
+                                          // entry in the present row
+                                          // of the present
+                                          // block. exclude the main
+                                          // diagonal element, which
+                                          // is the diagonal element
+                                          // of a diagonal block,
+                                          // which must be a square
+                                          // matrix so the diagonal
+                                          // element is the first of
+                                          // this row.
+         const unsigned int
+           last  = local_sparsity.get_rowstart_indices()[block_index.second+1],
+           first = (block_col == block_index.first ?
+                    local_sparsity.get_rowstart_indices()[block_index.second]+1 :
+                    local_sparsity.get_rowstart_indices()[block_index.second]);
+
+         for (unsigned int j=first; j<last; ++j)
+           matrix.block(block_index.first,block_col).global_entry(j) = 0.;
+       }
 
-template void MGTools::make_boundary_list(
-  const MGDoFHandler<deal_II_dimension>&,
-  const FunctionMap<deal_II_dimension>::type&,
-  std::vector<IndexSet>&,
-  const std::vector<bool>&);
+      matrix.block(block_index.first, block_index.first)
+       .diag_element(block_index.second)
+       = first_nonzero_diagonal_entry;
+
+                                      // if the user wants to have
+                                      // the symmetry of the matrix
+                                      // preserved, and if the
+                                      // sparsity pattern is
+                                      // symmetric, then do a Gauss
+                                      // elimination step with the
+                                      // present row. this is a
+                                      // little more complicated for
+                                      // block matrices.
+      if (preserve_symmetry)
+       {
+                                          // we have to loop over all
+                                          // rows of the matrix which
+                                          // have a nonzero entry in
+                                          // the column which we work
+                                          // in presently. if the
+                                          // sparsity pattern is
+                                          // symmetric, then we can
+                                          // get the positions of
+                                          // these rows cheaply by
+                                          // looking at the nonzero
+                                          // column numbers of the
+                                          // present row.
+                                          //
+                                          // note that if we check
+                                          // whether row @p{row} in
+                                          // block (r,c) is non-zero,
+                                          // then we have to check
+                                          // for the existence of
+                                          // column @p{row} in block
+                                          // (c,r), i.e. of the
+                                          // transpose block
+         for (unsigned int block_row=0; block_row<blocks; ++block_row)
+           {
+                                              // get pointers to the
+                                              // sparsity patterns of
+                                              // this block and of
+                                              // the transpose one
+             const SparsityPattern &this_sparsity
+               = sparsity_pattern.block (block_row, block_index.first);
+             const SparsityPattern &transpose_sparsity
+               = sparsity_pattern.block (block_index.first, block_row);
+
+                                              // traverse the row of
+                                              // the transpose block
+                                              // to find the
+                                              // interesting rows in
+                                              // the present block.
+                                              // don't use the
+                                              // diagonal element of
+                                              // the diagonal block
+             const unsigned int
+               first = (block_index.first == block_row ?
+                        transpose_sparsity.get_rowstart_indices()[block_index.second]+1 :
+                        transpose_sparsity.get_rowstart_indices()[block_index.second]),
+               last  = transpose_sparsity.get_rowstart_indices()[block_index.second+1];
+
+             for (unsigned int j=first; j<last; ++j)
+               {
+                                                  // get the number
+                                                  // of the column in
+                                                  // this row in
+                                                  // which a nonzero
+                                                  // entry is. this
+                                                  // is also the row
+                                                  // of the transpose
+                                                  // block which has
+                                                  // an entry in the
+                                                  // interesting row
+                 const unsigned int row = transpose_sparsity.get_column_numbers()[j];
+
+                                                  // find the
+                                                  // position of
+                                                  // element
+                                                  // (row,dof_number)
+                                                  // in this block
+                                                  // (not in the
+                                                  // transpose
+                                                  // one). note that
+                                                  // we have to take
+                                                  // care of special
+                                                  // cases with
+                                                  // square
+                                                  // sub-matrices
+                 const unsigned int *p = 0;
+                 if (this_sparsity.n_rows() == this_sparsity.n_cols())
+                   {
+                     if (this_sparsity.get_column_numbers()
+                         [this_sparsity.get_rowstart_indices()[row]]
+                         ==
+                         block_index.second)
+                       p = &this_sparsity.get_column_numbers()
+                           [this_sparsity.get_rowstart_indices()[row]];
+                     else
+                       p = std::lower_bound(&this_sparsity.get_column_numbers()
+                                            [this_sparsity.get_rowstart_indices()[row]+1],
+                                            &this_sparsity.get_column_numbers()
+                                            [this_sparsity.get_rowstart_indices()[row+1]],
+                                            block_index.second);
+                   }
+                 else
+                   p = std::lower_bound(&this_sparsity.get_column_numbers()
+                                        [this_sparsity.get_rowstart_indices()[row]],
+                                        &this_sparsity.get_column_numbers()
+                                        [this_sparsity.get_rowstart_indices()[row+1]],
+                                        block_index.second);
+
+                                                  // check whether this line has
+                                                  // an entry in the regarding column
+                                                  // (check for ==dof_number and
+                                                  // != next_row, since if
+                                                  // row==dof_number-1, *p is a
+                                                  // past-the-end pointer but points
+                                                  // to dof_number anyway...)
+                                                  //
+                                                  // there should be
+                                                  // such an entry!
+                                                  // note, however,
+                                                  // that this
+                                                  // assertion will
+                                                  // fail sometimes
+                                                  // if the sparsity
+                                                  // pattern is not
+                                                  // symmetric!
+                 Assert ((*p == block_index.second) &&
+                         (p != &this_sparsity.get_column_numbers()
+                          [this_sparsity.get_rowstart_indices()[row+1]]),
+                         ExcInternalError());
+
+                 const unsigned int global_entry
+                   = (p
+                      -
+                      &this_sparsity.get_column_numbers()
+                      [this_sparsity.get_rowstart_indices()[0]]);
+
+                                                  // set matrix entry to zero
+                 matrix.block(block_row,block_index.first).global_entry(global_entry) = 0.;
+               }
+           }
+       }
+    }
+}
 
-template
-void
-MGTools::
-extract_inner_interface_dofs (const MGDoFHandler<deal_II_dimension> &mg_dof_handler,
-                             std::vector<std::vector<bool> >  &interface_dofs,
-                             std::vector<std::vector<bool> >  &boundary_interface_dofs);
-template
-void
-MGTools::
-extract_inner_interface_dofs (const MGDoFHandler<deal_II_dimension> &mg_dof_handler,
-                             std::vector<std::vector<bool> >  &interface_dofs);
 
-#if deal_II_dimension < 3
 
-template void MGTools::count_dofs_per_block<deal_II_dimension,deal_II_dimension+1> (
-  const MGDoFHandler<deal_II_dimension,deal_II_dimension+1>&,
-  std::vector<std::vector<unsigned int> >&, std::vector<unsigned int>);
+// explicit instantiations
+#include "mg_tools.inst"
+
+template void MGTools::apply_boundary_values (
+  const std::set<unsigned int>&,
+  SparseMatrix<float>&, const bool, const bool);
+template void MGTools::apply_boundary_values (
+  const std::set<unsigned int>&,
+  SparseMatrix<double>&, const bool, const bool);
+template void MGTools::apply_boundary_values (
+  const std::set<unsigned int>&,
+  BlockSparseMatrix<float>&, const bool);
+template void MGTools::apply_boundary_values (
+  const std::set<unsigned int>&,
+  BlockSparseMatrix<double>&, const bool);
 
-#endif
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/multigrid/mg_tools.inst.in b/deal.II/source/multigrid/mg_tools.inst.in
new file mode 100644 (file)
index 0000000..26ccd68
--- /dev/null
@@ -0,0 +1,110 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+for (PATTERN : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS)
+{
+template void
+MGTools::make_sparsity_pattern<deal_II_dimension> (
+  const MGDoFHandler<deal_II_dimension> &,
+  PATTERN &,
+  const unsigned int);
+
+template void
+MGTools::make_flux_sparsity_pattern<deal_II_dimension> (
+  const MGDoFHandler<deal_II_dimension> &,
+  PATTERN &,
+  const unsigned int);
+
+template void
+MGTools::make_flux_sparsity_pattern_edge<deal_II_dimension> (
+  const MGDoFHandler<deal_II_dimension> &,
+  PATTERN &,
+  const unsigned int);
+
+#if deal_II_dimension > 1
+
+template void
+MGTools::make_flux_sparsity_pattern<deal_II_dimension> (
+  const MGDoFHandler<deal_II_dimension> &,
+  PATTERN &,
+  const unsigned int,
+  const Table<2,DoFTools::Coupling>&,
+  const Table<2,DoFTools::Coupling>&);
+
+template void
+MGTools::make_flux_sparsity_pattern_edge<deal_II_dimension> (
+  const MGDoFHandler<deal_II_dimension> &,
+  PATTERN &,
+  const unsigned int,
+  const Table<2,DoFTools::Coupling>&);
+
+#endif
+}
+
+
+for (deal_II_dimension : DIMENSIONS)
+  {
+template void
+MGTools::compute_row_length_vector(
+  const MGDoFHandler<deal_II_dimension>&, unsigned int,
+  std::vector<unsigned int>&, const DoFTools::Coupling);
+template void
+MGTools::compute_row_length_vector(
+  const MGDoFHandler<deal_II_dimension>&, unsigned int,
+  std::vector<unsigned int>&,
+  const Table<2,DoFTools::Coupling>&, const Table<2,DoFTools::Coupling>&);
+
+template void MGTools::count_dofs_per_component<deal_II_dimension> (
+  const MGDoFHandler<deal_II_dimension>&, std::vector<std::vector<unsigned int> >&,
+  bool, std::vector<unsigned int>);
+template void MGTools::count_dofs_per_component<deal_II_dimension> (
+  const MGDoFHandler<deal_II_dimension>&, std::vector<std::vector<unsigned int> >&,
+  std::vector<unsigned int>);
+template void MGTools::count_dofs_per_block<deal_II_dimension> (
+  const MGDoFHandler<deal_II_dimension>&, std::vector<std::vector<unsigned int> >&,
+  std::vector<unsigned int>);
+
+template void MGTools::make_boundary_list(
+  const MGDoFHandler<deal_II_dimension>&,
+  const FunctionMap<deal_II_dimension>::type&,
+  std::vector<std::set<unsigned int> >&,
+  const std::vector<bool>&);
+
+template void MGTools::make_boundary_list(
+  const MGDoFHandler<deal_II_dimension>&,
+  const FunctionMap<deal_II_dimension>::type&,
+  std::vector<IndexSet>&,
+  const std::vector<bool>&);
+
+template
+void
+MGTools::
+extract_inner_interface_dofs (const MGDoFHandler<deal_II_dimension> &mg_dof_handler,
+                             std::vector<std::vector<bool> >  &interface_dofs,
+                             std::vector<std::vector<bool> >  &boundary_interface_dofs);
+template
+void
+MGTools::
+extract_inner_interface_dofs (const MGDoFHandler<deal_II_dimension> &mg_dof_handler,
+                             std::vector<std::vector<bool> >  &interface_dofs);
+
+#if deal_II_dimension < 3
+
+template void MGTools::count_dofs_per_block<deal_II_dimension,deal_II_dimension+1> (
+  const MGDoFHandler<deal_II_dimension,deal_II_dimension+1>&,
+  std::vector<std::vector<unsigned int> >&, std::vector<unsigned int>);
+
+#endif
+  }
+
diff --git a/deal.II/source/multigrid/mg_tools.pattern.in.h b/deal.II/source/multigrid/mg_tools.pattern.in.h
deleted file mode 100644 (file)
index 397d6c6..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-//---------------------------------------------------------------------------
-//    $Id$
-//    Version: $Name$
-//
-//    Copyright (C) 2002, 2003, 2005, 2006 by the deal.II authors
-//
-//    This file is subject to QPL and may not be  distributed
-//    without copyright and license information. Please refer
-//    to the file deal.II/doc/license.html for the  text  and
-//    further information on this license.
-//
-//---------------------------------------------------------------------------
-
-// Driver file for MGTools::Make_*_sparsity_* routines.
-
-// Call this file after defining PATTERN to the desired sparsity
-// pattern type.
-
-DEAL_II_NAMESPACE_OPEN
-
-
-
-template void
-MGTools::make_sparsity_pattern<deal_II_dimension> (
-  const MGDoFHandler<deal_II_dimension> &,
-  PATTERN &,
-  const unsigned int);
-
-template void
-MGTools::make_flux_sparsity_pattern<deal_II_dimension> (
-  const MGDoFHandler<deal_II_dimension> &,
-  PATTERN &,
-  const unsigned int);
-
-template void
-MGTools::make_flux_sparsity_pattern_edge<deal_II_dimension> (
-  const MGDoFHandler<deal_II_dimension> &,
-  PATTERN &,
-  const unsigned int);
-
-#if deal_II_dimension > 1
-
-template void
-MGTools::make_flux_sparsity_pattern<deal_II_dimension> (
-  const MGDoFHandler<deal_II_dimension> &,
-  PATTERN &,
-  const unsigned int,
-  const Table<2,DoFTools::Coupling>&,
-  const Table<2,DoFTools::Coupling>&);
-
-template void
-MGTools::make_flux_sparsity_pattern_edge<deal_II_dimension> (
-  const MGDoFHandler<deal_II_dimension> &,
-  PATTERN &,
-  const unsigned int,
-  const Table<2,DoFTools::Coupling>&);
-
-#endif
-
-
-DEAL_II_NAMESPACE_CLOSE
index 216a28eb2136bc8c15434eed638c5d9d831bd00e..d6209b3360e77044f2ccb5b1105ad6d31400c9d0 100644 (file)
@@ -565,119 +565,7 @@ void MGTransferBlock<number>::build_matrices (
 
 
 // explicit instantiations
+#include "mg_transfer_block.inst"
 
-template
-void MGTransferBlock<float>::build_matrices<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>&, const MGDoFHandler<deal_II_dimension>&,
- const std::vector<bool>&);
-
-template
-void MGTransferBlock<double>::build_matrices<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>&, const MGDoFHandler<deal_II_dimension>&,
- const std::vector<bool>&);
-
-template
-void MGTransferBlockSelect<float>::build_matrices<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>&, const MGDoFHandler<deal_II_dimension>&,
- const unsigned int);
-
-template
-void MGTransferBlockSelect<double>::build_matrices<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>&, const MGDoFHandler<deal_II_dimension>&,
- const unsigned int);
-
-template void
-MGTransferBlock<float>::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<BlockVector<float> >&,
-  const BlockVector<double>&) const;
-template void
-MGTransferBlock<float>::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<BlockVector<float> >&) const;
-template void
-MGTransferBlock<float>::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<BlockVector<float> >&) const;
-
-template void
-MGTransferBlock<double>::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<BlockVector<double> >&,
-  const BlockVector<double>&) const;
-template void
-MGTransferBlock<double>::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<BlockVector<double> >&) const;
-template void
-MGTransferBlock<double>::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<BlockVector<double> >&) const;
-
-template void
-MGTransferBlockSelect<float>::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<float> >&,
-  const Vector<double>&) const;
-template void
-MGTransferBlockSelect<float>::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<float> >&,
-  const BlockVector<double>&) const;
-template void
-MGTransferBlockSelect<float>::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-template void
-MGTransferBlockSelect<float>::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-template void
-MGTransferBlockSelect<float>::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-template void
-MGTransferBlockSelect<float>::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-
-template void
-MGTransferBlockSelect<double>::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<double> >&,
-  const Vector<double>&) const;
-template void
-MGTransferBlockSelect<double>::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<double> >&,
-  const BlockVector<double>&) const;
-template void
-MGTransferBlockSelect<double>::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
-template void
-MGTransferBlockSelect<double>::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
-template void
-MGTransferBlockSelect<double>::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
-template void
-MGTransferBlockSelect<double>::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/multigrid/mg_transfer_block.inst.in b/deal.II/source/multigrid/mg_transfer_block.inst.in
new file mode 100644 (file)
index 0000000..3a60301
--- /dev/null
@@ -0,0 +1,131 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+for (deal_II_dimension : DIMENSIONS)
+  {
+template
+void MGTransferBlock<float>::build_matrices<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>&, const MGDoFHandler<deal_II_dimension>&,
+ const std::vector<bool>&);
+
+template
+void MGTransferBlock<double>::build_matrices<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>&, const MGDoFHandler<deal_II_dimension>&,
+ const std::vector<bool>&);
+
+template
+void MGTransferBlockSelect<float>::build_matrices<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>&, const MGDoFHandler<deal_II_dimension>&,
+ const unsigned int);
+
+template
+void MGTransferBlockSelect<double>::build_matrices<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>&, const MGDoFHandler<deal_II_dimension>&,
+ const unsigned int);
+
+template void
+MGTransferBlock<float>::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<BlockVector<float> >&,
+  const BlockVector<double>&) const;
+template void
+MGTransferBlock<float>::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<BlockVector<float> >&) const;
+template void
+MGTransferBlock<float>::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<BlockVector<float> >&) const;
+
+template void
+MGTransferBlock<double>::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<BlockVector<double> >&,
+  const BlockVector<double>&) const;
+template void
+MGTransferBlock<double>::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<BlockVector<double> >&) const;
+template void
+MGTransferBlock<double>::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<BlockVector<double> >&) const;
+
+template void
+MGTransferBlockSelect<float>::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<float> >&,
+  const Vector<double>&) const;
+template void
+MGTransferBlockSelect<float>::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<float> >&,
+  const BlockVector<double>&) const;
+template void
+MGTransferBlockSelect<float>::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+template void
+MGTransferBlockSelect<float>::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+template void
+MGTransferBlockSelect<float>::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+template void
+MGTransferBlockSelect<float>::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+
+template void
+MGTransferBlockSelect<double>::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<double> >&,
+  const Vector<double>&) const;
+template void
+MGTransferBlockSelect<double>::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<double> >&,
+  const BlockVector<double>&) const;
+template void
+MGTransferBlockSelect<double>::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+template void
+MGTransferBlockSelect<double>::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+template void
+MGTransferBlockSelect<double>::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+template void
+MGTransferBlockSelect<double>::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+  }
+
index 81b650dff28aa377b5df1c0c4b7afd5497ca5836..0f165b69444aba972932b68cf8ac0d1a0cb670dd 100644 (file)
@@ -32,6 +32,7 @@
 #include <algorithm>
 #include <numeric>
 #include <iostream>
+
 DEAL_II_NAMESPACE_OPEN
 
 
@@ -674,85 +675,7 @@ void MGTransferSelect<number>::build_matrices (
 
 
 // explicit instantiations
+#include "mg_transfer_component.inst"
 
-template
-void MGTransferSelect<float>::build_matrices<deal_II_dimension>
-(const DoFHandler<deal_II_dimension> &d,
- const MGDoFHandler<deal_II_dimension> &,
- unsigned int, unsigned int,
- const std::vector<unsigned int>&,
- const std::vector<unsigned int>&,
- const std::vector<std::set<unsigned int> >&);
-
-template
-void MGTransferSelect<double>::build_matrices<deal_II_dimension>
-(const DoFHandler<deal_II_dimension> &d,
- const MGDoFHandler<deal_II_dimension> &,
- unsigned int, unsigned int,
- const std::vector<unsigned int>&,
- const std::vector<unsigned int>&,
- const std::vector<std::set<unsigned int> >&);
-
-template void
-MGTransferSelect<float>::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<float> >&,
-  const Vector<double>&) const;
-template void
-MGTransferSelect<float>::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<float> >&,
-  const BlockVector<double>&) const;
-template void
-MGTransferSelect<float>::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-template void
-MGTransferSelect<float>::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-template void
-MGTransferSelect<float>::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-template void
-MGTransferSelect<float>::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-
-template void
-MGTransferSelect<double>::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<double> >&,
-  const Vector<double>&) const;
-template void
-MGTransferSelect<double>::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<double> >&,
-  const BlockVector<double>&) const;
-template void
-MGTransferSelect<double>::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
-template void
-MGTransferSelect<double>::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
-template void
-MGTransferSelect<double>::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
-template void
-MGTransferSelect<double>::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/multigrid/mg_transfer_component.inst.in b/deal.II/source/multigrid/mg_transfer_component.inst.in
new file mode 100644 (file)
index 0000000..9b32e36
--- /dev/null
@@ -0,0 +1,97 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+for (deal_II_dimension : DIMENSIONS)
+  {
+template
+void MGTransferSelect<float>::build_matrices<deal_II_dimension>
+(const DoFHandler<deal_II_dimension> &d,
+ const MGDoFHandler<deal_II_dimension> &,
+ unsigned int, unsigned int,
+ const std::vector<unsigned int>&,
+ const std::vector<unsigned int>&,
+ const std::vector<std::set<unsigned int> >&);
+
+template
+void MGTransferSelect<double>::build_matrices<deal_II_dimension>
+(const DoFHandler<deal_II_dimension> &d,
+ const MGDoFHandler<deal_II_dimension> &,
+ unsigned int, unsigned int,
+ const std::vector<unsigned int>&,
+ const std::vector<unsigned int>&,
+ const std::vector<std::set<unsigned int> >&);
+
+template void
+MGTransferSelect<float>::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<float> >&,
+  const Vector<double>&) const;
+template void
+MGTransferSelect<float>::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<float> >&,
+  const BlockVector<double>&) const;
+template void
+MGTransferSelect<float>::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+template void
+MGTransferSelect<float>::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+template void
+MGTransferSelect<float>::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+template void
+MGTransferSelect<float>::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+
+template void
+MGTransferSelect<double>::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<double> >&,
+  const Vector<double>&) const;
+template void
+MGTransferSelect<double>::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<double> >&,
+  const BlockVector<double>&) const;
+template void
+MGTransferSelect<double>::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+template void
+MGTransferSelect<double>::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+template void
+MGTransferSelect<double>::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+template void
+MGTransferSelect<double>::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+  }
+
index 0a60fe656f60a497f6071d8af24781590620c231..1e269c22711df5f039524100351eda9dc737098f 100644 (file)
@@ -292,7 +292,7 @@ void MGTransferPrebuilt<VECTOR>::build_matrices (
                                // need to filter away.
          constrain_indices.resize (0);
          constrain_indices.resize (prolongation_matrices[level]->n(), 0);
-         std::set<unsigned int>::const_iterator dof 
+         std::set<unsigned int>::const_iterator dof
             = mg_constrained_dofs->get_boundary_indices()[level].begin(),
            endd = mg_constrained_dofs->get_boundary_indices()[level].end();
          for (; dof != endd; ++dof)
@@ -384,146 +384,9 @@ void MGTransferPrebuilt<VECTOR>::build_matrices (
 }
 
 
-//TODO: Use template expander script
-
-template
-void MGTransferPrebuilt<Vector<float> >::build_matrices<deal_II_dimension>
-(const MGDoFHandler<deal_II_dimension> &mg_dof);
-
-template
-void MGTransferPrebuilt<Vector<double> >::build_matrices<deal_II_dimension>
-(const MGDoFHandler<deal_II_dimension> &mg_dof);
-
-template
-void MGTransferPrebuilt<BlockVector<float> >::build_matrices<deal_II_dimension>
-(const MGDoFHandler<deal_II_dimension> &mg_dof);
-
-template
-void MGTransferPrebuilt<BlockVector<double> >::build_matrices<deal_II_dimension>
-(const MGDoFHandler<deal_II_dimension> &mg_dof);
-
-template void
-MGTransferPrebuilt<Vector<float> >::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<float> >&,
-  const Vector<double>&) const;
-template void
-MGTransferPrebuilt<Vector<float> >::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<float> >&,
-  const BlockVector<double>&) const;
-template void
-MGTransferPrebuilt<Vector<float> >::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-template void
-MGTransferPrebuilt<Vector<float> >::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-template void
-MGTransferPrebuilt<Vector<float> >::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-template void
-MGTransferPrebuilt<Vector<float> >::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<float> >&) const;
-
-template void
-MGTransferPrebuilt<BlockVector<float> >::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<BlockVector<float> >&,
-  const Vector<double>&) const;
-template void
-MGTransferPrebuilt<BlockVector<float> >::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<BlockVector<float> >&,
-  const BlockVector<double>&) const;
-template void
-MGTransferPrebuilt<BlockVector<float> >::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<BlockVector<float> >&) const;
-template void
-MGTransferPrebuilt<BlockVector<float> >::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<BlockVector<float> >&) const;
-template void
-MGTransferPrebuilt<BlockVector<float> >::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<BlockVector<float> >&) const;
-template void
-MGTransferPrebuilt<BlockVector<float> >::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<BlockVector<float> >&) const;
-
-template void
-MGTransferPrebuilt<Vector<double> >::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<double> >&,
-  const Vector<double>&) const;
-template void
-MGTransferPrebuilt<Vector<double> >::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<Vector<double> >&,
-  const BlockVector<double>&) const;
-template void
-MGTransferPrebuilt<Vector<double> >::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
-template void
-MGTransferPrebuilt<Vector<double> >::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
-template void
-MGTransferPrebuilt<Vector<double> >::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
-template void
-MGTransferPrebuilt<Vector<double> >::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<Vector<double> >&) const;
-
-template void
-MGTransferPrebuilt<BlockVector<double> >::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<BlockVector<double> >&,
-  const Vector<double>&) const;
-template void
-MGTransferPrebuilt<BlockVector<double> >::copy_to_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  MGLevelObject<BlockVector<double> >&,
-  const BlockVector<double>&) const;
-template void
-MGTransferPrebuilt<BlockVector<double> >::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<BlockVector<double> >&) const;
-template void
-MGTransferPrebuilt<BlockVector<double> >::copy_from_mg (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<BlockVector<double> >&) const;
-template void
-MGTransferPrebuilt<BlockVector<double> >::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  Vector<double>&,
-  const MGLevelObject<BlockVector<double> >&) const;
-template void
-MGTransferPrebuilt<BlockVector<double> >::copy_from_mg_add (
-  const MGDoFHandler<deal_II_dimension>&,
-  BlockVector<double>&,
-  const MGLevelObject<BlockVector<double> >&) const;
+
+// explicit instantiation
+#include "mg_transfer_prebuilt.inst"
+
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/multigrid/mg_transfer_prebuilt.inst.in b/deal.II/source/multigrid/mg_transfer_prebuilt.inst.in
new file mode 100644 (file)
index 0000000..49660ae
--- /dev/null
@@ -0,0 +1,159 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+for (deal_II_dimension : DIMENSIONS)
+  {
+//TODO: Use template expander script
+
+template
+void MGTransferPrebuilt<Vector<float> >::build_matrices<deal_II_dimension>
+(const MGDoFHandler<deal_II_dimension> &mg_dof);
+
+template
+void MGTransferPrebuilt<Vector<double> >::build_matrices<deal_II_dimension>
+(const MGDoFHandler<deal_II_dimension> &mg_dof);
+
+template
+void MGTransferPrebuilt<BlockVector<float> >::build_matrices<deal_II_dimension>
+(const MGDoFHandler<deal_II_dimension> &mg_dof);
+
+template
+void MGTransferPrebuilt<BlockVector<double> >::build_matrices<deal_II_dimension>
+(const MGDoFHandler<deal_II_dimension> &mg_dof);
+
+template void
+MGTransferPrebuilt<Vector<float> >::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<float> >&,
+  const Vector<double>&) const;
+template void
+MGTransferPrebuilt<Vector<float> >::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<float> >&,
+  const BlockVector<double>&) const;
+template void
+MGTransferPrebuilt<Vector<float> >::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+template void
+MGTransferPrebuilt<Vector<float> >::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+template void
+MGTransferPrebuilt<Vector<float> >::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+template void
+MGTransferPrebuilt<Vector<float> >::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<float> >&) const;
+
+template void
+MGTransferPrebuilt<BlockVector<float> >::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<BlockVector<float> >&,
+  const Vector<double>&) const;
+template void
+MGTransferPrebuilt<BlockVector<float> >::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<BlockVector<float> >&,
+  const BlockVector<double>&) const;
+template void
+MGTransferPrebuilt<BlockVector<float> >::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<BlockVector<float> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<float> >::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<BlockVector<float> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<float> >::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<BlockVector<float> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<float> >::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<BlockVector<float> >&) const;
+
+template void
+MGTransferPrebuilt<Vector<double> >::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<double> >&,
+  const Vector<double>&) const;
+template void
+MGTransferPrebuilt<Vector<double> >::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<Vector<double> >&,
+  const BlockVector<double>&) const;
+template void
+MGTransferPrebuilt<Vector<double> >::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+template void
+MGTransferPrebuilt<Vector<double> >::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+template void
+MGTransferPrebuilt<Vector<double> >::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+template void
+MGTransferPrebuilt<Vector<double> >::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<Vector<double> >&) const;
+
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<BlockVector<double> >&,
+  const Vector<double>&) const;
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_to_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  MGLevelObject<BlockVector<double> >&,
+  const BlockVector<double>&) const;
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<BlockVector<double> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_from_mg (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<BlockVector<double> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  Vector<double>&,
+  const MGLevelObject<BlockVector<double> >&) const;
+template void
+MGTransferPrebuilt<BlockVector<double> >::copy_from_mg_add (
+  const MGDoFHandler<deal_II_dimension>&,
+  BlockVector<double>&,
+  const MGLevelObject<BlockVector<double> >&) const;
+  }
+
similarity index 99%
rename from deal.II/source/multigrid/multigrid.all_dimensions.cc
rename to deal.II/source/multigrid/multigrid.cc
index 73c90dba11bf15973a04e2e7aa98e2a4555a807e..ce06736b3ca41a89cbbc07cd69dcc178069b51f7 100644 (file)
@@ -36,6 +36,8 @@ DEAL_II_NAMESPACE_OPEN
 
 // If this function is to be used, its declaration must be added to
 // the class Multigrid again.
+
+// TODO: deal_II_dimension not set any more, so this will not compile!
 #ifdef MG_DEBUG
 template <>
 void
index 2d29adf0b7a625e4decf82b3d5b6cd44661b6d98..6a2c8dbcec667cf124128d9fab98e4a651295162 100644 (file)
@@ -11,7 +11,7 @@
 //
 //---------------------------------------------------------------------------
 
-for (VEC : SERIAL_VECTORS; DH : DOFHANDLER_TEMPLATES)
+for (VEC : SERIAL_VECTORS; DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS)
 {
 // codim=0
 
@@ -102,7 +102,7 @@ for (VEC : SERIAL_VECTORS; DH : DOFHANDLER_TEMPLATES)
 }
 
 
-for (DH : DOFHANDLER_TEMPLATES)
+for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS)
 {
   template class DataOut_DoFData<DH<deal_II_dimension>,deal_II_dimension>;
   template class DataOut_DoFData<DH<deal_II_dimension>,deal_II_dimension+1>;
index cad21ea6b09acc0f692b069383ee3f6a104cd3f1..87c03b39b32e1ff52b3d9b62cbec6d0b299b0272 100644 (file)
@@ -449,11 +449,8 @@ DataOutFaces<dim,DH>::next_face (const FaceDescriptor &old_face)
 }
 
 
+
 // explicit instantiations
-// don't instantiate anything for the 1d
-#if deal_II_dimension >=2
-template class DataOutFaces<deal_II_dimension, DoFHandler<deal_II_dimension> >;
-template class DataOutFaces<deal_II_dimension, hp::DoFHandler<deal_II_dimension> >;
-#endif
+#include "data_out_faces.inst"
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/numerics/data_out_faces.inst.in b/deal.II/source/numerics/data_out_faces.inst.in
new file mode 100644 (file)
index 0000000..87a8b2e
--- /dev/null
@@ -0,0 +1,21 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+  // don't instantiate anything for the 1d
+#if deal_II_dimension >=2
+  template class DataOutFaces<deal_II_dimension, DoFHandler<deal_II_dimension> >;
+  template class DataOutFaces<deal_II_dimension, hp::DoFHandler<deal_II_dimension> >;
+#endif
+}
index 4d14e22165762e00ec732eaf30d102a0548b0f6f..386e662d508eb02bfd14802bac502bcf96d551b3 100644 (file)
@@ -89,13 +89,12 @@ namespace internal
          patches.push_back (new_patches[i]);
          patches.back().patch_index = patches.size()-1;
        }
-    }    
+    }
   }
 }
 
-    
 
-#if deal_II_dimension < 3
+
 template <int dim, class DH>
 void
 DataOutRotation<dim,DH>::
@@ -103,6 +102,16 @@ build_one_patch (const cell_iterator *cell,
                 internal::DataOutRotation::ParallelData<DH::dimension, DH::space_dimension> &data,
                 std::vector<DataOutBase::Patch<DH::dimension+1,DH::space_dimension+1> > &patches)
 {
+  if (dim == 3)
+    {
+                                  // would this function make any
+                                  // sense after all? who would want
+                                  // to output/compute in four space
+                                  // dimensions?
+      Assert (false, ExcNotImplemented());
+      return;
+    }
+
   Assert (!(*cell)->is_ghost() &&
          !(*cell)->is_artificial(),
          ExcNotImplemented());
@@ -113,7 +122,7 @@ build_one_patch (const cell_iterator *cell,
                                   // the number of q_points in each
                                   // direction
   const unsigned int n_points = data.n_subdivisions+1;
-  
+
                                   // set up an array that holds the
                                   // directions in the plane of
                                   // rotation in which we will put
@@ -131,7 +140,7 @@ build_one_patch (const cell_iterator *cell,
       angle_directions[i][DH::dimension] = std::sin(2*numbers::PI *
                                                    i/n_patches_per_circle);
     }
-  
+
   for (unsigned int angle=0; angle<n_patches_per_circle; ++angle)
     {
                                       // first compute the
@@ -147,9 +156,9 @@ build_one_patch (const cell_iterator *cell,
          {
            const double r1 = (*cell)->vertex(0)(0),
                         r2 = (*cell)->vertex(1)(0);
-           Assert (r1 >= 0, ExcRadialVariableHasNegativeValues(r1));   
+           Assert (r1 >= 0, ExcRadialVariableHasNegativeValues(r1));
            Assert (r2 >= 0, ExcRadialVariableHasNegativeValues(r2));
-               
+
            patches[angle].vertices[0] = r1*angle_directions[angle];
            patches[angle].vertices[1] = r2*angle_directions[angle];
            patches[angle].vertices[2] = r1*angle_directions[angle+1];
@@ -157,7 +166,7 @@ build_one_patch (const cell_iterator *cell,
 
            break;
          };
-              
+
          case 2:
          {
            for (unsigned int vertex=0;
@@ -165,33 +174,33 @@ build_one_patch (const cell_iterator *cell,
                 ++vertex)
              {
                const Point<DH::dimension> v = (*cell)->vertex(vertex);
-                   
+
                                                 // make sure that the
                                                 // radial variable does
                                                 // attain negative
                                                 // values
                Assert (v(0) >= 0, ExcRadialVariableHasNegativeValues(v(0)));
-                   
+
                                                 // now set the vertices
                                                 // of the patch
                patches[angle].vertices[vertex] = v(0) * angle_directions[angle];
                patches[angle].vertices[vertex][0] = v(1);
-                   
+
                patches[angle].vertices[vertex+GeometryInfo<DH::dimension>::vertices_per_cell]
                  = v(0) * angle_directions[angle+1];
                patches[angle].vertices[vertex+GeometryInfo<DH::dimension>::vertices_per_cell][0]
                  = v(1);
              };
-               
+
            break;
          };
 
          default:
                Assert (false, ExcNotImplemented());
        };
-         
+
       unsigned int offset=0;
-              
+
                                       // then fill in data
       if (data.n_datasets > 0)
        {
@@ -224,9 +233,9 @@ build_one_patch (const cell_iterator *cell,
                      if (update_flags & update_hessians)
                        this->dof_data[dataset]->get_function_hessians (fe_patch_values,
                                                                        data.patch_hessians);
-                                                                       
+
                        if (update_flags & update_quadrature_points)
-                     data.patch_evaluation_points = fe_patch_values.get_quadrature_points();                                           
+                     data.patch_evaluation_points = fe_patch_values.get_quadrature_points();
 
                      std::vector<Point<DH::space_dimension> > dummy_normals;
                      postprocessor->
@@ -252,10 +261,10 @@ build_one_patch (const cell_iterator *cell,
                      if (update_flags & update_hessians)
                        this->dof_data[dataset]->get_function_hessians (fe_patch_values,
                                                                        data.patch_hessians_system);
-                                                                       
+
                        if (update_flags & update_quadrature_points)
-                     data.patch_evaluation_points = fe_patch_values.get_quadrature_points();                                           
-                                                                       
+                     data.patch_evaluation_points = fe_patch_values.get_quadrature_points();
+
                      std::vector<Point<DH::space_dimension> > dummy_normals;
                      postprocessor->
                        compute_derived_quantities_vector(data.patch_values_system,
@@ -265,7 +274,7 @@ build_one_patch (const cell_iterator *cell,
                                                          data.patch_evaluation_points,
                                                          data.postprocessed_values[dataset]);
                    }
-                     
+
                  for (unsigned int component=0;
                       component<this->dof_data[dataset]->n_output_variables;
                       ++component)
@@ -279,7 +288,7 @@ build_one_patch (const cell_iterator *cell,
                                                x*n_points + y)
                                      = data.postprocessed_values[dataset][x](component);
                                break;
-                                     
+
                          case 2:
                                for (unsigned int x=0; x<n_points; ++x)
                                  for (unsigned int y=0; y<n_points; ++y)
@@ -290,7 +299,7 @@ build_one_patch (const cell_iterator *cell,
                                                  z)
                                        = data.postprocessed_values[dataset][x*n_points+z](component);
                                break;
-                                     
+
                          default:
                                Assert (false, ExcNotImplemented());
                        }
@@ -301,7 +310,7 @@ build_one_patch (const cell_iterator *cell,
                  {
                    this->dof_data[dataset]->get_function_values (fe_patch_values,
                                                                  data.patch_values);
-                       
+
                    switch (DH::dimension)
                      {
                        case 1:
@@ -311,7 +320,7 @@ build_one_patch (const cell_iterator *cell,
                                              x*n_points + y)
                                    = data.patch_values[x];
                              break;
-                                 
+
                        case 2:
                              for (unsigned int x=0; x<n_points; ++x)
                                for (unsigned int y=0; y<n_points; ++y)
@@ -322,7 +331,7 @@ build_one_patch (const cell_iterator *cell,
                                                z*n_points)
                                      = data.patch_values[x*n_points+z];
                              break;
-                                 
+
                        default:
                              Assert (false, ExcNotImplemented());
                      }
@@ -332,7 +341,7 @@ build_one_patch (const cell_iterator *cell,
                  {
                    this->dof_data[dataset]->get_function_values (fe_patch_values,
                                                                  data.patch_values_system);
-                       
+
                    for (unsigned int component=0; component<data.n_components;
                         ++component)
                      {
@@ -345,7 +354,7 @@ build_one_patch (const cell_iterator *cell,
                                                  x*n_points + y)
                                        = data.patch_values_system[x](component);
                                  break;
-                                     
+
                            case 2:
                                  for (unsigned int x=0; x<n_points; ++x)
                                    for (unsigned int y=0; y<n_points; ++y)
@@ -356,7 +365,7 @@ build_one_patch (const cell_iterator *cell,
                                                    z)
                                          = data.patch_values_system[x*n_points+z](component);
                                  break;
-                                     
+
                            default:
                                  Assert (false, ExcNotImplemented());
                          }
@@ -364,7 +373,7 @@ build_one_patch (const cell_iterator *cell,
                  }
              offset+=this->dof_data[dataset]->n_output_variables;
            }
-                 
+
                                           // then do the cell data
          for (unsigned int dataset=0; dataset<this->cell_data.size(); ++dataset)
            {
@@ -395,7 +404,7 @@ build_one_patch (const cell_iterator *cell,
                                        y)
                              = value;
                        break;
-                           
+
                  case 2:
                        for (unsigned int x=0; x<n_points; ++x)
                          for (unsigned int y=0; y<n_points; ++y)
@@ -417,29 +426,9 @@ build_one_patch (const cell_iterator *cell,
 
 
 
-#else
-
-template <int dim, class DH>
-void
-DataOutRotation<dim,DH>::
-build_one_patch (const cell_iterator *,
-                internal::DataOutRotation::ParallelData<DH::dimension, DH::space_dimension> &,
-                std::vector<DataOutBase::Patch<DH::dimension+1,DH::space_dimension+1> > &)
-{
-                                  // would this function make any
-                                  // sense after all? who would want
-                                  // to output/compute in four space
-                                  // dimensions?
-  Assert (false, ExcNotImplemented());
-}
-
-#endif
-
-
-
 template <int dim, class DH>
 void DataOutRotation<dim,DH>::build_patches (const unsigned int n_patches_per_circle,
-                                            const unsigned int nnnn_subdivisions) 
+                                            const unsigned int nnnn_subdivisions)
 {
                                   // Check consistency of redundant
                                   // template parameter
@@ -449,13 +438,13 @@ void DataOutRotation<dim,DH>::build_patches (const unsigned int n_patches_per_ci
 
   const unsigned int n_subdivisions = (nnnn_subdivisions != 0)
                                      ? nnnn_subdivisions
-                                     : this->default_subdivisions;  
+                                     : this->default_subdivisions;
   Assert (n_subdivisions >= 1,
          ExcInvalidNumberOfSubdivisions(n_subdivisions));
 
   const QTrapez<1>     q_trapez;
   const QIterated<DH::dimension> patch_points (q_trapez, n_subdivisions);
-  
+
   const unsigned int n_components   = this->dofs->get_fe().n_components();
   unsigned int n_datasets=this->cell_data.size();
   for (unsigned int i=0; i<this->dof_data.size(); ++i)
@@ -471,7 +460,7 @@ void DataOutRotation<dim,DH>::build_patches (const unsigned int n_patches_per_ci
   Assert (!(update_flags & update_normal_vectors),
          ExcMessage("The update of normal vectors may not be requested for "
                     "evaluation of data on cells via DataPostprocessor."));
-  
+
                                   // first count the cells we want to
                                   // create patches of and make sure
                                   // there is enough memory for that
@@ -479,7 +468,7 @@ void DataOutRotation<dim,DH>::build_patches (const unsigned int n_patches_per_ci
   for (cell_iterator cell=first_cell(); cell != this->dofs->end();
        cell = next_cell(cell))
     all_cells.push_back (cell);
-  
+
                                   // then also take into account that
                                   // we want more than one patch to
                                   // come out of every cell, as they
@@ -487,8 +476,8 @@ void DataOutRotation<dim,DH>::build_patches (const unsigned int n_patches_per_ci
                                   // rotation
   this->patches.clear();
   this->patches.reserve (all_cells.size() * n_patches_per_circle);
-  
-  
+
+
   std::vector<unsigned int> n_postprocessor_outputs (this->dof_data.size());
   for (unsigned int dataset=0; dataset<this->dof_data.size(); ++dataset)
     if (this->dof_data[dataset]->postprocessor)
@@ -527,7 +516,7 @@ void DataOutRotation<dim,DH>::build_patches (const unsigned int n_patches_per_ci
 
 template <int dim, class DH>
 typename DataOutRotation<dim,DH>::cell_iterator
-DataOutRotation<dim,DH>::first_cell () 
+DataOutRotation<dim,DH>::first_cell ()
 {
   return this->dofs->begin_active ();
 }
@@ -535,7 +524,7 @@ DataOutRotation<dim,DH>::first_cell ()
 
 template <int dim, class DH>
 typename DataOutRotation<dim,DH>::cell_iterator
-DataOutRotation<dim,DH>::next_cell (const cell_iterator &cell) 
+DataOutRotation<dim,DH>::next_cell (const cell_iterator &cell)
 {
                                   // convert the iterator to an
                                   // active_iterator and advance
@@ -546,7 +535,9 @@ DataOutRotation<dim,DH>::next_cell (const cell_iterator &cell)
 }
 
 
+
 // explicit instantiations
-template class DataOutRotation<deal_II_dimension, DoFHandler<deal_II_dimension> >;
+#include "data_out_rotation.inst"
+
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/numerics/data_out_rotation.inst.in b/deal.II/source/numerics/data_out_rotation.inst.in
new file mode 100644 (file)
index 0000000..ed90dd3
--- /dev/null
@@ -0,0 +1,17 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+  template class DataOutRotation<deal_II_dimension, DoFHandler<deal_II_dimension> >;
+}
index 59ed4fcc33758b1d715ce09d87650a9547c97034..235c4841ab73d7873c70b18d41dc8c7303a4a3be 100644 (file)
@@ -468,23 +468,9 @@ std::vector<std::string> DataOutStack<dim,spacedim,DH>::get_dataset_names () con
 }
 
 
+
 // explicit instantiations
-template class DataOutStack<deal_II_dimension,deal_II_dimension,DoFHandler<deal_II_dimension> >;
-
-template void DataOutStack<deal_II_dimension,deal_II_dimension,DoFHandler<deal_II_dimension> >::
-add_data_vector<double> (const Vector<double> &vec,
-                        const std::string    &name);
-
-template void DataOutStack<deal_II_dimension,deal_II_dimension,DoFHandler<deal_II_dimension> >::
-add_data_vector<float> (const Vector<float>  &vec,
-                       const std::string    &name);
-
-template class DataOutStack<deal_II_dimension,deal_II_dimension,hp::DoFHandler<deal_II_dimension> >;
-template void DataOutStack<deal_II_dimension,deal_II_dimension,hp::DoFHandler<deal_II_dimension> >::
-add_data_vector<double> (const Vector<double> &vec,
-                        const std::string    &name);
-template void DataOutStack<deal_II_dimension,deal_II_dimension,hp::DoFHandler<deal_II_dimension> >::
-add_data_vector<float> (const Vector<float>  &vec,
-                       const std::string    &name);
+#include "data_out_stack.inst"
+
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/numerics/data_out_stack.inst.in b/deal.II/source/numerics/data_out_stack.inst.in
new file mode 100644 (file)
index 0000000..401fa98
--- /dev/null
@@ -0,0 +1,33 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+template class DataOutStack<deal_II_dimension,deal_II_dimension,DoFHandler<deal_II_dimension> >;
+
+template void DataOutStack<deal_II_dimension,deal_II_dimension,DoFHandler<deal_II_dimension> >::
+add_data_vector<double> (const Vector<double> &vec,
+                        const std::string    &name);
+
+template void DataOutStack<deal_II_dimension,deal_II_dimension,DoFHandler<deal_II_dimension> >::
+add_data_vector<float> (const Vector<float>  &vec,
+                       const std::string    &name);
+
+template class DataOutStack<deal_II_dimension,deal_II_dimension,hp::DoFHandler<deal_II_dimension> >;
+template void DataOutStack<deal_II_dimension,deal_II_dimension,hp::DoFHandler<deal_II_dimension> >::
+add_data_vector<double> (const Vector<double> &vec,
+                        const std::string    &name);
+template void DataOutStack<deal_II_dimension,deal_II_dimension,hp::DoFHandler<deal_II_dimension> >::
+add_data_vector<float> (const Vector<float>  &vec,
+                       const std::string    &name);
+}
index 502b24452ceb2c99759ba988cfe69f64a888ba74..1a314caa013b6a86994eae42d60a4ed8a7f70028 100644 (file)
@@ -95,6 +95,7 @@ DataPostprocessor<dim>::get_data_component_interpretation () const
 
 
 // explicit instantiation
-template class DataPostprocessor<deal_II_dimension>;
+#include "data_postprocessor.inst"
+
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/numerics/data_postprocessor.inst.in b/deal.II/source/numerics/data_postprocessor.inst.in
new file mode 100644 (file)
index 0000000..3cf15e8
--- /dev/null
@@ -0,0 +1,17 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+  template class DataPostprocessor<deal_II_dimension>;
+}
index 8aeaaa50b0ba68ef17728c8b46300c18f2d9d224..edaedeb53426b950fa708a524855fc8188c3b4cf 100644 (file)
@@ -132,7 +132,6 @@ get_projected_derivative (const FEValues<dim,spacedim>  &fe_values,
 }
 
 
-#if deal_II_dimension == 1
 
 template <>
 inline
@@ -143,9 +142,7 @@ derivative_norm (const Derivative &d)
   return std::fabs (d[0][0]);
 }
 
-#endif
 
-#if deal_II_dimension == 2
 
 template <>
 inline
@@ -166,15 +163,12 @@ derivative_norm (const Derivative &d)
   const double eigenvalues[2]
     = { 0.5*(d[0][0] + d[1][1] + std::sqrt(radicand)),
        0.5*(d[0][0] + d[1][1] - std::sqrt(radicand))  };
-  
+
   return std::max (std::fabs (eigenvalues[0]),
                   std::fabs (eigenvalues[1]));
 }
 
-#endif
-
 
-#if deal_II_dimension == 3
 
 template <>
 inline
@@ -186,7 +180,7 @@ derivative_norm (const Derivative &d)
   compute the three eigenvalues of the tensor @p{d} and take the
   largest. one could use the following maple script to generate C
   code:
-  
+
   with(linalg);
   readlib(C);
   A:=matrix(3,3,[[a00,a01,a02],[a01,a11,a12],[a02,a12,a22]]);
@@ -205,7 +199,7 @@ derivative_norm (const Derivative &d)
   augmented by a test for R>0, since R==0 indicates that all three
   eigenvalues are equal.)
 
-  
+
       PROGRAM MAIN
 
 C FIND EIGENVALUES OF REAL SYMMETRIC MATRIX
@@ -232,7 +226,7 @@ C DEFINE A TEST MATRIX
       A22 = -2.D0
       A23 = 0.5D0
       A33 = 4.D0
-      
+
 
       I1 = A11 + A22 + A33
       AM = I1/3.D0
@@ -279,7 +273,7 @@ C DEFINE A TEST MATRIX
       ENDIF
 
       THETA = (ACOS(XX))/3.D0
-      
+
       A1 = AM + R*COS(THETA)
       A2 = AM + R*COS(THETA + 2.D0*PI/3.D0)
       A3 = AM + R*COS(THETA + 4.D0*PI/3.D0)
@@ -288,7 +282,7 @@ C DEFINE A TEST MATRIX
 
       STOP
       END
-  
+
 */
 
   const double am = trace(d) / 3.;
@@ -297,7 +291,7 @@ C DEFINE A TEST MATRIX
   Tensor<2,3> s = d;
   for (unsigned int i=0; i<3; ++i)
     s[i][i] -= am;
-  
+
   const double ss01 = s[0][1] * s[0][1],
               ss12 = s[1][2] * s[1][2],
               ss02 = s[0][2] * s[0][2];
@@ -309,7 +303,7 @@ C DEFINE A TEST MATRIX
                     + 3. * s[1][1] * (ss01 + ss12)
                     + 3. * s[2][2] * (ss02 + ss12)
                     + 6. * s[0][1] * s[0][2] * s[1][2]) / 3.;
-  
+
   const double R  = std::sqrt (4. * J2 / 3.);
 
   double EE[3] = { 0, 0, 0 };
@@ -330,7 +324,7 @@ C DEFINE A TEST MATRIX
       const double YY = 1. - std::fabs(XX);
 
       Assert (YY > -1e-14, ExcInternalError());
-      
+
       if (YY < 0)
        {
                                           // two roots are equal
@@ -352,7 +346,6 @@ C DEFINE A TEST MATRIX
                             std::fabs (EE[2])));
 }
 
-#endif
 
 
 template <int dim>
@@ -420,7 +413,6 @@ get_projected_derivative (const FEValues<dim,spacedim>  &fe_values,
 }
 
 
-#if deal_II_dimension == 1
 
 template <>
 inline
@@ -431,7 +423,6 @@ derivative_norm (const Derivative &d)
   return std::fabs (d[0][0][0]);
 }
 
-#endif
 
 
 template <int dim>
@@ -499,13 +490,13 @@ DerivativeApproximation::ThirdDerivative<dim>::symmetrize (Derivative &d)
          = d[j][j][i]
          = t;
       };
-  
+
 }
 
 
 
 template <int dim, template <int, int> class DH, class InputVector, int spacedim>
-void 
+void
 DerivativeApproximation::
 approximate_gradient (const Mapping<dim,spacedim>    &mapping,
                      const DH<dim,spacedim>         &dof_handler,
@@ -522,7 +513,7 @@ approximate_gradient (const Mapping<dim,spacedim>    &mapping,
 
 
 template <int dim, template <int, int> class DH, class InputVector, int spacedim>
-void 
+void
 DerivativeApproximation::
 approximate_gradient (const DH<dim,spacedim>         &dof_handler,
                      const InputVector     &solution,
@@ -539,7 +530,7 @@ approximate_gradient (const DH<dim,spacedim>         &dof_handler,
 
 
 template <int dim, template <int, int> class DH, class InputVector, int spacedim>
-void 
+void
 DerivativeApproximation::
 approximate_second_derivative (const Mapping<dim,spacedim>    &mapping,
                               const DH<dim,spacedim>         &dof_handler,
@@ -556,7 +547,7 @@ approximate_second_derivative (const Mapping<dim,spacedim>    &mapping,
 
 
 template <int dim, template <int, int> class DH, class InputVector, int spacedim>
-void 
+void
 DerivativeApproximation::
 approximate_second_derivative (const DH<dim,spacedim>         &dof_handler,
                               const InputVector     &solution,
@@ -617,7 +608,7 @@ approximate_derivative_tensor (const DH<dim,spacedim>
 
 template <class DerivativeDescription, int dim,
           template <int, int> class DH, class InputVector, int spacedim>
-void 
+void
 DerivativeApproximation::
 approximate_derivative (const Mapping<dim,spacedim>    &mapping,
                        const DH<dim,spacedim>         &dof_handler,
@@ -646,8 +637,8 @@ approximate_derivative (const Mapping<dim,spacedim>    &mapping,
                   template approximate<DerivativeDescription,dim,
                   DH,InputVector>;
 
-//TODO: Use WorkStream here  
-  Threads::TaskGroup<> tasks;  
+//TODO: Use WorkStream here
+  Threads::TaskGroup<> tasks;
   for (unsigned int i=0; i<n_threads; ++i)
     tasks += Threads::new_task (fun_ptr,
                                mapping, dof_handler,
@@ -661,7 +652,7 @@ approximate_derivative (const Mapping<dim,spacedim>    &mapping,
 
 template <class DerivativeDescription, int dim,
           template <int, int> class DH, class InputVector, int spacedim>
-void 
+void
 DerivativeApproximation::approximate (const Mapping<dim,spacedim>    &mapping,
                                      const DH<dim,spacedim>         &dof_handler,
                                      const InputVector     &solution,
@@ -675,7 +666,7 @@ DerivativeApproximation::approximate (const Mapping<dim,spacedim>    &mapping,
   Vector<float>::iterator
     derivative_norm_on_this_cell
     = derivative_norm.begin() + index_interval.first;
-  
+
   typename DH<dim,spacedim>::active_cell_iterator cell, endc;
   cell = endc = dof_handler.begin_active();
                                   // (static_cast to avoid warnings
@@ -705,15 +696,15 @@ DerivativeApproximation::approximate (const Mapping<dim,spacedim>    &mapping,
 
 template <class DerivativeDescription, int dim,
           template <int, int> class DH, class InputVector, int spacedim>
-void 
+void
 DerivativeApproximation::
-approximate_cell (const Mapping<dim,spacedim>                            &mapping,
-                 const DH<dim,spacedim>                                 &dof_handler,
+approximate_cell (const Mapping<dim,spacedim>                   &mapping,
+                 const DH<dim,spacedim>                        &dof_handler,
                  const InputVector                             &solution,
                  const unsigned int                             component,
                  const typename DH<dim,spacedim>::active_cell_iterator  &cell,
-                 typename DerivativeDescription::Derivative    &derivative)    
-{ 
+                 typename DerivativeDescription::Derivative    &derivative)
+{
   QMidpoint<dim> midpoint_rule;
 
                                   // create collection objects from
@@ -726,15 +717,15 @@ approximate_cell (const Mapping<dim,spacedim>                            &mappin
   const hp::QCollection<dim>       q_collection (midpoint_rule);
   const hp::FECollection<dim>      fe_collection(dof_handler.get_fe());
   const hp::MappingCollection<dim> mapping_collection (mapping);
-  
+
   hp::FEValues<dim> x_fe_midpoint_value (mapping_collection, fe_collection,
                                         q_collection,
                                         DerivativeDescription::update_flags |
                                         update_quadrature_points);
-  
+
                                   // matrix Y=sum_i y_i y_i^T
   Tensor<2,dim> Y;
-  
+
 
                                   // vector to hold iterators to all
                                   // active neighbors of a cell
@@ -748,24 +739,24 @@ approximate_cell (const Mapping<dim,spacedim>                            &mappin
                                       // g=sum_i y_i (f(x+y_i)-f(x))/|y_i|
                                       // or related type for higher
                                       // derivatives
-      typename DerivativeDescription::Derivative projected_derivative;
+  typename DerivativeDescription::Derivative projected_derivative;
 
                                       // reinit fe values object...
-      x_fe_midpoint_value.reinit (cell);
-      const FEValues<dim> &fe_midpoint_value
-        = x_fe_midpoint_value.get_present_fe_values();
+  x_fe_midpoint_value.reinit (cell);
+  const FEValues<dim> &fe_midpoint_value
+    = x_fe_midpoint_value.get_present_fe_values();
 
                                       // ...and get the value of the
                                       // projected derivative...
-      const typename DerivativeDescription::ProjectedDerivative
-       this_midpoint_value
-       = DerivativeDescription::get_projected_derivative (fe_midpoint_value,
-                                                          solution,
-                                                          component);
+  const typename DerivativeDescription::ProjectedDerivative
+    this_midpoint_value
+    = DerivativeDescription::get_projected_derivative (fe_midpoint_value,
+                                                      solution,
+                                                      component);
                                       // ...and the place where it lives
-      const Point<dim> this_center = fe_midpoint_value.quadrature_point(0);
+  const Point<dim> this_center = fe_midpoint_value.quadrature_point(0);
+
 
-      
                                       // loop over all neighbors and
                                       // accumulate the difference
                                       // quotients from them. note
@@ -778,44 +769,44 @@ approximate_cell (const Mapping<dim,spacedim>                            &mappin
                                       // first collect all neighbor
                                       // cells in a vector, and then
                                       // collect the data from them
-      GridTools::template get_active_neighbors<DH<dim,spacedim> >(cell, active_neighbors);
-      
+  GridTools::template get_active_neighbors<DH<dim,spacedim> >(cell, active_neighbors);
+
                                       // now loop over all active
                                       // neighbors and collect the
                                       // data we need
-      typename std::vector<typename DH<dim,spacedim>::active_cell_iterator>::const_iterator
-       neighbor_ptr = active_neighbors.begin();
-      for (; neighbor_ptr!=active_neighbors.end(); ++neighbor_ptr)
-       {
-         const typename DH<dim,spacedim>::active_cell_iterator
-           neighbor = *neighbor_ptr;
-           
+  typename std::vector<typename DH<dim,spacedim>::active_cell_iterator>::const_iterator
+    neighbor_ptr = active_neighbors.begin();
+  for (; neighbor_ptr!=active_neighbors.end(); ++neighbor_ptr)
+    {
+      const typename DH<dim,spacedim>::active_cell_iterator
+       neighbor = *neighbor_ptr;
+
                                           // reinit fe values object...
-          x_fe_midpoint_value.reinit (neighbor);
-          const FEValues<dim> &fe_midpoint_value
-            = x_fe_midpoint_value.get_present_fe_values();
-         
+      x_fe_midpoint_value.reinit (neighbor);
+      const FEValues<dim> &fe_midpoint_value
+       = x_fe_midpoint_value.get_present_fe_values();
+
                                           // ...and get the value of the
                                           // solution...
-         const typename DerivativeDescription::ProjectedDerivative
-           neighbor_midpoint_value
-           = DerivativeDescription::get_projected_derivative (fe_midpoint_value,
+      const typename DerivativeDescription::ProjectedDerivative
+       neighbor_midpoint_value
+       = DerivativeDescription::get_projected_derivative (fe_midpoint_value,
                                                               solution, component);
-         
+
                                           // ...and the place where it lives
-         const Point<dim>
-           neighbor_center = fe_midpoint_value.quadrature_point(0);
-         
-         
+      const Point<dim>
+       neighbor_center = fe_midpoint_value.quadrature_point(0);
+
+
                                           // vector for the
                                           // normalized
                                           // direction between
                                           // the centers of two
                                           // cells
-         Point<dim>   y        = neighbor_center - this_center;
-         const double distance = std::sqrt(y.square());
+      Point<dim>   y        = neighbor_center - this_center;
+      const double distance = std::sqrt(y.square());
                                           // normalize y
-         y /= distance;
+      y /= distance;
                                           // *** note that unlike in
                                           // the docs, y denotes the
                                           // normalized vector
@@ -823,29 +814,29 @@ approximate_cell (const Mapping<dim,spacedim>                            &mappin
                                           // of the two cells, rather
                                           // than the normal
                                           // difference! ***
-         
+
                                           // add up the
                                           // contribution of
                                           // this cell to Y
-         for (unsigned int i=0; i<dim; ++i)
-           for (unsigned int j=0; j<dim; ++j)
-             Y[i][j] += y[i] * y[j];
-         
+      for (unsigned int i=0; i<dim; ++i)
+       for (unsigned int j=0; j<dim; ++j)
+         Y[i][j] += y[i] * y[j];
+
                                           // then update the sum
                                           // of difference
                                           // quotients
-         typename DerivativeDescription::ProjectedDerivative
-           projected_finite_difference
-           = (neighbor_midpoint_value -
-              this_midpoint_value);
-         projected_finite_difference /= distance;
-         
-         typename DerivativeDescription::Derivative projected_derivative_update;
-         outer_product (projected_derivative_update,
-                        y,
-                        projected_finite_difference);
-         projected_derivative += projected_derivative_update;
-       };
+      typename DerivativeDescription::ProjectedDerivative
+       projected_finite_difference
+       = (neighbor_midpoint_value -
+          this_midpoint_value);
+      projected_finite_difference /= distance;
+
+      typename DerivativeDescription::Derivative projected_derivative_update;
+      outer_product (projected_derivative_update,
+                    y,
+                    projected_finite_difference);
+      projected_derivative += projected_derivative_update;
+    };
 
                                       // can we determine an
                                       // approximation of the
@@ -856,16 +847,16 @@ approximate_cell (const Mapping<dim,spacedim>                            &mappin
                                       // otherwise we would not have
                                       // all components of the
                                       // gradient
-      AssertThrow (determinant(Y) != 0,
-                  ExcInsufficientDirections());
-      
+  AssertThrow (determinant(Y) != 0,
+              ExcInsufficientDirections());
+
                                        // compute Y^-1 g
-      const Tensor<2,dim> Y_inverse = invert(Y);
-      
-      contract (derivative, Y_inverse, projected_derivative);
-      
+  const Tensor<2,dim> Y_inverse = invert(Y);
+
+  contract (derivative, Y_inverse, projected_derivative);
+
                                       // finally symmetrize the derivative
-      DerivativeDescription::symmetrize (derivative);
+  DerivativeDescription::symmetrize (derivative);
 }
 
 
@@ -878,129 +869,9 @@ derivative_norm(const Tensor<order,dim> &derivative)
 }
 
 
-// --------------------------------------------------------------------
-
-// explicit instantiations
-#define INSTANTIATE(InputVector,DH)                      \
-template                                                 \
-void                                                     \
-DerivativeApproximation::                                \
-approximate_gradient<deal_II_dimension>                  \
-(const Mapping<deal_II_dimension> &mapping,              \
- const DH<deal_II_dimension> &dof_handler,               \
- const InputVector  &solution,                           \
- Vector<float>         &derivative_norm,                 \
- const unsigned int     component);                      \
-                                                         \
-template                                                 \
-void                                                     \
-DerivativeApproximation::                                \
-approximate_gradient<deal_II_dimension>                  \
-(const DH<deal_II_dimension> &dof_handler,               \
- const InputVector     &solution,                        \
- Vector<float>         &derivative_norm,                 \
- const unsigned int     component);                      \
-                                                         \
-template                                                 \
-void                                                     \
-DerivativeApproximation::                                \
-approximate_second_derivative<deal_II_dimension>         \
-(const Mapping<deal_II_dimension> &mapping,              \
- const DH<deal_II_dimension> &dof_handler,               \
- const InputVector  &solution,                           \
- Vector<float>         &derivative_norm,                 \
- const unsigned int     component);                      \
-                                                         \
-template                                                 \
-void                                                     \
-DerivativeApproximation::                                \
-approximate_second_derivative<deal_II_dimension>         \
-(const DH<deal_II_dimension> &dof_handler,               \
- const InputVector     &solution,                        \
- Vector<float>         &derivative_norm,                 \
- const unsigned int     component);                      \
-                                                         \
-template                                                 \
-void                                                     \
-DerivativeApproximation::                                \
-approximate_derivative_tensor<deal_II_dimension>         \
-(const DH<deal_II_dimension> &dof_handler,               \
- const InputVector     &solution,                        \
- const DH<deal_II_dimension>::active_cell_iterator &cell,\
- Tensor<1,deal_II_dimension> &derivative,                \
- const unsigned int     component);                      \
-                                                         \
-template                                                 \
-void                                                     \
-DerivativeApproximation::                                \
-approximate_derivative_tensor<deal_II_dimension>         \
-(const DH<deal_II_dimension> &dof_handler,               \
- const InputVector     &solution,                        \
- const DH<deal_II_dimension>::active_cell_iterator &cell,\
- Tensor<2,deal_II_dimension> &derivative,                \
- const unsigned int     component);                      \
-                                                         \
-template                                                 \
-void                                                     \
-DerivativeApproximation::                                \
-approximate_derivative_tensor<deal_II_dimension>         \
-(const DH<deal_II_dimension> &dof_handler,               \
- const InputVector     &solution,                        \
- const DH<deal_II_dimension>::active_cell_iterator &cell,\
- Tensor<3,deal_II_dimension> &derivative,                \
- const unsigned int     component)
-
-
-INSTANTIATE(Vector<double>, DoFHandler);
-INSTANTIATE(Vector<float>, DoFHandler);
-INSTANTIATE(BlockVector<double>, DoFHandler);
-INSTANTIATE(BlockVector<float>, DoFHandler);
-
-INSTANTIATE(Vector<double>, hp::DoFHandler);
-INSTANTIATE(Vector<float>, hp::DoFHandler);
-INSTANTIATE(BlockVector<double>, hp::DoFHandler);
-INSTANTIATE(BlockVector<float>, hp::DoFHandler);
-
-#ifdef DEAL_II_USE_PETSC
-INSTANTIATE(PETScWrappers::Vector, DoFHandler);
-INSTANTIATE(PETScWrappers::BlockVector, DoFHandler);
-
-INSTANTIATE(PETScWrappers::Vector, hp::DoFHandler);
-INSTANTIATE(PETScWrappers::BlockVector, hp::DoFHandler);
-#endif
-
-#undef INSTANTIATE
-
-template
-double
-DerivativeApproximation::
-derivative_norm(const Tensor<1,deal_II_dimension> &derivative);
-
-template
-double
-DerivativeApproximation::
-derivative_norm(const Tensor<2,deal_II_dimension> &derivative);
-
-template
-double
-DerivativeApproximation::
-derivative_norm(const Tensor<3,deal_II_dimension> &derivative);
 
+// --------------------------- explicit instantiations ---------------------
+#include "derivative_approximation.inst"
 
-// static variables
-// 
-// on AIX, the linker is unhappy about some missing symbols. they
-// should really be there, but explicitly instantiating them will also
-// not hurt
-template
-const UpdateFlags
-DerivativeApproximation::Gradient<deal_II_dimension>::update_flags;
-
-template
-const UpdateFlags
-DerivativeApproximation::SecondDerivative<deal_II_dimension>::update_flags;
-template
-const UpdateFlags
-DerivativeApproximation::ThirdDerivative<deal_II_dimension>::update_flags;
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/numerics/derivative_approximation.inst.in b/deal.II/source/numerics/derivative_approximation.inst.in
new file mode 100644 (file)
index 0000000..3723b4e
--- /dev/null
@@ -0,0 +1,137 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+#define INSTANTIATE(InputVector,DH)                      \
+template                                                 \
+void                                                     \
+DerivativeApproximation::                                \
+approximate_gradient<deal_II_dimension>                  \
+(const Mapping<deal_II_dimension> &mapping,              \
+ const DH<deal_II_dimension> &dof_handler,               \
+ const InputVector  &solution,                           \
+ Vector<float>         &derivative_norm,                 \
+ const unsigned int     component);                      \
+                                                         \
+template                                                 \
+void                                                     \
+DerivativeApproximation::                                \
+approximate_gradient<deal_II_dimension>                  \
+(const DH<deal_II_dimension> &dof_handler,               \
+ const InputVector     &solution,                        \
+ Vector<float>         &derivative_norm,                 \
+ const unsigned int     component);                      \
+                                                         \
+template                                                 \
+void                                                     \
+DerivativeApproximation::                                \
+approximate_second_derivative<deal_II_dimension>         \
+(const Mapping<deal_II_dimension> &mapping,              \
+ const DH<deal_II_dimension> &dof_handler,               \
+ const InputVector  &solution,                           \
+ Vector<float>         &derivative_norm,                 \
+ const unsigned int     component);                      \
+                                                         \
+template                                                 \
+void                                                     \
+DerivativeApproximation::                                \
+approximate_second_derivative<deal_II_dimension>         \
+(const DH<deal_II_dimension> &dof_handler,               \
+ const InputVector     &solution,                        \
+ Vector<float>         &derivative_norm,                 \
+ const unsigned int     component);                      \
+                                                         \
+template                                                 \
+void                                                     \
+DerivativeApproximation::                                \
+approximate_derivative_tensor<deal_II_dimension>         \
+(const DH<deal_II_dimension> &dof_handler,               \
+ const InputVector     &solution,                        \
+ const DH<deal_II_dimension>::active_cell_iterator &cell,\
+ Tensor<1,deal_II_dimension> &derivative,                \
+ const unsigned int     component);                      \
+                                                         \
+template                                                 \
+void                                                     \
+DerivativeApproximation::                                \
+approximate_derivative_tensor<deal_II_dimension>         \
+(const DH<deal_II_dimension> &dof_handler,               \
+ const InputVector     &solution,                        \
+ const DH<deal_II_dimension>::active_cell_iterator &cell,\
+ Tensor<2,deal_II_dimension> &derivative,                \
+ const unsigned int     component);                      \
+                                                         \
+template                                                 \
+void                                                     \
+DerivativeApproximation::                                \
+approximate_derivative_tensor<deal_II_dimension>         \
+(const DH<deal_II_dimension> &dof_handler,               \
+ const InputVector     &solution,                        \
+ const DH<deal_II_dimension>::active_cell_iterator &cell,\
+ Tensor<3,deal_II_dimension> &derivative,                \
+ const unsigned int     component)
+
+
+INSTANTIATE(Vector<double>, DoFHandler);
+INSTANTIATE(Vector<float>, DoFHandler);
+INSTANTIATE(BlockVector<double>, DoFHandler);
+INSTANTIATE(BlockVector<float>, DoFHandler);
+
+INSTANTIATE(Vector<double>, hp::DoFHandler);
+INSTANTIATE(Vector<float>, hp::DoFHandler);
+INSTANTIATE(BlockVector<double>, hp::DoFHandler);
+INSTANTIATE(BlockVector<float>, hp::DoFHandler);
+
+#ifdef DEAL_II_USE_PETSC
+INSTANTIATE(PETScWrappers::Vector, DoFHandler);
+INSTANTIATE(PETScWrappers::BlockVector, DoFHandler);
+
+INSTANTIATE(PETScWrappers::Vector, hp::DoFHandler);
+INSTANTIATE(PETScWrappers::BlockVector, hp::DoFHandler);
+#endif
+
+#undef INSTANTIATE
+
+template
+double
+DerivativeApproximation::
+derivative_norm(const Tensor<1,deal_II_dimension> &derivative);
+
+template
+double
+DerivativeApproximation::
+derivative_norm(const Tensor<2,deal_II_dimension> &derivative);
+
+template
+double
+DerivativeApproximation::
+derivative_norm(const Tensor<3,deal_II_dimension> &derivative);
+
+
+// static variables
+// 
+// on AIX, the linker is unhappy about some missing symbols. they
+// should really be there, but explicitly instantiating them will also
+// not hurt
+template
+const UpdateFlags
+DerivativeApproximation::Gradient<deal_II_dimension>::update_flags;
+
+template
+const UpdateFlags
+DerivativeApproximation::SecondDerivative<deal_II_dimension>::update_flags;
+template
+const UpdateFlags
+DerivativeApproximation::ThirdDerivative<deal_II_dimension>::update_flags;
+}
index 55106b8c3a28bd80be50a68fd147b085608e36f9..16bce12dd56dd0fbb1c73d25d6b3d3b97ffe491b 100644 (file)
@@ -1001,7 +1001,6 @@ namespace internal
 
 
 
-#if deal_II_dimension == 1
 
 
 template <int spacedim>
@@ -1425,7 +1424,6 @@ estimate (const Mapping<1,spacedim>                    &mapping,
 }
 
 
-#else // #if deal_II_dimension !=1
 
 
 
@@ -1770,120 +1768,11 @@ void KellyErrorEstimator<dim, spacedim>::estimate (const DH
 
 
 
-#endif
 
 
 
 // explicit instantiations
-#if deal_II_dimension != 1
-template class KellyErrorEstimator<deal_II_dimension, deal_II_dimension>;
-#endif
-
-// instantiate the externally visible functions. define a list of functions
-// for vectors, where the vector/matrix can be replaced using a preprocessor
-// variable VectorType/MatrixType
-#define INSTANTIATE_1(InputVector,DH,Q) \
-template    \
-void    \
-KellyErrorEstimator<deal_II_dimension, deal_II_dimension>::    \
-estimate<InputVector,DH > (const Mapping<deal_II_dimension, deal_II_dimension>      &,    \
-          const DH   &,    \
-          const Q<deal_II_dimension-1> &,    \
-          const FunctionMap<deal_II_dimension>::type &,    \
-          const InputVector       &,    \
-          Vector<float>           &,    \
-          const std::vector<bool> &,    \
-          const Function<deal_II_dimension>     *,    \
-          const unsigned int       , \
-          const unsigned int       , \
-          const unsigned int);    \
-    \
-template    \
-void    \
-KellyErrorEstimator<deal_II_dimension, deal_II_dimension>::    \
-estimate<InputVector,DH > (const DH   &,    \
-          const Q<deal_II_dimension-1> &,    \
-          const FunctionMap<deal_II_dimension>::type &,    \
-          const InputVector       &,    \
-          Vector<float>           &,    \
-          const std::vector<bool> &,    \
-          const Function<deal_II_dimension>     *,    \
-          const unsigned int       , \
-          const unsigned int       , \
-          const unsigned int);    \
-        \
-template    \
-void    \
-KellyErrorEstimator<deal_II_dimension, deal_II_dimension>::    \
-estimate<InputVector,DH > (const Mapping<deal_II_dimension, deal_II_dimension>          &,    \
-          const DH       &,    \
-          const Q<deal_II_dimension-1>     &,    \
-          const FunctionMap<deal_II_dimension>::type &,    \
-          const std::vector<const InputVector *> &,    \
-          std::vector<Vector<float>*> &,    \
-          const std::vector<bool>     &,    \
-          const Function<deal_II_dimension>         *,    \
-          const unsigned int           , \
-          const unsigned int           , \
-          const unsigned int);    \
-    \
-template    \
-void    \
-KellyErrorEstimator<deal_II_dimension, deal_II_dimension>::    \
-estimate<InputVector,DH > (const DH       &,    \
-          const Q<deal_II_dimension-1>     &,    \
-          const FunctionMap<deal_II_dimension>::type &,    \
-          const std::vector<const InputVector *> &,    \
-          std::vector<Vector<float>*> &,    \
-          const std::vector<bool>     &,    \
-          const Function<deal_II_dimension>         *,    \
-          const unsigned int           , \
-          const unsigned int           , \
-          const unsigned int)
-
-#define INSTANTIATE(InputVector,DH) \
-     INSTANTIATE_1(InputVector,DH,Quadrature); \
-     INSTANTIATE_1(InputVector,DH,hp::QCollection)
-
-
-INSTANTIATE(Vector<double>,DoFHandler<deal_II_dimension>);
-INSTANTIATE(Vector<float>,DoFHandler<deal_II_dimension>);
-INSTANTIATE(BlockVector<double>,DoFHandler<deal_II_dimension>);
-INSTANTIATE(BlockVector<float>,DoFHandler<deal_II_dimension>);
-
-INSTANTIATE(Vector<double>,hp::DoFHandler<deal_II_dimension>);
-INSTANTIATE(Vector<float>,hp::DoFHandler<deal_II_dimension>);
-INSTANTIATE(BlockVector<double>,hp::DoFHandler<deal_II_dimension>);
-INSTANTIATE(BlockVector<float>,hp::DoFHandler<deal_II_dimension>);
-
-#ifdef DEAL_II_USE_PETSC
-INSTANTIATE(PETScWrappers::Vector,DoFHandler<deal_II_dimension>);
-INSTANTIATE(PETScWrappers::BlockVector,DoFHandler<deal_II_dimension>);
-
-INSTANTIATE(PETScWrappers::Vector,hp::DoFHandler<deal_II_dimension>);
-INSTANTIATE(PETScWrappers::BlockVector,hp::DoFHandler<deal_II_dimension>);
-
-INSTANTIATE(PETScWrappers::MPI::Vector,DoFHandler<deal_II_dimension>);
-INSTANTIATE(PETScWrappers::MPI::BlockVector,DoFHandler<deal_II_dimension>);
-
-#endif
-
-#ifdef DEAL_II_USE_TRILINOS
-INSTANTIATE(TrilinosWrappers::Vector,DoFHandler<deal_II_dimension>);
-INSTANTIATE(TrilinosWrappers::BlockVector,DoFHandler<deal_II_dimension>);
-
-INSTANTIATE(TrilinosWrappers::Vector,hp::DoFHandler<deal_II_dimension>);
-INSTANTIATE(TrilinosWrappers::BlockVector,hp::DoFHandler<deal_II_dimension>);
-
-INSTANTIATE(TrilinosWrappers::MPI::Vector,DoFHandler<deal_II_dimension>);
-INSTANTIATE(TrilinosWrappers::MPI::BlockVector,DoFHandler<deal_II_dimension>);
-
-INSTANTIATE(TrilinosWrappers::MPI::Vector,hp::DoFHandler<deal_II_dimension>);
-INSTANTIATE(TrilinosWrappers::MPI::BlockVector,hp::DoFHandler<deal_II_dimension>);
-#endif
-
-#undef INSTANTIATE
-#undef INSTANTIATE_1
+#include "error_estimator.inst"
 
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/numerics/error_estimator.inst.in b/deal.II/source/numerics/error_estimator.inst.in
new file mode 100644 (file)
index 0000000..2400e5e
--- /dev/null
@@ -0,0 +1,125 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+#if deal_II_dimension != 1
+template class KellyErrorEstimator<deal_II_dimension, deal_II_dimension>;
+#endif
+
+// instantiate the externally visible functions. define a list of functions
+// for vectors, where the vector/matrix can be replaced using a preprocessor
+// variable VectorType/MatrixType
+#define INSTANTIATE_1(InputVector,DH,Q) \
+template    \
+void    \
+KellyErrorEstimator<deal_II_dimension, deal_II_dimension>::    \
+estimate<InputVector,DH > (const Mapping<deal_II_dimension, deal_II_dimension>      &,    \
+          const DH   &,    \
+          const Q<deal_II_dimension-1> &,    \
+          const FunctionMap<deal_II_dimension>::type &,    \
+          const InputVector       &,    \
+          Vector<float>           &,    \
+          const std::vector<bool> &,    \
+          const Function<deal_II_dimension>     *,    \
+          const unsigned int       , \
+          const unsigned int       , \
+          const unsigned int);    \
+    \
+template    \
+void    \
+KellyErrorEstimator<deal_II_dimension, deal_II_dimension>::    \
+estimate<InputVector,DH > (const DH   &,    \
+          const Q<deal_II_dimension-1> &,    \
+          const FunctionMap<deal_II_dimension>::type &,    \
+          const InputVector       &,    \
+          Vector<float>           &,    \
+          const std::vector<bool> &,    \
+          const Function<deal_II_dimension>     *,    \
+          const unsigned int       , \
+          const unsigned int       , \
+          const unsigned int);    \
+        \
+template    \
+void    \
+KellyErrorEstimator<deal_II_dimension, deal_II_dimension>::    \
+estimate<InputVector,DH > (const Mapping<deal_II_dimension, deal_II_dimension>          &,    \
+          const DH       &,    \
+          const Q<deal_II_dimension-1>     &,    \
+          const FunctionMap<deal_II_dimension>::type &,    \
+          const std::vector<const InputVector *> &,    \
+          std::vector<Vector<float>*> &,    \
+          const std::vector<bool>     &,    \
+          const Function<deal_II_dimension>         *,    \
+          const unsigned int           , \
+          const unsigned int           , \
+          const unsigned int);    \
+    \
+template    \
+void    \
+KellyErrorEstimator<deal_II_dimension, deal_II_dimension>::    \
+estimate<InputVector,DH > (const DH       &,    \
+          const Q<deal_II_dimension-1>     &,    \
+          const FunctionMap<deal_II_dimension>::type &,    \
+          const std::vector<const InputVector *> &,    \
+          std::vector<Vector<float>*> &,    \
+          const std::vector<bool>     &,    \
+          const Function<deal_II_dimension>         *,    \
+          const unsigned int           , \
+          const unsigned int           , \
+          const unsigned int)
+
+#define INSTANTIATE(InputVector,DH) \
+     INSTANTIATE_1(InputVector,DH,Quadrature); \
+     INSTANTIATE_1(InputVector,DH,hp::QCollection)
+
+
+INSTANTIATE(Vector<double>,DoFHandler<deal_II_dimension>);
+INSTANTIATE(Vector<float>,DoFHandler<deal_II_dimension>);
+INSTANTIATE(BlockVector<double>,DoFHandler<deal_II_dimension>);
+INSTANTIATE(BlockVector<float>,DoFHandler<deal_II_dimension>);
+
+INSTANTIATE(Vector<double>,hp::DoFHandler<deal_II_dimension>);
+INSTANTIATE(Vector<float>,hp::DoFHandler<deal_II_dimension>);
+INSTANTIATE(BlockVector<double>,hp::DoFHandler<deal_II_dimension>);
+INSTANTIATE(BlockVector<float>,hp::DoFHandler<deal_II_dimension>);
+
+#ifdef DEAL_II_USE_PETSC
+INSTANTIATE(PETScWrappers::Vector,DoFHandler<deal_II_dimension>);
+INSTANTIATE(PETScWrappers::BlockVector,DoFHandler<deal_II_dimension>);
+
+INSTANTIATE(PETScWrappers::Vector,hp::DoFHandler<deal_II_dimension>);
+INSTANTIATE(PETScWrappers::BlockVector,hp::DoFHandler<deal_II_dimension>);
+
+INSTANTIATE(PETScWrappers::MPI::Vector,DoFHandler<deal_II_dimension>);
+INSTANTIATE(PETScWrappers::MPI::BlockVector,DoFHandler<deal_II_dimension>);
+
+#endif
+
+#ifdef DEAL_II_USE_TRILINOS
+INSTANTIATE(TrilinosWrappers::Vector,DoFHandler<deal_II_dimension>);
+INSTANTIATE(TrilinosWrappers::BlockVector,DoFHandler<deal_II_dimension>);
+
+INSTANTIATE(TrilinosWrappers::Vector,hp::DoFHandler<deal_II_dimension>);
+INSTANTIATE(TrilinosWrappers::BlockVector,hp::DoFHandler<deal_II_dimension>);
+
+INSTANTIATE(TrilinosWrappers::MPI::Vector,DoFHandler<deal_II_dimension>);
+INSTANTIATE(TrilinosWrappers::MPI::BlockVector,DoFHandler<deal_II_dimension>);
+
+INSTANTIATE(TrilinosWrappers::MPI::Vector,hp::DoFHandler<deal_II_dimension>);
+INSTANTIATE(TrilinosWrappers::MPI::BlockVector,hp::DoFHandler<deal_II_dimension>);
+#endif
+
+#undef INSTANTIATE
+#undef INSTANTIATE_1
+}
index 54a65c46a79b1fb94f603b38cfb7361b32de93c7..7e51bae6b8da0940d07bf4174178498a109505c0 100644 (file)
@@ -11,7 +11,7 @@
 //---------------------------------------------------------------------------
 
 
-for (VECTOR : SERIAL_VECTORS)
+for (VECTOR : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS)
 {
   template class FEFieldFunction<deal_II_dimension, 
                                 DoFHandler<deal_II_dimension>, 
diff --git a/deal.II/source/numerics/matrices.all_dimensions.cc b/deal.II/source/numerics/matrices.all_dimensions.cc
deleted file mode 100644 (file)
index 910c814..0000000
+++ /dev/null
@@ -1,1179 +0,0 @@
-//---------------------------------------------------------------------------
-//    $Id$
-//    Version: $Name$
-//
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors
-//
-//    This file is subject to QPL and may not be  distributed
-//    without copyright and license information. Please refer
-//    to the file deal.II/doc/license.html for the  text  and
-//    further information on this license.
-//
-//---------------------------------------------------------------------------
-
-
-#include <numerics/matrices.h>
-#include <lac/full_matrix.h>
-#include <lac/vector.h>
-#include <lac/block_vector.h>
-#include <lac/sparse_matrix.h>
-#include <lac/block_sparse_matrix.h>
-
-#ifdef DEAL_II_USE_PETSC
-#  include <lac/petsc_parallel_sparse_matrix.h>
-#  include <lac/petsc_sparse_matrix.h>
-#  include <lac/petsc_parallel_vector.h>
-#  include <lac/petsc_vector.h>
-#  include <lac/petsc_parallel_block_sparse_matrix.h>
-#endif
-
-#ifdef DEAL_II_USE_TRILINOS
-#  include <lac/trilinos_sparse_matrix.h>
-#  include <lac/trilinos_vector.h>
-#  include <lac/trilinos_block_sparse_matrix.h>
-#  include <lac/trilinos_block_vector.h>
-#endif
-
-#include <algorithm>
-
-DEAL_II_NAMESPACE_OPEN
-
-
-//TODO:[WB] I don't think that the optimized storage of diagonals is needed (GK)
-template <typename number>
-void
-MatrixTools::apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                                   SparseMatrix<number>  &matrix,
-                                   Vector<number>   &solution,
-                                   Vector<number>   &right_hand_side,
-                                   const bool        eliminate_columns)
-{
-                                  // Require that diagonals are first
-                                  // in each row
-  Assert (matrix.get_sparsity_pattern().optimize_diagonal(),
-         typename SparsityPattern::ExcDiagonalNotOptimized());
-  Assert (matrix.n() == right_hand_side.size(),
-         ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
-  Assert (matrix.n() == solution.size(),
-         ExcDimensionMismatch(matrix.n(), solution.size()));
-                                  // if no boundary values are to be applied
-                                  // simply return
-  if (boundary_values.size() == 0)
-    return;
-
-
-  const unsigned int n_dofs = matrix.m();
-
-                                  // if a diagonal entry is zero
-                                  // later, then we use another
-                                  // number instead. take it to be
-                                  // the first nonzero diagonal
-                                  // element of the matrix, or 1 if
-                                  // there is no such thing
-  number first_nonzero_diagonal_entry = 1;
-  for (unsigned int i=0; i<n_dofs; ++i)
-    if (matrix.diag_element(i) != 0)
-      {
-       first_nonzero_diagonal_entry = matrix.diag_element(i);
-       break;
-      }
-
-  
-  std::map<unsigned int,double>::const_iterator dof  = boundary_values.begin(),
-                                               endd = boundary_values.end();
-  const SparsityPattern    &sparsity    = matrix.get_sparsity_pattern();
-  const std::size_t  *sparsity_rowstart = sparsity.get_rowstart_indices();
-  const unsigned int *sparsity_colnums  = sparsity.get_column_numbers();
-  for (; dof != endd; ++dof)
-    {
-      Assert (dof->first < n_dofs, ExcInternalError());
-      
-      const unsigned int dof_number = dof->first;
-                                      // for each boundary dof:
-      
-                                      // set entries of this line
-                                      // to zero except for the diagonal
-                                      // entry. Note that the diagonal
-                                      // entry is always the first one
-                                      // for square matrices, i.e.
-                                      // we shall not set
-                                      // matrix.global_entry(
-                                      //     sparsity_rowstart[dof.first])
-      const unsigned int last = sparsity_rowstart[dof_number+1];
-      for (unsigned int j=sparsity_rowstart[dof_number]+1; j<last; ++j)
-       matrix.global_entry(j) = 0.;
-
-
-                                      // set right hand side to
-                                      // wanted value: if main diagonal
-                                      // entry nonzero, don't touch it
-                                      // and scale rhs accordingly. If
-                                      // zero, take the first main
-                                      // diagonal entry we can find, or
-                                      // one if no nonzero main diagonal
-                                      // element exists. Normally, however,
-                                      // the main diagonal entry should
-                                      // not be zero.
-                                      //
-                                      // store the new rhs entry to make
-                                      // the gauss step more efficient
-      number new_rhs;
-      if (matrix.diag_element(dof_number) != 0.0)
-        {
-          new_rhs = dof->second * matrix.diag_element(dof_number);
-          right_hand_side(dof_number) = new_rhs;
-        }
-      else
-       {
-         matrix.set (dof_number, dof_number,
-                      first_nonzero_diagonal_entry);
-         new_rhs = dof->second * first_nonzero_diagonal_entry;
-          right_hand_side(dof_number) = new_rhs;
-       }
-
-
-                                      // if the user wants to have
-                                      // the symmetry of the matrix
-                                      // preserved, and if the
-                                      // sparsity pattern is
-                                      // symmetric, then do a Gauss
-                                      // elimination step with the
-                                      // present row
-      if (eliminate_columns)
-       {
-                                          // store the only nonzero entry
-                                          // of this line for the Gauss
-                                          // elimination step
-         const number diagonal_entry = matrix.diag_element(dof_number);
-         
-                                          // we have to loop over all
-                                          // rows of the matrix which
-                                          // have a nonzero entry in
-                                          // the column which we work
-                                          // in presently. if the
-                                          // sparsity pattern is
-                                          // symmetric, then we can
-                                          // get the positions of
-                                          // these rows cheaply by
-                                          // looking at the nonzero
-                                          // column numbers of the
-                                          // present row. we need not
-                                          // look at the first entry,
-                                          // since that is the
-                                          // diagonal element and
-                                          // thus the present row
-         for (unsigned int j=sparsity_rowstart[dof_number]+1; j<last; ++j)
-           {
-             const unsigned int row = sparsity_colnums[j];
-
-                                              // find the position of
-                                              // element
-                                              // (row,dof_number)
-             const unsigned int *
-               p = std::lower_bound(&sparsity_colnums[sparsity_rowstart[row]+1],
-                                    &sparsity_colnums[sparsity_rowstart[row+1]],
-                                    dof_number);
-
-                                              // check whether this line has
-                                              // an entry in the regarding column
-                                              // (check for ==dof_number and
-                                              // != next_row, since if
-                                              // row==dof_number-1, *p is a
-                                              // past-the-end pointer but points
-                                              // to dof_number anyway...)
-                                              //
-                                              // there should be such an entry!
-             Assert ((*p == dof_number) &&
-                     (p != &sparsity_colnums[sparsity_rowstart[row+1]]),
-                     ExcInternalError());
-
-             const unsigned int global_entry
-               = (p - &sparsity_colnums[sparsity_rowstart[0]]);
-             
-                                              // correct right hand side
-             right_hand_side(row) -= matrix.global_entry(global_entry) /
-                                     diagonal_entry * new_rhs;
-             
-                                              // set matrix entry to zero
-             matrix.global_entry(global_entry) = 0.;
-           }
-       }
-
-                                      // preset solution vector
-      solution(dof_number) = dof->second;
-    }
-}
-
-
-
-template <typename number>
-void
-MatrixTools::apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                                   BlockSparseMatrix<number>  &matrix,
-                                   BlockVector<number>   &solution,
-                                   BlockVector<number>   &right_hand_side,
-                                   const bool             eliminate_columns)
-{
-  const unsigned int blocks = matrix.n_block_rows();
-  
-  Assert (matrix.n() == right_hand_side.size(),
-         ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
-  Assert (matrix.n() == solution.size(),
-         ExcDimensionMismatch(matrix.n(), solution.size()));
-  Assert (matrix.n_block_rows() == matrix.n_block_cols(),
-         ExcNotQuadratic());
-  Assert (matrix.get_sparsity_pattern().get_row_indices() == 
-         matrix.get_sparsity_pattern().get_column_indices(),
-         ExcNotQuadratic());
-  Assert (matrix.get_sparsity_pattern().get_column_indices() ==
-         solution.get_block_indices (),
-         ExcBlocksDontMatch ());
-  Assert (matrix.get_sparsity_pattern().get_row_indices() ==
-         right_hand_side.get_block_indices (),
-         ExcBlocksDontMatch ());
-
-  for (unsigned int i=0; i<blocks; ++i)
-    Assert (matrix.block(i,i).get_sparsity_pattern().optimize_diagonal(),
-           SparsityPattern::ExcDiagonalNotOptimized());
-
-  
-                                  // if no boundary values are to be applied
-                                  // simply return
-  if (boundary_values.size() == 0)
-    return;
-
-
-  const unsigned int n_dofs = matrix.m();
-
-                                  // if a diagonal entry is zero
-                                  // later, then we use another
-                                  // number instead. take it to be
-                                  // the first nonzero diagonal
-                                  // element of the matrix, or 1 if
-                                  // there is no such thing
-  number first_nonzero_diagonal_entry = 0;
-  for (unsigned int diag_block=0; diag_block<blocks; ++diag_block)
-    {
-      for (unsigned int i=0; i<matrix.block(diag_block,diag_block).n(); ++i)
-       if (matrix.block(diag_block,diag_block).diag_element(i) != 0)
-         {
-           first_nonzero_diagonal_entry 
-             = matrix.block(diag_block,diag_block).diag_element(i);
-           break;
-         }
-                                      // check whether we have found
-                                      // something in the present
-                                      // block
-      if (first_nonzero_diagonal_entry != 0)
-       break;
-    }
-                                  // nothing found on all diagonal
-                                  // blocks? if so, use 1.0 instead
-  if (first_nonzero_diagonal_entry == 0)
-    first_nonzero_diagonal_entry = 1;
-  
-
-  std::map<unsigned int,double>::const_iterator dof  = boundary_values.begin(),
-                                               endd = boundary_values.end();
-  const BlockSparsityPattern &
-    sparsity_pattern = matrix.get_sparsity_pattern();
-  
-                                  // pointer to the mapping between
-                                  // global and block indices. since
-                                  // the row and column mappings are
-                                  // equal, store a pointer on only
-                                  // one of them
-  const BlockIndices &
-    index_mapping = sparsity_pattern.get_column_indices();
-  
-                                  // now loop over all boundary dofs
-  for (; dof != endd; ++dof)
-    {
-      Assert (dof->first < n_dofs, ExcInternalError());
-
-                                      // get global index and index
-                                      // in the block in which this
-                                      // dof is located
-      const unsigned int dof_number = dof->first;
-      const std::pair<unsigned int,unsigned int>
-       block_index = index_mapping.global_to_local (dof_number);
-
-                                      // for each boundary dof:
-      
-                                      // set entries of this line
-                                      // to zero except for the diagonal
-                                      // entry. Note that the diagonal
-                                      // entry is always the first one
-                                      // for square matrices, i.e.
-                                      // we shall not set
-                                      // matrix.global_entry(
-                                      //     sparsity_rowstart[dof.first])
-                                      // of the diagonal block
-      for (unsigned int block_col=0; block_col<blocks; ++block_col)
-       {
-         const SparsityPattern &
-           local_sparsity = sparsity_pattern.block(block_index.first,
-                                                   block_col);
-
-                                          // find first and last
-                                          // entry in the present row
-                                          // of the present
-                                          // block. exclude the main
-                                          // diagonal element, which
-                                          // is the diagonal element
-                                          // of a diagonal block,
-                                          // which must be a square
-                                          // matrix so the diagonal
-                                          // element is the first of
-                                          // this row.
-         const unsigned int 
-           last  = local_sparsity.get_rowstart_indices()[block_index.second+1],
-           first = (block_col == block_index.first ?
-                    local_sparsity.get_rowstart_indices()[block_index.second]+1 :
-                    local_sparsity.get_rowstart_indices()[block_index.second]);
-         
-         for (unsigned int j=first; j<last; ++j)
-           matrix.block(block_index.first,block_col).global_entry(j) = 0.;
-       }
-      
-
-                                      // set right hand side to
-                                      // wanted value: if main diagonal
-                                      // entry nonzero, don't touch it
-                                      // and scale rhs accordingly. If
-                                      // zero, take the first main
-                                      // diagonal entry we can find, or
-                                      // one if no nonzero main diagonal
-                                      // element exists. Normally, however,
-                                      // the main diagonal entry should
-                                      // not be zero.
-                                      //
-                                      // store the new rhs entry to make
-                                      // the gauss step more efficient
-      number new_rhs;
-      if (matrix.block(block_index.first, block_index.first)
-         .diag_element(block_index.second) != 0.0)
-       new_rhs = dof->second * 
-                 matrix.block(block_index.first, block_index.first)
-                 .diag_element(block_index.second);
-      else
-       {
-         matrix.block(block_index.first, block_index.first)
-           .diag_element(block_index.second)
-           = first_nonzero_diagonal_entry;
-         new_rhs = dof->second * first_nonzero_diagonal_entry;
-       }
-      right_hand_side.block(block_index.first)(block_index.second)
-       = new_rhs;
-
-
-                                      // if the user wants to have
-                                      // the symmetry of the matrix
-                                      // preserved, and if the
-                                      // sparsity pattern is
-                                      // symmetric, then do a Gauss
-                                      // elimination step with the
-                                      // present row. this is a
-                                      // little more complicated for
-                                      // block matrices.
-      if (eliminate_columns)
-       {
-                                          // store the only nonzero entry
-                                          // of this line for the Gauss
-                                          // elimination step
-         const number diagonal_entry 
-           = matrix.block(block_index.first,block_index.first)
-           .diag_element(block_index.second);
-         
-                                          // we have to loop over all
-                                          // rows of the matrix which
-                                          // have a nonzero entry in
-                                          // the column which we work
-                                          // in presently. if the
-                                          // sparsity pattern is
-                                          // symmetric, then we can
-                                          // get the positions of
-                                          // these rows cheaply by
-                                          // looking at the nonzero
-                                          // column numbers of the
-                                          // present row.
-                                          //
-                                          // note that if we check
-                                          // whether row @p{row} in
-                                          // block (r,c) is non-zero,
-                                          // then we have to check
-                                          // for the existence of
-                                          // column @p{row} in block
-                                          // (c,r), i.e. of the
-                                          // transpose block
-         for (unsigned int block_row=0; block_row<blocks; ++block_row)
-           {
-                                              // get pointers to the
-                                              // sparsity patterns of
-                                              // this block and of
-                                              // the transpose one
-             const SparsityPattern &this_sparsity
-               = sparsity_pattern.block (block_row, block_index.first);
-             const SparsityPattern &transpose_sparsity
-               = sparsity_pattern.block (block_index.first, block_row);
-             
-                                              // traverse the row of
-                                              // the transpose block
-                                              // to find the
-                                              // interesting rows in
-                                              // the present block.
-                                              // don't use the
-                                              // diagonal element of
-                                              // the diagonal block
-             const unsigned int
-               first = (block_index.first == block_row ?
-                        transpose_sparsity.get_rowstart_indices()[block_index.second]+1 :
-                        transpose_sparsity.get_rowstart_indices()[block_index.second]),
-               last  = transpose_sparsity.get_rowstart_indices()[block_index.second+1];
-             
-             for (unsigned int j=first; j<last; ++j)
-               {
-                                                  // get the number
-                                                  // of the column in
-                                                  // this row in
-                                                  // which a nonzero
-                                                  // entry is. this
-                                                  // is also the row
-                                                  // of the transpose
-                                                  // block which has
-                                                  // an entry in the
-                                                  // interesting row
-                 const unsigned int row = transpose_sparsity.get_column_numbers()[j];
-
-                                                  // find the
-                                                  // position of
-                                                  // element
-                                                  // (row,dof_number)
-                                                  // in this block
-                                                  // (not in the
-                                                  // transpose
-                                                  // one). note that
-                                                  // we have to take
-                                                  // care of special
-                                                  // cases with
-                                                  // square
-                                                  // sub-matrices
-                 const unsigned int *p = 0;
-                 if (this_sparsity.n_rows() == this_sparsity.n_cols())
-                   {
-                     if (this_sparsity.get_column_numbers()
-                         [this_sparsity.get_rowstart_indices()[row]]
-                         ==
-                         block_index.second)
-                       p = &this_sparsity.get_column_numbers()
-                           [this_sparsity.get_rowstart_indices()[row]];
-                     else
-                       p = std::lower_bound(&this_sparsity.get_column_numbers()
-                                            [this_sparsity.get_rowstart_indices()[row]+1],
-                                            &this_sparsity.get_column_numbers()
-                                            [this_sparsity.get_rowstart_indices()[row+1]],
-                                            block_index.second);
-                   }
-                 else
-                   p = std::lower_bound(&this_sparsity.get_column_numbers()
-                                        [this_sparsity.get_rowstart_indices()[row]],
-                                        &this_sparsity.get_column_numbers()
-                                        [this_sparsity.get_rowstart_indices()[row+1]],
-                                        block_index.second);
-
-                                                  // check whether this line has
-                                                  // an entry in the regarding column
-                                                  // (check for ==dof_number and
-                                                  // != next_row, since if
-                                                  // row==dof_number-1, *p is a
-                                                  // past-the-end pointer but points
-                                                  // to dof_number anyway...)
-                                                  //
-                                                  // there should be
-                                                  // such an entry!
-                                                  // note, however,
-                                                  // that this
-                                                  // assertion will
-                                                  // fail sometimes
-                                                  // if the sparsity
-                                                  // pattern is not
-                                                  // symmetric!
-                 Assert ((*p == block_index.second) &&
-                         (p != &this_sparsity.get_column_numbers()
-                          [this_sparsity.get_rowstart_indices()[row+1]]),
-                         ExcInternalError());
-                 
-                 const unsigned int global_entry
-                   = (p
-                      -
-                      &this_sparsity.get_column_numbers()
-                      [this_sparsity.get_rowstart_indices()[0]]);
-
-                                                  // correct right hand side
-                 right_hand_side.block(block_row)(row)
-                   -= matrix.block(block_row,block_index.first).global_entry(global_entry) /
-                   diagonal_entry * new_rhs;
-                 
-                                                  // set matrix entry to zero
-                 matrix.block(block_row,block_index.first).global_entry(global_entry) = 0.;
-               }
-           }
-       }
-
-                                      // preset solution vector
-      solution.block(block_index.first)(block_index.second) = dof->second;
-    }
-}
-
-
-
-#ifdef DEAL_II_USE_PETSC
-
-namespace PETScWrappers
-{
-  template <typename PETScMatrix, typename PETScVector>
-  void
-  apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                         PETScMatrix      &matrix,
-                         PETScVector      &solution,
-                         PETScVector      &right_hand_side,
-                         const bool        eliminate_columns)
-  {
-    Assert (eliminate_columns == false, ExcNotImplemented());
-
-    Assert (matrix.n() == right_hand_side.size(),
-            ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
-    Assert (matrix.n() == solution.size(),
-            ExcDimensionMismatch(matrix.n(), solution.size()));
-
-                                     // if no boundary values are to be applied
-                                     // simply return
-    if (boundary_values.size() == 0)
-      return;
-
-    const std::pair<unsigned int, unsigned int> local_range
-      = matrix.local_range();
-    Assert (local_range == right_hand_side.local_range(),
-            ExcInternalError());
-    Assert (local_range == solution.local_range(),
-            ExcInternalError());
-    
-
-                                     // we have to read and write from this
-                                     // matrix (in this order). this will only
-                                     // work if we compress the matrix first,
-                                     // done here
-    matrix.compress ();
-
-                                     // determine the first nonzero diagonal
-                                     // entry from within the part of the
-                                     // matrix that we can see. if we can't
-                                     // find such an entry, take one
-    PetscScalar average_nonzero_diagonal_entry = 1;
-    for (unsigned int i=local_range.first; i<local_range.second; ++i)
-      if (matrix.diag_element(i) != 0)
-        {
-          average_nonzero_diagonal_entry = std::fabs(matrix.diag_element(i));
-          break;
-        }
-
-                                     // figure out which rows of the matrix we
-                                     // have to eliminate on this processor
-    std::vector<unsigned int> constrained_rows;
-    for (std::map<unsigned int,double>::const_iterator
-           dof  = boundary_values.begin();
-         dof != boundary_values.end();
-         ++dof)
-      if ((dof->first >= local_range.first) &&
-          (dof->first < local_range.second))
-        constrained_rows.push_back (dof->first);
-
-                                     // then eliminate these rows and set
-                                     // their diagonal entry to what we have
-                                     // determined above. note that for petsc
-                                     // matrices interleaving read with write
-                                     // operations is very expensive. thus, we
-                                     // here always replace the diagonal
-                                     // element, rather than first checking
-                                     // whether it is nonzero and in that case
-                                     // preserving it. this is different from
-                                     // the case of deal.II sparse matrices
-                                     // treated in the other functions.
-    matrix.clear_rows (constrained_rows, average_nonzero_diagonal_entry);
-
-                                     // the next thing is to set right hand
-                                     // side to the wanted value. there's one
-                                     // drawback: if we write to individual
-                                     // vector elements, then we have to do
-                                     // that on all processors. however, some
-                                     // processors may not need to set
-                                     // anything because their chunk of
-                                     // matrix/rhs do not contain any boundary
-                                     // nodes. therefore, rather than using
-                                     // individual calls, we use one call for
-                                     // all elements, thereby making sure that
-                                     // all processors call this function,
-                                     // even if some only have an empty set of
-                                     // elements to set
-    right_hand_side.compress ();
-    solution.compress ();
-
-    std::vector<unsigned int> indices;
-    std::vector<PetscScalar>  solution_values;
-    for (std::map<unsigned int,double>::const_iterator
-           dof  = boundary_values.begin();
-         dof != boundary_values.end();
-         ++dof)
-      if ((dof->first >= local_range.first) &&
-          (dof->first < local_range.second))
-        {
-          indices.push_back (dof->first);
-          solution_values.push_back (dof->second);
-        }
-    solution.set (indices, solution_values);
-
-                                     // now also set appropriate values for
-                                     // the rhs
-    for (unsigned int i=0; i<solution_values.size(); ++i)
-      solution_values[i] *= average_nonzero_diagonal_entry;
-
-    right_hand_side.set (indices, solution_values);
-
-                                     // clean up
-    matrix.compress ();
-    solution.compress ();
-    right_hand_side.compress ();
-  }
-}
-
-
-
-void
-MatrixTools::
-apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                       PETScWrappers::SparseMatrix   &matrix,
-                       PETScWrappers::Vector   &solution,
-                       PETScWrappers::Vector   &right_hand_side,
-                       const bool        eliminate_columns)
-{
-                                   // simply redirect to the generic function
-                                   // used for both petsc matrix types
-  PETScWrappers::apply_boundary_values (boundary_values, matrix, solution,
-                                        right_hand_side, eliminate_columns);
-}
-
-
-
-void
-MatrixTools::
-apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                       PETScWrappers::MPI::SparseMatrix   &matrix,
-                       PETScWrappers::MPI::Vector   &solution,
-                       PETScWrappers::MPI::Vector   &right_hand_side,
-                       const bool        eliminate_columns)
-{
-                                   // simply redirect to the generic function
-                                   // used for both petsc matrix types
-  PETScWrappers::apply_boundary_values (boundary_values, matrix, solution,
-                                        right_hand_side, eliminate_columns);
-
-                                  // compress the matrix once we're done
-  matrix.compress ();  
-}
-
-
-void
-MatrixTools::
-apply_boundary_values (const std::map<unsigned int,double>  &boundary_values,
-                       PETScWrappers::MPI::BlockSparseMatrix  &matrix,
-                       PETScWrappers::MPI::BlockVector        &solution,
-                       PETScWrappers::MPI::BlockVector        &right_hand_side,
-                       const bool                            eliminate_columns)
-{
-  Assert (matrix.n() == right_hand_side.size(),
-          ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
-  Assert (matrix.n() == solution.size(),
-          ExcDimensionMismatch(matrix.n(), solution.size()));
-  Assert (matrix.n_block_rows() == matrix.n_block_cols(),
-          ExcNotQuadratic());
-
-  const unsigned int n_blocks = matrix.n_block_rows();
-
-  matrix.compress();
-
-                                   // We need to find the subdivision
-                                   // into blocks for the boundary values.
-                                   // To this end, generate a vector of
-                                   // maps with the respective indices.
-  std::vector<std::map<unsigned int,double> > block_boundary_values(n_blocks);
-  {
-    int offset = 0, block=0;
-    for (std::map<unsigned int,double>::const_iterator
-            dof  = boundary_values.begin();
-          dof != boundary_values.end();
-          ++dof)
-      {
-        if (dof->first >= matrix.block(block,0).m() + offset)
-          {
-            offset += matrix.block(block,0).m();
-            block++;
-          }
-        const unsigned int index = dof->first - offset;
-        block_boundary_values[block].insert(std::pair<unsigned int, double> (index,dof->second));
-      }
-  }
-
-                                   // Now call the non-block variants on
-                                   // the diagonal subblocks and the
-                                   // solution/rhs.
-  for (unsigned int block=0; block<n_blocks; ++block)
-    PETScWrappers::apply_boundary_values(block_boundary_values[block],
-                                         matrix.block(block,block),
-                                         solution.block(block),
-                                         right_hand_side.block(block),
-                                         eliminate_columns);
-
-                                  // Finally, we need to do something
-                                   // about the off-diagonal matrices. This
-                                   // is luckily not difficult. Just clear
-                                   // the whole row.
-  for (unsigned int block_m=0; block_m<n_blocks; ++block_m)
-    {
-      const std::pair<unsigned int, unsigned int> local_range
-        = matrix.block(block_m,0).local_range();
-
-      std::vector<unsigned int> constrained_rows;
-      for (std::map<unsigned int,double>::const_iterator
-            dof  = block_boundary_values[block_m].begin();
-          dof != block_boundary_values[block_m].end();
-          ++dof)
-        if ((dof->first >= local_range.first) &&
-            (dof->first < local_range.second))
-          constrained_rows.push_back (dof->first);
-
-      for (unsigned int block_n=0; block_n<n_blocks; ++block_n)
-        if (block_m != block_n)
-          matrix.block(block_m,block_n).clear_rows(constrained_rows);
-    }
-}
-
-#endif
-
-
-
-#ifdef DEAL_II_USE_TRILINOS
-
-namespace TrilinosWrappers
-{
-  template <typename TrilinosMatrix, typename TrilinosVector>
-  void
-  apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                         TrilinosMatrix      &matrix,
-                         TrilinosVector      &solution,
-                         TrilinosVector      &right_hand_side,
-                         const bool           eliminate_columns)
-  {
-    Assert (eliminate_columns == false, ExcNotImplemented());
-
-    Assert (matrix.n() == right_hand_side.size(),
-            ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
-    Assert (matrix.n() == solution.size(),
-            ExcDimensionMismatch(matrix.m(), solution.size()));
-
-                                     // if no boundary values are to be applied
-                                     // simply return
-    if (boundary_values.size() == 0)
-      return;
-
-    const std::pair<unsigned int, unsigned int> local_range
-      = matrix.local_range();
-    Assert (local_range == right_hand_side.local_range(),
-            ExcInternalError());
-    Assert (local_range == solution.local_range(),
-            ExcInternalError());
-
-                                     // we have to read and write from this
-                                     // matrix (in this order). this will only
-                                     // work if we compress the matrix first,
-                                     // done here
-    matrix.compress ();
-
-                                     // determine the first nonzero diagonal
-                                     // entry from within the part of the
-                                     // matrix that we can see. if we can't
-                                     // find such an entry, take one
-    TrilinosScalar average_nonzero_diagonal_entry = 1;
-    for (unsigned int i=local_range.first; i<local_range.second; ++i)
-      if (matrix.diag_element(i) != 0)
-        {
-          average_nonzero_diagonal_entry = std::fabs(matrix.diag_element(i));
-          break;
-        }
-
-                                     // figure out which rows of the matrix we
-                                     // have to eliminate on this processor
-    std::vector<unsigned int> constrained_rows;
-    for (std::map<unsigned int,double>::const_iterator
-           dof  = boundary_values.begin();
-         dof != boundary_values.end();
-         ++dof)
-      if ((dof->first >= local_range.first) &&
-          (dof->first < local_range.second))
-        constrained_rows.push_back (dof->first);
-
-                                     // then eliminate these rows and
-                                     // set their diagonal entry to
-                                     // what we have determined
-                                     // above. if the value already is
-                                     // nonzero, it will be preserved,
-                                     // in accordance with the basic
-                                     // matrix classes in deal.II.
-    matrix.clear_rows (constrained_rows, average_nonzero_diagonal_entry);
-
-                                     // the next thing is to set right
-                                     // hand side to the wanted
-                                     // value. there's one drawback:
-                                     // if we write to individual
-                                     // vector elements, then we have
-                                     // to do that on all
-                                     // processors. however, some
-                                     // processors may not need to set
-                                     // anything because their chunk
-                                     // of matrix/rhs do not contain
-                                     // any boundary nodes. therefore,
-                                     // rather than using individual
-                                     // calls, we use one call for all
-                                     // elements, thereby making sure
-                                     // that all processors call this
-                                     // function, even if some only
-                                     // have an empty set of elements
-                                     // to set
-    right_hand_side.compress ();
-    solution.compress ();
-
-    std::vector<unsigned int> indices;
-    std::vector<TrilinosScalar>  solution_values;
-    for (std::map<unsigned int,double>::const_iterator
-           dof  = boundary_values.begin();
-         dof != boundary_values.end();
-         ++dof)
-      if ((dof->first >= local_range.first) &&
-          (dof->first < local_range.second))
-        {
-          indices.push_back (dof->first);
-          solution_values.push_back (dof->second);
-        }
-    solution.set (indices, solution_values);
-
-                                     // now also set appropriate
-                                     // values for the rhs
-    for (unsigned int i=0; i<solution_values.size(); ++i)
-      solution_values[i] *= matrix.diag_element(indices[i]);
-
-    right_hand_side.set (indices, solution_values);
-
-                                     // clean up
-    matrix.compress ();
-    solution.compress ();
-    right_hand_side.compress ();
-  }
-
-
-
-  template <typename TrilinosMatrix, typename TrilinosBlockVector>
-  void
-  apply_block_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                              TrilinosMatrix      &matrix,
-                              TrilinosBlockVector &solution,
-                              TrilinosBlockVector &right_hand_side,
-                              const bool          eliminate_columns)
-  {
-    Assert (eliminate_columns == false, ExcNotImplemented());
-
-    Assert (matrix.n() == right_hand_side.size(),
-           ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
-    Assert (matrix.n() == solution.size(),
-           ExcDimensionMismatch(matrix.n(), solution.size()));
-    Assert (matrix.n_block_rows() == matrix.n_block_cols(),
-           ExcNotQuadratic());
-  
-    const unsigned int n_blocks = matrix.n_block_rows();
-
-    matrix.compress();
-
-                                  // We need to find the subdivision
-                                  // into blocks for the boundary values.
-                                  // To this end, generate a vector of
-                                  // maps with the respective indices.
-    std::vector<std::map<unsigned int,double> > block_boundary_values(n_blocks);
-    {
-      int offset = 0, block=0;
-      for (std::map<unsigned int,double>::const_iterator
-            dof  = boundary_values.begin();
-          dof != boundary_values.end();
-          ++dof)
-       {
-         if (dof->first >= matrix.block(block,0).m() + offset)
-           {
-             offset += matrix.block(block,0).m();
-             block++;
-           }
-         const unsigned int index = dof->first - offset;
-         block_boundary_values[block].insert(
-            std::pair<unsigned int, double> (index,dof->second));
-       }
-    }
-  
-                                  // Now call the non-block variants on
-                                  // the diagonal subblocks and the
-                                  // solution/rhs.
-    for (unsigned int block=0; block<n_blocks; ++block)
-      TrilinosWrappers::apply_boundary_values(block_boundary_values[block],
-                                             matrix.block(block,block),
-                                             solution.block(block),
-                                             right_hand_side.block(block),
-                                             eliminate_columns);
-  
-                                  // Finally, we need to do something 
-                                  // about the off-diagonal matrices. This
-                                  // is luckily not difficult. Just clear
-                                  // the whole row.
-    for (unsigned int block_m=0; block_m<n_blocks; ++block_m)
-      {
-       const std::pair<unsigned int, unsigned int> local_range
-         = matrix.block(block_m,0).local_range();
-      
-       std::vector<unsigned int> constrained_rows;
-       for (std::map<unsigned int,double>::const_iterator
-              dof  = block_boundary_values[block_m].begin();
-            dof != block_boundary_values[block_m].end();
-            ++dof)
-         if ((dof->first >= local_range.first) &&
-             (dof->first < local_range.second))
-           constrained_rows.push_back (dof->first);
-  
-       for (unsigned int block_n=0; block_n<n_blocks; ++block_n)
-         if (block_m != block_n)
-           matrix.block(block_m,block_n).clear_rows(constrained_rows);
-      }
-  }
-
-}
-
-
-
-void
-MatrixTools::
-apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                       TrilinosWrappers::SparseMatrix   &matrix,
-                       TrilinosWrappers::Vector         &solution,
-                       TrilinosWrappers::Vector         &right_hand_side,
-                       const bool        eliminate_columns)
-{
-                                   // simply redirect to the generic function
-                                   // used for both trilinos matrix types
-  TrilinosWrappers::apply_boundary_values (boundary_values, matrix, solution,
-                                        right_hand_side, eliminate_columns);
-}
-
-
-
-void
-MatrixTools::
-apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                       TrilinosWrappers::SparseMatrix   &matrix,
-                       TrilinosWrappers::MPI::Vector    &solution,
-                       TrilinosWrappers::MPI::Vector    &right_hand_side,
-                       const bool        eliminate_columns)
-{
-                                   // simply redirect to the generic function
-                                   // used for both trilinos matrix types
-  TrilinosWrappers::apply_boundary_values (boundary_values, matrix, solution,
-                                          right_hand_side, eliminate_columns);
-}
-
-
-
-void
-MatrixTools::
-apply_boundary_values (const std::map<unsigned int,double>  &boundary_values,
-                       TrilinosWrappers::BlockSparseMatrix  &matrix,
-                       TrilinosWrappers::BlockVector        &solution,
-                       TrilinosWrappers::BlockVector        &right_hand_side,
-                       const bool                            eliminate_columns)
-{
-  TrilinosWrappers::apply_block_boundary_values (boundary_values, matrix, 
-                                                solution, right_hand_side, 
-                                                eliminate_columns);
-}
-
-
-
-void
-MatrixTools::
-apply_boundary_values (const std::map<unsigned int,double>  &boundary_values,
-                       TrilinosWrappers::BlockSparseMatrix  &matrix,
-                       TrilinosWrappers::MPI::BlockVector   &solution,
-                       TrilinosWrappers::MPI::BlockVector   &right_hand_side,
-                       const bool                            eliminate_columns)
-{
-  TrilinosWrappers::apply_block_boundary_values (boundary_values, matrix, 
-                                                solution, right_hand_side, 
-                                                eliminate_columns);
-}
-
-#endif
-
-
-
-void
-MatrixTools::
-local_apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
-                             const std::vector<unsigned int> &local_dof_indices,
-                             FullMatrix<double> &local_matrix,
-                             Vector<double>     &local_rhs,
-                             const bool          eliminate_columns)
-{
-  Assert (local_dof_indices.size() == local_matrix.m(),
-          ExcDimensionMismatch(local_dof_indices.size(),
-                               local_matrix.m()));
-  Assert (local_dof_indices.size() == local_matrix.n(),
-          ExcDimensionMismatch(local_dof_indices.size(),
-                               local_matrix.n()));
-  Assert (local_dof_indices.size() == local_rhs.size(),
-          ExcDimensionMismatch(local_dof_indices.size(),
-                               local_rhs.size()));
-
-                                   // if there is nothing to do, then exit
-                                   // right away
-  if (boundary_values.size() == 0)
-    return;
-
-                                   // otherwise traverse all the dofs used in
-                                   // the local matrices and vectors and see
-                                   // what's there to do
-
-                                   // if we need to treat an entry, then we
-                                   // set the diagonal entry to its absolute
-                                   // value. if it is zero, we used to set it
-                                   // to one, which is a really terrible
-                                   // choice that can lead to hours of
-                                   // searching for bugs in programs (I
-                                   // experienced this :-( ) if the matrix
-                                   // entries are otherwise very large. this
-                                   // is so since iterative solvers would
-                                   // simply not correct boundary nodes for
-                                   // their correct values since the residual
-                                   // contributions of their rows of the
-                                   // linear system is almost zero if the
-                                   // diagonal entry is one. thus, set it to
-                                   // the average absolute value of the
-                                   // nonzero diagonal elements.
-                                   //
-                                   // we only compute this value lazily the
-                                   // first time we need it.
-  double average_diagonal = 0;
-  const unsigned int n_local_dofs = local_dof_indices.size();
-  for (unsigned int i=0; i<n_local_dofs; ++i)
-    {
-      const std::map<unsigned int, double>::const_iterator
-        boundary_value = boundary_values.find (local_dof_indices[i]);
-      if (boundary_value != boundary_values.end())
-        {
-                                           // remove this row, except for the
-                                           // diagonal element
-          for (unsigned j=0; j<n_local_dofs; ++j)
-            if (i != j)
-              local_matrix(i,j) = 0;
-
-                                           // replace diagonal entry by its
-                                           // absolute value to make sure that
-                                           // everything remains positive, or
-                                           // by the average diagonal value if
-                                           // zero
-          if (local_matrix(i,i) == 0.)
-            {
-                                               // if average diagonal hasn't
-                                               // yet been computed, do so now
-              if (average_diagonal == 0.)
-                {
-                  unsigned int nonzero_diagonals = 0;
-                  for (unsigned int k=0; k<n_local_dofs; ++k)
-                    if (local_matrix(k,k) != 0.)
-                      {
-                        average_diagonal += std::fabs(local_matrix(k,k));
-                        ++nonzero_diagonals;
-                      }
-                  if (nonzero_diagonals != 0)
-                    average_diagonal /= nonzero_diagonals;
-                  else
-                    average_diagonal = 0;
-                }
-
-                                               // only if all diagonal entries
-                                               // are zero, then resort to the
-                                               // last measure: choose one
-              if (average_diagonal == 0.)
-                average_diagonal = 1.;
-
-              local_matrix(i,i) = average_diagonal;
-            }
-          else
-            local_matrix(i,i) = std::fabs(local_matrix(i,i));
-          
-                                           // and replace rhs entry by correct
-                                           // value
-          local_rhs(i) = local_matrix(i,i) * boundary_value->second;
-
-                                           // finally do the elimination step
-                                           // if requested
-          if (eliminate_columns == true)
-            {
-              for (unsigned int row=0; row<n_local_dofs; ++row)
-                if (row != i)
-                  {
-                    local_rhs(row) -= local_matrix(row,i) * boundary_value->second;
-                    local_matrix(row,i) = 0;
-                  }
-            }
-        }
-    }
-}
-
-
-
-
-
-// explicit instantiations
-
-template
-void
-MatrixTools::apply_boundary_values<double> (const std::map<unsigned int,double> &boundary_values,
-                                           SparseMatrix<double>  &matrix,
-                                           Vector<double>   &solution,
-                                           Vector<double>   &right_hand_side,
-                                           const bool        eliminate_columns);
-template
-void
-MatrixTools::apply_boundary_values<float> (const std::map<unsigned int,double> &boundary_values,
-                                          SparseMatrix<float>  &matrix,
-                                          Vector<float>   &solution,
-                                          Vector<float>   &right_hand_side,
-                                          const bool        eliminate_columns);
-
-template
-void
-MatrixTools::apply_boundary_values<double> (const std::map<unsigned int,double> &boundary_values,
-                                           BlockSparseMatrix<double>  &matrix,
-                                           BlockVector<double>   &solution,
-                                           BlockVector<double>   &right_hand_side,
-                                           const bool        eliminate_columns);
-template
-void
-MatrixTools::apply_boundary_values<float> (const std::map<unsigned int,double> &boundary_values,
-                                          BlockSparseMatrix<float>  &matrix,
-                                          BlockVector<float>   &solution,
-                                          BlockVector<float>   &right_hand_side,
-                                          const bool        eliminate_columns);
-
-DEAL_II_NAMESPACE_CLOSE
index 0c3b0e709c4e2464e61c3821768ffccf04a77099..2a87aaaf9f0c3010cdfbe774422160f768a5cc7f 100644 (file)
 #include <numerics/matrices.h>
 #include <lac/vector.h>
 #include <lac/block_vector.h>
+#include <lac/full_matrix.h>
 #include <lac/sparse_matrix.h>
 #include <lac/block_sparse_matrix.h>
 
+#ifdef DEAL_II_USE_PETSC
+#  include <lac/petsc_parallel_sparse_matrix.h>
+#  include <lac/petsc_sparse_matrix.h>
+#  include <lac/petsc_parallel_vector.h>
+#  include <lac/petsc_vector.h>
+#  include <lac/petsc_parallel_block_sparse_matrix.h>
+#endif
+
+#ifdef DEAL_II_USE_TRILINOS
+#  include <lac/trilinos_sparse_matrix.h>
+#  include <lac/trilinos_vector.h>
+#  include <lac/trilinos_block_sparse_matrix.h>
+#  include <lac/trilinos_block_vector.h>
+#endif
+
+#include <algorithm>
+
+
 #include <algorithm>
 #include <set>
 #include <cmath>
@@ -766,48 +785,6 @@ void MatrixCreator::create_mass_matrix (const hp::DoFHandler<dim,spacedim>    &d
 
 
 
-
-#if deal_II_dimension == 1
-
-template <>
-void MatrixCreator::create_boundary_mass_matrix (const Mapping<1,1>&,
-                                                const DoFHandler<1,1>&,
-                                                const Quadrature<0>&,
-                                                SparseMatrix<double>&,
-                                                const FunctionMap<1>::type&,
-                                                Vector<double>&,
-                                                std::vector<unsigned int>&,
-                                                const Function<1>* const,
-                                                std::vector<unsigned int>)
-{
-                                  // what would that be in 1d? the
-                                  // identity matrix on the boundary
-                                  // dofs?
-  Assert (false, ExcNotImplemented());
-}
-
-template <>
-void MatrixCreator::create_boundary_mass_matrix (const Mapping<1,2>&,
-                                                const DoFHandler<1,2>&,
-                                                const Quadrature<0>&,
-                                                SparseMatrix<double>&,
-                                                const FunctionMap<2>::type&,
-                                                Vector<double>&,
-                                                std::vector<unsigned int>&,
-                                                const Function<2>* const,
-                                                std::vector<unsigned int>)
-{
-                                  // what would that be in 1d? the
-                                  // identity matrix on the boundary
-                                  // dofs?
-  Assert (false, ExcNotImplemented());
-}
-
-
-#else
-
-
-
 template <int dim, int spacedim>
 void
 MatrixCreator::create_boundary_mass_matrix (const Mapping<dim, spacedim>  &mapping,
@@ -820,6 +797,15 @@ MatrixCreator::create_boundary_mass_matrix (const Mapping<dim, spacedim>  &mappi
                                            const Function<spacedim> * const coefficient,
                                            std::vector<unsigned int> component_mapping)
 {
+                                  // what would that be in 1d? the
+                                  // identity matrix on the boundary
+                                  // dofs?
+  if (dim == 1)
+    {
+      Assert (false, ExcNotImplemented());
+      return;
+    }
+
   const FiniteElement<dim,spacedim> &fe = dof.get_fe();
   const unsigned int n_components  = fe.n_components();
 
@@ -886,7 +872,6 @@ MatrixCreator::create_boundary_mass_matrix (const Mapping<dim, spacedim>  &mappi
 }
 
 
-#if deal_II_dimension == 2
 
 template <>
 void
@@ -906,7 +891,6 @@ create_boundary_mass_matrix_1<2,3> (std_cxx1x::tuple<const Mapping<2,3> &,
   Assert(false,ExcNotImplemented());
 }
 
-#endif
 
 
 template <int dim, int spacedim>
@@ -1177,7 +1161,7 @@ create_boundary_mass_matrix_1 (std_cxx1x::tuple<const Mapping<dim, spacedim> &,
        }
 }
 
-#endif
+
 
 template <int dim, int spacedim>
 void MatrixCreator::create_boundary_mass_matrix (const DoFHandler<dim,spacedim>     &dof,
@@ -1196,30 +1180,6 @@ void MatrixCreator::create_boundary_mass_matrix (const DoFHandler<dim,spacedim>
 
 
 
-#if deal_II_dimension == 1
-
-template <int dim, int spacedim>
-void
-MatrixCreator::create_boundary_mass_matrix (const hp::MappingCollection<dim,spacedim>&,
-                                           const hp::DoFHandler<dim,spacedim>&,
-                                           const hp::QCollection<dim-1>&,
-                                           SparseMatrix<double>&,
-                                           const typename FunctionMap<spacedim>::type&,
-                                           Vector<double>&,
-                                           std::vector<unsigned int>&,
-                                           const Function<spacedim>* const,
-                                           std::vector<unsigned int>)
-{
-                                  // what would that be in 1d? the
-                                  // identity matrix on the boundary
-                                  // dofs?
-  Assert (false, ExcNotImplemented());
-}
-
-
-#else
-
-
 template <int dim, int spacedim>
 void
 MatrixCreator::create_boundary_mass_matrix (const hp::MappingCollection<dim,spacedim>        &mapping,
@@ -1232,6 +1192,15 @@ MatrixCreator::create_boundary_mass_matrix (const hp::MappingCollection<dim,spac
                                            const Function<spacedim> * const coefficient,
                                            std::vector<unsigned int> component_mapping)
 {
+                                  // what would that be in 1d? the
+                                  // identity matrix on the boundary
+                                  // dofs?
+  if (dim == 1)
+    {
+      Assert (false, ExcNotImplemented());
+      return;
+    }
+
   const hp::FECollection<dim,spacedim> &fe_collection = dof.get_fe();
   const unsigned int n_components  = fe_collection.n_components();
 
@@ -1664,7 +1633,7 @@ create_boundary_mass_matrix_1 (std_cxx1x::tuple<const hp::MappingCollection<dim,
        }
 }
 
-#endif
+
 
 template <int dim, int spacedim>
 void MatrixCreator::create_boundary_mass_matrix (const hp::DoFHandler<dim,spacedim>     &dof,
@@ -1906,442 +1875,1141 @@ void MatrixCreator::create_laplace_matrix (const hp::DoFHandler<dim,spacedim>
 
 
 
+//TODO:[WB] I don't think that the optimized storage of diagonals is needed (GK)
+template <typename number>
+void
+MatrixTools::apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                                   SparseMatrix<number>  &matrix,
+                                   Vector<number>   &solution,
+                                   Vector<number>   &right_hand_side,
+                                   const bool        eliminate_columns)
+{
+                                  // Require that diagonals are first
+                                  // in each row
+  Assert (matrix.get_sparsity_pattern().optimize_diagonal(),
+         typename SparsityPattern::ExcDiagonalNotOptimized());
+  Assert (matrix.n() == right_hand_side.size(),
+         ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
+  Assert (matrix.n() == solution.size(),
+         ExcDimensionMismatch(matrix.n(), solution.size()));
+                                  // if no boundary values are to be applied
+                                  // simply return
+  if (boundary_values.size() == 0)
+    return;
+
+
+  const unsigned int n_dofs = matrix.m();
+
+                                  // if a diagonal entry is zero
+                                  // later, then we use another
+                                  // number instead. take it to be
+                                  // the first nonzero diagonal
+                                  // element of the matrix, or 1 if
+                                  // there is no such thing
+  number first_nonzero_diagonal_entry = 1;
+  for (unsigned int i=0; i<n_dofs; ++i)
+    if (matrix.diag_element(i) != 0)
+      {
+       first_nonzero_diagonal_entry = matrix.diag_element(i);
+       break;
+      }
+
+  
+  std::map<unsigned int,double>::const_iterator dof  = boundary_values.begin(),
+                                               endd = boundary_values.end();
+  const SparsityPattern    &sparsity    = matrix.get_sparsity_pattern();
+  const std::size_t  *sparsity_rowstart = sparsity.get_rowstart_indices();
+  const unsigned int *sparsity_colnums  = sparsity.get_column_numbers();
+  for (; dof != endd; ++dof)
+    {
+      Assert (dof->first < n_dofs, ExcInternalError());
+      
+      const unsigned int dof_number = dof->first;
+                                      // for each boundary dof:
+      
+                                      // set entries of this line
+                                      // to zero except for the diagonal
+                                      // entry. Note that the diagonal
+                                      // entry is always the first one
+                                      // for square matrices, i.e.
+                                      // we shall not set
+                                      // matrix.global_entry(
+                                      //     sparsity_rowstart[dof.first])
+      const unsigned int last = sparsity_rowstart[dof_number+1];
+      for (unsigned int j=sparsity_rowstart[dof_number]+1; j<last; ++j)
+       matrix.global_entry(j) = 0.;
+
+
+                                      // set right hand side to
+                                      // wanted value: if main diagonal
+                                      // entry nonzero, don't touch it
+                                      // and scale rhs accordingly. If
+                                      // zero, take the first main
+                                      // diagonal entry we can find, or
+                                      // one if no nonzero main diagonal
+                                      // element exists. Normally, however,
+                                      // the main diagonal entry should
+                                      // not be zero.
+                                      //
+                                      // store the new rhs entry to make
+                                      // the gauss step more efficient
+      number new_rhs;
+      if (matrix.diag_element(dof_number) != 0.0)
+        {
+          new_rhs = dof->second * matrix.diag_element(dof_number);
+          right_hand_side(dof_number) = new_rhs;
+        }
+      else
+       {
+         matrix.set (dof_number, dof_number,
+                      first_nonzero_diagonal_entry);
+         new_rhs = dof->second * first_nonzero_diagonal_entry;
+          right_hand_side(dof_number) = new_rhs;
+       }
 
 
-// explicit instantiations
+                                      // if the user wants to have
+                                      // the symmetry of the matrix
+                                      // preserved, and if the
+                                      // sparsity pattern is
+                                      // symmetric, then do a Gauss
+                                      // elimination step with the
+                                      // present row
+      if (eliminate_columns)
+       {
+                                          // store the only nonzero entry
+                                          // of this line for the Gauss
+                                          // elimination step
+         const number diagonal_entry = matrix.diag_element(dof_number);
+         
+                                          // we have to loop over all
+                                          // rows of the matrix which
+                                          // have a nonzero entry in
+                                          // the column which we work
+                                          // in presently. if the
+                                          // sparsity pattern is
+                                          // symmetric, then we can
+                                          // get the positions of
+                                          // these rows cheaply by
+                                          // looking at the nonzero
+                                          // column numbers of the
+                                          // present row. we need not
+                                          // look at the first entry,
+                                          // since that is the
+                                          // diagonal element and
+                                          // thus the present row
+         for (unsigned int j=sparsity_rowstart[dof_number]+1; j<last; ++j)
+           {
+             const unsigned int row = sparsity_colnums[j];
+
+                                              // find the position of
+                                              // element
+                                              // (row,dof_number)
+             const unsigned int *
+               p = std::lower_bound(&sparsity_colnums[sparsity_rowstart[row]+1],
+                                    &sparsity_colnums[sparsity_rowstart[row+1]],
+                                    dof_number);
+
+                                              // check whether this line has
+                                              // an entry in the regarding column
+                                              // (check for ==dof_number and
+                                              // != next_row, since if
+                                              // row==dof_number-1, *p is a
+                                              // past-the-end pointer but points
+                                              // to dof_number anyway...)
+                                              //
+                                              // there should be such an entry!
+             Assert ((*p == dof_number) &&
+                     (p != &sparsity_colnums[sparsity_rowstart[row+1]]),
+                     ExcInternalError());
+
+             const unsigned int global_entry
+               = (p - &sparsity_colnums[sparsity_rowstart[0]]);
+             
+                                              // correct right hand side
+             right_hand_side(row) -= matrix.global_entry(global_entry) /
+                                     diagonal_entry * new_rhs;
+             
+                                              // set matrix entry to zero
+             matrix.global_entry(global_entry) = 0.;
+           }
+       }
 
-// non-hp version of create_mass_matrix
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const Mapping<deal_II_dimension>       &mapping,
- const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const Mapping<deal_II_dimension>       &mapping,
- const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
+                                      // preset solution vector
+      solution(dof_number) = dof->second;
+    }
+}
 
 
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const Mapping<deal_II_dimension>       &mapping,
- const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const Mapping<deal_II_dimension>       &mapping,
- const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
-
-// hp versions of functions
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const hp::MappingCollection<deal_II_dimension>       &mapping,
- const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const hp::MappingCollection<deal_II_dimension>       &mapping,
- const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
 
+template <typename number>
+void
+MatrixTools::apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                                   BlockSparseMatrix<number>  &matrix,
+                                   BlockVector<number>   &solution,
+                                   BlockVector<number>   &right_hand_side,
+                                   const bool             eliminate_columns)
+{
+  const unsigned int blocks = matrix.n_block_rows();
+  
+  Assert (matrix.n() == right_hand_side.size(),
+         ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
+  Assert (matrix.n() == solution.size(),
+         ExcDimensionMismatch(matrix.n(), solution.size()));
+  Assert (matrix.n_block_rows() == matrix.n_block_cols(),
+         ExcNotQuadratic());
+  Assert (matrix.get_sparsity_pattern().get_row_indices() == 
+         matrix.get_sparsity_pattern().get_column_indices(),
+         ExcNotQuadratic());
+  Assert (matrix.get_sparsity_pattern().get_column_indices() ==
+         solution.get_block_indices (),
+         ExcBlocksDontMatch ());
+  Assert (matrix.get_sparsity_pattern().get_row_indices() ==
+         right_hand_side.get_block_indices (),
+         ExcBlocksDontMatch ());
+
+  for (unsigned int i=0; i<blocks; ++i)
+    Assert (matrix.block(i,i).get_sparsity_pattern().optimize_diagonal(),
+           SparsityPattern::ExcDiagonalNotOptimized());
+
+  
+                                  // if no boundary values are to be applied
+                                  // simply return
+  if (boundary_values.size() == 0)
+    return;
+
+
+  const unsigned int n_dofs = matrix.m();
+
+                                  // if a diagonal entry is zero
+                                  // later, then we use another
+                                  // number instead. take it to be
+                                  // the first nonzero diagonal
+                                  // element of the matrix, or 1 if
+                                  // there is no such thing
+  number first_nonzero_diagonal_entry = 0;
+  for (unsigned int diag_block=0; diag_block<blocks; ++diag_block)
+    {
+      for (unsigned int i=0; i<matrix.block(diag_block,diag_block).n(); ++i)
+       if (matrix.block(diag_block,diag_block).diag_element(i) != 0)
+         {
+           first_nonzero_diagonal_entry 
+             = matrix.block(diag_block,diag_block).diag_element(i);
+           break;
+         }
+                                      // check whether we have found
+                                      // something in the present
+                                      // block
+      if (first_nonzero_diagonal_entry != 0)
+       break;
+    }
+                                  // nothing found on all diagonal
+                                  // blocks? if so, use 1.0 instead
+  if (first_nonzero_diagonal_entry == 0)
+    first_nonzero_diagonal_entry = 1;
+  
+
+  std::map<unsigned int,double>::const_iterator dof  = boundary_values.begin(),
+                                               endd = boundary_values.end();
+  const BlockSparsityPattern &
+    sparsity_pattern = matrix.get_sparsity_pattern();
+  
+                                  // pointer to the mapping between
+                                  // global and block indices. since
+                                  // the row and column mappings are
+                                  // equal, store a pointer on only
+                                  // one of them
+  const BlockIndices &
+    index_mapping = sparsity_pattern.get_column_indices();
+  
+                                  // now loop over all boundary dofs
+  for (; dof != endd; ++dof)
+    {
+      Assert (dof->first < n_dofs, ExcInternalError());
+
+                                      // get global index and index
+                                      // in the block in which this
+                                      // dof is located
+      const unsigned int dof_number = dof->first;
+      const std::pair<unsigned int,unsigned int>
+       block_index = index_mapping.global_to_local (dof_number);
+
+                                      // for each boundary dof:
+      
+                                      // set entries of this line
+                                      // to zero except for the diagonal
+                                      // entry. Note that the diagonal
+                                      // entry is always the first one
+                                      // for square matrices, i.e.
+                                      // we shall not set
+                                      // matrix.global_entry(
+                                      //     sparsity_rowstart[dof.first])
+                                      // of the diagonal block
+      for (unsigned int block_col=0; block_col<blocks; ++block_col)
+       {
+         const SparsityPattern &
+           local_sparsity = sparsity_pattern.block(block_index.first,
+                                                   block_col);
+
+                                          // find first and last
+                                          // entry in the present row
+                                          // of the present
+                                          // block. exclude the main
+                                          // diagonal element, which
+                                          // is the diagonal element
+                                          // of a diagonal block,
+                                          // which must be a square
+                                          // matrix so the diagonal
+                                          // element is the first of
+                                          // this row.
+         const unsigned int 
+           last  = local_sparsity.get_rowstart_indices()[block_index.second+1],
+           first = (block_col == block_index.first ?
+                    local_sparsity.get_rowstart_indices()[block_index.second]+1 :
+                    local_sparsity.get_rowstart_indices()[block_index.second]);
+         
+         for (unsigned int j=first; j<last; ++j)
+           matrix.block(block_index.first,block_col).global_entry(j) = 0.;
+       }
+      
+
+                                      // set right hand side to
+                                      // wanted value: if main diagonal
+                                      // entry nonzero, don't touch it
+                                      // and scale rhs accordingly. If
+                                      // zero, take the first main
+                                      // diagonal entry we can find, or
+                                      // one if no nonzero main diagonal
+                                      // element exists. Normally, however,
+                                      // the main diagonal entry should
+                                      // not be zero.
+                                      //
+                                      // store the new rhs entry to make
+                                      // the gauss step more efficient
+      number new_rhs;
+      if (matrix.block(block_index.first, block_index.first)
+         .diag_element(block_index.second) != 0.0)
+       new_rhs = dof->second * 
+                 matrix.block(block_index.first, block_index.first)
+                 .diag_element(block_index.second);
+      else
+       {
+         matrix.block(block_index.first, block_index.first)
+           .diag_element(block_index.second)
+           = first_nonzero_diagonal_entry;
+         new_rhs = dof->second * first_nonzero_diagonal_entry;
+       }
+      right_hand_side.block(block_index.first)(block_index.second)
+       = new_rhs;
+
+
+                                      // if the user wants to have
+                                      // the symmetry of the matrix
+                                      // preserved, and if the
+                                      // sparsity pattern is
+                                      // symmetric, then do a Gauss
+                                      // elimination step with the
+                                      // present row. this is a
+                                      // little more complicated for
+                                      // block matrices.
+      if (eliminate_columns)
+       {
+                                          // store the only nonzero entry
+                                          // of this line for the Gauss
+                                          // elimination step
+         const number diagonal_entry 
+           = matrix.block(block_index.first,block_index.first)
+           .diag_element(block_index.second);
+         
+                                          // we have to loop over all
+                                          // rows of the matrix which
+                                          // have a nonzero entry in
+                                          // the column which we work
+                                          // in presently. if the
+                                          // sparsity pattern is
+                                          // symmetric, then we can
+                                          // get the positions of
+                                          // these rows cheaply by
+                                          // looking at the nonzero
+                                          // column numbers of the
+                                          // present row.
+                                          //
+                                          // note that if we check
+                                          // whether row @p{row} in
+                                          // block (r,c) is non-zero,
+                                          // then we have to check
+                                          // for the existence of
+                                          // column @p{row} in block
+                                          // (c,r), i.e. of the
+                                          // transpose block
+         for (unsigned int block_row=0; block_row<blocks; ++block_row)
+           {
+                                              // get pointers to the
+                                              // sparsity patterns of
+                                              // this block and of
+                                              // the transpose one
+             const SparsityPattern &this_sparsity
+               = sparsity_pattern.block (block_row, block_index.first);
+             const SparsityPattern &transpose_sparsity
+               = sparsity_pattern.block (block_index.first, block_row);
+             
+                                              // traverse the row of
+                                              // the transpose block
+                                              // to find the
+                                              // interesting rows in
+                                              // the present block.
+                                              // don't use the
+                                              // diagonal element of
+                                              // the diagonal block
+             const unsigned int
+               first = (block_index.first == block_row ?
+                        transpose_sparsity.get_rowstart_indices()[block_index.second]+1 :
+                        transpose_sparsity.get_rowstart_indices()[block_index.second]),
+               last  = transpose_sparsity.get_rowstart_indices()[block_index.second+1];
+             
+             for (unsigned int j=first; j<last; ++j)
+               {
+                                                  // get the number
+                                                  // of the column in
+                                                  // this row in
+                                                  // which a nonzero
+                                                  // entry is. this
+                                                  // is also the row
+                                                  // of the transpose
+                                                  // block which has
+                                                  // an entry in the
+                                                  // interesting row
+                 const unsigned int row = transpose_sparsity.get_column_numbers()[j];
+
+                                                  // find the
+                                                  // position of
+                                                  // element
+                                                  // (row,dof_number)
+                                                  // in this block
+                                                  // (not in the
+                                                  // transpose
+                                                  // one). note that
+                                                  // we have to take
+                                                  // care of special
+                                                  // cases with
+                                                  // square
+                                                  // sub-matrices
+                 const unsigned int *p = 0;
+                 if (this_sparsity.n_rows() == this_sparsity.n_cols())
+                   {
+                     if (this_sparsity.get_column_numbers()
+                         [this_sparsity.get_rowstart_indices()[row]]
+                         ==
+                         block_index.second)
+                       p = &this_sparsity.get_column_numbers()
+                           [this_sparsity.get_rowstart_indices()[row]];
+                     else
+                       p = std::lower_bound(&this_sparsity.get_column_numbers()
+                                            [this_sparsity.get_rowstart_indices()[row]+1],
+                                            &this_sparsity.get_column_numbers()
+                                            [this_sparsity.get_rowstart_indices()[row+1]],
+                                            block_index.second);
+                   }
+                 else
+                   p = std::lower_bound(&this_sparsity.get_column_numbers()
+                                        [this_sparsity.get_rowstart_indices()[row]],
+                                        &this_sparsity.get_column_numbers()
+                                        [this_sparsity.get_rowstart_indices()[row+1]],
+                                        block_index.second);
+
+                                                  // check whether this line has
+                                                  // an entry in the regarding column
+                                                  // (check for ==dof_number and
+                                                  // != next_row, since if
+                                                  // row==dof_number-1, *p is a
+                                                  // past-the-end pointer but points
+                                                  // to dof_number anyway...)
+                                                  //
+                                                  // there should be
+                                                  // such an entry!
+                                                  // note, however,
+                                                  // that this
+                                                  // assertion will
+                                                  // fail sometimes
+                                                  // if the sparsity
+                                                  // pattern is not
+                                                  // symmetric!
+                 Assert ((*p == block_index.second) &&
+                         (p != &this_sparsity.get_column_numbers()
+                          [this_sparsity.get_rowstart_indices()[row+1]]),
+                         ExcInternalError());
+                 
+                 const unsigned int global_entry
+                   = (p
+                      -
+                      &this_sparsity.get_column_numbers()
+                      [this_sparsity.get_rowstart_indices()[0]]);
+
+                                                  // correct right hand side
+                 right_hand_side.block(block_row)(row)
+                   -= matrix.block(block_row,block_index.first).global_entry(global_entry) /
+                   diagonal_entry * new_rhs;
+                 
+                                                  // set matrix entry to zero
+                 matrix.block(block_row,block_index.first).global_entry(global_entry) = 0.;
+               }
+           }
+       }
 
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const hp::MappingCollection<deal_II_dimension>       &mapping,
- const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const hp::MappingCollection<deal_II_dimension>       &mapping,
- const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
+                                      // preset solution vector
+      solution.block(block_index.first)(block_index.second) = dof->second;
+    }
+}
 
 
-#if deal_II_dimension != 1
 
-template
-void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>     &dof,
- const Quadrature<deal_II_dimension-1>   &q,
- SparseMatrix<double>      &matrix,
- const FunctionMap<deal_II_dimension>::type &rhs,
- Vector<double>            &rhs_vector,
- std::vector<unsigned int> &dof_to_boundary_mapping,
- const Function<deal_II_dimension> * const a,
- std::vector<unsigned int>);
+#ifdef DEAL_II_USE_PETSC
+
+namespace PETScWrappers
+{
+  template <typename PETScMatrix, typename PETScVector>
+  void
+  apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                         PETScMatrix      &matrix,
+                         PETScVector      &solution,
+                         PETScVector      &right_hand_side,
+                         const bool        eliminate_columns)
+  {
+    Assert (eliminate_columns == false, ExcNotImplemented());
+
+    Assert (matrix.n() == right_hand_side.size(),
+            ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
+    Assert (matrix.n() == solution.size(),
+            ExcDimensionMismatch(matrix.n(), solution.size()));
+
+                                     // if no boundary values are to be applied
+                                     // simply return
+    if (boundary_values.size() == 0)
+      return;
+
+    const std::pair<unsigned int, unsigned int> local_range
+      = matrix.local_range();
+    Assert (local_range == right_hand_side.local_range(),
+            ExcInternalError());
+    Assert (local_range == solution.local_range(),
+            ExcInternalError());
+    
+
+                                     // we have to read and write from this
+                                     // matrix (in this order). this will only
+                                     // work if we compress the matrix first,
+                                     // done here
+    matrix.compress ();
+
+                                     // determine the first nonzero diagonal
+                                     // entry from within the part of the
+                                     // matrix that we can see. if we can't
+                                     // find such an entry, take one
+    PetscScalar average_nonzero_diagonal_entry = 1;
+    for (unsigned int i=local_range.first; i<local_range.second; ++i)
+      if (matrix.diag_element(i) != 0)
+        {
+          average_nonzero_diagonal_entry = std::fabs(matrix.diag_element(i));
+          break;
+        }
+
+                                     // figure out which rows of the matrix we
+                                     // have to eliminate on this processor
+    std::vector<unsigned int> constrained_rows;
+    for (std::map<unsigned int,double>::const_iterator
+           dof  = boundary_values.begin();
+         dof != boundary_values.end();
+         ++dof)
+      if ((dof->first >= local_range.first) &&
+          (dof->first < local_range.second))
+        constrained_rows.push_back (dof->first);
+
+                                     // then eliminate these rows and set
+                                     // their diagonal entry to what we have
+                                     // determined above. note that for petsc
+                                     // matrices interleaving read with write
+                                     // operations is very expensive. thus, we
+                                     // here always replace the diagonal
+                                     // element, rather than first checking
+                                     // whether it is nonzero and in that case
+                                     // preserving it. this is different from
+                                     // the case of deal.II sparse matrices
+                                     // treated in the other functions.
+    matrix.clear_rows (constrained_rows, average_nonzero_diagonal_entry);
+
+                                     // the next thing is to set right hand
+                                     // side to the wanted value. there's one
+                                     // drawback: if we write to individual
+                                     // vector elements, then we have to do
+                                     // that on all processors. however, some
+                                     // processors may not need to set
+                                     // anything because their chunk of
+                                     // matrix/rhs do not contain any boundary
+                                     // nodes. therefore, rather than using
+                                     // individual calls, we use one call for
+                                     // all elements, thereby making sure that
+                                     // all processors call this function,
+                                     // even if some only have an empty set of
+                                     // elements to set
+    right_hand_side.compress ();
+    solution.compress ();
+
+    std::vector<unsigned int> indices;
+    std::vector<PetscScalar>  solution_values;
+    for (std::map<unsigned int,double>::const_iterator
+           dof  = boundary_values.begin();
+         dof != boundary_values.end();
+         ++dof)
+      if ((dof->first >= local_range.first) &&
+          (dof->first < local_range.second))
+        {
+          indices.push_back (dof->first);
+          solution_values.push_back (dof->second);
+        }
+    solution.set (indices, solution_values);
+
+                                     // now also set appropriate values for
+                                     // the rhs
+    for (unsigned int i=0; i<solution_values.size(); ++i)
+      solution_values[i] *= average_nonzero_diagonal_entry;
+
+    right_hand_side.set (indices, solution_values);
+
+                                     // clean up
+    matrix.compress ();
+    solution.compress ();
+    right_hand_side.compress ();
+  }
+}
+
 
-template
-void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension>
-(const Mapping<deal_II_dimension> &,
- const DoFHandler<deal_II_dimension>     &dof,
- const Quadrature<deal_II_dimension-1>   &q,
- SparseMatrix<double>      &matrix,
- const FunctionMap<deal_II_dimension>::type &rhs,
- Vector<double>            &rhs_vector,
- std::vector<unsigned int> &dof_to_boundary_mapping,
- const Function<deal_II_dimension> * const a,
- std::vector<unsigned int>);
 
-template
 void
-MatrixCreator::create_boundary_mass_matrix<deal_II_dimension>
-(const hp::MappingCollection<deal_II_dimension>&,
- const hp::DoFHandler<deal_II_dimension>&,
- const hp::QCollection<deal_II_dimension-1>&,
- SparseMatrix<double>&,
- const FunctionMap<deal_II_dimension>::type&,
- Vector<double>&,
- std::vector<unsigned int>&,
- const Function<deal_II_dimension> * const,
- std::vector<unsigned int>);
+MatrixTools::
+apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                       PETScWrappers::SparseMatrix   &matrix,
+                       PETScWrappers::Vector   &solution,
+                       PETScWrappers::Vector   &right_hand_side,
+                       const bool        eliminate_columns)
+{
+                                   // simply redirect to the generic function
+                                   // used for both petsc matrix types
+  PETScWrappers::apply_boundary_values (boundary_values, matrix, solution,
+                                        right_hand_side, eliminate_columns);
+}
 
-template
-void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension>&,
- const hp::QCollection<deal_II_dimension-1>&,
- SparseMatrix<double>&,
- const FunctionMap<deal_II_dimension>::type&,
- Vector<double>&,
- std::vector<unsigned int>&,
- const Function<deal_II_dimension> * const,
- std::vector<unsigned int>);
+
+
+void
+MatrixTools::
+apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                       PETScWrappers::MPI::SparseMatrix   &matrix,
+                       PETScWrappers::MPI::Vector   &solution,
+                       PETScWrappers::MPI::Vector   &right_hand_side,
+                       const bool        eliminate_columns)
+{
+                                   // simply redirect to the generic function
+                                   // used for both petsc matrix types
+  PETScWrappers::apply_boundary_values (boundary_values, matrix, solution,
+                                        right_hand_side, eliminate_columns);
+
+                                  // compress the matrix once we're done
+  matrix.compress ();  
+}
+
+
+void
+MatrixTools::
+apply_boundary_values (const std::map<unsigned int,double>  &boundary_values,
+                       PETScWrappers::MPI::BlockSparseMatrix  &matrix,
+                       PETScWrappers::MPI::BlockVector        &solution,
+                       PETScWrappers::MPI::BlockVector        &right_hand_side,
+                       const bool                            eliminate_columns)
+{
+  Assert (matrix.n() == right_hand_side.size(),
+          ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
+  Assert (matrix.n() == solution.size(),
+          ExcDimensionMismatch(matrix.n(), solution.size()));
+  Assert (matrix.n_block_rows() == matrix.n_block_cols(),
+          ExcNotQuadratic());
+
+  const unsigned int n_blocks = matrix.n_block_rows();
+
+  matrix.compress();
+
+                                   // We need to find the subdivision
+                                   // into blocks for the boundary values.
+                                   // To this end, generate a vector of
+                                   // maps with the respective indices.
+  std::vector<std::map<unsigned int,double> > block_boundary_values(n_blocks);
+  {
+    int offset = 0, block=0;
+    for (std::map<unsigned int,double>::const_iterator
+            dof  = boundary_values.begin();
+          dof != boundary_values.end();
+          ++dof)
+      {
+        if (dof->first >= matrix.block(block,0).m() + offset)
+          {
+            offset += matrix.block(block,0).m();
+            block++;
+          }
+        const unsigned int index = dof->first - offset;
+        block_boundary_values[block].insert(std::pair<unsigned int, double> (index,dof->second));
+      }
+  }
+
+                                   // Now call the non-block variants on
+                                   // the diagonal subblocks and the
+                                   // solution/rhs.
+  for (unsigned int block=0; block<n_blocks; ++block)
+    PETScWrappers::apply_boundary_values(block_boundary_values[block],
+                                         matrix.block(block,block),
+                                         solution.block(block),
+                                         right_hand_side.block(block),
+                                         eliminate_columns);
+
+                                  // Finally, we need to do something
+                                   // about the off-diagonal matrices. This
+                                   // is luckily not difficult. Just clear
+                                   // the whole row.
+  for (unsigned int block_m=0; block_m<n_blocks; ++block_m)
+    {
+      const std::pair<unsigned int, unsigned int> local_range
+        = matrix.block(block_m,0).local_range();
+
+      std::vector<unsigned int> constrained_rows;
+      for (std::map<unsigned int,double>::const_iterator
+            dof  = block_boundary_values[block_m].begin();
+          dof != block_boundary_values[block_m].end();
+          ++dof)
+        if ((dof->first >= local_range.first) &&
+            (dof->first < local_range.second))
+          constrained_rows.push_back (dof->first);
+
+      for (unsigned int block_n=0; block_n<n_blocks; ++block_n)
+        if (block_m != block_n)
+          matrix.block(block_m,block_n).clear_rows(constrained_rows);
+    }
+}
 
 #endif
 
 
-// non-hp versions of create_laplace_matrix
-template
-void MatrixCreator::create_laplace_matrix<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_laplace_matrix<deal_II_dimension>
-(const Mapping<deal_II_dimension>       &mapping,
- const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_laplace_matrix<deal_II_dimension>
-(const Mapping<deal_II_dimension>       &mapping,
- const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_laplace_matrix<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
-
-// hp versions of create_laplace_matrix
-template
-void MatrixCreator::create_laplace_matrix<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_laplace_matrix<deal_II_dimension>
-(const hp::MappingCollection<deal_II_dimension>       &mapping,
- const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_laplace_matrix<deal_II_dimension>
-(const hp::MappingCollection<deal_II_dimension>       &mapping,
- const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
-template
-void MatrixCreator::create_laplace_matrix<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension>    &dof,
- const hp::QCollection<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension> * const coefficient);
 
+#ifdef DEAL_II_USE_TRILINOS
 
+namespace TrilinosWrappers
+{
+  template <typename TrilinosMatrix, typename TrilinosVector>
+  void
+  apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                         TrilinosMatrix      &matrix,
+                         TrilinosVector      &solution,
+                         TrilinosVector      &right_hand_side,
+                         const bool           eliminate_columns)
+  {
+    Assert (eliminate_columns == false, ExcNotImplemented());
+
+    Assert (matrix.n() == right_hand_side.size(),
+            ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
+    Assert (matrix.n() == solution.size(),
+            ExcDimensionMismatch(matrix.m(), solution.size()));
+
+                                     // if no boundary values are to be applied
+                                     // simply return
+    if (boundary_values.size() == 0)
+      return;
+
+    const std::pair<unsigned int, unsigned int> local_range
+      = matrix.local_range();
+    Assert (local_range == right_hand_side.local_range(),
+            ExcInternalError());
+    Assert (local_range == solution.local_range(),
+            ExcInternalError());
+
+                                     // we have to read and write from this
+                                     // matrix (in this order). this will only
+                                     // work if we compress the matrix first,
+                                     // done here
+    matrix.compress ();
+
+                                     // determine the first nonzero diagonal
+                                     // entry from within the part of the
+                                     // matrix that we can see. if we can't
+                                     // find such an entry, take one
+    TrilinosScalar average_nonzero_diagonal_entry = 1;
+    for (unsigned int i=local_range.first; i<local_range.second; ++i)
+      if (matrix.diag_element(i) != 0)
+        {
+          average_nonzero_diagonal_entry = std::fabs(matrix.diag_element(i));
+          break;
+        }
+
+                                     // figure out which rows of the matrix we
+                                     // have to eliminate on this processor
+    std::vector<unsigned int> constrained_rows;
+    for (std::map<unsigned int,double>::const_iterator
+           dof  = boundary_values.begin();
+         dof != boundary_values.end();
+         ++dof)
+      if ((dof->first >= local_range.first) &&
+          (dof->first < local_range.second))
+        constrained_rows.push_back (dof->first);
+
+                                     // then eliminate these rows and
+                                     // set their diagonal entry to
+                                     // what we have determined
+                                     // above. if the value already is
+                                     // nonzero, it will be preserved,
+                                     // in accordance with the basic
+                                     // matrix classes in deal.II.
+    matrix.clear_rows (constrained_rows, average_nonzero_diagonal_entry);
+
+                                     // the next thing is to set right
+                                     // hand side to the wanted
+                                     // value. there's one drawback:
+                                     // if we write to individual
+                                     // vector elements, then we have
+                                     // to do that on all
+                                     // processors. however, some
+                                     // processors may not need to set
+                                     // anything because their chunk
+                                     // of matrix/rhs do not contain
+                                     // any boundary nodes. therefore,
+                                     // rather than using individual
+                                     // calls, we use one call for all
+                                     // elements, thereby making sure
+                                     // that all processors call this
+                                     // function, even if some only
+                                     // have an empty set of elements
+                                     // to set
+    right_hand_side.compress ();
+    solution.compress ();
+
+    std::vector<unsigned int> indices;
+    std::vector<TrilinosScalar>  solution_values;
+    for (std::map<unsigned int,double>::const_iterator
+           dof  = boundary_values.begin();
+         dof != boundary_values.end();
+         ++dof)
+      if ((dof->first >= local_range.first) &&
+          (dof->first < local_range.second))
+        {
+          indices.push_back (dof->first);
+          solution_values.push_back (dof->second);
+        }
+    solution.set (indices, solution_values);
+
+                                     // now also set appropriate
+                                     // values for the rhs
+    for (unsigned int i=0; i<solution_values.size(); ++i)
+      solution_values[i] *= matrix.diag_element(indices[i]);
+
+    right_hand_side.set (indices, solution_values);
+
+                                     // clean up
+    matrix.compress ();
+    solution.compress ();
+    right_hand_side.compress ();
+  }
 
-#if deal_II_dimension != 3
 
-// non-hp version of create_mass_matrix
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension,double,deal_II_dimension+1>
-(const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
- const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension+1> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension,double,deal_II_dimension+1>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension+1> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension,double,deal_II_dimension+1>
-(const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
- const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension+1>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension+1> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension,double,deal_II_dimension+1>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<double>     &matrix,
- const Function<deal_II_dimension+1>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension+1> * const coefficient);
 
+  template <typename TrilinosMatrix, typename TrilinosBlockVector>
+  void
+  apply_block_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                              TrilinosMatrix      &matrix,
+                              TrilinosBlockVector &solution,
+                              TrilinosBlockVector &right_hand_side,
+                              const bool          eliminate_columns)
+  {
+    Assert (eliminate_columns == false, ExcNotImplemented());
+
+    Assert (matrix.n() == right_hand_side.size(),
+           ExcDimensionMismatch(matrix.n(), right_hand_side.size()));
+    Assert (matrix.n() == solution.size(),
+           ExcDimensionMismatch(matrix.n(), solution.size()));
+    Assert (matrix.n_block_rows() == matrix.n_block_cols(),
+           ExcNotQuadratic());
+  
+    const unsigned int n_blocks = matrix.n_block_rows();
+
+    matrix.compress();
+
+                                  // We need to find the subdivision
+                                  // into blocks for the boundary values.
+                                  // To this end, generate a vector of
+                                  // maps with the respective indices.
+    std::vector<std::map<unsigned int,double> > block_boundary_values(n_blocks);
+    {
+      int offset = 0, block=0;
+      for (std::map<unsigned int,double>::const_iterator
+            dof  = boundary_values.begin();
+          dof != boundary_values.end();
+          ++dof)
+       {
+         if (dof->first >= matrix.block(block,0).m() + offset)
+           {
+             offset += matrix.block(block,0).m();
+             block++;
+           }
+         const unsigned int index = dof->first - offset;
+         block_boundary_values[block].insert(
+            std::pair<unsigned int, double> (index,dof->second));
+       }
+    }
+  
+                                  // Now call the non-block variants on
+                                  // the diagonal subblocks and the
+                                  // solution/rhs.
+    for (unsigned int block=0; block<n_blocks; ++block)
+      TrilinosWrappers::apply_boundary_values(block_boundary_values[block],
+                                             matrix.block(block,block),
+                                             solution.block(block),
+                                             right_hand_side.block(block),
+                                             eliminate_columns);
+  
+                                  // Finally, we need to do something 
+                                  // about the off-diagonal matrices. This
+                                  // is luckily not difficult. Just clear
+                                  // the whole row.
+    for (unsigned int block_m=0; block_m<n_blocks; ++block_m)
+      {
+       const std::pair<unsigned int, unsigned int> local_range
+         = matrix.block(block_m,0).local_range();
+      
+       std::vector<unsigned int> constrained_rows;
+       for (std::map<unsigned int,double>::const_iterator
+              dof  = block_boundary_values[block_m].begin();
+            dof != block_boundary_values[block_m].end();
+            ++dof)
+         if ((dof->first >= local_range.first) &&
+             (dof->first < local_range.second))
+           constrained_rows.push_back (dof->first);
+  
+       for (unsigned int block_n=0; block_n<n_blocks; ++block_n)
+         if (block_m != block_n)
+           matrix.block(block_m,block_n).clear_rows(constrained_rows);
+      }
+  }
+
+}
 
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension,float,deal_II_dimension+1>
-(const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
- const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension+1> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension,float,deal_II_dimension+1>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension+1> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension,float,deal_II_dimension+1>
-(const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
- const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension+1>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension+1> * const coefficient);
-template
-void MatrixCreator::create_mass_matrix<deal_II_dimension,float,deal_II_dimension+1>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
- const Quadrature<deal_II_dimension>    &q,
- SparseMatrix<float>     &matrix,
- const Function<deal_II_dimension+1>      &rhs,
- Vector<double>           &rhs_vector,
- const Function<deal_II_dimension+1> * const coefficient);
 
-#if deal_II_dimension == 2
 
-template
-void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension,deal_II_dimension+1>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1>     &dof,
- const Quadrature<deal_II_dimension-1>   &q,
- SparseMatrix<double>      &matrix,
- const FunctionMap<deal_II_dimension+1>::type &rhs,
- Vector<double>            &rhs_vector,
- std::vector<unsigned int> &dof_to_boundary_mapping,
- const Function<deal_II_dimension+1> * const a,
- std::vector<unsigned int>);
+void
+MatrixTools::
+apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                       TrilinosWrappers::SparseMatrix   &matrix,
+                       TrilinosWrappers::Vector         &solution,
+                       TrilinosWrappers::Vector         &right_hand_side,
+                       const bool        eliminate_columns)
+{
+                                   // simply redirect to the generic function
+                                   // used for both trilinos matrix types
+  TrilinosWrappers::apply_boundary_values (boundary_values, matrix, solution,
+                                        right_hand_side, eliminate_columns);
+}
 
-template
-void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension,deal_II_dimension+1>
-(const Mapping<deal_II_dimension,deal_II_dimension+1> &,
- const DoFHandler<deal_II_dimension,deal_II_dimension+1>     &dof,
- const Quadrature<deal_II_dimension-1>   &q,
- SparseMatrix<double>      &matrix,
- const FunctionMap<deal_II_dimension+1>::type &rhs,
- Vector<double>            &rhs_vector,
- std::vector<unsigned int> &dof_to_boundary_mapping,
- const Function<deal_II_dimension+1> * const a,
- std::vector<unsigned int>);
 
-#endif
 
-// #if deal_II_dimension != 1
-// template
-// void
-// MatrixCreator::create_boundary_mass_matrix<deal_II_dimension,deal_II_dimension+1>
-// (const Mapping<deal_II_dimension,deal_II_dimension+1>        &mapping,
-//  const DoFHandler<deal_II_dimension,deal_II_dimension+1>     &dof,
-//  const Quadrature<deal_II_dimension-1>   &q,
-//  SparseMatrix<double>      &matrix,
-//  const FunctionMap<deal_II_dimension+1>::type         &boundary_functions,
-//  Vector<double>            &rhs_vector,
-//  std::vector<unsigned int> &dof_to_boundary_mapping,
-//  const Function<deal_II_dimension+1> * const a,
-//  std::vector<unsigned int> &component_mapping);
-// #endif
-
-// template
-// void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension,deal_II_dimension+1>
-// (const DoFHandler<deal_II_dimension,deal_II_dimension+1>     &dof,
-//  const Quadrature<deal_II_dimension-1>   &q,
-//  SparseMatrix<double>      &matrix,
-//  const FunctionMap<deal_II_dimension+1>::type &rhs,
-//  Vector<double>            &rhs_vector,
-//  std::vector<unsigned int> &dof_to_boundary_mapping,
-//  const Function<deal_II_dimension+1> * const a,
-//  std::vector<unsigned int> &component_mapping);
-
-
-// // non-hp version of create_mass_matrix
-// template
-// void MatrixCreator::create_mass_matrix
-// (const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
-//  const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
-//  const Quadrature<deal_II_dimension>    &q,
-//  SparseMatrix<double>     &matrix,
-//  const Function<deal_II_dimension+1> * const coefficient);
-// template
-// void MatrixCreator::create_mass_matrix
-// (const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
-//  const Quadrature<deal_II_dimension>    &q,
-//  SparseMatrix<double>     &matrix,
-//  const Function<deal_II_dimension+1> * const coefficient);
-// template
-// void MatrixCreator::create_mass_matrix
-// (const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
-//  const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
-//  const Quadrature<deal_II_dimension>    &q,
-//  SparseMatrix<double>     &matrix,
-//  const Function<deal_II_dimension+1>      &rhs,
-//  Vector<double>           &rhs_vector,
-//  const Function<deal_II_dimension+1> * const coefficient);
-// template
-// void MatrixCreator::create_mass_matrix
-// (const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
-//  const Quadrature<deal_II_dimension>    &q,
-//  SparseMatrix<double>     &matrix,
-//  const Function<deal_II_dimension+1>      &rhs,
-//  Vector<double>           &rhs_vector,
-//  const Function<deal_II_dimension+1> * const coefficient);
-
-
-// template
-// void MatrixCreator::create_mass_matrix
-// (const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
-//  const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
-//  const Quadrature<deal_II_dimension>    &q,
-//  SparseMatrix<float>     &matrix,
-//  const Function<deal_II_dimension+1> * const coefficient);
-// template
-// void MatrixCreator::create_mass_matrix
-// (const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
-//  const Quadrature<deal_II_dimension>    &q,
-//  SparseMatrix<float>     &matrix,
-//  const Function<deal_II_dimension+1> * const coefficient);
-// template
-// void MatrixCreator::create_mass_matrix
-// (const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
-//  const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
-//  const Quadrature<deal_II_dimension>    &q,
-//  SparseMatrix<float>     &matrix,
-//  const Function<deal_II_dimension+1>      &rhs,
-//  Vector<double>           &rhs_vector,
-//  const Function<deal_II_dimension+1> * const coefficient);
-// template
-// void MatrixCreator::create_mass_matrix
-// (const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
-//  const Quadrature<deal_II_dimension>    &q,
-//  SparseMatrix<float>     &matrix,
-//  const Function<deal_II_dimension+1>      &rhs,
-//  Vector<double>           &rhs_vector,
-//  const Function<deal_II_dimension+1> * const coefficient);
+void
+MatrixTools::
+apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                       TrilinosWrappers::SparseMatrix   &matrix,
+                       TrilinosWrappers::MPI::Vector    &solution,
+                       TrilinosWrappers::MPI::Vector    &right_hand_side,
+                       const bool        eliminate_columns)
+{
+                                   // simply redirect to the generic function
+                                   // used for both trilinos matrix types
+  TrilinosWrappers::apply_boundary_values (boundary_values, matrix, solution,
+                                          right_hand_side, eliminate_columns);
+}
 
 
+
+void
+MatrixTools::
+apply_boundary_values (const std::map<unsigned int,double>  &boundary_values,
+                       TrilinosWrappers::BlockSparseMatrix  &matrix,
+                       TrilinosWrappers::BlockVector        &solution,
+                       TrilinosWrappers::BlockVector        &right_hand_side,
+                       const bool                            eliminate_columns)
+{
+  TrilinosWrappers::apply_block_boundary_values (boundary_values, matrix, 
+                                                solution, right_hand_side, 
+                                                eliminate_columns);
+}
+
+
+
+void
+MatrixTools::
+apply_boundary_values (const std::map<unsigned int,double>  &boundary_values,
+                       TrilinosWrappers::BlockSparseMatrix  &matrix,
+                       TrilinosWrappers::MPI::BlockVector   &solution,
+                       TrilinosWrappers::MPI::BlockVector   &right_hand_side,
+                       const bool                            eliminate_columns)
+{
+  TrilinosWrappers::apply_block_boundary_values (boundary_values, matrix, 
+                                                solution, right_hand_side, 
+                                                eliminate_columns);
+}
+
 #endif
 
+
+
+void
+MatrixTools::
+local_apply_boundary_values (const std::map<unsigned int,double> &boundary_values,
+                             const std::vector<unsigned int> &local_dof_indices,
+                             FullMatrix<double> &local_matrix,
+                             Vector<double>     &local_rhs,
+                             const bool          eliminate_columns)
+{
+  Assert (local_dof_indices.size() == local_matrix.m(),
+          ExcDimensionMismatch(local_dof_indices.size(),
+                               local_matrix.m()));
+  Assert (local_dof_indices.size() == local_matrix.n(),
+          ExcDimensionMismatch(local_dof_indices.size(),
+                               local_matrix.n()));
+  Assert (local_dof_indices.size() == local_rhs.size(),
+          ExcDimensionMismatch(local_dof_indices.size(),
+                               local_rhs.size()));
+
+                                   // if there is nothing to do, then exit
+                                   // right away
+  if (boundary_values.size() == 0)
+    return;
+
+                                   // otherwise traverse all the dofs used in
+                                   // the local matrices and vectors and see
+                                   // what's there to do
+
+                                   // if we need to treat an entry, then we
+                                   // set the diagonal entry to its absolute
+                                   // value. if it is zero, we used to set it
+                                   // to one, which is a really terrible
+                                   // choice that can lead to hours of
+                                   // searching for bugs in programs (I
+                                   // experienced this :-( ) if the matrix
+                                   // entries are otherwise very large. this
+                                   // is so since iterative solvers would
+                                   // simply not correct boundary nodes for
+                                   // their correct values since the residual
+                                   // contributions of their rows of the
+                                   // linear system is almost zero if the
+                                   // diagonal entry is one. thus, set it to
+                                   // the average absolute value of the
+                                   // nonzero diagonal elements.
+                                   //
+                                   // we only compute this value lazily the
+                                   // first time we need it.
+  double average_diagonal = 0;
+  const unsigned int n_local_dofs = local_dof_indices.size();
+  for (unsigned int i=0; i<n_local_dofs; ++i)
+    {
+      const std::map<unsigned int, double>::const_iterator
+        boundary_value = boundary_values.find (local_dof_indices[i]);
+      if (boundary_value != boundary_values.end())
+        {
+                                           // remove this row, except for the
+                                           // diagonal element
+          for (unsigned j=0; j<n_local_dofs; ++j)
+            if (i != j)
+              local_matrix(i,j) = 0;
+
+                                           // replace diagonal entry by its
+                                           // absolute value to make sure that
+                                           // everything remains positive, or
+                                           // by the average diagonal value if
+                                           // zero
+          if (local_matrix(i,i) == 0.)
+            {
+                                               // if average diagonal hasn't
+                                               // yet been computed, do so now
+              if (average_diagonal == 0.)
+                {
+                  unsigned int nonzero_diagonals = 0;
+                  for (unsigned int k=0; k<n_local_dofs; ++k)
+                    if (local_matrix(k,k) != 0.)
+                      {
+                        average_diagonal += std::fabs(local_matrix(k,k));
+                        ++nonzero_diagonals;
+                      }
+                  if (nonzero_diagonals != 0)
+                    average_diagonal /= nonzero_diagonals;
+                  else
+                    average_diagonal = 0;
+                }
+
+                                               // only if all diagonal entries
+                                               // are zero, then resort to the
+                                               // last measure: choose one
+              if (average_diagonal == 0.)
+                average_diagonal = 1.;
+
+              local_matrix(i,i) = average_diagonal;
+            }
+          else
+            local_matrix(i,i) = std::fabs(local_matrix(i,i));
+          
+                                           // and replace rhs entry by correct
+                                           // value
+          local_rhs(i) = local_matrix(i,i) * boundary_value->second;
+
+                                           // finally do the elimination step
+                                           // if requested
+          if (eliminate_columns == true)
+            {
+              for (unsigned int row=0; row<n_local_dofs; ++row)
+                if (row != i)
+                  {
+                    local_rhs(row) -= local_matrix(row,i) * boundary_value->second;
+                    local_matrix(row,i) = 0;
+                  }
+            }
+        }
+    }
+}
+
+
+
+// explicit instantiations
+#include "matrices.inst"
+
+template
+void
+MatrixTools::apply_boundary_values<double> (const std::map<unsigned int,double> &boundary_values,
+                                           SparseMatrix<double>  &matrix,
+                                           Vector<double>   &solution,
+                                           Vector<double>   &right_hand_side,
+                                           const bool        eliminate_columns);
+template
+void
+MatrixTools::apply_boundary_values<float> (const std::map<unsigned int,double> &boundary_values,
+                                          SparseMatrix<float>  &matrix,
+                                          Vector<float>   &solution,
+                                          Vector<float>   &right_hand_side,
+                                          const bool        eliminate_columns);
+
+template
+void
+MatrixTools::apply_boundary_values<double> (const std::map<unsigned int,double> &boundary_values,
+                                           BlockSparseMatrix<double>  &matrix,
+                                           BlockVector<double>   &solution,
+                                           BlockVector<double>   &right_hand_side,
+                                           const bool        eliminate_columns);
+template
+void
+MatrixTools::apply_boundary_values<float> (const std::map<unsigned int,double> &boundary_values,
+                                          BlockSparseMatrix<float>  &matrix,
+                                          BlockVector<float>   &solution,
+                                          BlockVector<float>   &right_hand_side,
+                                          const bool        eliminate_columns);
+
+
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/numerics/matrices.inst.in b/deal.II/source/numerics/matrices.inst.in
new file mode 100644 (file)
index 0000000..c6f0071
--- /dev/null
@@ -0,0 +1,450 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+// non-hp version of create_mass_matrix
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const Mapping<deal_II_dimension>       &mapping,
+ const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const Mapping<deal_II_dimension>       &mapping,
+ const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+
+
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const Mapping<deal_II_dimension>       &mapping,
+ const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const Mapping<deal_II_dimension>       &mapping,
+ const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+
+// hp versions of functions
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const hp::MappingCollection<deal_II_dimension>       &mapping,
+ const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const hp::MappingCollection<deal_II_dimension>       &mapping,
+ const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+
+
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const hp::MappingCollection<deal_II_dimension>       &mapping,
+ const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const hp::MappingCollection<deal_II_dimension>       &mapping,
+ const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+
+
+#if deal_II_dimension != 1
+
+template
+void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>     &dof,
+ const Quadrature<deal_II_dimension-1>   &q,
+ SparseMatrix<double>      &matrix,
+ const FunctionMap<deal_II_dimension>::type &rhs,
+ Vector<double>            &rhs_vector,
+ std::vector<unsigned int> &dof_to_boundary_mapping,
+ const Function<deal_II_dimension> * const a,
+ std::vector<unsigned int>);
+
+template
+void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension>
+(const Mapping<deal_II_dimension> &,
+ const DoFHandler<deal_II_dimension>     &dof,
+ const Quadrature<deal_II_dimension-1>   &q,
+ SparseMatrix<double>      &matrix,
+ const FunctionMap<deal_II_dimension>::type &rhs,
+ Vector<double>            &rhs_vector,
+ std::vector<unsigned int> &dof_to_boundary_mapping,
+ const Function<deal_II_dimension> * const a,
+ std::vector<unsigned int>);
+
+template
+void
+MatrixCreator::create_boundary_mass_matrix<deal_II_dimension>
+(const hp::MappingCollection<deal_II_dimension>&,
+ const hp::DoFHandler<deal_II_dimension>&,
+ const hp::QCollection<deal_II_dimension-1>&,
+ SparseMatrix<double>&,
+ const FunctionMap<deal_II_dimension>::type&,
+ Vector<double>&,
+ std::vector<unsigned int>&,
+ const Function<deal_II_dimension> * const,
+ std::vector<unsigned int>);
+
+template
+void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension>&,
+ const hp::QCollection<deal_II_dimension-1>&,
+ SparseMatrix<double>&,
+ const FunctionMap<deal_II_dimension>::type&,
+ Vector<double>&,
+ std::vector<unsigned int>&,
+ const Function<deal_II_dimension> * const,
+ std::vector<unsigned int>);
+
+#endif
+
+
+// non-hp versions of create_laplace_matrix
+template
+void MatrixCreator::create_laplace_matrix<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_laplace_matrix<deal_II_dimension>
+(const Mapping<deal_II_dimension>       &mapping,
+ const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_laplace_matrix<deal_II_dimension>
+(const Mapping<deal_II_dimension>       &mapping,
+ const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_laplace_matrix<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+
+// hp versions of create_laplace_matrix
+template
+void MatrixCreator::create_laplace_matrix<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_laplace_matrix<deal_II_dimension>
+(const hp::MappingCollection<deal_II_dimension>       &mapping,
+ const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_laplace_matrix<deal_II_dimension>
+(const hp::MappingCollection<deal_II_dimension>       &mapping,
+ const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+template
+void MatrixCreator::create_laplace_matrix<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension>    &dof,
+ const hp::QCollection<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension> * const coefficient);
+
+
+
+#if deal_II_dimension != 3
+
+// non-hp version of create_mass_matrix
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension,double,deal_II_dimension+1>
+(const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
+ const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension+1> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension,double,deal_II_dimension+1>
+(const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension+1> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension,double,deal_II_dimension+1>
+(const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
+ const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension+1>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension+1> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension,double,deal_II_dimension+1>
+(const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<double>     &matrix,
+ const Function<deal_II_dimension+1>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension+1> * const coefficient);
+
+
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension,float,deal_II_dimension+1>
+(const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
+ const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension+1> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension,float,deal_II_dimension+1>
+(const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension+1> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension,float,deal_II_dimension+1>
+(const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
+ const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension+1>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension+1> * const coefficient);
+template
+void MatrixCreator::create_mass_matrix<deal_II_dimension,float,deal_II_dimension+1>
+(const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+ const Quadrature<deal_II_dimension>    &q,
+ SparseMatrix<float>     &matrix,
+ const Function<deal_II_dimension+1>      &rhs,
+ Vector<double>           &rhs_vector,
+ const Function<deal_II_dimension+1> * const coefficient);
+
+#if deal_II_dimension == 2
+
+template
+void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension,deal_II_dimension+1>
+(const DoFHandler<deal_II_dimension,deal_II_dimension+1>     &dof,
+ const Quadrature<deal_II_dimension-1>   &q,
+ SparseMatrix<double>      &matrix,
+ const FunctionMap<deal_II_dimension+1>::type &rhs,
+ Vector<double>            &rhs_vector,
+ std::vector<unsigned int> &dof_to_boundary_mapping,
+ const Function<deal_II_dimension+1> * const a,
+ std::vector<unsigned int>);
+
+template
+void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension,deal_II_dimension+1>
+(const Mapping<deal_II_dimension,deal_II_dimension+1> &,
+ const DoFHandler<deal_II_dimension,deal_II_dimension+1>     &dof,
+ const Quadrature<deal_II_dimension-1>   &q,
+ SparseMatrix<double>      &matrix,
+ const FunctionMap<deal_II_dimension+1>::type &rhs,
+ Vector<double>            &rhs_vector,
+ std::vector<unsigned int> &dof_to_boundary_mapping,
+ const Function<deal_II_dimension+1> * const a,
+ std::vector<unsigned int>);
+
+#endif
+
+// #if deal_II_dimension != 1
+// template
+// void
+// MatrixCreator::create_boundary_mass_matrix<deal_II_dimension,deal_II_dimension+1>
+// (const Mapping<deal_II_dimension,deal_II_dimension+1>        &mapping,
+//  const DoFHandler<deal_II_dimension,deal_II_dimension+1>     &dof,
+//  const Quadrature<deal_II_dimension-1>   &q,
+//  SparseMatrix<double>      &matrix,
+//  const FunctionMap<deal_II_dimension+1>::type         &boundary_functions,
+//  Vector<double>            &rhs_vector,
+//  std::vector<unsigned int> &dof_to_boundary_mapping,
+//  const Function<deal_II_dimension+1> * const a,
+//  std::vector<unsigned int> &component_mapping);
+// #endif
+
+// template
+// void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension,deal_II_dimension+1>
+// (const DoFHandler<deal_II_dimension,deal_II_dimension+1>     &dof,
+//  const Quadrature<deal_II_dimension-1>   &q,
+//  SparseMatrix<double>      &matrix,
+//  const FunctionMap<deal_II_dimension+1>::type &rhs,
+//  Vector<double>            &rhs_vector,
+//  std::vector<unsigned int> &dof_to_boundary_mapping,
+//  const Function<deal_II_dimension+1> * const a,
+//  std::vector<unsigned int> &component_mapping);
+
+
+// // non-hp version of create_mass_matrix
+// template
+// void MatrixCreator::create_mass_matrix
+// (const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
+//  const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+//  const Quadrature<deal_II_dimension>    &q,
+//  SparseMatrix<double>     &matrix,
+//  const Function<deal_II_dimension+1> * const coefficient);
+// template
+// void MatrixCreator::create_mass_matrix
+// (const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+//  const Quadrature<deal_II_dimension>    &q,
+//  SparseMatrix<double>     &matrix,
+//  const Function<deal_II_dimension+1> * const coefficient);
+// template
+// void MatrixCreator::create_mass_matrix
+// (const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
+//  const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+//  const Quadrature<deal_II_dimension>    &q,
+//  SparseMatrix<double>     &matrix,
+//  const Function<deal_II_dimension+1>      &rhs,
+//  Vector<double>           &rhs_vector,
+//  const Function<deal_II_dimension+1> * const coefficient);
+// template
+// void MatrixCreator::create_mass_matrix
+// (const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+//  const Quadrature<deal_II_dimension>    &q,
+//  SparseMatrix<double>     &matrix,
+//  const Function<deal_II_dimension+1>      &rhs,
+//  Vector<double>           &rhs_vector,
+//  const Function<deal_II_dimension+1> * const coefficient);
+
+
+// template
+// void MatrixCreator::create_mass_matrix
+// (const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
+//  const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+//  const Quadrature<deal_II_dimension>    &q,
+//  SparseMatrix<float>     &matrix,
+//  const Function<deal_II_dimension+1> * const coefficient);
+// template
+// void MatrixCreator::create_mass_matrix
+// (const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+//  const Quadrature<deal_II_dimension>    &q,
+//  SparseMatrix<float>     &matrix,
+//  const Function<deal_II_dimension+1> * const coefficient);
+// template
+// void MatrixCreator::create_mass_matrix
+// (const Mapping<deal_II_dimension,deal_II_dimension+1>       &mapping,
+//  const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+//  const Quadrature<deal_II_dimension>    &q,
+//  SparseMatrix<float>     &matrix,
+//  const Function<deal_II_dimension+1>      &rhs,
+//  Vector<double>           &rhs_vector,
+//  const Function<deal_II_dimension+1> * const coefficient);
+// template
+// void MatrixCreator::create_mass_matrix
+// (const DoFHandler<deal_II_dimension,deal_II_dimension+1>    &dof,
+//  const Quadrature<deal_II_dimension>    &q,
+//  SparseMatrix<float>     &matrix,
+//  const Function<deal_II_dimension+1>      &rhs,
+//  Vector<double>           &rhs_vector,
+//  const Function<deal_II_dimension+1> * const coefficient);
+
+
+#endif
+}
+
index 44fe4ad0c8dbf3988b7d7dccbaf879e98bdcd658..229e3a088ee80d61e64530583b538c4f50b8abfa 100644 (file)
 
 DEAL_II_NAMESPACE_OPEN
 
-
-namespace MeshWorker
-{
-  template class IntegrationInfo<deal_II_dimension, deal_II_dimension>;
-  template class IntegrationInfoBox<deal_II_dimension, deal_II_dimension>;
-
-  template class DoFInfo<deal_II_dimension,deal_II_dimension,float>;
-  template class DoFInfoBox<deal_II_dimension,
-                           DoFInfo<deal_II_dimension,deal_II_dimension,float> >;
-
-  template void IntegrationInfo<deal_II_dimension>::fill_local_data(
-    const DoFInfo<deal_II_dimension, deal_II_dimension, float>&, bool);
-
-  template class DoFInfo<deal_II_dimension,deal_II_dimension,double>;
-  template class DoFInfoBox<deal_II_dimension,
-                           DoFInfo<deal_II_dimension,deal_II_dimension,double> >;
-
-  template void IntegrationInfo<deal_II_dimension>::fill_local_data(
-    const DoFInfo<deal_II_dimension, deal_II_dimension, double>&, bool);
-
-//   template void IntegrationInfo<deal_II_dimension>
-//   ::initialize<FEValues<deal_II_dimension> >(
-//     const FiniteElement<deal_II_dimension>&, const Mapping<deal_II_dimension>&,
-//     const Quadrature<FEValues<deal_II_dimension>::integral_dimension>&, const UpdateFlags, const BlockInfo*);
-//   template void IntegrationInfo<deal_II_dimension>
-//   ::initialize<FEFaceValues<deal_II_dimension> >(
-//     const FiniteElement<deal_II_dimension>&, const Mapping<deal_II_dimension>&,
-//     const Quadrature<FEFaceValues<deal_II_dimension>::integral_dimension>&, const UpdateFlags, const BlockInfo*);
-//   template void IntegrationInfo<deal_II_dimension>
-//   ::initialize<FESubfaceValues<deal_II_dimension> >(
-//     const FiniteElement<deal_II_dimension>&, const Mapping<deal_II_dimension>&,
-//     const Quadrature<FESubfaceValues<deal_II_dimension>::integral_dimension>&, const UpdateFlags, const BlockInfo*);
-}
+// explicit instantiations
+#include "mesh_worker_info.inst"
 
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/numerics/mesh_worker_info.inst.in b/deal.II/source/numerics/mesh_worker_info.inst.in
new file mode 100644 (file)
index 0000000..92f6d95
--- /dev/null
@@ -0,0 +1,48 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+namespace MeshWorker
+\{
+  template class IntegrationInfo<deal_II_dimension, deal_II_dimension>;
+  template class IntegrationInfoBox<deal_II_dimension, deal_II_dimension>;
+
+  template class DoFInfo<deal_II_dimension,deal_II_dimension,float>;
+  template class DoFInfoBox<deal_II_dimension,
+                           DoFInfo<deal_II_dimension,deal_II_dimension,float> >;
+
+  template void IntegrationInfo<deal_II_dimension>::fill_local_data(
+    const DoFInfo<deal_II_dimension, deal_II_dimension, float>&, bool);
+
+  template class DoFInfo<deal_II_dimension,deal_II_dimension,double>;
+  template class DoFInfoBox<deal_II_dimension,
+                           DoFInfo<deal_II_dimension,deal_II_dimension,double> >;
+
+  template void IntegrationInfo<deal_II_dimension>::fill_local_data(
+    const DoFInfo<deal_II_dimension, deal_II_dimension, double>&, bool);
+
+//   template void IntegrationInfo<deal_II_dimension>
+//   ::initialize<FEValues<deal_II_dimension> >(
+//     const FiniteElement<deal_II_dimension>&, const Mapping<deal_II_dimension>&,
+//     const Quadrature<FEValues<deal_II_dimension>::integral_dimension>&, const UpdateFlags, const BlockInfo*);
+//   template void IntegrationInfo<deal_II_dimension>
+//   ::initialize<FEFaceValues<deal_II_dimension> >(
+//     const FiniteElement<deal_II_dimension>&, const Mapping<deal_II_dimension>&,
+//     const Quadrature<FEFaceValues<deal_II_dimension>::integral_dimension>&, const UpdateFlags, const BlockInfo*);
+//   template void IntegrationInfo<deal_II_dimension>
+//   ::initialize<FESubfaceValues<deal_II_dimension> >(
+//     const FiniteElement<deal_II_dimension>&, const Mapping<deal_II_dimension>&,
+//     const Quadrature<FESubfaceValues<deal_II_dimension>::integral_dimension>&, const UpdateFlags, const BlockInfo*);
+\}
+}
index 90c2b126421077eaa0257ae2fdcc49ec832ac207..2c7424c7a22513519b1ce8c9c50fa15de9696308 100644 (file)
 
 DEAL_II_NAMESPACE_OPEN
 
-namespace MeshWorker
-{
-  template class VectorDataBase<deal_II_dimension>;
-
 #include "mesh_worker_vector_selector.inst"
-}
-
 
 
 DEAL_II_NAMESPACE_CLOSE
index 743ef908ceb5b4d157f6a4d19b7e0f6f056dc195..02c033d7205fe14f4f9796e418d75f1e51c03e94 100644 (file)
 //---------------------------------------------------------------------------
 
 
-for (VECTOR : SERIAL_VECTORS)
+for (deal_II_dimension : DIMENSIONS)
 {
-  template class VectorData<VECTOR,deal_II_dimension>;
-  template class MGVectorData<VECTOR,deal_II_dimension>;
+  namespace MeshWorker
+  \{
+    template class VectorDataBase<deal_II_dimension>;
+  \}
+}
+
+for (VECTOR : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS)
+{
+  namespace MeshWorker
+  \{
+    template class VectorData<VECTOR,deal_II_dimension>;
+    template class MGVectorData<VECTOR,deal_II_dimension>;
+  \}
 }
index 631ec8e98387e6bb9c60000feffacbdda4d7e2ed..536d4db14798d7365c1e08892ad2b494b1beefc8 100644 (file)
@@ -11,7 +11,7 @@
 //
 //---------------------------------------------------------------------------
 
-for (VEC : SERIAL_VECTORS)
+for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS)
 {  
   template class DoFOutputOperator<VEC, deal_II_dimension, deal_II_dimension>;
 }
index 621f4f3179d3e68566a1e7b64f972857996e7d00..3a7fd9a253ef788c9d235957bf3fabbfe6080738 100644 (file)
@@ -23,7 +23,6 @@
 
 DEAL_II_NAMESPACE_OPEN
 
-#include "point_value_history.inst"
 
 namespace internal
 {
@@ -788,8 +787,9 @@ bool PointValueHistory<dim>
 }
 
 
+
 // explicit instantiations
-template class PointValueHistory<deal_II_dimension>;
+#include "point_value_history.inst"
 
 
 DEAL_II_NAMESPACE_CLOSE
index 7d1fcd96d9eb62ce63963324429c8a8563991b92..92625c0d72229bc0441111d49eadb4943853a25b 100644 (file)
 //
 //---------------------------------------------------------------------------
 
-for (VEC : SERIAL_VECTORS)
+
+for (deal_II_dimension : DIMENSIONS)
+{
+  template class PointValueHistory<deal_II_dimension>;
+}
+
+
+for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS)
 {  
   template
   void PointValueHistory<deal_II_dimension>::evaluate_field 
index ceddc927c3f6dfa3453f047ab6158b04a953dfe6..0186b349e06665a142b2f98bd5dbf8ee60bbbbb4 100644 (file)
@@ -441,44 +441,7 @@ SolutionTransfer<dim, VECTOR, DH>::Pointerstruct::memory_consumption () const
 
 
 
-template class SolutionTransfer<deal_II_dimension, Vector<float>, DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, Vector<double>, DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, Vector<float>, hp::DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, Vector<double>, hp::DoFHandler<deal_II_dimension> >;
-
-template class SolutionTransfer<deal_II_dimension, BlockVector<float>, DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, BlockVector<double>, DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, BlockVector<float>, hp::DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, BlockVector<double>, hp::DoFHandler<deal_II_dimension> >;
-
-
-#ifdef DEAL_II_USE_PETSC
-template class SolutionTransfer<deal_II_dimension, PETScWrappers::Vector, DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, PETScWrappers::Vector, hp::DoFHandler<deal_II_dimension> >;
-
-template class SolutionTransfer<deal_II_dimension, PETScWrappers::BlockVector, DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, PETScWrappers::BlockVector, hp::DoFHandler<deal_II_dimension> >;
-#endif
-
-#ifdef DEAL_II_USE_TRILINOS
-template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::Vector, DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::Vector, hp::DoFHandler<deal_II_dimension> >;
-
-template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::BlockVector, DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::BlockVector, hp::DoFHandler<deal_II_dimension> >;
-
-template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::Vector, DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::Vector, hp::DoFHandler<deal_II_dimension> >;
-
-template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::BlockVector, DoFHandler<deal_II_dimension> >;
-template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::BlockVector, hp::DoFHandler<deal_II_dimension> >;
-#endif
-
-#if deal_II_dimension < 3
-template class SolutionTransfer<deal_II_dimension, Vector<double>, DoFHandler<deal_II_dimension, deal_II_dimension+1> >;
-template class SolutionTransfer<deal_II_dimension, BlockVector<double>, hp::DoFHandler<deal_II_dimension, deal_II_dimension+1> >;
-
-#endif
-/*----------------------------   solution_transfer.cc     ----------------------*/
+/*-------------- Explicit Instantiations -------------------------------*/
+#include "solution_transfer.inst"
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/numerics/solution_transfer.inst.in b/deal.II/source/numerics/solution_transfer.inst.in
new file mode 100644 (file)
index 0000000..625603e
--- /dev/null
@@ -0,0 +1,54 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+template class SolutionTransfer<deal_II_dimension, Vector<float>, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, Vector<double>, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, Vector<float>, hp::DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, Vector<double>, hp::DoFHandler<deal_II_dimension> >;
+
+template class SolutionTransfer<deal_II_dimension, BlockVector<float>, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, BlockVector<double>, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, BlockVector<float>, hp::DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, BlockVector<double>, hp::DoFHandler<deal_II_dimension> >;
+
+
+#ifdef DEAL_II_USE_PETSC
+template class SolutionTransfer<deal_II_dimension, PETScWrappers::Vector, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, PETScWrappers::Vector, hp::DoFHandler<deal_II_dimension> >;
+
+template class SolutionTransfer<deal_II_dimension, PETScWrappers::BlockVector, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, PETScWrappers::BlockVector, hp::DoFHandler<deal_II_dimension> >;
+#endif
+
+#ifdef DEAL_II_USE_TRILINOS
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::Vector, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::Vector, hp::DoFHandler<deal_II_dimension> >;
+
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::BlockVector, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::BlockVector, hp::DoFHandler<deal_II_dimension> >;
+
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::Vector, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::Vector, hp::DoFHandler<deal_II_dimension> >;
+
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::BlockVector, DoFHandler<deal_II_dimension> >;
+template class SolutionTransfer<deal_II_dimension, TrilinosWrappers::MPI::BlockVector, hp::DoFHandler<deal_II_dimension> >;
+#endif
+
+#if deal_II_dimension < 3
+template class SolutionTransfer<deal_II_dimension, Vector<double>, DoFHandler<deal_II_dimension, deal_II_dimension+1> >;
+template class SolutionTransfer<deal_II_dimension, BlockVector<double>, hp::DoFHandler<deal_II_dimension, deal_II_dimension+1> >;
+
+#endif
+}
diff --git a/deal.II/source/numerics/time_dependent.all_dimensions.cc b/deal.II/source/numerics/time_dependent.all_dimensions.cc
deleted file mode 100644 (file)
index 77be7a6..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-//---------------------------------------------------------------------------
-//    $Id: time_dependent.all_dimensions.cc 21627 2010-08-09 05:10:10Z bangerth $
-//    Version: $Name$
-//
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2009, 2010 by the deal.II authors
-//
-//    This file is subject to QPL and may not be  distributed
-//    without copyright and license information. Please refer
-//    to the file deal.II/doc/license.html for the  text  and
-//    further information on this license.
-//
-//---------------------------------------------------------------------------
-
-
-#include <numerics/time_dependent.h>
-#include <base/memory_consumption.h>
-#include <base/thread_management.h>
-
-#include <functional>
-#include <algorithm>
-#include <numeric>
-
-DEAL_II_NAMESPACE_OPEN
-
-TimeDependent::TimeSteppingData::TimeSteppingData (const unsigned int look_ahead,
-                                                  const unsigned int look_back)
-               :
-               look_ahead (look_ahead),
-               look_back (look_back)
-{}
-
-
-TimeDependent::TimeDependent (const TimeSteppingData &data_primal,
-                             const TimeSteppingData &data_dual,
-                             const TimeSteppingData &data_postprocess):
-               sweep_no (numbers::invalid_unsigned_int),
-               timestepping_data_primal (data_primal),
-               timestepping_data_dual (data_dual),
-               timestepping_data_postprocess (data_postprocess)
-{}
-
-
-TimeDependent::~TimeDependent ()
-{
-  while (timesteps.size() != 0)
-    delete_timestep (0);
-}
-
-
-void
-TimeDependent::insert_timestep (const TimeStepBase *position,
-                               TimeStepBase       *new_timestep)
-{
-  Assert ((std::find(timesteps.begin(), timesteps.end(), position) != timesteps.end()) ||
-         (position == 0),
-         ExcInvalidPosition());
-                                  // first insert the new time step
-                                  // into the doubly linked list
-                                  // of timesteps
-  if (position == 0)
-    {
-                                      // at the end
-      new_timestep->set_next_timestep (0);
-      if (timesteps.size() > 0)
-       {
-         timesteps.back()->set_next_timestep (new_timestep);
-         new_timestep->set_previous_timestep (timesteps.back());
-       }
-      else
-       new_timestep->set_previous_timestep (0);
-    }
-  else
-    if (position == timesteps[0])
-      {
-                                        // at the beginning
-       new_timestep->set_previous_timestep (0);
-       if (timesteps.size() > 0)
-         {
-           timesteps[0]->set_previous_timestep (new_timestep);
-           new_timestep->set_next_timestep (timesteps[0]);
-         }
-       else
-         new_timestep->set_next_timestep (0);
-      }
-    else
-      {
-                                        // inner time step
-       std::vector<SmartPointer<TimeStepBase,TimeDependent> >::iterator insert_position
-         = std::find(timesteps.begin(), timesteps.end(), position);
-
-       (*(insert_position-1))->set_next_timestep (new_timestep);
-       new_timestep->set_previous_timestep (*(insert_position-1));
-       new_timestep->set_next_timestep (*insert_position);
-       (*insert_position)->set_previous_timestep (new_timestep);
-      };
-
-                                  // finally enter it into the
-                                  // array
-  timesteps.insert ((position == 0 ?
-                    timesteps.end() :
-                    std::find(timesteps.begin(), timesteps.end(), position)),
-                   new_timestep);
-}
-
-
-void
-TimeDependent::add_timestep (TimeStepBase *new_timestep)
-{
-  insert_timestep (0, new_timestep);
-}
-
-
-void TimeDependent::delete_timestep (const unsigned int position)
-{
-  Assert (position<timesteps.size(),
-         ExcInvalidPosition());
-
-                                  // Remember time step object for
-                                  // later deletion and unlock
-                                  // SmartPointer
-  TimeStepBase* t = timesteps[position];
-  timesteps[position] = 0;
-                                  // Now delete unsubscribed object
-  delete t;
-
-  timesteps.erase (timesteps.begin() + position);
-
-                                  // reset "next" pointer of previous
-                                  // time step if possible
-                                  //
-                                  // note that if now position==size,
-                                  // then we deleted the last time step
-  if (position != 0)
-    timesteps[position-1]->set_next_timestep ((position<timesteps.size()) ?
-                                             timesteps[position] :
-                                             /*null*/SmartPointer<TimeStepBase,TimeDependent>());
-
-                                  // same for "previous" pointer of next
-                                  // time step
-  if (position<timesteps.size())
-    timesteps[position]->set_previous_timestep ((position!=0) ?
-                                               timesteps[position-1] :
-                                               /*null*/SmartPointer<TimeStepBase,TimeDependent>());
-}
-
-
-void
-TimeDependent::solve_primal_problem ()
-{
-  do_loop (std::mem_fun(&TimeStepBase::init_for_primal_problem),
-          std::mem_fun(&TimeStepBase::solve_primal_problem),
-          timestepping_data_primal,
-          forward);
-}
-
-
-void
-TimeDependent::solve_dual_problem ()
-{
-  do_loop (std::mem_fun(&TimeStepBase::init_for_dual_problem),
-          std::mem_fun(&TimeStepBase::solve_dual_problem),
-          timestepping_data_dual,
-          backward);
-}
-
-
-void
-TimeDependent::postprocess ()
-{
-  do_loop (std::mem_fun(&TimeStepBase::init_for_postprocessing),
-          std::mem_fun(&TimeStepBase::postprocess_timestep),
-          timestepping_data_postprocess,
-          forward);
-}
-
-
-
-void TimeDependent::start_sweep (const unsigned int s)
-{
-  sweep_no = s;
-
-                                  // reset the number each
-                                  // time step has, since some time
-                                  // steps might have been added since
-                                  // the last time we visited them
-                                  //
-                                  // also set the sweep we will
-                                  // process in the sequel
-  for (unsigned int step=0; step<timesteps.size(); ++step)
-    {
-      timesteps[step]->set_timestep_no (step);
-      timesteps[step]->set_sweep_no (sweep_no);
-    };
-
-  for (unsigned int step=0; step<timesteps.size(); ++step)
-    timesteps[step]->start_sweep ();
-}
-
-
-
-void TimeDependent::end_sweep (const unsigned int n_threads)
-{
-  if (DEAL_II_USE_MT && (n_threads > 1))
-    {
-      const unsigned int stride = timesteps.size() / n_threads;
-      Threads::ThreadGroup<> threads;
-      void (TimeDependent::*p) (const unsigned int, const unsigned int)
-        = &TimeDependent::end_sweep;
-      for (unsigned int i=0; i<n_threads; ++i)
-        threads += Threads::new_thread (p, *this, i*stride,
-                                       (i == n_threads-1 ?
-                                        timesteps.size() :
-                                        (i+1)*stride));
-      threads.join_all();
-    }
-  else
-                                     // now do the work
-    end_sweep (0, timesteps.size());
-}
-
-
-
-void TimeDependent::end_sweep (const unsigned int begin,
-                              const unsigned int end)
-{
-  for (unsigned int step=begin; step<end; ++step)
-    timesteps[step]->end_sweep ();
-}
-
-
-
-unsigned int TimeDependent::memory_consumption () const
-{
-  unsigned int mem = (MemoryConsumption::memory_consumption (timesteps) +
-                     MemoryConsumption::memory_consumption (sweep_no) +
-                     sizeof(timestepping_data_primal) +
-                     sizeof(timestepping_data_dual) +
-                     sizeof(timestepping_data_postprocess));
-  for (unsigned int i=0; i<timesteps.size(); ++i)
-    mem += MemoryConsumption::memory_consumption (*timesteps[i]);
-
-  return mem;
-}
-
-
-
-/* --------------------------------------------------------------------- */
-
-
-TimeStepBase::TimeStepBase (const double time) :
-               previous_timestep(0),
-               next_timestep (0),
-               sweep_no (numbers::invalid_unsigned_int),
-               timestep_no (numbers::invalid_unsigned_int),
-               time (time)
-{}
-
-
-
-TimeStepBase::~TimeStepBase ()
-{}
-
-
-
-void
-TimeStepBase::wake_up (const unsigned )
-{}
-
-
-
-void
-TimeStepBase::sleep (const unsigned)
-{}
-
-
-
-void
-TimeStepBase::start_sweep ()
-{}
-
-
-
-void
-TimeStepBase::end_sweep ()
-{}
-
-
-
-void
-TimeStepBase::init_for_primal_problem ()
-{
-  next_action = primal_problem;
-}
-
-
-
-void
-TimeStepBase::init_for_dual_problem ()
-{
-  next_action = dual_problem;
-}
-
-
-
-void
-TimeStepBase::init_for_postprocessing ()
-{
-  next_action = postprocess;
-}
-
-
-
-void
-TimeStepBase::solve_dual_problem ()
-{
-  Assert (false, ExcPureFunctionCalled());
-}
-
-
-
-void
-TimeStepBase::postprocess_timestep ()
-{
-  Assert (false, ExcPureFunctionCalled());
-}
-
-
-
-double
-TimeStepBase::get_time () const
-{
-  return time;
-}
-
-
-
-unsigned int
-TimeStepBase::get_timestep_no () const
-{
-  return timestep_no;
-}
-
-
-
-double
-TimeStepBase::get_backward_timestep () const
-{
-  Assert (previous_timestep != 0, ExcCantComputeTimestep());
-  return time - previous_timestep->time;
-}
-
-
-
-double
-TimeStepBase::get_forward_timestep () const
-{
-  Assert (next_timestep != 0, ExcCantComputeTimestep());
-  return next_timestep->time - time;
-}
-
-
-
-void
-TimeStepBase::set_previous_timestep (const TimeStepBase *previous)
-{
-  previous_timestep = previous;
-}
-
-
-
-void
-TimeStepBase::set_next_timestep (const TimeStepBase *next)
-{
-  next_timestep     = next;
-}
-
-
-
-void
-TimeStepBase::set_timestep_no (const unsigned int step_no)
-{
-  timestep_no = step_no;
-}
-
-
-
-void
-TimeStepBase::set_sweep_no (const unsigned int sweep)
-{
-  sweep_no = sweep;
-}
-
-
-
-unsigned int
-TimeStepBase::memory_consumption () const
-{
-                                  // only simple data types
-  return sizeof(*this);
-}
-
-
-DEAL_II_NAMESPACE_CLOSE
index 540805238884aac9cbd9fdff9cb47a9ab9feac8f..baa908189edc06891a93304bcbbd07b2c2de5b26 100644 (file)
 
 DEAL_II_NAMESPACE_OPEN
 
+TimeDependent::TimeSteppingData::TimeSteppingData (const unsigned int look_ahead,
+                                                  const unsigned int look_back)
+               :
+               look_ahead (look_ahead),
+               look_back (look_back)
+{}
+
+
+TimeDependent::TimeDependent (const TimeSteppingData &data_primal,
+                             const TimeSteppingData &data_dual,
+                             const TimeSteppingData &data_postprocess):
+               sweep_no (numbers::invalid_unsigned_int),
+               timestepping_data_primal (data_primal),
+               timestepping_data_dual (data_dual),
+               timestepping_data_postprocess (data_postprocess)
+{}
+
+
+TimeDependent::~TimeDependent ()
+{
+  while (timesteps.size() != 0)
+    delete_timestep (0);
+}
+
+
+void
+TimeDependent::insert_timestep (const TimeStepBase *position,
+                               TimeStepBase       *new_timestep)
+{
+  Assert ((std::find(timesteps.begin(), timesteps.end(), position) != timesteps.end()) ||
+         (position == 0),
+         ExcInvalidPosition());
+                                  // first insert the new time step
+                                  // into the doubly linked list
+                                  // of timesteps
+  if (position == 0)
+    {
+                                      // at the end
+      new_timestep->set_next_timestep (0);
+      if (timesteps.size() > 0)
+       {
+         timesteps.back()->set_next_timestep (new_timestep);
+         new_timestep->set_previous_timestep (timesteps.back());
+       }
+      else
+       new_timestep->set_previous_timestep (0);
+    }
+  else
+    if (position == timesteps[0])
+      {
+                                        // at the beginning
+       new_timestep->set_previous_timestep (0);
+       if (timesteps.size() > 0)
+         {
+           timesteps[0]->set_previous_timestep (new_timestep);
+           new_timestep->set_next_timestep (timesteps[0]);
+         }
+       else
+         new_timestep->set_next_timestep (0);
+      }
+    else
+      {
+                                        // inner time step
+       std::vector<SmartPointer<TimeStepBase,TimeDependent> >::iterator insert_position
+         = std::find(timesteps.begin(), timesteps.end(), position);
+
+       (*(insert_position-1))->set_next_timestep (new_timestep);
+       new_timestep->set_previous_timestep (*(insert_position-1));
+       new_timestep->set_next_timestep (*insert_position);
+       (*insert_position)->set_previous_timestep (new_timestep);
+      };
+
+                                  // finally enter it into the
+                                  // array
+  timesteps.insert ((position == 0 ?
+                    timesteps.end() :
+                    std::find(timesteps.begin(), timesteps.end(), position)),
+                   new_timestep);
+}
+
+
+void
+TimeDependent::add_timestep (TimeStepBase *new_timestep)
+{
+  insert_timestep (0, new_timestep);
+}
+
+
+void TimeDependent::delete_timestep (const unsigned int position)
+{
+  Assert (position<timesteps.size(),
+         ExcInvalidPosition());
+
+                                  // Remember time step object for
+                                  // later deletion and unlock
+                                  // SmartPointer
+  TimeStepBase* t = timesteps[position];
+  timesteps[position] = 0;
+                                  // Now delete unsubscribed object
+  delete t;
+
+  timesteps.erase (timesteps.begin() + position);
+
+                                  // reset "next" pointer of previous
+                                  // time step if possible
+                                  //
+                                  // note that if now position==size,
+                                  // then we deleted the last time step
+  if (position != 0)
+    timesteps[position-1]->set_next_timestep ((position<timesteps.size()) ?
+                                             timesteps[position] :
+                                             /*null*/SmartPointer<TimeStepBase,TimeDependent>());
+
+                                  // same for "previous" pointer of next
+                                  // time step
+  if (position<timesteps.size())
+    timesteps[position]->set_previous_timestep ((position!=0) ?
+                                               timesteps[position-1] :
+                                               /*null*/SmartPointer<TimeStepBase,TimeDependent>());
+}
+
+
+void
+TimeDependent::solve_primal_problem ()
+{
+  do_loop (std::mem_fun(&TimeStepBase::init_for_primal_problem),
+          std::mem_fun(&TimeStepBase::solve_primal_problem),
+          timestepping_data_primal,
+          forward);
+}
+
+
+void
+TimeDependent::solve_dual_problem ()
+{
+  do_loop (std::mem_fun(&TimeStepBase::init_for_dual_problem),
+          std::mem_fun(&TimeStepBase::solve_dual_problem),
+          timestepping_data_dual,
+          backward);
+}
+
+
+void
+TimeDependent::postprocess ()
+{
+  do_loop (std::mem_fun(&TimeStepBase::init_for_postprocessing),
+          std::mem_fun(&TimeStepBase::postprocess_timestep),
+          timestepping_data_postprocess,
+          forward);
+}
+
+
+
+void TimeDependent::start_sweep (const unsigned int s)
+{
+  sweep_no = s;
+
+                                  // reset the number each
+                                  // time step has, since some time
+                                  // steps might have been added since
+                                  // the last time we visited them
+                                  //
+                                  // also set the sweep we will
+                                  // process in the sequel
+  for (unsigned int step=0; step<timesteps.size(); ++step)
+    {
+      timesteps[step]->set_timestep_no (step);
+      timesteps[step]->set_sweep_no (sweep_no);
+    };
+
+  for (unsigned int step=0; step<timesteps.size(); ++step)
+    timesteps[step]->start_sweep ();
+}
+
+
+
+void TimeDependent::end_sweep (const unsigned int n_threads)
+{
+  if (DEAL_II_USE_MT && (n_threads > 1))
+    {
+      const unsigned int stride = timesteps.size() / n_threads;
+      Threads::ThreadGroup<> threads;
+      void (TimeDependent::*p) (const unsigned int, const unsigned int)
+        = &TimeDependent::end_sweep;
+      for (unsigned int i=0; i<n_threads; ++i)
+        threads += Threads::new_thread (p, *this, i*stride,
+                                       (i == n_threads-1 ?
+                                        timesteps.size() :
+                                        (i+1)*stride));
+      threads.join_all();
+    }
+  else
+                                     // now do the work
+    end_sweep (0, timesteps.size());
+}
+
+
+
+void TimeDependent::end_sweep (const unsigned int begin,
+                              const unsigned int end)
+{
+  for (unsigned int step=begin; step<end; ++step)
+    timesteps[step]->end_sweep ();
+}
+
+
+
+unsigned int TimeDependent::memory_consumption () const
+{
+  unsigned int mem = (MemoryConsumption::memory_consumption (timesteps) +
+                     MemoryConsumption::memory_consumption (sweep_no) +
+                     sizeof(timestepping_data_primal) +
+                     sizeof(timestepping_data_dual) +
+                     sizeof(timestepping_data_postprocess));
+  for (unsigned int i=0; i<timesteps.size(); ++i)
+    mem += MemoryConsumption::memory_consumption (*timesteps[i]);
+
+  return mem;
+}
+
+
+
+/* --------------------------------------------------------------------- */
+
+
+TimeStepBase::TimeStepBase (const double time) :
+               previous_timestep(0),
+               next_timestep (0),
+               sweep_no (numbers::invalid_unsigned_int),
+               timestep_no (numbers::invalid_unsigned_int),
+               time (time)
+{}
+
+
+
+TimeStepBase::~TimeStepBase ()
+{}
+
+
+
+void
+TimeStepBase::wake_up (const unsigned )
+{}
+
+
+
+void
+TimeStepBase::sleep (const unsigned)
+{}
+
+
+
+void
+TimeStepBase::start_sweep ()
+{}
+
+
+
+void
+TimeStepBase::end_sweep ()
+{}
+
+
+
+void
+TimeStepBase::init_for_primal_problem ()
+{
+  next_action = primal_problem;
+}
+
+
+
+void
+TimeStepBase::init_for_dual_problem ()
+{
+  next_action = dual_problem;
+}
+
+
+
+void
+TimeStepBase::init_for_postprocessing ()
+{
+  next_action = postprocess;
+}
+
+
+
+void
+TimeStepBase::solve_dual_problem ()
+{
+  Assert (false, ExcPureFunctionCalled());
+}
+
+
+
+void
+TimeStepBase::postprocess_timestep ()
+{
+  Assert (false, ExcPureFunctionCalled());
+}
+
+
+
+double
+TimeStepBase::get_time () const
+{
+  return time;
+}
+
+
+
+unsigned int
+TimeStepBase::get_timestep_no () const
+{
+  return timestep_no;
+}
+
+
+
+double
+TimeStepBase::get_backward_timestep () const
+{
+  Assert (previous_timestep != 0, ExcCantComputeTimestep());
+  return time - previous_timestep->time;
+}
+
+
+
+double
+TimeStepBase::get_forward_timestep () const
+{
+  Assert (next_timestep != 0, ExcCantComputeTimestep());
+  return next_timestep->time - time;
+}
+
+
+
+void
+TimeStepBase::set_previous_timestep (const TimeStepBase *previous)
+{
+  previous_timestep = previous;
+}
+
+
+
+void
+TimeStepBase::set_next_timestep (const TimeStepBase *next)
+{
+  next_timestep     = next;
+}
+
+
+
+void
+TimeStepBase::set_timestep_no (const unsigned int step_no)
+{
+  timestep_no = step_no;
+}
+
+
+
+void
+TimeStepBase::set_sweep_no (const unsigned int sweep)
+{
+  sweep_no = sweep;
+}
+
+
+
+unsigned int
+TimeStepBase::memory_consumption () const
+{
+                                  // only simple data types
+  return sizeof(*this);
+}
+
+
 
 template <int dim>
 TimeStepBase_Tria<dim>::TimeStepBase_Tria() :
@@ -864,14 +1242,9 @@ RefinementData (const double         _refinement_threshold,
 }
 
 
-// explicit instantiations
-template class TimeStepBase_Tria<deal_II_dimension>;
 
-namespace TimeStepBase_Tria_Flags
-{
-  template class Flags<deal_II_dimension>;
-  template class RefinementFlags<deal_II_dimension>;
-  template class RefinementData<deal_II_dimension>;
-}
+/*-------------- Explicit Instantiations -------------------------------*/
+#include "time_dependent.inst"
+
 
 DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/numerics/time_dependent.inst.in b/deal.II/source/numerics/time_dependent.inst.in
new file mode 100644 (file)
index 0000000..bb15942
--- /dev/null
@@ -0,0 +1,23 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+for (deal_II_dimension : DIMENSIONS)
+{
+   template class TimeStepBase_Tria<deal_II_dimension>;
+   namespace TimeStepBase_Tria_Flags
+   \{
+     template class Flags<deal_II_dimension>;
+     template class RefinementFlags<deal_II_dimension>;
+     template class RefinementData<deal_II_dimension>;
+   \}
+}
diff --git a/deal.II/source/numerics/vectors.all_dimensions.cc b/deal.II/source/numerics/vectors.all_dimensions.cc
deleted file mode 100644 (file)
index 7e8e7d5..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//---------------------------------------------------------------------------
-//    $Id$
-//    Version: $Name$
-//
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006 by the deal.II authors
-//
-//    This file is subject to QPL and may not be  distributed
-//    without copyright and license information. Please refer
-//    to the file deal.II/doc/license.html for the  text  and
-//    further information on this license.
-//
-//---------------------------------------------------------------------------
-
-
-#include <lac/vector.h>
-#include <numerics/vectors.h>
-
-DEAL_II_NAMESPACE_OPEN
-
-
-void
-VectorTools::subtract_mean_value(Vector<double>     &v,
-                                const std::vector<bool> &p_select)
-{
-  const unsigned int n = v.size();
-  Assert(n == p_select.size(),
-         ExcDimensionMismatch(n, p_select.size()));
-
-  double       s       = 0;
-  unsigned int counter = 0;
-  
-  for (unsigned int i=0; i<n; ++i)
-    if (p_select[i])
-      {
-       s += v(i);
-       ++counter;
-      }
-  Assert (counter > 0, ExcNoComponentSelected());
-  
-  s /= counter;
-  
-  for (unsigned int i=0; i<n; ++i)
-    if (p_select[i])
-      v(i) -= s;  
-}
-
-DEAL_II_NAMESPACE_CLOSE
index c30a9f4c51c223d5b76d8590c133443fa4496031..ecc894e6cd8239bc6f83f98a23bbc3232b1fe5e5 100644 (file)
 
 #include<numerics/vectors.templates.h>
 
-// explicit instantiations
-
-
 DEAL_II_NAMESPACE_OPEN
 
-#include "vectors.inst"
-
-template
-void VectorTools::create_right_hand_side<deal_II_dimension>
-(const Mapping<deal_II_dimension>    &,
- const DoFHandler<deal_II_dimension> &,
- const Quadrature<deal_II_dimension> &,
- const Function<deal_II_dimension>   &,
- Vector<double>                      &);
-template
-void VectorTools::create_right_hand_side<deal_II_dimension>
-(const DoFHandler<deal_II_dimension> &,
- const Quadrature<deal_II_dimension> &,
- const Function<deal_II_dimension>   &,
- Vector<double>                      &);
-
-template
-void VectorTools::create_right_hand_side<deal_II_dimension>
-(const hp::MappingCollection<deal_II_dimension>    &,
- const hp::DoFHandler<deal_II_dimension> &,
- const hp::QCollection<deal_II_dimension> &,
- const Function<deal_II_dimension>   &,
- Vector<double>                      &);
-template
-void VectorTools::create_right_hand_side<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension> &,
- const hp::QCollection<deal_II_dimension> &,
- const Function<deal_II_dimension>   &,
- Vector<double>                      &);
-
-template
-void VectorTools::create_point_source_vector<deal_II_dimension>
-(const Mapping<deal_II_dimension>    &,
- const DoFHandler<deal_II_dimension> &,
- const Point<deal_II_dimension>      &,
- Vector<double>                      &);
-template
-void VectorTools::create_point_source_vector<deal_II_dimension>
-(const DoFHandler<deal_II_dimension> &,
- const Point<deal_II_dimension>      &,
- Vector<double>                      &);
-
-template
-void VectorTools::create_point_source_vector<deal_II_dimension>
-(const hp::MappingCollection<deal_II_dimension>    &,
- const hp::DoFHandler<deal_II_dimension> &,
- const Point<deal_II_dimension>      &,
- Vector<double>                      &);
-template
-void VectorTools::create_point_source_vector<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension> &,
- const Point<deal_II_dimension>      &,
- Vector<double>                      &);
-
-template
-void
-VectorTools::create_boundary_right_hand_side<deal_II_dimension>
-(const Mapping<deal_II_dimension>    &,
- const DoFHandler<deal_II_dimension> &,
- const Quadrature<deal_II_dimension-1> &,
- const Function<deal_II_dimension>   &,
- Vector<double>                      &,
- const std::set<unsigned char> &);
-
-template
-void
-VectorTools::create_boundary_right_hand_side<deal_II_dimension>
-(const DoFHandler<deal_II_dimension> &,
- const Quadrature<deal_II_dimension-1> &,
- const Function<deal_II_dimension>   &,
- Vector<double>                      &,
- const std::set<unsigned char> &);
-
-template
-void
-VectorTools::create_boundary_right_hand_side<deal_II_dimension>
-(const hp::MappingCollection<deal_II_dimension>    &,
- const hp::DoFHandler<deal_II_dimension> &,
- const hp::QCollection<deal_II_dimension-1> &,
- const Function<deal_II_dimension>   &,
- Vector<double>                      &,
- const std::set<unsigned char> &);
-
-template
-void
-VectorTools::create_boundary_right_hand_side<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension> &,
- const hp::QCollection<deal_II_dimension-1> &,
- const Function<deal_II_dimension>   &,
- Vector<double>                      &,
- const std::set<unsigned char> &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const DoFHandler<deal_II_dimension> &,
-  const unsigned char,
-  const Function<deal_II_dimension>   &,
-  std::map<unsigned int,double>       &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const hp::DoFHandler<deal_II_dimension> &,
-  const unsigned char,
-  const Function<deal_II_dimension>   &,
-  std::map<unsigned int,double>       &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const MGDoFHandler<deal_II_dimension> &,
-  const unsigned char,
-  const Function<deal_II_dimension>   &,
-  std::map<unsigned int,double>       &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const DoFHandler<deal_II_dimension> &,
-  const unsigned char,
-  const Function<deal_II_dimension>   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const hp::DoFHandler<deal_II_dimension> &,
-  const unsigned char,
-  const Function<deal_II_dimension>   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const MGDoFHandler<deal_II_dimension> &,
-  const unsigned char,
-  const Function<deal_II_dimension>   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const Mapping<deal_II_dimension>    &,
-  const DoFHandler<deal_II_dimension> &,
-  const FunctionMap<deal_II_dimension>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const Mapping<deal_II_dimension>    &,
-  const hp::DoFHandler<deal_II_dimension> &,
-  const FunctionMap<deal_II_dimension>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const Mapping<deal_II_dimension>    &,
-  const MGDoFHandler<deal_II_dimension> &,
-  const FunctionMap<deal_II_dimension>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const DoFHandler<deal_II_dimension> &,
-  const FunctionMap<deal_II_dimension>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const hp::DoFHandler<deal_II_dimension> &,
-  const FunctionMap<deal_II_dimension>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const MGDoFHandler<deal_II_dimension> &,
-  const FunctionMap<deal_II_dimension>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-#if deal_II_dimension < 3
-template
-void VectorTools::interpolate_boundary_values (
-  const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const unsigned char,
-  const Function<deal_II_dimension+1>   &,
-  std::map<unsigned int,double>       &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const unsigned char,
-  const Function<deal_II_dimension+1>   &,
-  std::map<unsigned int,double>       &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const MGDoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const unsigned char,
-  const Function<deal_II_dimension+1>   &,
-  std::map<unsigned int,double>       &,
-  const std::vector<bool>    &);
 
-template
-void VectorTools::interpolate_boundary_values (
-  const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const unsigned char,
-  const Function<deal_II_dimension+1>   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const unsigned char,
-  const Function<deal_II_dimension+1>   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const MGDoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const unsigned char,
-  const Function<deal_II_dimension+1>   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
-  const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const FunctionMap<deal_II_dimension+1>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
-  const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const FunctionMap<deal_II_dimension+1>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
-  const MGDoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const FunctionMap<deal_II_dimension+1>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const FunctionMap<deal_II_dimension+1>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const FunctionMap<deal_II_dimension+1>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values (
-  const MGDoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-  const FunctionMap<deal_II_dimension+1>::type   &,
-  ConstraintMatrix                    &,
-  const std::vector<bool>    &);
-#endif
-
-template
-void VectorTools::project_boundary_values<deal_II_dimension>
-(const Mapping<deal_II_dimension>     &,
- const DoFHandler<deal_II_dimension>  &,
- const FunctionMap<deal_II_dimension>::type &,
- const Quadrature<deal_II_dimension-1>&,
- std::map<unsigned int,double>&, std::vector<unsigned int>);
-
-template
-void VectorTools::project_boundary_values<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>  &,
- const FunctionMap<deal_II_dimension>::type &,
- const Quadrature<deal_II_dimension-1>&,
- std::map<unsigned int,double>&, std::vector<unsigned int>);
-
-
-template
-void VectorTools::project_boundary_values<deal_II_dimension>
-(const Mapping<deal_II_dimension>     &,
- const DoFHandler<deal_II_dimension>  &,
- const FunctionMap<deal_II_dimension>::type &,
- const Quadrature<deal_II_dimension-1>&,
- ConstraintMatrix&, std::vector<unsigned int>);
-
-template
-void VectorTools::project_boundary_values<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>  &,
- const FunctionMap<deal_II_dimension>::type &,
- const Quadrature<deal_II_dimension-1>&,
- ConstraintMatrix&, std::vector<unsigned int>);
-
-
-#if deal_II_dimension != 1
-template
-void VectorTools::project_boundary_values_curl_conforming<deal_II_dimension>
-(const DoFHandler<deal_II_dimension>&,
- const unsigned int,
- const Function<deal_II_dimension>&,
- const unsigned char,
- ConstraintMatrix&,
- const Mapping<deal_II_dimension>&);
-template
-void VectorTools::project_boundary_values_curl_conforming<deal_II_dimension>
-(const hp::DoFHandler<deal_II_dimension>&,
- const unsigned int,
- const Function<deal_II_dimension>&,
- const unsigned char,
- ConstraintMatrix&,
- const hp::MappingCollection<deal_II_dimension>&);
-template
 void
-VectorTools::compute_no_normal_flux_constraints (const DoFHandler<deal_II_dimension> &dof_handler,
-                                                const unsigned int     first_vector_component,
-                                                const std::set<unsigned char> &boundary_ids,
-                                                ConstraintMatrix      &constraints,
-                                                const Mapping<deal_II_dimension>    &mapping);
-#endif
-
-
-
-template
-void VectorTools::interpolate_boundary_values
-(const Mapping<deal_II_dimension>    &,
- const DoFHandler<deal_II_dimension> &,
- const FunctionMap<deal_II_dimension>::type &,
- std::map<unsigned int,double>       &,
- const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values
-(const Mapping<deal_II_dimension>    &,
- const DoFHandler<deal_II_dimension> &,
- const unsigned char,
- const Function<deal_II_dimension>   &,
- std::map<unsigned int,double>       &,
- const std::vector<bool>    &);
-
-#if deal_II_dimension < 3
-template
-void VectorTools::interpolate_boundary_values
-(const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
- const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
- const FunctionMap<deal_II_dimension+1>::type &,
- std::map<unsigned int,double>       &,
- const std::vector<bool>    &);
-
-template
-void VectorTools::interpolate_boundary_values
-(const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
- const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
- const unsigned char,
- const Function<deal_II_dimension+1>   &,
- std::map<unsigned int,double>       &,
- const std::vector<bool>    &);
-#endif
-
-
-template
-void
-VectorTools::interpolate_boundary_values
-(const DoFHandler<deal_II_dimension>         &,
- const FunctionMap<deal_II_dimension>::type &,
- std::map<unsigned int,double> &,
- const std::vector<bool>       &);
-
-
-#if deal_II_dimension != 3
-
-template
-void VectorTools::create_right_hand_side<deal_II_dimension,deal_II_dimension+1>
-(const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
- const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
- const Quadrature<deal_II_dimension> &,
- const Function<deal_II_dimension+1>   &,
- Vector<double>                      &);
-template
-void VectorTools::create_right_hand_side<deal_II_dimension,deal_II_dimension+1>
-(const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
- const Quadrature<deal_II_dimension> &,
- const Function<deal_II_dimension+1>   &,
- Vector<double>                      &);
-
-// template
-// void VectorTools::create_right_hand_side<deal_II_dimension,deal_II_dimension+1>
-// (const hp::MappingCollection<deal_II_dimension,deal_II_dimension+1>    &,
-//  const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-//  const hp::QCollection<deal_II_dimension> &,
-//  const Function<deal_II_dimension+1>   &,
-//  Vector<double>                      &);
-// template
-// void VectorTools::create_right_hand_side<deal_II_dimension,deal_II_dimension+1>
-// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
-//  const hp::QCollection<deal_II_dimension> &,
-//  const Function<deal_II_dimension+1>   &,
-//  Vector<double>                      &);
-
-#endif
+VectorTools::subtract_mean_value(Vector<double>     &v,
+                                const std::vector<bool> &p_select)
+{
+  const unsigned int n = v.size();
+  Assert(n == p_select.size(),
+         ExcDimensionMismatch(n, p_select.size()));
+
+  double       s       = 0;
+  unsigned int counter = 0;
+  
+  for (unsigned int i=0; i<n; ++i)
+    if (p_select[i])
+      {
+       s += v(i);
+       ++counter;
+      }
+  Assert (counter > 0, ExcNoComponentSelected());
+  
+  s /= counter;
+  
+  for (unsigned int i=0; i<n; ++i)
+    if (p_select[i])
+      v(i) -= s;  
+}
+
+
+
+// ---------------------------- explicit instantiations --------------------
+#include "vectors.inst"
 
 
 DEAL_II_NAMESPACE_CLOSE
index fab5d3d845e10ba391c5ec37b3ebdca18c3a1f7d..4a55495620d3acad1d4a1ace6ec565fc7b543d92 100644 (file)
@@ -11,7 +11,7 @@
 //
 //---------------------------------------------------------------------------
 
-for (VEC : SERIAL_VECTORS)
+for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS)
 {  
   template
     void VectorTools::interpolate
@@ -314,3 +314,423 @@ for (VEC : SERIAL_VECTORS)
 #endif
 
 }
+
+
+for ( deal_II_dimension : DIMENSIONS )
+{
+template
+void VectorTools::create_right_hand_side<deal_II_dimension>
+(const Mapping<deal_II_dimension>    &,
+ const DoFHandler<deal_II_dimension> &,
+ const Quadrature<deal_II_dimension> &,
+ const Function<deal_II_dimension>   &,
+ Vector<double>                      &);
+template
+void VectorTools::create_right_hand_side<deal_II_dimension>
+(const DoFHandler<deal_II_dimension> &,
+ const Quadrature<deal_II_dimension> &,
+ const Function<deal_II_dimension>   &,
+ Vector<double>                      &);
+
+template
+void VectorTools::create_right_hand_side<deal_II_dimension>
+(const hp::MappingCollection<deal_II_dimension>    &,
+ const hp::DoFHandler<deal_II_dimension> &,
+ const hp::QCollection<deal_II_dimension> &,
+ const Function<deal_II_dimension>   &,
+ Vector<double>                      &);
+template
+void VectorTools::create_right_hand_side<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension> &,
+ const hp::QCollection<deal_II_dimension> &,
+ const Function<deal_II_dimension>   &,
+ Vector<double>                      &);
+
+template
+void VectorTools::create_point_source_vector<deal_II_dimension>
+(const Mapping<deal_II_dimension>    &,
+ const DoFHandler<deal_II_dimension> &,
+ const Point<deal_II_dimension>      &,
+ Vector<double>                      &);
+template
+void VectorTools::create_point_source_vector<deal_II_dimension>
+(const DoFHandler<deal_II_dimension> &,
+ const Point<deal_II_dimension>      &,
+ Vector<double>                      &);
+
+template
+void VectorTools::create_point_source_vector<deal_II_dimension>
+(const hp::MappingCollection<deal_II_dimension>    &,
+ const hp::DoFHandler<deal_II_dimension> &,
+ const Point<deal_II_dimension>      &,
+ Vector<double>                      &);
+template
+void VectorTools::create_point_source_vector<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension> &,
+ const Point<deal_II_dimension>      &,
+ Vector<double>                      &);
+
+template
+void
+VectorTools::create_boundary_right_hand_side<deal_II_dimension>
+(const Mapping<deal_II_dimension>    &,
+ const DoFHandler<deal_II_dimension> &,
+ const Quadrature<deal_II_dimension-1> &,
+ const Function<deal_II_dimension>   &,
+ Vector<double>                      &,
+ const std::set<unsigned char> &);
+
+template
+void
+VectorTools::create_boundary_right_hand_side<deal_II_dimension>
+(const DoFHandler<deal_II_dimension> &,
+ const Quadrature<deal_II_dimension-1> &,
+ const Function<deal_II_dimension>   &,
+ Vector<double>                      &,
+ const std::set<unsigned char> &);
+
+template
+void
+VectorTools::create_boundary_right_hand_side<deal_II_dimension>
+(const hp::MappingCollection<deal_II_dimension>    &,
+ const hp::DoFHandler<deal_II_dimension> &,
+ const hp::QCollection<deal_II_dimension-1> &,
+ const Function<deal_II_dimension>   &,
+ Vector<double>                      &,
+ const std::set<unsigned char> &);
+
+template
+void
+VectorTools::create_boundary_right_hand_side<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension> &,
+ const hp::QCollection<deal_II_dimension-1> &,
+ const Function<deal_II_dimension>   &,
+ Vector<double>                      &,
+ const std::set<unsigned char> &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const DoFHandler<deal_II_dimension> &,
+  const unsigned char,
+  const Function<deal_II_dimension>   &,
+  std::map<unsigned int,double>       &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const hp::DoFHandler<deal_II_dimension> &,
+  const unsigned char,
+  const Function<deal_II_dimension>   &,
+  std::map<unsigned int,double>       &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const MGDoFHandler<deal_II_dimension> &,
+  const unsigned char,
+  const Function<deal_II_dimension>   &,
+  std::map<unsigned int,double>       &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const DoFHandler<deal_II_dimension> &,
+  const unsigned char,
+  const Function<deal_II_dimension>   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const hp::DoFHandler<deal_II_dimension> &,
+  const unsigned char,
+  const Function<deal_II_dimension>   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const MGDoFHandler<deal_II_dimension> &,
+  const unsigned char,
+  const Function<deal_II_dimension>   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const Mapping<deal_II_dimension>    &,
+  const DoFHandler<deal_II_dimension> &,
+  const FunctionMap<deal_II_dimension>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const Mapping<deal_II_dimension>    &,
+  const hp::DoFHandler<deal_II_dimension> &,
+  const FunctionMap<deal_II_dimension>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const Mapping<deal_II_dimension>    &,
+  const MGDoFHandler<deal_II_dimension> &,
+  const FunctionMap<deal_II_dimension>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const DoFHandler<deal_II_dimension> &,
+  const FunctionMap<deal_II_dimension>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const hp::DoFHandler<deal_II_dimension> &,
+  const FunctionMap<deal_II_dimension>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const MGDoFHandler<deal_II_dimension> &,
+  const FunctionMap<deal_II_dimension>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+#if deal_II_dimension < 3
+template
+void VectorTools::interpolate_boundary_values (
+  const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const unsigned char,
+  const Function<deal_II_dimension+1>   &,
+  std::map<unsigned int,double>       &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const unsigned char,
+  const Function<deal_II_dimension+1>   &,
+  std::map<unsigned int,double>       &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const MGDoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const unsigned char,
+  const Function<deal_II_dimension+1>   &,
+  std::map<unsigned int,double>       &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const unsigned char,
+  const Function<deal_II_dimension+1>   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const unsigned char,
+  const Function<deal_II_dimension+1>   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const MGDoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const unsigned char,
+  const Function<deal_II_dimension+1>   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
+  const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const FunctionMap<deal_II_dimension+1>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
+  const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const FunctionMap<deal_II_dimension+1>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
+  const MGDoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const FunctionMap<deal_II_dimension+1>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const FunctionMap<deal_II_dimension+1>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const FunctionMap<deal_II_dimension+1>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values (
+  const MGDoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+  const FunctionMap<deal_II_dimension+1>::type   &,
+  ConstraintMatrix                    &,
+  const std::vector<bool>    &);
+#endif
+
+template
+void VectorTools::project_boundary_values<deal_II_dimension>
+(const Mapping<deal_II_dimension>     &,
+ const DoFHandler<deal_II_dimension>  &,
+ const FunctionMap<deal_II_dimension>::type &,
+ const Quadrature<deal_II_dimension-1>&,
+ std::map<unsigned int,double>&, std::vector<unsigned int>);
+
+template
+void VectorTools::project_boundary_values<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>  &,
+ const FunctionMap<deal_II_dimension>::type &,
+ const Quadrature<deal_II_dimension-1>&,
+ std::map<unsigned int,double>&, std::vector<unsigned int>);
+
+
+template
+void VectorTools::project_boundary_values<deal_II_dimension>
+(const Mapping<deal_II_dimension>     &,
+ const DoFHandler<deal_II_dimension>  &,
+ const FunctionMap<deal_II_dimension>::type &,
+ const Quadrature<deal_II_dimension-1>&,
+ ConstraintMatrix&, std::vector<unsigned int>);
+
+template
+void VectorTools::project_boundary_values<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>  &,
+ const FunctionMap<deal_II_dimension>::type &,
+ const Quadrature<deal_II_dimension-1>&,
+ ConstraintMatrix&, std::vector<unsigned int>);
+
+
+#if deal_II_dimension != 1
+template
+void VectorTools::project_boundary_values_curl_conforming<deal_II_dimension>
+(const DoFHandler<deal_II_dimension>&,
+ const unsigned int,
+ const Function<deal_II_dimension>&,
+ const unsigned char,
+ ConstraintMatrix&,
+ const Mapping<deal_II_dimension>&);
+template
+void VectorTools::project_boundary_values_curl_conforming<deal_II_dimension>
+(const hp::DoFHandler<deal_II_dimension>&,
+ const unsigned int,
+ const Function<deal_II_dimension>&,
+ const unsigned char,
+ ConstraintMatrix&,
+ const hp::MappingCollection<deal_II_dimension>&);
+template
+void
+VectorTools::compute_no_normal_flux_constraints (const DoFHandler<deal_II_dimension> &dof_handler,
+                                                const unsigned int     first_vector_component,
+                                                const std::set<unsigned char> &boundary_ids,
+                                                ConstraintMatrix      &constraints,
+                                                const Mapping<deal_II_dimension>    &mapping);
+#endif
+
+
+
+template
+void VectorTools::interpolate_boundary_values
+(const Mapping<deal_II_dimension>    &,
+ const DoFHandler<deal_II_dimension> &,
+ const FunctionMap<deal_II_dimension>::type &,
+ std::map<unsigned int,double>       &,
+ const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values
+(const Mapping<deal_II_dimension>    &,
+ const DoFHandler<deal_II_dimension> &,
+ const unsigned char,
+ const Function<deal_II_dimension>   &,
+ std::map<unsigned int,double>       &,
+ const std::vector<bool>    &);
+
+#if deal_II_dimension < 3
+template
+void VectorTools::interpolate_boundary_values
+(const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
+ const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+ const FunctionMap<deal_II_dimension+1>::type &,
+ std::map<unsigned int,double>       &,
+ const std::vector<bool>    &);
+
+template
+void VectorTools::interpolate_boundary_values
+(const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
+ const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+ const unsigned char,
+ const Function<deal_II_dimension+1>   &,
+ std::map<unsigned int,double>       &,
+ const std::vector<bool>    &);
+#endif
+
+
+template
+void
+VectorTools::interpolate_boundary_values
+(const DoFHandler<deal_II_dimension>         &,
+ const FunctionMap<deal_II_dimension>::type &,
+ std::map<unsigned int,double> &,
+ const std::vector<bool>       &);
+
+
+#if deal_II_dimension != 3
+
+template
+void VectorTools::create_right_hand_side<deal_II_dimension,deal_II_dimension+1>
+(const Mapping<deal_II_dimension,deal_II_dimension+1>    &,
+ const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+ const Quadrature<deal_II_dimension> &,
+ const Function<deal_II_dimension+1>   &,
+ Vector<double>                      &);
+template
+void VectorTools::create_right_hand_side<deal_II_dimension,deal_II_dimension+1>
+(const DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+ const Quadrature<deal_II_dimension> &,
+ const Function<deal_II_dimension+1>   &,
+ Vector<double>                      &);
+
+// template
+// void VectorTools::create_right_hand_side<deal_II_dimension,deal_II_dimension+1>
+// (const hp::MappingCollection<deal_II_dimension,deal_II_dimension+1>    &,
+//  const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+//  const hp::QCollection<deal_II_dimension> &,
+//  const Function<deal_II_dimension+1>   &,
+//  Vector<double>                      &);
+// template
+// void VectorTools::create_right_hand_side<deal_II_dimension,deal_II_dimension+1>
+// (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &,
+//  const hp::QCollection<deal_II_dimension> &,
+//  const Function<deal_II_dimension+1>   &,
+//  Vector<double>                      &);
+
+#endif
+}

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.