]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove unnecessary template argument of InterGridMap. Allows to DH-templatize DoFTool...
authorRalf Hartmann <Ralf.Hartmann@dlr.de>
Mon, 27 Feb 2006 16:25:42 +0000 (16:25 +0000)
committerRalf Hartmann <Ralf.Hartmann@dlr.de>
Mon, 27 Feb 2006 16:25:42 +0000 (16:25 +0000)
git-svn-id: https://svn.dealii.org/trunk@12512 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_tools.h
deal.II/deal.II/include/grid/intergrid_map.h
deal.II/deal.II/source/dofs/dof_tools.cc
deal.II/deal.II/source/grid/intergrid_map.cc

index 6bcf061459734b8ec4f2129869c19f259e6f93ac..1c7078430be2b7011e3a0e1065214958331a8bce 100644 (file)
@@ -36,7 +36,7 @@ namespace hp
 }
 template <int dim> class MGDoFHandler;
 class ConstraintMatrix;
-template <template <int> class GridClass, int dim> class InterGridMap;
+template <class GridClass> class InterGridMap;
 template <int dim> class Mapping;
 
 
@@ -1297,7 +1297,7 @@ class DoFTools
                                   const unsigned int                  coarse_component,
                                   const DoFHandler<dim>              &fine_grid,
                                   const unsigned int                  fine_component,
-                                  const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
+                                  const InterGridMap<DoFHandler<dim> > &coarse_to_fine_grid_map,
                                   ConstraintMatrix                   &constraints);
 
 
@@ -1330,7 +1330,7 @@ class DoFTools
                                               const unsigned int                  coarse_component,
                                               const DoFHandler<dim>              &fine_grid,
                                               const unsigned int                  fine_component,
-                                              const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
+                                              const InterGridMap<DoFHandler<dim> > &coarse_to_fine_grid_map,
                                               std::vector<std::map<unsigned int, float> > &transfer_representation);
     
                                     /**
@@ -1539,7 +1539,7 @@ class DoFTools
                                 const unsigned int                  coarse_component,
                                 const DoFHandler<dim>              &fine_grid,
                                 const unsigned int                  fine_component,
-                                const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
+                                const InterGridMap<DoFHandler<dim> > &coarse_to_fine_grid_map,
                                 std::vector<std::map<unsigned int, float> > &weights,
                                 std::vector<int>                   &weight_mapping);
     
@@ -1554,7 +1554,7 @@ class DoFTools
     static void
     compute_intergrid_weights_2 (const DoFHandler<dim>              &coarse_grid,
                                 const unsigned int                  coarse_component,
-                                const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
+                                const InterGridMap<DoFHandler<dim> > &coarse_to_fine_grid_map,
                                 const std::vector<Vector<double> > &parameter_dofs,
                                 const std::vector<int>             &weight_mapping,
                                 std::vector<std::map<unsigned int, float> > &weights);
@@ -1573,7 +1573,7 @@ class DoFTools
     static void
     compute_intergrid_weights_3 (const DoFHandler<dim>              &coarse_grid,
                                 const unsigned int                  coarse_component,
-                                const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
+                                const InterGridMap<DoFHandler<dim> > &coarse_to_fine_grid_map,
                                 const std::vector<Vector<double> > &parameter_dofs,
                                 const std::vector<int>             &weight_mapping,
                                 std::vector<std::map<unsigned int, float> > &weights,
index 407448841cade0fd303a84770ec70470261a3a63..da64368fa2ce608da64fa3a7ad559c23755b9e8e 100644 (file)
@@ -89,7 +89,7 @@
  *                   // distribute degrees of freedom, etc
  *   ...
  *                   // create the mapping
- *   InterGridMap<DoFHandler,dim> grid_1_to_2_map;
+ *   InterGridMap<DoFHandler<dim> > grid_1_to_2_map;
  *   grid_1_to_2_map.make_mapping (dof_handler_1,
  *                                 dof_handler_2);
  *   ...
  * @endverbatim
  *
  * Note that the template parameters to this class have to be given as
- * <tt>InterGridMap<DoFHandler,2></tt>, i.e. the dimension is given explicitly and
- * no dimension is attributed to the first parameter, which here is
- * DoFHandler (and could equally well be Triangulation or MGDoFHandler).
+ * <tt>InterGridMap<DoFHandler<2> ></tt>, which here is DoFHandler
+ * (and could equally well be Triangulation, PersistentTriangulation,
+ * hp::DoFHandler or MGDoFHandler).
  *
  * @ingroup grid
  * @author Wolfgang Bangerth, 1999
  */
-template <template <int> class GridClass, int dim>
+template <class GridClass>
 class InterGridMap 
 {
   public:
 
-#ifdef DEAL_II_TEMPLATE_TEMPLATE_TYPEDEF_BUG
-                                    // helper class
-    struct GridClass_dim : public GridClass<dim>
-    {
-                                        // constructor. will
-                                        // not be implemented,
-                                        // but suppresses compiler
-                                        // warning about non-default
-                                        // constructor of GridClass
-       GridClass_dim ();
-
-                                        /**
-                                         * Declare iterator type, for
-                                         * access from outside.
-                                         */
-       typedef typename GridClass<dim>::cell_iterator cell_iterator;
-    };
-    
                                     /**
                                      * Typedef to the iterator type of
                                      * the grid class under consideration.
                                      */
-    typedef typename GridClass_dim::cell_iterator cell_iterator;
+    typedef typename GridClass::cell_iterator cell_iterator;
 
-#else
-
-                                    /**
-                                     * Typedef to the iterator type of
-                                     * the grid class under consideration.
-                                     */
-    typedef typename GridClass<dim>::cell_iterator cell_iterator;
-#endif
                                     /**
                                      * Constructor setting the class
                                      * name arguments in the
@@ -158,8 +132,8 @@ class InterGridMap
                                      * Create the mapping between the two
                                      * grids.
                                      */
-    void make_mapping (const GridClass<dim> &source_grid,
-                      const GridClass<dim> &destination_grid);
+    void make_mapping (const GridClass &source_grid,
+                      const GridClass &destination_grid);
 
                                     /**
                                      * Access operator: give a cell
@@ -182,13 +156,13 @@ class InterGridMap
                                      * Return a pointer to the source
                                      * grid.
                                      */
-    const GridClass<dim> & get_source_grid () const;
+    const GridClass & get_source_grid () const;
     
                                     /**
                                      * Return a pointer to the
                                      * destination grid.
                                      */
-    const GridClass<dim> & get_destination_grid () const;
+    const GridClass & get_destination_grid () const;
 
                                     /**
                                      * Determine an estimate for the
@@ -219,12 +193,12 @@ class InterGridMap
                                     /**
                                      * Store a pointer to the source grid.
                                      */
-    SmartPointer<const GridClass<dim> > source_grid;
+    SmartPointer<const GridClass > source_grid;
 
                                     /**
                                      * Likewise for the destination grid.
                                      */
-    SmartPointer<const GridClass<dim> > destination_grid;
+    SmartPointer<const GridClass > destination_grid;
 
                                     /**
                                      * Set the mapping for the pair of
index 19661cfc9f4d71bf2f2a5f6be52ba77e4613fd83..6eea0bff5f8fdf24132f6d55c8cf12815502d2f3 100644 (file)
@@ -2627,7 +2627,7 @@ DoFTools::compute_intergrid_constraints (
   const unsigned int                  coarse_component,
   const DoFHandler<dim>              &fine_grid,
   const unsigned int                  fine_component,
-  const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
+  const InterGridMap<DoFHandler<dim> > &coarse_to_fine_grid_map,
   ConstraintMatrix                   &constraints)
 {
                                   // store the weights with which a dof
@@ -2851,7 +2851,7 @@ compute_intergrid_transfer_representation (
   const unsigned int                  coarse_component,
   const DoFHandler<dim>              &fine_grid,
   const unsigned int                  fine_component,
-  const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
+  const InterGridMap<DoFHandler<dim> > &coarse_to_fine_grid_map,
   std::vector<std::map<unsigned int, float> > &transfer_representation)
 {
                                   // store the weights with which a dof
@@ -2961,7 +2961,7 @@ DoFTools::compute_intergrid_weights_1 (
   const unsigned int                  coarse_component,
   const DoFHandler<dim>              &fine_grid,
   const unsigned int                  fine_component,
-  const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
+  const InterGridMap<DoFHandler<dim> > &coarse_to_fine_grid_map,
   std::vector<std::map<unsigned int, float> > &weights,
   std::vector<int>                   &weight_mapping)
 {
@@ -3196,7 +3196,7 @@ void
 DoFTools::compute_intergrid_weights_2 (
   const DoFHandler<dim>              &coarse_grid,
   const unsigned int                  coarse_component,
-  const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
+  const InterGridMap<DoFHandler<dim> > &coarse_to_fine_grid_map,
   const std::vector<Vector<double> > &parameter_dofs,
   const std::vector<int>             &weight_mapping,
   std::vector<std::map<unsigned int,float> > &weights)
@@ -3212,7 +3212,7 @@ DoFTools::compute_intergrid_weights_2 (
   Threads::ThreadGroup<> threads;
   void (*fun_ptr) (const DoFHandler<dim>              &,
                   const unsigned int                  ,
-                  const InterGridMap<DoFHandler,dim> &,
+                  const InterGridMap<DoFHandler<dim> > &,
                   const std::vector<Vector<double> > &,
                   const std::vector<int>             &,
                   std::vector<std::map<unsigned int, float> > &,
@@ -3237,7 +3237,7 @@ void
 DoFTools::compute_intergrid_weights_3 (
   const DoFHandler<dim>              &coarse_grid,
   const unsigned int                  coarse_component,
-  const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
+  const InterGridMap<DoFHandler<dim> > &coarse_to_fine_grid_map,
   const std::vector<Vector<double> > &parameter_dofs,
   const std::vector<int>             &weight_mapping,
   std::vector<std::map<unsigned int, float> > &weights,
@@ -4063,7 +4063,7 @@ 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> &,
+  const InterGridMap<DoFHandler<deal_II_dimension> > &,
   ConstraintMatrix&);
 
 template
@@ -4071,7 +4071,7 @@ 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> &,
+ const InterGridMap<DoFHandler<deal_II_dimension> > &,
  std::vector<std::map<unsigned int, float> > &);
 
 
index 8b16968af1c4e5cc15e25aaa031576ae58ba5234..49bd07e002551636e88f7bf14b0fc178666c145c 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -52,8 +52,8 @@ get_n_levels (const Triangulation<dim> &grid)
 }
 
 
-template <template <int> class GridClass, int dim>
-InterGridMap<GridClass,dim>::InterGridMap ()
+template <class GridClass>
+InterGridMap<GridClass>::InterGridMap ()
                :
                source_grid(0, typeid(*this).name()),
                destination_grid(0, typeid(*this).name())
@@ -62,9 +62,9 @@ InterGridMap<GridClass,dim>::InterGridMap ()
 
 
 
-template <template <int> class GridClass, int dim>
-void InterGridMap<GridClass,dim>::make_mapping (const GridClass<dim> &source_grid,
-                                               const GridClass<dim> &destination_grid) 
+template <class GridClass>
+void InterGridMap<GridClass>::make_mapping (const GridClass &source_grid,
+                                           const GridClass &destination_grid) 
 {
                                   // first delete all contents
   clear ();
@@ -119,10 +119,10 @@ void InterGridMap<GridClass,dim>::make_mapping (const GridClass<dim> &source_gri
 
 
 
-template <template <int> class GridClass, int dim>
+template <class GridClass>
 void
-InterGridMap<GridClass,dim>::set_mapping (const cell_iterator &src_cell,
-                                         const cell_iterator &dst_cell)
+InterGridMap<GridClass>::set_mapping (const cell_iterator &src_cell,
+                                     const cell_iterator &dst_cell)
 {
                                   // first set the map for this cell
   mapping[src_cell->level()][src_cell->index()] = dst_cell;
@@ -130,7 +130,7 @@ InterGridMap<GridClass,dim>::set_mapping (const cell_iterator &src_cell,
                                   // if both cells have children, we may
                                   // recurse further into the hierarchy
   if (src_cell->has_children() && dst_cell->has_children())
-    for (unsigned int c=0; c<GeometryInfo<dim>::children_per_cell; ++c)
+    for (unsigned int c=0; c<GeometryInfo<GridClass::dimension>::children_per_cell; ++c)
       set_mapping (src_cell->child(c),
                   dst_cell->child(c));
   else
@@ -140,7 +140,7 @@ InterGridMap<GridClass,dim>::set_mapping (const cell_iterator &src_cell,
                                       // set entries for all children
                                       // of this cell to the one
                                       // dst_cell
-      for (unsigned int c=0; c<GeometryInfo<dim>::children_per_cell; ++c)
+      for (unsigned int c=0; c<GeometryInfo<GridClass::dimension>::children_per_cell; ++c)
        set_entries_to_cell (src_cell->child(c),
                             dst_cell);
                                   // else (no cell is refined or
@@ -150,10 +150,10 @@ InterGridMap<GridClass,dim>::set_mapping (const cell_iterator &src_cell,
 
 
 
-template <template <int> class GridClass, int dim>
+template <class GridClass>
 void
-InterGridMap<GridClass,dim>::set_entries_to_cell (const cell_iterator &src_cell,
-                                                 const cell_iterator &dst_cell)
+InterGridMap<GridClass>::set_entries_to_cell (const cell_iterator &src_cell,
+                                             const cell_iterator &dst_cell)
 {
                                   // first set the map for this cell
   mapping[src_cell->level()][src_cell->index()] = dst_cell;
@@ -161,15 +161,15 @@ InterGridMap<GridClass,dim>::set_entries_to_cell (const cell_iterator &src_cell,
                                   // then do so for the children as well
                                   // if there are any
   if (src_cell->has_children())
-    for (unsigned int c=0; c<GeometryInfo<dim>::children_per_cell; ++c)
+    for (unsigned int c=0; c<GeometryInfo<GridClass::dimension>::children_per_cell; ++c)
       set_entries_to_cell (src_cell->child(c),
                           dst_cell);
 }
 
 
-template <template <int> class GridClass, int dim>
-typename InterGridMap<GridClass,dim>::cell_iterator
-InterGridMap<GridClass,dim>::operator [] (const cell_iterator &source_cell) const
+template <class GridClass>
+typename InterGridMap<GridClass>::cell_iterator
+InterGridMap<GridClass>::operator [] (const cell_iterator &source_cell) const
 {
   Assert (source_cell.state() == IteratorState::valid,
          ExcInvalidKey (source_cell));
@@ -183,8 +183,8 @@ InterGridMap<GridClass,dim>::operator [] (const cell_iterator &source_cell) cons
 
 
 
-template <template <int> class GridClass, int dim>
-void InterGridMap<GridClass,dim>::clear () 
+template <class GridClass>
+void InterGridMap<GridClass>::clear () 
 {
   mapping.clear ();
   source_grid      = 0;
@@ -193,27 +193,27 @@ void InterGridMap<GridClass,dim>::clear ()
 
 
 
-template <template <int> class GridClass, int dim>
-const GridClass<dim> &
-InterGridMap<GridClass,dim>::get_source_grid () const
+template <class GridClass>
+const GridClass &
+InterGridMap<GridClass>::get_source_grid () const
 {
   return *source_grid;
 }
 
 
 
-template <template <int> class GridClass, int dim>
-const GridClass<dim> &
-InterGridMap<GridClass,dim>::get_destination_grid () const
+template <class GridClass>
+const GridClass &
+InterGridMap<GridClass>::get_destination_grid () const
 {
   return *destination_grid;
 }
 
 
 
-template <template <int> class GridClass, int dim>
+template <class GridClass>
 unsigned int
-InterGridMap<GridClass,dim>::memory_consumption () const
+InterGridMap<GridClass>::memory_consumption () const
 {
   return (MemoryConsumption::memory_consumption (mapping) +
          MemoryConsumption::memory_consumption (source_grid) +
@@ -223,7 +223,8 @@ InterGridMap<GridClass,dim>::memory_consumption () const
 
   
 // explicit instantiations
-template class InterGridMap<Triangulation, deal_II_dimension>;
-template class InterGridMap<DoFHandler, deal_II_dimension>;
+template class InterGridMap<Triangulation<deal_II_dimension> >;
+template class InterGridMap<DoFHandler<deal_II_dimension> >;
 
-template class InterGridMap<MGDoFHandler, deal_II_dimension>;
+template class InterGridMap<hp::DoFHandler<deal_II_dimension> >;
+template class InterGridMap<MGDoFHandler<deal_II_dimension> >;

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.