]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Smartpointer got a second template argument and ALL deal.II Smartpointers now identif...
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 15 Oct 2009 22:19:51 +0000 (22:19 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 15 Oct 2009 22:19:51 +0000 (22:19 +0000)
git-svn-id: https://svn.dealii.org/trunk@19894 0785d39b-7218-0410-832d-ea1e28bc413d

66 files changed:
deal.II/base/include/base/named_data.h
deal.II/base/include/base/smartpointer.h
deal.II/deal.II/include/dofs/dof_handler.h
deal.II/deal.II/include/fe/fe_values.h
deal.II/deal.II/include/fe/mapping_q1_eulerian.h
deal.II/deal.II/include/fe/mapping_q_eulerian.h
deal.II/deal.II/include/grid/grid_in.h
deal.II/deal.II/include/grid/intergrid_map.h
deal.II/deal.II/include/grid/persistent_tria.h
deal.II/deal.II/include/grid/tria.h
deal.II/deal.II/include/hp/dof_handler.h
deal.II/deal.II/include/hp/fe_values.h
deal.II/deal.II/include/hp/q_collection.h
deal.II/deal.II/include/multigrid/mg_coarse.h
deal.II/deal.II/include/multigrid/mg_matrix.h
deal.II/deal.II/include/multigrid/mg_transfer_block.h
deal.II/deal.II/include/multigrid/multigrid.h
deal.II/deal.II/include/numerics/data_out.h
deal.II/deal.II/include/numerics/data_out_stack.h
deal.II/deal.II/include/numerics/fe_field_function.h
deal.II/deal.II/include/numerics/mesh_worker.h
deal.II/deal.II/include/numerics/mesh_worker_assembler.h
deal.II/deal.II/include/numerics/mesh_worker_info.h
deal.II/deal.II/include/numerics/mesh_worker_vector_selector.h
deal.II/deal.II/include/numerics/mesh_worker_vector_selector.templates.h
deal.II/deal.II/include/numerics/point_value_history.h
deal.II/deal.II/include/numerics/solution_transfer.h
deal.II/deal.II/include/numerics/time_dependent.h
deal.II/deal.II/source/fe/fe_values.cc
deal.II/deal.II/source/fe/mapping_q1_eulerian.cc
deal.II/deal.II/source/fe/mapping_q_eulerian.cc
deal.II/deal.II/source/grid/grid_in.cc
deal.II/deal.II/source/grid/persistent_tria.cc
deal.II/deal.II/source/grid/tria.cc
deal.II/deal.II/source/hp/dof_handler.cc
deal.II/deal.II/source/hp/fe_values.cc
deal.II/deal.II/source/numerics/data_out.cc
deal.II/deal.II/source/numerics/point_value_history.cc
deal.II/deal.II/source/numerics/solution_transfer.cc
deal.II/deal.II/source/numerics/time_dependent.cc
deal.II/lac/include/lac/block_matrix.h
deal.II/lac/include/lac/block_matrix_array.h
deal.II/lac/include/lac/block_matrix_base.h
deal.II/lac/include/lac/block_sparse_matrix.h
deal.II/lac/include/lac/block_sparse_matrix.templates.h
deal.II/lac/include/lac/block_sparsity_pattern.h
deal.II/lac/include/lac/chunk_sparse_matrix.h
deal.II/lac/include/lac/filtered_matrix.h
deal.II/lac/include/lac/lapack_full_matrix.h
deal.II/lac/include/lac/matrix_lib.h
deal.II/lac/include/lac/pointer_matrix.h
deal.II/lac/include/lac/precondition.h
deal.II/lac/include/lac/precondition_block.h
deal.II/lac/include/lac/precondition_block.templates.h
deal.II/lac/include/lac/precondition_selector.h
deal.II/lac/include/lac/schur_matrix.h
deal.II/lac/include/lac/shifted_matrix.h
deal.II/lac/include/lac/solver_selector.h
deal.II/lac/include/lac/sparse_direct.h
deal.II/lac/include/lac/sparse_matrix.h
deal.II/lac/include/lac/sparse_vanka.h
deal.II/lac/include/lac/sparse_vanka.templates.h
deal.II/lac/include/lac/transpose_matrix.h
deal.II/lac/include/lac/tridiagonal_matrix.h
deal.II/lac/include/lac/vector_memory.h
deal.II/lac/source/sparse_direct.cc

index 6fba2c1cccbb29856da14cc4e63af7e964b9c565..f8c747dc468eb8abefc4324fdbfd9259b0361e59 100644 (file)
@@ -48,6 +48,15 @@ class NamedData : public Subscriptor
                                      * an empty object.
                                      */
     NamedData();
+
+                                    /**
+                                     * Assignment operator, copying
+                                     * conversible data from another
+                                     * object.
+                                     */
+    template <typename DATA2>
+    NamedData<DATA>& operator = (const NamedData<DATA2>& other);
+    
                                     /**
                                      * \name Adding members
                                      */
@@ -75,7 +84,8 @@ class NamedData : public Subscriptor
                                      * #is_constant set, so will have
                                      * this object after merge.
                                      */
-    void merge(NamedData&);
+    template <typename DATA2>
+    void merge(NamedData<DATA2>&);
                                     /**
                                      * Merge the data of another
                                      * NamedData to the end of this
@@ -85,7 +95,8 @@ class NamedData : public Subscriptor
                                      * data in this object will be
                                      * treated as const.
                                      */
-    void merge(const NamedData&);
+    template <typename DATA2>
+    void merge(const NamedData<DATA2>&);
 //@}
                                     /**
                                      * \name Accessing and querying
@@ -243,35 +254,52 @@ NamedData<DATA>::add(const DATA& v, const std::string& n)
   
   
 template<typename DATA>
+template<typename DATA2>
 inline
 void
-NamedData<DATA>::merge(NamedData<DATA>& other)
+NamedData<DATA>::merge(NamedData<DATA2>& other)
 {
   Assert(!is_constant, ExcConstantObject());
   for (unsigned int i=0;i<other.size();++i)
     {
-      names.push_back(other.names[i]);
-      data.push_back(other.data[i]);
+      names.push_back(other.name(i));
+      data.push_back(other(i));
     }
-  is_constant = other.is_constant;
+  is_constant = other.is_const();
 }
   
   
 template<typename DATA>
+template<typename DATA2>
 inline
 void
-NamedData<DATA>::merge(const NamedData<DATA>& other)
+NamedData<DATA>::merge(const NamedData<DATA2>& other)
 {
   Assert(!is_constant, ExcConstantObject());
   for (unsigned int i=0;i<other.size();++i)
     {
-      names.push_back(other.names[i]);
-      data.push_back(other.data[i]);
+      names.push_back(other.name(i));
+      data.push_back(other(i));
     }
   is_constant = true;
 }
   
+
+
+template<typename DATA>
+template<typename DATA2>
+inline
+NamedData<DATA>&
+NamedData<DATA>::operator= (const NamedData<DATA2>& other)
+{
+  is_constant = false;
+  merge(other);
+  is_constant = other.is_const();
+  return *this;
+}
   
+
+
 template<typename DATA>
 inline
 unsigned int
index 8b2ad54bcb20a7608efe7ba8d773a39a6e11b9ce..4f3bd1b8737fa96bbaabb6de4f2ac2adf6bcec79 100644 (file)
@@ -25,20 +25,24 @@ DEAL_II_NAMESPACE_OPEN
  * but make sure that the object pointed to is not deleted in the course of
  * use of the pointer by signalling the pointee its use.
  *
- * Objects pointed to should inherit <tt>Subscriptor</tt> or must implement
- * the same functionality. Null pointers are an exception from this
- * rule and are allowed, too.
+ * Objects pointed to, that is ,the class T, should inherit
+ * Subscriptor or must implement the same functionality. Null pointers
+ * are an exception from this rule and are allowed, too.
+ *
+ * The second template argument P only serves a single purpose: if a
+ * constructor without a debug string is used, then the name of P is
+ * used as the debug string.
  *
  * SmartPointer does NOT implement any memory handling! Especially,
  * deleting a SmartPointer does not delete the object. Writing
  * @code
- * SmartPointer<T> dont_do_this = new T;
+ * SmartPointer<T,P> dont_do_this = new T;
  * @endcode
  * is a sure way to program a memory leak! The secure version is
  * @code
  * T* p = new T;
  * {
- *   SmartPointer<T> t(p, "mypointer");
+ *   SmartPointer<T,P> t(p);
  *   ...
  * }
  * delete p;
@@ -52,17 +56,15 @@ DEAL_II_NAMESPACE_OPEN
  * @ingroup memory
  * @author Guido Kanschat, Wolfgang Bangerth, 1998 - 2009
  */
-template<typename T>
+template<typename T, typename P = void>
 class SmartPointer
 {
   public:
                                     /**
                                      * Standard constructor for null
-                                     * pointer.  @deprecated Since
-                                     * this constructor will leave
-                                     * SmartPointer::id empty, it should be
-                                     * avoided wherever possible and
-                                     * replaced by SmartPointer(0,id).
+                                     * pointer. The id of this
+                                     * pointer is set to the name of
+                                     * the class P.
                                      */
     SmartPointer ();
 
@@ -72,13 +74,18 @@ class SmartPointer
                                      * copy the object subscribed to
                                      * from <tt>tt</tt>, but subscribe
                                      * ourselves to it again.
-                                     *
-                                     * The <tt>id</tt> is used in the
-                                     * call to
-                                     * Subscriptor::subscribe(typeid(*this).name()). The #id of
-                                     * the object copied is used here.
                                      */
-    SmartPointer (const SmartPointer<T> &tt);
+    template <class Q>
+    SmartPointer (const SmartPointer<T,Q> &tt);
+
+                                    /*
+                                     * Copy constructor for
+                                     * SmartPointer. We do now
+                                     * copy the object subscribed to
+                                     * from <tt>tt</tt>, but subscribe
+                                     * ourselves to it again.
+                                     */
+    SmartPointer (const SmartPointer<T,P> &tt);
 
                                     /**
                                      * Constructor taking a normal
@@ -92,11 +99,25 @@ class SmartPointer
                                      *
                                      * The <tt>id</tt> is used in the
                                      * call to
-                                     * Subscriptor::subscribe(typeid(*this).name()) and
+                                     * Subscriptor::subscribe(id) and
                                      * by ~SmartPointer() in the call
                                      * to Subscriptor::unsubscribe().
                                      */
-    SmartPointer (T *t, const char* id=0);
+    SmartPointer (T *t, const char* id);
+
+                                    /**
+                                     * Constructor taking a normal
+                                     * pointer.  If possible, i.e. if
+                                     * the pointer is not a null
+                                     * pointer, the constructor
+                                     * subscribes to the given object
+                                     * to lock it, i.e. to prevent
+                                     * its destruction before the end
+                                     * of its use. The id of this
+                                     * pointer is set to the name of
+                                     * the class P.
+                                     */
+    SmartPointer (T *t);
 
 
                                     /**
@@ -115,7 +136,17 @@ class SmartPointer
                                      * null-pointer, but stilll
                                      * delete the old subscription.
                                      */
-    SmartPointer<T> & operator= (T *tt);
+    SmartPointer<T,P> & operator= (T *tt);
+
+                                    /**
+                                     * Assignment operator for
+                                     * SmartPointer.  The pointer
+                                     * subscribes to the new object
+                                     * automatically and unsubscribes
+                                     * to an old one if it exists.
+                                     */
+    template <class Q>
+    SmartPointer<T,P> & operator= (const SmartPointer<T,Q> &tt);
 
                                     /**
                                      * Assignment operator for
@@ -124,7 +155,7 @@ class SmartPointer
                                      * automatically and unsubscribes
                                      * to an old one if it exists.
                                      */
-    SmartPointer<T> & operator= (const SmartPointer<T> &tt);
+    SmartPointer<T,P> & operator= (const SmartPointer<T,P> &tt);
 
                                     /**
                                      * Conversion to normal pointer.
@@ -132,12 +163,18 @@ class SmartPointer
     operator T* () const;
     
                                     /**
-                                     * Dereferencing operator.
+                                     * Dereferencing operator. This
+                                     * operator throws an
+                                     * ExcNotInitialized if the
+                                     * pointer is a null pointer.
                                      */
     T& operator * () const;
     
                                     /**
-                                     * Dereferencing operator.
+                                     * Dereferencing operator. This
+                                     * operator throws an
+                                     * ExcNotInitialized if the
+                                     * pointer is a null pointer.
                                      */
     T * operator -> () const;
 
@@ -158,7 +195,8 @@ class SmartPointer
                                      * pointer are implemented in
                                      * global namespace.
                                      */
-    void swap (SmartPointer<T> &tt);
+    template <class Q>
+    void swap (SmartPointer<T,Q> &tt);
 
                                     /**
                                      * Swap pointers between this
@@ -209,16 +247,30 @@ class SmartPointer
 /* --------------------------- inline Template functions ------------------------------*/
 
 
-template <typename T>
-SmartPointer<T>::SmartPointer ()
+template <typename T, typename P>
+inline
+SmartPointer<T,P>::SmartPointer ()
                 :
-               t (0), id(0)
+               t (0), id(typeid(P).name())
 {}
 
 
 
-template <typename T>
-SmartPointer<T>::SmartPointer (T *t, const char* id)
+template <typename T, typename P>
+inline
+SmartPointer<T,P>::SmartPointer (T *t)
+                :
+               t (t), id(typeid(P).name())
+{
+  if (t != 0)
+    t->subscribe(id);
+}
+
+
+
+template <typename T, typename P>
+inline
+SmartPointer<T,P>::SmartPointer (T *t, const char* id)
                 :
                t (t), id(id)
 {
@@ -228,8 +280,22 @@ SmartPointer<T>::SmartPointer (T *t, const char* id)
 
 
 
-template <typename T>
-SmartPointer<T>::SmartPointer (const SmartPointer<T> &tt)
+template <typename T, typename P>
+template <class Q>
+inline
+SmartPointer<T,P>::SmartPointer (const SmartPointer<T,Q> &tt)
+                :
+               t (tt.t), id(tt.id)
+{
+  if (t != 0)
+    t->subscribe(id);
+}
+
+
+
+template <typename T, typename P>
+inline
+SmartPointer<T,P>::SmartPointer (const SmartPointer<T,P> &tt)
                 :
                t (tt.t), id(tt.id)
 {
@@ -239,8 +305,9 @@ SmartPointer<T>::SmartPointer (const SmartPointer<T> &tt)
 
 
 
-template <typename T>
-SmartPointer<T>::~SmartPointer ()
+template <typename T, typename P>
+inline
+SmartPointer<T,P>::~SmartPointer ()
 {
   if (t != 0)
     t->unsubscribe(id);
@@ -248,8 +315,9 @@ SmartPointer<T>::~SmartPointer ()
 
 
 
-template <typename T>
-SmartPointer<T> & SmartPointer<T>::operator = (T *tt)
+template <typename T, typename P>
+inline
+SmartPointer<T,P> & SmartPointer<T,P>::operator = (T *tt)
 {
                                   // optimize if no real action is
                                   // requested
@@ -266,9 +334,32 @@ SmartPointer<T> & SmartPointer<T>::operator = (T *tt)
 
 
 
-template <typename T>
-SmartPointer<T> &
-SmartPointer<T>::operator = (const SmartPointer<T>& tt)
+template <typename T, typename P>
+template <class Q>
+inline
+SmartPointer<T,P> &
+SmartPointer<T,P>::operator = (const SmartPointer<T,Q>& tt)
+{
+                                  // if objects on the left and right
+                                  // hand side of the operator= are
+                                  // the same, then this is a no-op
+  if (&tt == this)
+    return *this;
+  
+  if (t != 0)
+    t->unsubscribe(id);
+  t = static_cast<T*>(tt);
+  if (tt != 0)
+    tt->subscribe(id);
+  return *this;
+}
+
+
+
+template <typename T, typename P>
+inline
+SmartPointer<T,P> &
+SmartPointer<T,P>::operator = (const SmartPointer<T,P>& tt)
 {
                                   // if objects on the left and right
                                   // hand side of the operator= are
@@ -286,18 +377,18 @@ SmartPointer<T>::operator = (const SmartPointer<T>& tt)
 
 
 
-template <typename T>
+template <typename T, typename P>
 inline
-SmartPointer<T>::operator T* () const
+SmartPointer<T,P>::operator T* () const
 {
   return t;
 }
 
 
 
-template <typename T>
+template <typename T, typename P>
 inline
-T & SmartPointer<T>::operator * () const
+T & SmartPointer<T,P>::operator * () const
 {
   Assert(t != 0, ExcNotInitialized());
   return *t;
@@ -305,9 +396,9 @@ T & SmartPointer<T>::operator * () const
 
 
 
-template <typename T>
+template <typename T, typename P>
 inline
-T * SmartPointer<T>::operator -> () const
+T * SmartPointer<T,P>::operator -> () const
 {
   Assert(t != 0, ExcNotInitialized());
   return t;
@@ -315,12 +406,13 @@ T * SmartPointer<T>::operator -> () const
 
 
 
-template <typename T>
+template <typename T, typename P>
+template <class Q>
 inline
-void SmartPointer<T>::swap (SmartPointer<T> &tt)
+void SmartPointer<T,P>::swap (SmartPointer<T,Q> &tt)
 {
 #ifdef DEBUG
-  SmartPointer<T> aux(t,id);
+  SmartPointer<T,P> aux(t,id);
   *this = tt;
   tt = aux;
 #else
@@ -330,9 +422,9 @@ void SmartPointer<T>::swap (SmartPointer<T> &tt)
 
 
 
-template <typename T>
+template <typename T, typename P>
 inline
-void SmartPointer<T>::swap (T *&tt)
+void SmartPointer<T,P>::swap (T *&tt)
 {
   if (t != 0)
     t->unsubscribe (id);
@@ -345,11 +437,11 @@ void SmartPointer<T>::swap (T *&tt)
 
 
 
-template <typename T>
+template <typename T, typename P>
 inline
-unsigned int SmartPointer<T>::memory_consumption () const
+unsigned int SmartPointer<T,P>::memory_consumption () const
 {
-  return sizeof(SmartPointer<T>);
+  return sizeof(SmartPointer<T,P>);
 }
 
 
@@ -360,9 +452,9 @@ unsigned int SmartPointer<T>::memory_consumption () const
  * objects to which the pointers point retain to be subscribed to, we
  * do not have to change their subscription count.
  */
-template <typename T>
+template <typename T, typename P, class Q>
 inline
-void swap (SmartPointer<T> &t1, SmartPointer<T> &t2)
+void swap (SmartPointer<T,P> &t1, SmartPointer<T,Q> &t2)
 {
   t1.swap (t2);
 }
@@ -376,9 +468,9 @@ void swap (SmartPointer<T> &t1, SmartPointer<T> &t2)
  * Note that we indeed need a reference of a pointer, as we want to
  * change the pointer variable which we are given.
  */
-template <typename T>
+template <typename T, typename P>
 inline
-void swap (SmartPointer<T> &t1, T *&t2)
+void swap (SmartPointer<T,P> &t1, T *&t2)
 {
   t1.swap (t2);
 }
@@ -392,9 +484,9 @@ void swap (SmartPointer<T> &t1, T *&t2)
  * Note that we indeed need a reference of a pointer, as we want to
  * change the pointer variable which we are given.
  */
-template <typename T>
+template <typename T, typename P>
 inline
-void swap (T *&t1, SmartPointer<T> &t2)
+void swap (T *&t1, SmartPointer<T,P> &t2)
 {
   t2.swap (t1);
 }
index 20fe30e31dd38fb235c2046ebb35a9ef53327091..523e6a9db954ee3ccff8bace02212a524ec9aded 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -1005,7 +1005,7 @@ class DoFHandler  :  public Subscriptor
                                      * Address of the triangulation to
                                      * work on.
                                      */
-    SmartPointer<const Triangulation<dim,spacedim> > tria;
+    SmartPointer<const Triangulation<dim,spacedim>,DoFHandler<dim,spacedim> > tria;
 
                                     /**
                                      * Store a pointer to the finite element
@@ -1019,7 +1019,7 @@ class DoFHandler  :  public Subscriptor
                                      * function (this clears all data of
                                      * this object as well, though).
                                      */
-    SmartPointer<const FiniteElement<dim,spacedim> > selected_fe;
+    SmartPointer<const FiniteElement<dim,spacedim>,DoFHandler<dim,spacedim> > selected_fe;
 
   private:
 
index 26f8c516d4495f99feefe50ddbf97b1d5b1c2039..3a13434c528c5617772f9b94e9ed0697d404f02f 100644 (file)
@@ -2875,23 +2875,23 @@ class FEValuesBase : protected FEValuesData<dim,spacedim>,
                                     /**
                                      * Storage for the mapping object.
                                      */
-    const SmartPointer<const Mapping<dim,spacedim> > mapping;
+    const SmartPointer<const Mapping<dim,spacedim>,FEValuesBase<dim,spacedim> > mapping;
 
                                     /**
                                      * Store the finite element for later use.
                                      */
-    const SmartPointer<const FiniteElement<dim,spacedim> > fe;
+    const SmartPointer<const FiniteElement<dim,spacedim>,FEValuesBase<dim,spacedim> > fe;
 
 
                                     /**
                                      * Internal data of mapping.
                                      */
-    SmartPointer<typename Mapping<dim,spacedim>::InternalDataBase> mapping_data;
+    SmartPointer<typename Mapping<dim,spacedim>::InternalDataBase,FEValuesBase<dim,spacedim> > mapping_data;
 
                                     /**
                                      * Internal data of finite element.
                                      */
-    SmartPointer<typename Mapping<dim,spacedim>::InternalDataBase> fe_data;
+    SmartPointer<typename Mapping<dim,spacedim>::InternalDataBase,FEValuesBase<dim,spacedim> > fe_data;
 
                                     /**
                                      * Initialize some update
index c8f4f6a0e18d714e5e7c8ad36723908efb1ac5e3..6cb5a0fcd9f396aac2cb49b71ad7a12b58821496 100644 (file)
@@ -84,7 +84,7 @@ DEAL_II_NAMESPACE_OPEN
  *
  * @author Michael Stadler, 2001
  */
-template <int dim, class EulerVectorType = Vector<double>, int spacedim=dim >
+template <int dim, class VECTOR = Vector<double>, int spacedim=dim >
 class MappingQ1Eulerian : public MappingQ1<dim,spacedim>
 {
   public:
@@ -110,7 +110,7 @@ class MappingQ1Eulerian : public MappingQ1<dim,spacedim>
                                      * can be initialized by
                                      * <tt>DoFAccessor::set_dof_values()</tt>.
                                      */
-    MappingQ1Eulerian (const EulerVectorType  &euler_transform_vectors,
+    MappingQ1Eulerian (const VECTOR  &euler_transform_vectors,
                        const DoFHandler<dim,spacedim> &shiftmap_dof_handler);
     
                                      /**
@@ -165,14 +165,14 @@ class MappingQ1Eulerian : public MappingQ1<dim,spacedim>
                                      * Reference to the vector of
                                      * shifts.
                                      */
-    const EulerVectorType &euler_transform_vectors;
+    const VECTOR &euler_transform_vectors;
     
                                      /**
                                      * Pointer to the DoFHandler to
                                      * which the mapping vector is
                                      * associated.
                                      */
-    const SmartPointer<const DoFHandler<dim,spacedim> > shiftmap_dof_handler;
+    const SmartPointer<const DoFHandler<dim,spacedim>,MappingQ1Eulerian<dim,VECTOR,spacedim> > shiftmap_dof_handler;
     
 
   private:    
index e8ca37dcc6215b0dfa6daf6c51f2ee8535c092c3..fdbefcdff060e6fe405b86c500c34a8ee130033d 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -86,7 +86,7 @@ DEAL_II_NAMESPACE_OPEN
  *
  * @author Joshua White, 2008
  */
-template <int dim, class EulerVectorType = Vector<double>, int spacedim=dim >
+template <int dim, class VECTOR = Vector<double>, int spacedim=dim >
 class MappingQEulerian : public MappingQ<dim, spacedim>
 {
   public:
@@ -114,7 +114,7 @@ class MappingQEulerian : public MappingQ<dim, spacedim>
                                       */
 
     MappingQEulerian (const unsigned int     degree,
-                      const EulerVectorType  &euler_vector,
+                      const VECTOR  &euler_vector,
                       const DoFHandler<dim>  &euler_dof_handler);
 
                                      /**
@@ -169,7 +169,7 @@ class MappingQEulerian : public MappingQ<dim, spacedim>
                                       * shifts.
                                       */
 
-    const EulerVectorType &euler_vector;
+    const VECTOR &euler_vector;
     
                                      /**
                                       * Pointer to the DoFHandler to
@@ -177,7 +177,7 @@ class MappingQEulerian : public MappingQ<dim, spacedim>
                                       * associated.
                                       */
 
-    const SmartPointer<const DoFHandler<dim> > euler_dof_handler;
+    const SmartPointer<const DoFHandler<dim>,MappingQEulerian<dim,VECTOR,spacedim> > euler_dof_handler;
 
 
   private:   
index 729ab09361b2c8a5a289445f017c6889809cfffe..636afee4cbc5e4ae41b2df851729e5b7f17fb33a 100644 (file)
@@ -441,7 +441,7 @@ class GridIn
                                      * Store address of the triangulation to
                                      * be fed with the data read in.
                                      */
-    SmartPointer<Triangulation<dim,spacedim> > tria;
+    SmartPointer<Triangulation<dim,spacedim>,GridIn<dim,spacedim> > tria;
     
                                     /**
                                      * This function can write the
index 9f3b80a5188c5d365e34d8becad15e721fcaf295..1ac1ed72edb98c5593911780ada5be9c63195f59 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -195,12 +195,12 @@ class InterGridMap
                                     /**
                                      * Store a pointer to the source grid.
                                      */
-    SmartPointer<const GridClass > source_grid;
+    SmartPointer<const GridClass,InterGridMap<GridClass> > source_grid;
 
                                     /**
                                      * Likewise for the destination grid.
                                      */
-    SmartPointer<const GridClass > destination_grid;
+    SmartPointer<const GridClass,InterGridMap<GridClass> > destination_grid;
 
                                     /**
                                      * Set the mapping for the pair of
index 4bce1e0340a359ccf058605338484d4b2256aa5b..da68425a75ec6a339e44b3bfac335f7dfc7e5545 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -282,7 +282,7 @@ class PersistentTriangulation : public Triangulation<dim>
                                      * This grid shall be used as coarse
                                      * grid.
                                      */
-    SmartPointer<const Triangulation<dim> > coarse_grid;
+    SmartPointer<const Triangulation<dim>,PersistentTriangulation<dim> > coarse_grid;
     
                                     /**
                                      * Vectors holding the refinement and
index 030d201f5e2953337a157f238cb4b6803a60ae64..5ebfb137db5325ff5676220dff5ae7f891c98e9c 100644 (file)
@@ -3264,7 +3264,7 @@ class Triangulation : public Subscriptor
                                      *  and can thus never be
                                      *  associated with a boundary.
                                      */
-    SmartPointer<const Boundary<dim,spacedim> > boundary[255];
+    SmartPointer<const Boundary<dim,spacedim>,Triangulation<dim,spacedim> > boundary[255];
 
                                     /**
                                      *  Collection of ly
@@ -3275,7 +3275,7 @@ class Triangulation : public Subscriptor
                                      *  and can thus never be
                                      *  associated with a boundary.
                                      */
-    SmartPointer<const Boundary<spacedim,spacedim> > manifold_description[255];
+    SmartPointer<const Boundary<spacedim,spacedim>,Triangulation<dim,spacedim> > manifold_description[255];
 
                                     /**
                                      * Flag indicating whether
index 4a34f2a4b380d96e2fb62d7635decdf67c5c72d6..f8a8b4a7ad15736d83bf4a2815b132f428f03008 100644 (file)
@@ -936,7 +936,7 @@ namespace hp
                                         * Address of the triangulation to
                                         * work on.
                                         */
-      SmartPointer<const Triangulation<dim,spacedim> > tria;
+      SmartPointer<const Triangulation<dim,spacedim>,DoFHandler<dim,spacedim> > tria;
 
                                        /**
                                         * Store a pointer to the finite
@@ -953,7 +953,7 @@ namespace hp
                                         * (this clears all data of this
                                         * object as well, though).
                                         */
-      SmartPointer<const hp::FECollection<dim,spacedim> > finite_elements;
+      SmartPointer<const hp::FECollection<dim,spacedim>,hp::DoFHandler<dim,spacedim> > finite_elements;
 
     private:
 
index 0e91c643f733029ca48c2cc05e80127749850c35..3486441199b6a7288fcfd13f51a489590c9dda2b 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2003, 2004, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -129,14 +129,16 @@ namespace internal
                                           * collection of finite
                                           * elements to be used.
                                           */
-        const SmartPointer<const dealii::hp::FECollection<dim,FEValues::space_dimension> > fe_collection;
+        const SmartPointer<const dealii::hp::FECollection<dim,FEValues::space_dimension>,
+                          FEValuesBase<dim,q_dim,FEValues> > fe_collection;
         
                                          /**
                                           * A pointer to the
                                           * collection of mappings to
                                           * be used.
                                           */
-        const SmartPointer<const dealii::hp::MappingCollection<dim, FEValues::space_dimension> > mapping_collection;
+        const SmartPointer<const dealii::hp::MappingCollection<dim, FEValues::space_dimension>,
+                          FEValuesBase<dim,q_dim,FEValues> > mapping_collection;
     
                                          /**
                                           * Copy of the quadrature
index 009aa6377bf10acf479ec6802eef6ae923a7af76..923bea2d4c142bf76a438920ee6dfc5911b0a6eb 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -16,7 +16,6 @@
 #include <base/config.h>
 #include <base/subscriptor.h>
 #include <base/quadrature.h>
-#include <base/smartpointer.h>
 #include <base/memory_consumption.h>
 #include <fe/fe.h>
 
index 3cc764de656458c78c6092d1eebc706118450cfb..7a51c724a931b85070d5d3781501301b5cf8af9f 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -97,7 +97,7 @@ class MGCoarseGridLACIteration :  public MGCoarseGridBase<VECTOR>
                                     /**
                                      * Reference to the solver.
                                      */
-    SmartPointer<SOLVER> solver;
+    SmartPointer<SOLVER,MGCoarseGridLACIteration<SOLVER,VECTOR> > solver;
     
                                     /**
                                      * Reference to the matrix.
index 1949783debc914436ebcedcfe771c77629d714c8..8870b16b2469c833172d086788e876a4386396c0 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2003, 2004, 2005, 2006, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -97,7 +97,7 @@ class MGMatrix : public MGMatrixBase<VECTOR>
                                     /**
                                      * Pointer to the matrix objects on each level.
                                      */
-    SmartPointer<MGLevelObject<MATRIX> > matrix;
+    SmartPointer<MGLevelObject<MATRIX>,MGMAtrix<MATRIX,VECTOR> > matrix;
 };
 
 
@@ -181,7 +181,7 @@ class MGMatrixSelect : public MGMatrixBase<Vector<number> >
                                     /**
                                      * Pointer to the matrix objects on each level.
                                      */
-    SmartPointer<MGLevelObject<MATRIX> > matrix;
+    SmartPointer<MGLevelObject<MATRIX>,MGMAtrixSelect<MATRIX,number> > matrix;
                                     /**
                                      * Row coordinate of selected block.
                                      */
index bb15a590055e2afb193ea11d676142ba039aa997..8c6621478b2bd33a9efb4e7a245873c4ab59a26f 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -293,7 +293,7 @@ class MGTransferBlock : public MGTransferBase<BlockVector<number> >,
                                      * additional multiplication
                                      * using #factors is desired.
                                      */
-    SmartPointer<VectorMemory<Vector<number> > > memory;
+    SmartPointer<VectorMemory<Vector<number> >,MGTransferBlock<number> > memory;
 };
 
 
index 0c56053be3ea14a4b4aa8104c19fa0a425f9ea40..26ec75f3856e6a7741c33df3dc5e0ecb7f506aef 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -374,37 +374,37 @@ class Multigrid : public Subscriptor
                                     /**
                                      * The matrix for each level.
                                      */
-    SmartPointer<const MGMatrixBase<VECTOR> > matrix;
+    SmartPointer<const MGMatrixBase<VECTOR>,Multigrid<VECTOR> > matrix;
     
                                     /**
                                      * The matrix for each level.
                                      */
-    SmartPointer<const MGCoarseGridBase<VECTOR> > coarse;
+    SmartPointer<const MGCoarseGridBase<VECTOR>,Multigrid<VECTOR> > coarse;
     
                                     /**
                                      * Object for grid tranfer.
                                      */
-    SmartPointer<const MGTransferBase<VECTOR> > transfer;
+    SmartPointer<const MGTransferBase<VECTOR>,Multigrid<VECTOR> > transfer;
 
                                     /**
                                      * The pre-smoothing object.
                                      */
-    SmartPointer<const MGSmootherBase<VECTOR> > pre_smooth;
+    SmartPointer<const MGSmootherBase<VECTOR>,Multigrid<VECTOR> > pre_smooth;
 
                                     /**
                                      * The post-smoothing object.
                                      */
-    SmartPointer<const MGSmootherBase<VECTOR> > post_smooth;
+    SmartPointer<const MGSmootherBase<VECTOR>,Multigrid<VECTOR> > post_smooth;
     
                                     /**
                                      * Edge matrix from fine to coarse.
                                      */
-    SmartPointer<const MGMatrixBase<VECTOR> > edge_down;
+    SmartPointer<const MGMatrixBase<VECTOR>,Multigrid<VECTOR> > edge_down;
 
                                     /**
                                      * Transpose edge matrix from coarse to fine.
                                      */
-    SmartPointer<const MGMatrixBase<VECTOR> > edge_up;
+    SmartPointer<const MGMatrixBase<VECTOR>,Multigrid<VECTOR> > edge_up;
 
                                     /**
                                      * Level for debug
@@ -494,17 +494,17 @@ class PreconditionMG : public Subscriptor
                                     /**
                                      * Associated @p MGDoFHandler.
                                      */
-    SmartPointer<const MGDoFHandler<dim> > mg_dof_handler;
+    SmartPointer<const MGDoFHandler<dim>,PreconditionMG<dim,VECTOR,TRANSFER> > mg_dof_handler;
 
                                     /**
                                      * The multigrid object.
                                      */
-    SmartPointer<Multigrid<VECTOR> > multigrid;
+    SmartPointer<Multigrid<VECTOR>,PreconditionMG<dim,VECTOR,TRANSFER> > multigrid;
     
                                     /**
                                      * Object for grid tranfer.
                                      */
-    SmartPointer<const TRANSFER> transfer;  
+    SmartPointer<const TRANSFER,PreconditionMG<dim,VECTOR,TRANSFER> > transfer;  
 };
 
 /*@}*/
index cf4ce13da27570236a61cf780674d4b928ce9fb7..8e0d7e477473df015e06c453fa7308b479063229 100644 (file)
@@ -873,7 +873,7 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                          * object which shall be applied to
                                          * this data vector.
                                          */
-       SmartPointer<const DataPostprocessor<DH::space_dimension> > postprocessor;
+       SmartPointer<const DataPostprocessor<DH::space_dimension>,DataOut_DoFData<DH,patch_dim,patch_space_dim>  > postprocessor;
 
                                         /**
                                          * Number of output variables this
@@ -1039,7 +1039,7 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                     /**
                                      * Pointer to the dof handler object.
                                      */
-    SmartPointer<const DH> dofs;
+    SmartPointer<const DH, DataOut_DoFData<DH,patch_dim,patch_space_dim> > dofs;
 
                                     /**
                                      * List of data elements with vectors of
index bd85379c91e989b0cae9d7b804c7f31c1708da15..184edbf15451175d668b01e2646b64073b513f77 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -372,7 +372,7 @@ class DataOutStack : public DataOutInterface<dim+1>
                                      * corresponding to the present parameter
                                      * value.
                                      */
-    SmartPointer<const DH> dof_handler;
+    SmartPointer<const DH,DataOutStack<dim,spacedim,DH> > dof_handler;
 
                                     /**
                                      * List of patches of all past and
index 694cb3c40c517f54002d9fa0c44c3f449b9c162d..4255ea68be29248aaf41d3cb6f0ac34bd2087b2a 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2007 by the deal.II authors
+//    Copyright (C) 2007, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -333,7 +333,7 @@ namespace Functions
                                       /**
                                        * Pointer to the dof handler.
                                        */
-      SmartPointer<const DH> dh;
+      SmartPointer<const DH,FEFieldFunction<dim, DH, VECTOR> > dh;
     
                                       /**
                                        * A reference to the actual
index 9c05d44251274dc788eb1f75fe0ce674a812bcd1..3e8dff06c49c9a5391afbe8629e65178798a77cd 100644 (file)
@@ -399,7 +399,7 @@ namespace MeshWorker
                                        * Pointer to the object doing
                                        * local integration.
                                        */
-      SmartPointer<const INTEGRATOR> local;
+      SmartPointer<const INTEGRATOR, AssemblingIntegrator<dim,ASSEMBLER,INTEGRATOR> > local;
   };
 
 //----------------------------------------------------------------------//
index b71701d1a841c06b5d6a8f5e31d8edf49518078c..eb9dea657f0a4186b7ef74da4f4260d758cfe722 100644 (file)
@@ -157,7 +157,7 @@ namespace MeshWorker
                                          * communicating the cell and
                                          * face vectors.
                                          */
-       typedef NamedData<SmartPointer<BlockVector<number> > > DataVectors;
+       typedef NamedData<SmartPointer<BlockVector<number>,CellsAndFaces<number> > > DataVectors;
        
                                         /**
                                          * The initialization
@@ -258,7 +258,7 @@ namespace MeshWorker
     class ResidualSimple
     {
       public:
-       void initialize(NamedData<SmartPointer<VECTOR> >& results);
+       void initialize(NamedData<VECTOR*>& results);
                                         /**
                                          * Initialize the local data
                                          * in the
@@ -299,7 +299,7 @@ namespace MeshWorker
                                          * The global residal vectors
                                          * filled by assemble().
                                          */
-       NamedData<SmartPointer<VECTOR> > residuals;
+       NamedData<SmartPointer<VECTOR,ResidualSimple<VECTOR> > > residuals;
     };
     
 /**
@@ -331,7 +331,7 @@ namespace MeshWorker
                                          * matrix pointers into local
                                          * variables.
                                          */
-       void initialize(NamedData<SmartPointer<VECTOR> >& residuals);
+       void initialize(NamedData<VECTOR*>& residuals);
                                         /**
                                          * Initialize the local data
                                          * in the
@@ -383,7 +383,7 @@ namespace MeshWorker
                                          * stored as a vector of
                                          * pointers.
                                          */
-       NamedData<SmartPointer<VECTOR> > residuals;
+       NamedData<SmartPointer<VECTOR,ResidualLocalBlocksToGlobalBlocks<VECTOR> > > residuals;
     };
 
 
@@ -391,6 +391,14 @@ namespace MeshWorker
  * Assemble local matrices into a single global matrix without using
  * block structure.
  *
+ * After being initialized with a SparseMatrix object (or another
+ * matrix offering the same functionality as SparseMatrix::add()),
+ * this class can be used in a MeshWorker::loop() to assemble the cell
+ * and face matrices into the global matrix.
+ *
+ * @todo On locally refined meshes, a ConstraintMatrix should be used
+ * to automatically eliminate hanging nodes.
+ *
  * @author Guido Kanschat, 2009
  */
     template <class MATRIX>
@@ -462,7 +470,130 @@ namespace MeshWorker
                                          * The global matrix being
                                          * assembled.
                                          */
-       SmartPointer<MATRIX> matrix;
+       SmartPointer<MATRIX,MatrixSimple<MATRIX> > matrix;
+       
+                                        /**
+                                         * The smallest positive
+                                         * number that will be
+                                         * entered into the global
+                                         * matrix. All smaller
+                                         * absolute values will be
+                                         * treated as zero and will
+                                         * not be assembled.
+                                         */
+       const double threshold;
+       
+    };
+    
+    
+/**
+ * Assemble local matrices into level matrices without using
+ * block structure.
+ *
+ * @todo The matrix structures needed for assembling level matrices
+ * with local refinement and continuous elements are missing.
+ *
+ * @author Guido Kanschat, 2009
+ */
+    template <class MATRIX>
+    class MGMatrixSimple
+    {
+      public:
+                                        /**
+                                         * Constructor, initializing
+                                         * the #threshold, which
+                                         * limits how small numbers
+                                         * may be to be entered into
+                                         * the matrix.
+                                         */
+       MGMatrixSimple(double threshold = 1.e-12);
+       
+                                        /**
+                                         * Store the result matrix
+                                         * for later assembling.
+                                         */
+       void initialize(MGLevelObject<MATRIX>& m);
+
+                                        /**
+                                         * Initialize the matrices
+                                         * #flux_up and #flux_down
+                                         * used for local refinement
+                                         * with discontinuous
+                                         * Galerkin methods.
+                                         */
+       void initialize_fluxes(MGLevelObject<MATRIX>& flux_up,
+                              MGLevelObject<MATRIX>& flux_down);
+       
+                                        /**
+                                         * Initialize the local data
+                                         * in the
+                                         * DoFInfo
+                                         * object used later for
+                                         * assembling.
+                                         *
+                                         * The second parameter is
+                                         * used to distinguish
+                                         * between the data used on
+                                         * cells and boundary faces
+                                         * on the one hand and
+                                         * interior faces on the
+                                         * other. Interior faces may
+                                         * require additional data
+                                         * being initialized.
+                                         */
+       template <int dim>
+       void initialize_info(DoFInfo<dim>& info,
+                            bool interior_face) const;
+       
+                                        /**
+                                         * Assemble the matrix
+                                         * DoFInfo::M1[0]
+                                         * into the global matrix.
+                                         */
+       template<int dim>
+       void assemble(const DoFInfo<dim>& info);
+       
+                                        /**
+                                         * Assemble both local
+                                         * matrices in the info
+                                         * objects into the global
+                                         * matrices.
+                                         */
+       template<int dim>
+       void assemble(const DoFInfo<dim>& info1,
+                     const DoFInfo<dim>& info2);
+      private:
+                                        /**
+                                         * Assemble a single matrix
+                                         * into a global matrix.
+                                         */
+    void assemble(MATRIX& G,
+                 const FullMatrix<double>& M,
+                 const std::vector<unsigned int>& i1,
+                 const std::vector<unsigned int>& i2,
+                 const bool transpose = false);
+       
+                                        /**
+                                         * The global matrix being
+                                         * assembled.
+                                         */
+       SmartPointer<MGLevelObject<MATRIX>,MGMatrixSimple<MATRIX> > matrix;
+       
+                                        /**
+                                         * The matrix used for face
+                                         * flux terms across the
+                                         * refinement edge, coupling
+                                         * coarse to fine.
+                                         */
+       SmartPointer<MGLevelObject<MATRIX>,MGMatrixSimple<MATRIX> > flux_up;
+       
+                                        /**
+                                         * The matrix used for face
+                                         * flux terms across the
+                                         * refinement edge, coupling
+                                         * fine to coarse.
+                                         */
+       SmartPointer<MGLevelObject<MATRIX>,MGMatrixSimple<MATRIX> > flux_down;
        
                                         /**
                                          * The smallest positive
@@ -815,7 +946,7 @@ namespace MeshWorker
 
     template <class VECTOR>
     inline void
-    ResidualSimple<VECTOR>::initialize(NamedData<SmartPointer<VECTOR> >& results)
+    ResidualSimple<VECTOR>::initialize(NamedData<VECTOR*>& results)
     {
       residuals = results;
     }
@@ -861,7 +992,7 @@ namespace MeshWorker
 
     template <class VECTOR>
     inline void
-    ResidualLocalBlocksToGlobalBlocks<VECTOR>::initialize(NamedData<SmartPointer<VECTOR> >& m)
+    ResidualLocalBlocksToGlobalBlocks<VECTOR>::initialize(NamedData<VECTOR*>& m)
     {
       residuals = m;      
     }
@@ -994,6 +1125,106 @@ namespace MeshWorker
     }
     
     
+//----------------------------------------------------------------------//
+
+    template <class MATRIX>
+    inline
+    MGMatrixSimple<MATRIX>::MGMatrixSimple(double threshold)
+                   :
+                   threshold(threshold)
+    {}
+    
+    
+    template <class MATRIX>
+    inline void
+    MGMatrixSimple<MATRIX>::initialize(MGLevelObject<MATRIX>& m)
+    {
+      matrix = &m;
+    }
+    
+
+    template <class MATRIX>
+    inline void
+    MGMatrixSimple<MATRIX>::initialize_fluxes(
+      MGLevelObject<MATRIX>& up, MGLevelObject<MATRIX>& down)
+    {
+      flux_up = &up;
+      flux_down = &down;
+    }
+    
+
+    template <class MATRIX >
+    template <int dim>
+    inline void
+    MGMatrixSimple<MATRIX>::initialize_info(DoFInfo<dim>& info,
+                                           bool interior_face) const
+    {
+      info.initialize_matrices(1, interior_face);
+    }
+
+
+
+    template <class MATRIX>
+    inline void
+    MGMatrixSimple<MATRIX>::assemble(MATRIX& G,
+                                    const FullMatrix<double>& M,
+                                    const std::vector<unsigned int>& i1,
+                                    const std::vector<unsigned int>& i2,
+                                    bool transpose)
+    {
+      AssertDimension(M.m(), i1.size());
+      AssertDimension(M.n(), i2.size());
+      
+      for (unsigned int j=0; j<i1.size(); ++j)
+       for (unsigned int k=0; k<i2.size(); ++k)
+         if (std::fabs(M(j,k)) >= threshold)
+           {
+             if (transpose)
+               G.add(i1[j], i2[k], M(j,k));
+             else
+               G.add(i1[j], i2[k], M(j,k));
+           }
+    }
+    
+    
+    template <class MATRIX>
+    template <int dim>
+    inline void
+    MGMatrixSimple<MATRIX>::assemble(const DoFInfo<dim>& info)
+    {
+      assemble(info.M1[0].matrix, info.indices, info.indices);
+    }
+    
+
+    template <class MATRIX>
+    template <int dim>
+    inline void
+    MGMatrixSimple<MATRIX>::assemble(const DoFInfo<dim>& info1,
+                                    const DoFInfo<dim>& info2)
+    {
+      const unsigned int level1 = info1.cell->level();
+      const unsigned int level2 = info2.cell->level();
+      
+      if (level1 == level2)
+       {
+         assemble(matrix[level1], info1.M1[0].matrix, info1.indices, info1.indices);
+         assemble(matrix[level1], info1.M2[0].matrix, info1.indices, info2.indices);
+         assemble(matrix[level1], info2.M1[0].matrix, info2.indices, info2.indices);
+         assemble(matrix[level1], info2.M2[0].matrix, info2.indices, info1.indices);
+       }
+      else
+       {
+         Assert(level1 > level2, ExcInternalError());
+                                          // Do not add info2.M1,
+                                          // which is done by
+                                          // the coarser cell
+         assemble(matrix[level1], info1.M1[0].matrix, info1.indices, info1.indices);
+         assemble(flux_up[level1],info1.M2[0].matrix, info1.indices, info2.indices, true);
+         assemble(flux_down[level1], info2.M2[0].matrix, info2.indices, info1.indices);
+       }
+    }
+    
+    
 //----------------------------------------------------------------------//
     
     template <class MATRIX, typename number>
@@ -1261,8 +1492,8 @@ namespace MeshWorker
     inline void
     SystemSimple<MATRIX,VECTOR>::initialize(MATRIX& m, VECTOR& rhs)
     {
-      NamedData<SmartPointer<VECTOR> > data;
-      SmartPointer<VECTOR> p = &rhs;
+      NamedData<VECTOR*> data;
+      VECTOR* p = &rhs;
       data.add(p, "right hand side");
       
       MatrixSimple<MATRIX>::initialize(m);
index 1c0a1f0bea5875a5666d5ed40ea9e4ba8d986994..f07d1722e99638d722458e1c2735373642b95b6d 100644 (file)
@@ -249,7 +249,7 @@ namespace MeshWorker
       
        
                                       /// The block structure of the system
-      SmartPointer<const BlockInfo> block_info;
+      SmartPointer<const BlockInfo,DoFInfo<dim,spacedim> > block_info;
     private:
                                       /// Fill index vector
       void get_indices(const typename DoFHandler<dim, spacedim>::cell_iterator c);
@@ -544,11 +544,11 @@ namespace MeshWorker
                      const FiniteElement<dim, spacedim>& el,
                      const Mapping<dim, spacedim>& mapping);
        
-      template <class WORKER, class VECTOR>
+      template <class WORKER, class VECTOR,class P>
       void initialize(const WORKER&,
                      const FiniteElement<dim, spacedim>& el,
                      const Mapping<dim, spacedim>& mapping,
-                     const NamedData<SmartPointer<VECTOR> >& data);
+                     const NamedData<SmartPointer<VECTOR,P> >& data);
 //      private:
        
       CellInfo cell_info;
@@ -843,13 +843,13 @@ namespace MeshWorker
 
     
   template <int dim, int sdim>
-  template <class WORKER, class VECTOR>
+  template <class WORKER, class VECTOR, class P>
   void
   IntegrationInfoBox<dim,sdim>::initialize(
     const WORKER& integrator,
     const FiniteElement<dim,sdim>& el,
     const Mapping<dim,sdim>& mapping,
-    const NamedData<SmartPointer<VECTOR> >& data)
+    const NamedData<SmartPointer<VECTOR,P> >& data)
   {
     cell_info.initialize_data(data);
     bdry_info.initialize_data(data);
index c4fadab0cd378becd0d6678c1cee9d66c83f3b39..4b5654ee45390b957175d4c76473058ead35e2fa 100644 (file)
@@ -249,7 +249,7 @@ namespace MeshWorker
       public VectorDataBase<dim, spacedim>
   {
     public:
-      void initialize(const NamedData<SmartPointer<VECTOR> >&);
+      void initialize(const NamedData<VECTOR*>&);
       
       virtual void fill(
        std::vector<std::vector<std::vector<double> > >& values,
@@ -262,7 +262,7 @@ namespace MeshWorker
        unsigned int start,
        unsigned int size) const;
     private:
-      SmartPointer<const NamedData<SmartPointer<VECTOR> > > data;
+      NamedData<SmartPointer<VECTOR,VectorData<VECTOR,dim,spacedim> > > data;
   };
   
 //----------------------------------------------------------------------//
index b6cf863947da8325fed55e6ddd88fcc503ac5a0f..d0d3e6a6df610af9ca7f1d86c3d8b336867fe825 100644 (file)
@@ -40,9 +40,9 @@ namespace MeshWorker
 
   template <class VECTOR, int dim, int spacedim>
   void
-  VectorData<VECTOR, dim, spacedim>::initialize(const NamedData<SmartPointer<VECTOR> >& d)
+  VectorData<VECTOR, dim, spacedim>::initialize(const NamedData<VECTOR*>& d)
   {
-    data = &d;
+    data = d;
     VectorSelector::initialize(d);
   }
   
@@ -62,21 +62,21 @@ namespace MeshWorker
   {
     for (unsigned int i=0;i<this->n_values();++i)
       {
-       const VECTOR& src = *(*data)(this->value_index(i));
+       const VECTOR& src = *data(this->value_index(i));
        VectorSlice<std::vector<std::vector<double> > > dst(values[i], component, n_comp);
        fe.get_function_values(src, make_slice(index, start, size), dst, true);
       }
     
     for (unsigned int i=0;i<this->n_gradients();++i)
       {
-       const VECTOR& src = *(*data)(this->value_index(i));
+       const VECTOR& src = *data(this->value_index(i));
        VectorSlice<std::vector<std::vector<Tensor<1,dim> > > > dst(gradients[i], component, n_comp);
        fe.get_function_gradients(src, make_slice(index, start, size), dst, true);
       }
     
     for (unsigned int i=0;i<this->n_hessians();++i)
       {
-       const VECTOR& src = *(*data)(this->value_index(i));
+       const VECTOR& src = *data(this->value_index(i));
        VectorSlice<std::vector<std::vector<Tensor<2,dim> > > > dst(hessians[i], component, n_comp);
        fe.get_function_hessians(src, make_slice(index, start, size), dst, true);
       }
index f005f61b801bde1e5f629de1dcc899434d044ed4..c4768dfc80879717cd3eaa7d188e75b471d81803 100644 (file)
@@ -527,7 +527,7 @@ class PointValueHistory
                                      * supplied to the constructor. This can be 
                                      * released by calling @p clear().
                                      */
-    SmartPointer<const DoFHandler<dim> > dof_handler;
+    SmartPointer<const DoFHandler<dim>,PointValueHistory<dim> > dof_handler;
     
                                     /**
                                      * Variable to check that number of dofs
index df5c7f00ec9d917312afc39ddd82ae4e9f0821aa..249d86a61b201422c622779e16d546dbda716eec 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -198,7 +198,7 @@ DEAL_II_NAMESPACE_OPEN
  * @ingroup numerics
  * @author Ralf Hartmann, 1999
  */
-template<int dim, typename VectorType=Vector<double>, class DH=DoFHandler<dim> >
+template<int dim, typename VECTOR=Vector<double>, class DH=DoFHandler<dim> >
 class SolutionTransfer
 {
   public:
@@ -242,14 +242,14 @@ class SolutionTransfer
                                      * onto the new (refined and/or
                                      * coarsenend) grid.
                                      */
-    void prepare_for_coarsening_and_refinement (const std::vector<VectorType> &all_in);
+    void prepare_for_coarsening_and_refinement (const std::vector<VECTOR> &all_in);
     
                                     /**
                                      * Same as previous function
                                      * but for only one discrete function
                                      * to be interpolated.
                                      */
-    void prepare_for_coarsening_and_refinement (const VectorType &in);
+    void prepare_for_coarsening_and_refinement (const VECTOR &in);
                      
                                     /**
                                      * This function
@@ -269,8 +269,8 @@ class SolutionTransfer
                                      * allowed. e.g. for interpolating several
                                      * functions.
                                      */
-    void refine_interpolate (const VectorType &in,
-                            VectorType &out) const;
+    void refine_interpolate (const VECTOR &in,
+                            VECTOR &out) const;
       
                                     /**
                                      * This function
@@ -306,8 +306,8 @@ class SolutionTransfer
                                      * (@p n_dofs_refined). Otherwise
                                      * an assertion will be thrown.
                                      */
-    void interpolate (const std::vector<VectorType>&all_in,
-                     std::vector<VectorType>      &all_out) const;
+    void interpolate (const std::vector<VECTOR>&all_in,
+                     std::vector<VECTOR>      &all_out) const;
       
                                     /**
                                      * Same as the previous function.
@@ -322,8 +322,8 @@ class SolutionTransfer
                                      * in one step by using
                                      * <tt>interpolate (all_in, all_out)</tt>
                                      */
-    void interpolate (const VectorType &in,
-                     VectorType       &out) const;
+    void interpolate (const VECTOR &in,
+                     VECTOR       &out) const;
 
                                     /**
                                      * Determine an estimate for the
@@ -367,21 +367,13 @@ class SolutionTransfer
                                      */
     DeclException0(ExcNumberOfDoFsPerCellHasChanged);
 
-                                    /**
-                                     * Exception
-                                     */
-    DeclException2(ExcWrongVectorSize,
-                  int, int,
-                  << "The size of the vector is " << arg1
-                  << " although it should be " << arg2 << ".");
-                                 
   private:
 
                                     /**
                                      * Pointer to the degree of freedom handler
                                      * to work with.
                                      */
-    SmartPointer<const DH> dof_handler;
+    SmartPointer<const DH,SolutionTransfer<dim,VECTOR,DH> > dof_handler;
     
                                     /**
                                      * Stores the number of DoFs before the
@@ -443,7 +435,7 @@ class SolutionTransfer
        unsigned int memory_consumption () const;
        
        std::vector<unsigned int>    *indices_ptr;
-       std::vector<Vector<typename VectorType::value_type> > *dof_values_ptr;
+       std::vector<Vector<typename VECTOR::value_type> > *dof_values_ptr;
     };
 
                                     /**
@@ -464,7 +456,7 @@ class SolutionTransfer
                                      * of all cells that'll be coarsened
                                      * will be stored in this vector.
                                      */
-    std::vector<std::vector<Vector<typename VectorType::value_type> > > dof_values_on_cell;
+    std::vector<std::vector<Vector<typename VECTOR::value_type> > > dof_values_on_cell;
 };
 
 
index df3fd5fa21a668f531f41605d34c9b2d01bf3fdb..2f04bf087d2cabfa6e6f56bc96aeb69f3a6bf19c 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -699,7 +699,7 @@ class TimeDependent
                                      * objects pointed to by the pointers
                                      * in this collection.
                                      */
-    std::vector<SmartPointer<TimeStepBase> > timesteps;
+    std::vector<SmartPointer<TimeStepBase,TimeDependent> > timesteps;
 
                                     /**
                                      * Number of the present sweep. This is
@@ -1795,7 +1795,7 @@ class TimeStepBase_Tria : public TimeStepBase
                                      * such a behaviour is specified
                                      * in the @p flags structure.
                                      */
-    SmartPointer<Triangulation<dim, dim> > tria;
+    SmartPointer<Triangulation<dim, dim>,TimeStepBase_Tria<dim> > tria;
 
                                     /**
                                      * Pointer to a grid which is to
@@ -1806,7 +1806,7 @@ class TimeStepBase_Tria : public TimeStepBase
                                      * with the owner of this
                                      * management object.
                                      */
-    SmartPointer<const Triangulation<dim, dim> > coarse_grid;
+    SmartPointer<const Triangulation<dim, dim>,TimeStepBase_Tria<dim> > coarse_grid;
     
                                     /**
                                      * Some flags about how this time level
index c28f55b8b6d06b7080713509e3c4f5e6aa0d4b42..2421ef7919c8c2501c4d660f7244243604eaffe9 100644 (file)
@@ -1983,10 +1983,10 @@ FEValuesBase<dim,spacedim>::FEValuesBase (const unsigned int n_q_points,
                :
                n_quadrature_points (n_q_points),
                dofs_per_cell (dofs_per_cell),
-               mapping(&mapping),
-               fe(&fe),
-               mapping_data(0),
-               fe_data(0),
+               mapping(&mapping, typeid(*this).name()),
+               fe(&fe, typeid(*this).name()),
+               mapping_data(0, typeid(*this).name()),
+               fe_data(0, typeid(*this).name()),
                fe_values_views_cache (*this)
 {
   this->update_flags = flags;
index 006e9dc0b8a032eb6fd0127da845ad110069e9c9..fa37567b27980ef15330aaebc03bf8fe68335100 100644 (file)
@@ -29,7 +29,7 @@ MappingQ1Eulerian (const EulerVectorType  &euler_transform_vectors,
                   const DoFHandler<dim,spacedim> &shiftmap_dof_handler)
                    :
                   euler_transform_vectors(euler_transform_vectors),
-                  shiftmap_dof_handler(&shiftmap_dof_handler)
+                  shiftmap_dof_handler(&shiftmap_dof_handler, typeid(*this).name())
 {}
 
 
index 42b8ee3ffa06df23457b21f81a7b91adcbab834c..e810fb4c4153ee8290d5897bc17813b939bd9a6b 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -37,7 +37,7 @@ MappingQEulerian (const unsigned int degree,
                :
                MappingQ<dim,spacedim>(degree, true),
                euler_vector(euler_vector),
-               euler_dof_handler(&euler_dof_handler),
+               euler_dof_handler(&euler_dof_handler, typeid(*this).name()),
                support_quadrature(degree),
                fe_values(euler_dof_handler.get_fe(),
                          support_quadrature,
index d976f337ecffad1c0e736b2dd640d04919899683..01677aa7b85643e3704ad1bd9d8b4cd084dc7359 100644 (file)
@@ -35,7 +35,7 @@ DEAL_II_NAMESPACE_OPEN
 
 template <int dim, int spacedim>
 GridIn<dim, spacedim>::GridIn () :
-               tria(0), default_format(ucd)
+               tria(0, typeid(*this).name()), default_format(ucd)
 {}
 
 
index 36ec9cee1cc67c95891caa8593a4cb70c1d977e2..c73f84bcdf3b69afc9822bcb4a6d9695d91c3125 100644 (file)
@@ -29,7 +29,7 @@ template <int dim>
 PersistentTriangulation<dim>::
 PersistentTriangulation (const Triangulation<dim> &coarse_grid)
                 :
-               coarse_grid (&coarse_grid) 
+               coarse_grid (&coarse_grid, typeid(*this).name()
 {}
 
 
index 46bc8f93ee93e74a2ae376f7087c504127086b9e..6eba2e21acc42082696895d75eb2dbaaf1fe9c48 100644 (file)
@@ -9814,7 +9814,6 @@ Triangulation<dim, spacedim>::dimension;
 template <int dim, int spacedim>
 Triangulation<dim, spacedim>::Triangulation (const MeshSmoothing smooth_grid)
                :
-               Subscriptor (),
                faces(NULL),
                anisotropic_refinement(false),
                smooth_grid(smooth_grid)
@@ -9827,12 +9826,12 @@ Triangulation<dim, spacedim>::Triangulation (const MeshSmoothing smooth_grid)
 
 
 template <int dim, int spacedim>
-Triangulation<dim, spacedim>::Triangulation (const Triangulation<dim, spacedim> &) 
-               :
-               Subscriptor ()
+Triangulation<dim, spacedim>::Triangulation (const Triangulation<dim, spacedim> &)
                                   // do not set any subscriptors;
                                   // anyway, calling this constructor
                                   // is an error!
+               :
+               Subscriptor()
 {
   Assert (false, ExcInternalError());
 }
index 5d312bcfc7cf48ce069c4efb7e57c371a2cf154f..8f4203f00af89bbb04fadca4a0cfa6d06cccf7df 100644 (file)
@@ -1586,7 +1586,7 @@ namespace hp
   template<int dim, int spacedim>
   DoFHandler<dim,spacedim>::DoFHandler (const Triangulation<dim,spacedim> &tria)
                   :
-                  tria(&tria),
+                  tria(&tria, typeid(*this).name()),
                  faces (NULL),
                   used_dofs (0)
   {
index 7f5ef68c6fe3a508698aaf264cc83e40255dae3a..254ecc42f476678335376c34225819edc424e3ec 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2003, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2003, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
index 82a92b75121966684cc7c1ecc2ff3679e6aeb0c0..21a32a5fbb87b97beafd6d4e0ba0be081f0408ba 100644 (file)
@@ -95,7 +95,7 @@ DataEntryBase::DataEntryBase (const std::vector<std::string> &names_in,
                :
                names(names_in),
                data_component_interpretation (data_component_interpretation),
-               postprocessor(0),
+               postprocessor(0, typeid(*this).name()),
                n_output_variables(names.size())
 {
   Assert (names.size() == data_component_interpretation.size(),
@@ -123,7 +123,7 @@ DataEntryBase::DataEntryBase (const DataPostprocessor<DH::space_dimension> *data
                :
                names(data_postprocessor->get_names()),
                data_component_interpretation (data_postprocessor->get_data_component_interpretation()),
-               postprocessor(data_postprocessor),
+               postprocessor(data_postprocessor, typeid(*this).name()),
                n_output_variables(data_postprocessor->n_output_variables())
 {
                                   // if there is a post processor, then we
index 5abf9c8ca2e269338f8ac10c85fb8ec6b63bc71a..25783bbd28f94fdbd73d7bd90e9da496b0e560a4 100644 (file)
@@ -40,7 +40,6 @@ namespace internal
 template <int dim>
 PointValueHistory<dim>
 ::PointValueHistory (const unsigned int n_independent_variables) :
-               dof_handler (0, "No DoFHandler"),
                n_dofs (0),
                n_indep (n_independent_variables)
 {
@@ -57,10 +56,9 @@ PointValueHistory<dim>
 
 
 template <int dim>
-PointValueHistory<dim>
-::PointValueHistory (const DoFHandler<dim> & dof_handler,
+PointValueHistory<dim>::PointValueHistory (const DoFHandler<dim> & dof_handler,
                     const unsigned int n_independent_variables) :
-               dof_handler (&dof_handler, typeid (*this).name ()),
+               dof_handler (&dof_handler),
                n_dofs (dof_handler.n_dofs ()),
                n_indep (n_independent_variables)
 {
@@ -77,8 +75,7 @@ PointValueHistory<dim>
 
 
 template <int dim>
-PointValueHistory<dim>
-::PointValueHistory (const PointValueHistory & point_value_history)
+PointValueHistory<dim>::PointValueHistory (const PointValueHistory & point_value_history)
 {
   dataset_key = point_value_history.dataset_key;
   independent_values = point_value_history.independent_values;
@@ -418,7 +415,7 @@ void PointValueHistory<dim>
 ::clear ()
 {
   cleared = true;
-  dof_handler = SmartPointer<const DoFHandler<dim> > (0, "Cleared");
+  dof_handler = 0;
 }
 
 // Need to test that the internal data has a full and complete dataset for
index cb574b158f3b9405c9ef302ecf106db686d58e60..a9a64caa2b081be5d2fadb38e9e9f9b37858c190 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -31,31 +31,31 @@ DEAL_II_NAMESPACE_OPEN
 
 
 
-template<int dim, typename VectorType, class DH>
-SolutionTransfer<dim, VectorType, DH>::SolutionTransfer(const DH &dof):
-               dof_handler(&dof),
+template<int dim, typename VECTOR, class DH>
+SolutionTransfer<dim, VECTOR, DH>::SolutionTransfer(const DH &dof):
+               dof_handler(&dof, typeid(*this).name()),
                n_dofs_old(0),
                prepared_for(none)
 {}
 
 
-template<int dim, typename VectorType, class DH>
-SolutionTransfer<dim, VectorType, DH>::~SolutionTransfer()
+template<int dim, typename VECTOR, class DH>
+SolutionTransfer<dim, VECTOR, DH>::~SolutionTransfer()
 {
   clear ();
 }
 
 
-template<int dim, typename VectorType, class DH>
-SolutionTransfer<dim, VectorType, DH>::Pointerstruct::Pointerstruct():
+template<int dim, typename VECTOR, class DH>
+SolutionTransfer<dim, VECTOR, DH>::Pointerstruct::Pointerstruct():
                indices_ptr(0),
                dof_values_ptr(0)
 {}
 
 
 
-template<int dim, typename VectorType, class DH>
-void SolutionTransfer<dim, VectorType, DH>::clear ()
+template<int dim, typename VECTOR, class DH>
+void SolutionTransfer<dim, VECTOR, DH>::clear ()
 {
   indices_on_cell.clear();
   dof_values_on_cell.clear();
@@ -65,8 +65,8 @@ void SolutionTransfer<dim, VectorType, DH>::clear ()
 }
 
 
-template<int dim, typename VectorType, class DH>
-void SolutionTransfer<dim, VectorType, DH>::prepare_for_pure_refinement()
+template<int dim, typename VECTOR, class DH>
+void SolutionTransfer<dim, VECTOR, DH>::prepare_for_pure_refinement()
 { 
   Assert(prepared_for!=pure_refinement, ExcAlreadyPrepForRef());
   Assert(prepared_for!=coarsening_and_refinement, 
@@ -100,20 +100,20 @@ void SolutionTransfer<dim, VectorType, DH>::prepare_for_pure_refinement()
 }
 
 
-template<int dim, typename VectorType, class DH>  
+template<int dim, typename VECTOR, class DH>  
 void
-SolutionTransfer<dim, VectorType, DH>::refine_interpolate(const VectorType &in,
-                                                 VectorType       &out) const
+SolutionTransfer<dim, VECTOR, DH>::refine_interpolate(const VECTOR &in,
+                                                 VECTOR       &out) const
 {
   Assert(prepared_for==pure_refinement, ExcNotPrepared());
-  Assert(in.size()==n_dofs_old, ExcWrongVectorSize(in.size(),n_dofs_old));
+  Assert(in.size()==n_dofs_old, ExcDimensionMismatch(in.size(),n_dofs_old));
   Assert(out.size()==dof_handler->n_dofs(),
-        ExcWrongVectorSize(out.size(),dof_handler->n_dofs()));
+        ExcDimensionMismatch(out.size(),dof_handler->n_dofs()));
   Assert(&in != &out,
          ExcMessage ("Vectors cannot be used as input and output"
                      " at the same time!"));
 
-  Vector<typename VectorType::value_type> local_values(0);
+  Vector<typename VECTOR::value_type> local_values(0);
 
   typename DH::cell_iterator cell = dof_handler->begin(),
                             endc = dof_handler->end();
@@ -154,10 +154,10 @@ SolutionTransfer<dim, VectorType, DH>::refine_interpolate(const VectorType &in,
 }
 
 
-template<int dim, typename VectorType, class DH>
+template<int dim, typename VECTOR, class DH>
 void
-SolutionTransfer<dim, VectorType, DH>::
-prepare_for_coarsening_and_refinement(const std::vector<VectorType> &all_in)
+SolutionTransfer<dim, VECTOR, DH>::
+prepare_for_coarsening_and_refinement(const std::vector<VECTOR> &all_in)
 {
   Assert(prepared_for!=pure_refinement, ExcAlreadyPrepForRef());
   Assert(!prepared_for!=coarsening_and_refinement, 
@@ -174,7 +174,7 @@ prepare_for_coarsening_and_refinement(const std::vector<VectorType> &all_in)
   for (unsigned int i=0; i<in_size; ++i)
     {
       Assert(all_in[i].size()==n_dofs_old,
-            ExcWrongVectorSize(all_in[i].size(),n_dofs_old));
+            ExcDimensionMismatch(all_in[i].size(),n_dofs_old));
     }
 
                                   // first count the number
@@ -212,9 +212,9 @@ prepare_for_coarsening_and_refinement(const std::vector<VectorType> &all_in)
     (n_cells_to_stay_or_refine)
     .swap(indices_on_cell);
   
-  std::vector<std::vector<Vector<typename VectorType::value_type> > >
+  std::vector<std::vector<Vector<typename VECTOR::value_type> > >
     (n_coarsen_fathers,
-     std::vector<Vector<typename VectorType::value_type> > (in_size))
+     std::vector<Vector<typename VECTOR::value_type> > (in_size))
     .swap(dof_values_on_cell);
   
                                   // we need counters for
@@ -247,8 +247,8 @@ prepare_for_coarsening_and_refinement(const std::vector<VectorType> &all_in)
                   ExcTriaPrepCoarseningNotCalledBefore());
          const unsigned int dofs_per_cell=cell->get_fe().dofs_per_cell;
 
-         std::vector<Vector<typename VectorType::value_type> >(in_size,
-                                                               Vector<typename VectorType::value_type>(dofs_per_cell))
+         std::vector<Vector<typename VECTOR::value_type> >(in_size,
+                                                               Vector<typename VECTOR::value_type>(dofs_per_cell))
            .swap(dof_values_on_cell[n_cf]);
       
          for (unsigned int j=0; j<in_size; ++j)
@@ -269,36 +269,36 @@ prepare_for_coarsening_and_refinement(const std::vector<VectorType> &all_in)
 }
 
 
-template<int dim, typename VectorType, class DH>
+template<int dim, typename VECTOR, class DH>
 void
-SolutionTransfer<dim, VectorType, DH>::prepare_for_coarsening_and_refinement(const VectorType &in)
+SolutionTransfer<dim, VECTOR, DH>::prepare_for_coarsening_and_refinement(const VECTOR &in)
 {
-  std::vector<VectorType> all_in=std::vector<VectorType>(1, in);
+  std::vector<VECTOR> all_in=std::vector<VECTOR>(1, in);
   prepare_for_coarsening_and_refinement(all_in);
 }
 
 
-template<int dim, typename VectorType, class DH>
-void SolutionTransfer<dim, VectorType, DH>::
-interpolate (const std::vector<VectorType> &all_in,
-            std::vector<VectorType>       &all_out) const
+template<int dim, typename VECTOR, class DH>
+void SolutionTransfer<dim, VECTOR, DH>::
+interpolate (const std::vector<VECTOR> &all_in,
+            std::vector<VECTOR>       &all_out) const
 {
   Assert(prepared_for==coarsening_and_refinement, ExcNotPrepared());
   const unsigned int size=all_in.size();
   Assert(all_out.size()==size, ExcDimensionMismatch(all_out.size(), size));
   for (unsigned int i=0; i<size; ++i)
     Assert (all_in[i].size() == n_dofs_old,
-           ExcWrongVectorSize(all_in[i].size(), n_dofs_old));
+           ExcDimensionMismatch(all_in[i].size(), n_dofs_old));
   for (unsigned int i=0; i<all_out.size(); ++i)
     Assert (all_out[i].size() == dof_handler->n_dofs(),
-           ExcWrongVectorSize(all_out[i].size(), dof_handler->n_dofs()));
+           ExcDimensionMismatch(all_out[i].size(), dof_handler->n_dofs()));
   for (unsigned int i=0; i<size; ++i)
     for (unsigned int j=0; j<size; ++j)
       Assert(&all_in[i] != &all_out[j],
              ExcMessage ("Vectors cannot be used as input and output"
                          " at the same time!"));
 
-  Vector<typename VectorType::value_type> local_values;
+  Vector<typename VECTOR::value_type> local_values;
   std::vector<unsigned int> dofs;
 
   typename std::map<std::pair<unsigned int, unsigned int>, Pointerstruct>::const_iterator
@@ -316,7 +316,7 @@ interpolate (const std::vector<VectorType> &all_in,
          const std::vector<unsigned int> * const indexptr
            =pointerstruct->second.indices_ptr;
 
-         const std::vector<Vector<typename VectorType::value_type> > * const valuesptr
+         const std::vector<Vector<typename VECTOR::value_type> > * const valuesptr
            =pointerstruct->second.dof_values_ptr;
 
          const unsigned int dofs_per_cell=cell->get_fe().dofs_per_cell;
@@ -394,18 +394,18 @@ interpolate (const std::vector<VectorType> &all_in,
 
 
 
-template<int dim, typename VectorType, class DH>
-void SolutionTransfer<dim, VectorType, DH>::interpolate(const VectorType &in,
-                                               VectorType       &out) const
+template<int dim, typename VECTOR, class DH>
+void SolutionTransfer<dim, VECTOR, DH>::interpolate(const VECTOR &in,
+                                               VECTOR       &out) const
 {
   Assert (in.size()==n_dofs_old,
-         ExcWrongVectorSize(in.size(), n_dofs_old));
+         ExcDimensionMismatch(in.size(), n_dofs_old));
   Assert (out.size()==dof_handler->n_dofs(),
-         ExcWrongVectorSize(out.size(), dof_handler->n_dofs()));
+         ExcDimensionMismatch(out.size(), dof_handler->n_dofs()));
 
-  std::vector<VectorType> all_in(1);
+  std::vector<VECTOR> all_in(1);
   all_in[0] = in;
-  std::vector<VectorType> all_out(1);
+  std::vector<VECTOR> all_out(1);
   all_out[0] = out;
   interpolate(all_in,
              all_out);
@@ -414,9 +414,9 @@ void SolutionTransfer<dim, VectorType, DH>::interpolate(const VectorType &in,
 
 
 
-template<int dim, typename VectorType, class DH>
+template<int dim, typename VECTOR, class DH>
 unsigned int
-SolutionTransfer<dim, VectorType, DH>::memory_consumption () const
+SolutionTransfer<dim, VECTOR, DH>::memory_consumption () const
 {
                                   // at the moment we do not include the memory
                                   // consumption of the cell_map as we have no
@@ -431,9 +431,9 @@ SolutionTransfer<dim, VectorType, DH>::memory_consumption () const
 
 
 
-template<int dim, typename VectorType, class DH>
+template<int dim, typename VECTOR, class DH>
 unsigned int
-SolutionTransfer<dim, VectorType, DH>::Pointerstruct::memory_consumption () const
+SolutionTransfer<dim, VECTOR, DH>::Pointerstruct::memory_consumption () const
 {
   return sizeof(*this);
 }
index 534c589adcf2bb36b12a3c0538ae14c39acfde6a..8f7697c3dead9e1b2367b364128391170554c810 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -90,7 +90,7 @@ TimeDependent::insert_timestep (const TimeStepBase *position,
     else
       {
                                         // inner time step
-       std::vector<SmartPointer<TimeStepBase> >::iterator insert_position
+       std::vector<SmartPointer<TimeStepBase,TimeDependent> >::iterator insert_position
          = std::find(timesteps.begin(), timesteps.end(), position);
        
        (*(insert_position-1))->set_next_timestep (new_timestep);
@@ -138,14 +138,14 @@ void TimeDependent::delete_timestep (const unsigned int position)
   if (position != 0)
     timesteps[position-1]->set_next_timestep ((position<timesteps.size()) ?
                                              timesteps[position] :
-                                             /*null*/SmartPointer<TimeStepBase>());
+                                             /*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>());
+                                               /*null*/SmartPointer<TimeStepBase,TimeDependent>());
 }
 
 
@@ -411,8 +411,8 @@ TimeStepBase::memory_consumption () const
 template <int dim>
 TimeStepBase_Tria<dim>::TimeStepBase_Tria() :
                TimeStepBase (0),
-               tria (0),
-               coarse_grid (0),
+               tria (0, typeid(*this).name()),
+               coarse_grid (0, typeid(*this).name()),
                 flags (),
                refinement_flags(0)
 {
@@ -428,7 +428,7 @@ TimeStepBase_Tria<dim>::TimeStepBase_Tria (const double              time,
                                           const RefinementFlags    &refinement_flags) :
                TimeStepBase (time),
                tria(0, typeid(*this).name()),
-               coarse_grid (&coarse_grid),
+               coarse_grid (&coarse_grid, typeid(*this).name()),
                flags (flags),
                refinement_flags (refinement_flags)
 {}
index a8dfe75bd8034be91eb3c58f927cb199103cf971..26c9311c8f17d341b71c9d1dc422f45459b41a73 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -72,7 +72,7 @@ class BlockDiagonalMatrix : public Subscriptor
                                      /**
                                       * Diagonal entry.
                                       */
-    SmartPointer<const MATRIX> matrix;
+    SmartPointer<const MATRIX,BlockDiagonalMatrix<MATRIX> > matrix;
 };
 
 /*@}*/
index b3eedb75e90273252f8a42132caa540bd7dc92ba..92faba0d204f33b660fb783fa9a912535561b6dc 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -394,7 +394,7 @@ class BlockMatrixArray : public Subscriptor
                                      * The memory used for auxiliary
                                      * vectors.
                                      */
-    mutable SmartPointer<VectorMemory<Vector<number> > > mem;
+    mutable SmartPointer<VectorMemory<Vector<number> >,BlockMatrixArray<number> > mem;
 };
 
 /*@}*/
index 08727ff505143d259ae976fe17ca2cbdce1a83b7..500a12caad54f1d75e0b878f68ee4488356986c1 100644 (file)
@@ -1026,7 +1026,7 @@ class BlockMatrixBase : public Subscriptor
                                     /**
                                      * Array of sub-matrices.
                                      */
-    Table<2,SmartPointer<BlockType> > sub_objects;
+    Table<2,SmartPointer<BlockType, BlockMatrixBase<MatrixType> > > sub_objects;
 
                                      /**
                                       * This function collects the
index ff20e5b0b3fb0f10f8befb35a134a267a8e6e7ef..f23ffa5c90b121f9d8ed1a784baa1c31a0323394 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -422,7 +422,7 @@ class BlockSparseMatrix : public BlockMatrixBase<SparseMatrix<number> >
                                      * it using the SmartPointer
                                      * class.
                                      */
-    SmartPointer<const BlockSparsityPattern> sparsity_pattern;
+    SmartPointer<const BlockSparsityPattern,BlockSparseMatrix<number> > sparsity_pattern;
 };
 
 
index 6d5d06b14e1cb49e57b206dead359bee1c0c7baa..d6b84c64d599ca4c561707103ea4aae677a48c5d 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -23,8 +23,6 @@ DEAL_II_NAMESPACE_OPEN
 
 template <typename number>
 BlockSparseMatrix<number>::BlockSparseMatrix ()
-                :
-                sparsity_pattern (0)
 {}
 
 
@@ -32,8 +30,6 @@ BlockSparseMatrix<number>::BlockSparseMatrix ()
 template <typename number>
 BlockSparseMatrix<number>::
 BlockSparseMatrix (const BlockSparsityPattern &sparsity)
-                :
-                sparsity_pattern (0)
 {
   reinit (sparsity);
 }
index abb365c913ffccf350735001f3e4bc64b483b593..af999c3f30fb33f8fc1ed27a866c6c5c92c6f729 100644 (file)
@@ -424,7 +424,7 @@ class BlockSparsityPatternBase : public Subscriptor
                                     /**
                                      * Array of sparsity patterns.
                                      */
-    Table<2,SmartPointer<SparsityPatternBase> > sub_objects;
+    Table<2,SmartPointer<SparsityPatternBase, BlockSparsityPatternBase<SparsityPatternBase> > > sub_objects;
 
                                     /**
                                      * Object storing and managing
index 986c53b0ae0ce0da16906e3d68ca1308ac79a025..1b9a49182e5dea2046a5ccec46bf472fa4024d48 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name:  $
 //
-//    Copyright (C) 2008 by the deal.II authors
+//    Copyright (C) 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -1152,7 +1152,7 @@ class ChunkSparseMatrix : public virtual Subscriptor
                                      * it using the SmartPointer
                                      * class.
                                      */
-    SmartPointer<const ChunkSparsityPattern> cols;
+    SmartPointer<const ChunkSparsityPattern,ChunkSparseMatrix<number> > cols;
     
                                     /**
                                      * Array of values for all the
index 069326161d6beb3368bc5a3a2823affc772fe78d..e249a059de12997f786d0e6dd5dc0c857aaad72b 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -606,11 +606,7 @@ class FilteredMatrix : public Subscriptor
                                     /**
                                      * Pointer to the sparsity
                                      * pattern used for this
-                                     * matrix. In order to guarantee
-                                     * that it is not deleted while
-                                     * still in use, we subscribe to
-                                     * it using the SmartPointer
-                                     * class.
+                                     * matrix.
                                      */
     std_cxx1x::shared_ptr<PointerMatrixBase<VECTOR> > matrix;
 
index a419a81e4a89b98fd1d41f6b871d4cf8ebbb210d..a6fbbec8912fd31c9eee7fc0036a56c18ba9716d 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2005, 2006, 2008 by the deal.II authors
+//    Copyright (C) 2005, 2006, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -436,8 +436,8 @@ class PreconditionLU
     void Tvmult(BlockVector<number>&,
                const BlockVector<number>&) const;
   private:
-    SmartPointer<const LAPACKFullMatrix<number> > matrix;
-    SmartPointer<VectorMemory<Vector<number> > > mem;
+    SmartPointer<const LAPACKFullMatrix<number>,PreconditionLU<number> > matrix;
+    SmartPointer<VectorMemory<Vector<number> >,PreconditionLU<number> > mem;
 };
 
 
index 7a86ad5f548a809e067ec4baa4a35ea73e2862db..863ee2daa0f0891bb58ac88483bc662723d4979f 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -137,7 +137,7 @@ class ProductMatrix : public PointerMatrixBase<VECTOR>
                                     /**
                                      * Memory for auxiliary vector.
                                      */
-    SmartPointer<VectorMemory<VECTOR> > mem;
+    SmartPointer<VectorMemory<VECTOR>,ProductMatrix<VECTOR> > mem;
                                     /**
                                      * Return some kind of
                                      * identifier.
@@ -297,17 +297,17 @@ class ProductSparseMatrix : public PointerMatrixBase<Vector<vector_number> >
                                     /**
                                      * The left matrix of the product.
                                      */
-    SmartPointer<const MatrixType> m1;
+    SmartPointer<const MatrixType,ProductSparseMatrix<number,vector_number> > m1;
     
                                     /**
                                      * The right matrix of the product.
                                      */
-    SmartPointer<const MatrixType> m2;
+    SmartPointer<const MatrixType,ProductSparseMatrix<number,vector_number> > m2;
     
                                     /**
                                      * Memory for auxiliary vector.
                                      */
-    SmartPointer<VectorMemory<VectorType> > mem;
+    SmartPointer<VectorMemory<VectorType>,ProductSparseMatrix<number,vector_number>  > mem;
                                     /**
                                      * Return some kind of
                                      * identifier.
@@ -578,13 +578,13 @@ ScaledMatrix<VECTOR>::Tvmult (VECTOR& w, const VECTOR& v) const
 
 template<class VECTOR>
 ProductMatrix<VECTOR>::ProductMatrix ()
-  : m1(0), m2(0), mem(0, typeid(*this).name())
+  : m1(0), m2(0), mem(0)
 {}
 
 
 template<class VECTOR>
 ProductMatrix<VECTOR>::ProductMatrix (VectorMemory<VECTOR>& m)
-  : m1(0), m2(0), mem(&m, typeid(*this).name())
+  : m1(0), m2(0), mem(&m)
 {}
 
 
@@ -594,7 +594,7 @@ ProductMatrix<VECTOR>::ProductMatrix (
   const MATRIX1& mat1,
   const MATRIX2& mat2,
   VectorMemory<VECTOR>& m)
-  : mem(&m, typeid(*this).name())
+  : mem(&m)
 {
   m1 = new PointerMatrix<MATRIX1, VECTOR>(&mat1, typeid(*this).name());
   m2 = new PointerMatrix<MATRIX2, VECTOR>(&mat2, typeid(*this).name());
index 68182aa9ab84af8c0ae8d32134db6f7778944175..d398afb7c715833036162b67937d48e524b0bcd5 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -236,7 +236,7 @@ class PointerMatrix : public PointerMatrixBase<VECTOR>
                                     /**
                                      * The pointer to the actual matrix.
                                      */
-    SmartPointer<const MATRIX> m;
+    SmartPointer<const MATRIX,PointerMatrix<MATRIX,VECTOR> > m;
 };
 
 
@@ -364,12 +364,12 @@ class PointerMatrixAux : public PointerMatrixBase<VECTOR>
                                      * Object for getting the
                                      * auxiliary vector.
                                      */
-    mutable SmartPointer<VectorMemory<VECTOR> > mem;
+    mutable SmartPointer<VectorMemory<VECTOR>,PointerMatrixAux<MATRIX,VECTOR> > mem;
     
                                     /**
                                      * The pointer to the actual matrix.
                                      */
-    SmartPointer<const MATRIX> m;
+    SmartPointer<const MATRIX,PointerMatrixAux<MATRIX,VECTOR> > m;
 };
 
 
@@ -504,7 +504,7 @@ class PointerMatrixVector : public PointerMatrixBase<Vector<number> >
                                     /**
                                      * The pointer to the actual matrix.
                                      */
-    SmartPointer<const Vector<number> > m;
+    SmartPointer<const Vector<number>,PointerMatrixVector<number> > m;
 };
 
 
index a7fd5150bf6e21d4465f395f99bac6b02cfd5531..7074b29e6e9ce7b5d10a319b4580440f3723ddd8 100644 (file)
@@ -329,7 +329,7 @@ class PreconditionRelaxation : public Subscriptor
                                     /**
                                      * Pointer to the matrix object.
                                      */
-    SmartPointer<const MATRIX> A;
+    SmartPointer<const MATRIX, PreconditionRelaxation<MATRIX> > A;
 
                                     /**
                                      * Relaxation parameter.
@@ -740,17 +740,17 @@ class PreconditionLACSolver : public Subscriptor
                                     /**
                                      * The solver object to use.
                                      */
-    SmartPointer<SOLVER> solver;
+    SmartPointer<SOLVER,PreconditionLACSolver<SOLVER,MATRIX,PRECONDITION> > solver;
 
                                     /**
                                      * The matrix in use.
                                      */
-    SmartPointer<const MATRIX> matrix;
+    SmartPointer<const MATRIX,PreconditionLACSolver<SOLVER,MATRIX,PRECONDITION> > matrix;
     
                                     /**
                                      * The preconditioner to use.
                                      */
-    SmartPointer<const PRECONDITION> precondition;
+    SmartPointer<const PRECONDITION,PreconditionLACSolver<SOLVER,MATRIX,PRECONDITION> > precondition;
 };
 
 
@@ -979,7 +979,7 @@ private:
                                        * A pointer to the underlying
                                        * matrix.
                                        */
-  SmartPointer<const MATRIX> matrix_ptr;
+    SmartPointer<const MATRIX,PreconditionChebyshev<MATRIX,VECTOR> > matrix_ptr;
 
                                       /**
                                        * Internal vector used for the
index 8c25ce60dc274383f4f460bd02df2a9fb66647de..2c7d464a7747cd82f269cec8a5fa1fb4206a4f9b 100644 (file)
@@ -412,7 +412,7 @@ class PreconditionBlock : public virtual Subscriptor
                                      * @p vmult function of the
                                      * derived classes.
                                      */
-    SmartPointer<const MATRIX> A;
+    SmartPointer<const MATRIX,PreconditionBlock<MATRIX,inverse_type> > A;
                                     /**
                                      * Relaxation parameter to be
                                      * used by derived classes.
index 7ebbeae36224bdf4b9cb3bf985b8b5e6053a2abc..e86b7e04c51110b378b975beec7914a4524caf84 100644 (file)
@@ -29,7 +29,7 @@ DEAL_II_NAMESPACE_OPEN
 template <class MATRIX, typename inverse_type>
 PreconditionBlock<MATRIX,inverse_type>::PreconditionBlock ():
                blocksize(0),
-               A(0),
+               A(0, typeid(*this).name()),
                store_diagonals(false),
                var_same_diagonal(false)
 {}
index ef8e6204f6919ec4563389bcd82bd39227ee0073..58ceec1ce850cc5f58b95435f9e32c891bce1c10 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -89,8 +89,8 @@ template <class number> class SparseMatrix;
  *
  * @author Ralf Hartmann, 1999
  */
-template <class Matrix = SparseMatrix<double>,
-          class Vector = dealii::Vector<double> >
+template <class MATRIX = SparseMatrix<double>,
+          class VECTOR = dealii::Vector<double> >
 class PreconditionSelector : public Subscriptor
 {
   public:
@@ -101,7 +101,7 @@ class PreconditionSelector : public Subscriptor
                                      * the preconditioning.
                                      */
     PreconditionSelector(const std::string                 &preconditioning,
-                        const typename Vector::value_type &omega=1.);
+                        const typename VECTOR::value_type &omega=1.);
     
                                     /**
                                      * Destructor.
@@ -114,14 +114,14 @@ class PreconditionSelector : public Subscriptor
                                      * matrix. e.g. for @p precondition_jacobi,
                                      * <tt>~_sor</tt>, <tt>~_ssor</tt>.
                                      */
-    void use_matrix(const Matrix &M);
+    void use_matrix(const MATRIX &M);
 
                                     /**
                                      * Precondition procedure. Calls the
                                      * preconditioning that was specified in
                                      * the constructor.
                                      */    
-    virtual void vmult (Vector &dst, const Vector&src) const;
+    virtual void vmult (VECTOR &dst, const VECTOR&src) const;
 
                                     /**
                                      * Get the names of all implemented
@@ -153,44 +153,44 @@ class PreconditionSelector : public Subscriptor
                                      * matrix-builtin preconditioning function.
                                      * cf. also @p PreconditionUseMatrix.
                                      */
-    SmartPointer<const Matrix> A;
+    SmartPointer<const MATRIX,PreconditionSelector<MATRIX,VECTOR> > A;
     
                                     /**
                                      * Stores the damping parameter
                                      * of the preconditioner.
                                      */
-    const typename Vector::value_type omega;
+    const typename VECTOR::value_type omega;
 };
 
 /*@}*/
 /* --------------------- Inline and template functions ------------------- */
 
 
-template <class Matrix, class Vector>
-PreconditionSelector<Matrix,Vector>
+template <class MATRIX, class VECTOR>
+PreconditionSelector<MATRIX,VECTOR>
 ::PreconditionSelector(const std::string                 &preconditioning,
-                      const typename Vector::value_type &omega) :
+                      const typename VECTOR::value_type &omega) :
                preconditioning(preconditioning),
                omega(omega)  {}
 
 
-template <class Matrix, class Vector>
-PreconditionSelector<Matrix,Vector>::~PreconditionSelector()
+template <class MATRIX, class VECTOR>
+PreconditionSelector<MATRIX,VECTOR>::~PreconditionSelector()
 {
                                   // release the matrix A
   A=0;
 }
 
 
-template <class Matrix, class Vector>
-void PreconditionSelector<Matrix,Vector>::use_matrix(const Matrix &M)
+template <class MATRIX, class VECTOR>
+void PreconditionSelector<MATRIX,VECTOR>::use_matrix(const MATRIX &M)
 {
   A=&M;
 }
 
-template <class Matrix, class Vector>
-void PreconditionSelector<Matrix,Vector>::vmult (Vector &dst,
-                                                const Vector &src) const
+template <class MATRIX, class VECTOR>
+void PreconditionSelector<MATRIX,VECTOR>::vmult (VECTOR &dst,
+                                                const VECTOR &src) const
 {
   if (preconditioning=="none")
     {
@@ -218,8 +218,8 @@ void PreconditionSelector<Matrix,Vector>::vmult (Vector &dst,
 }
 
 
-template <class Matrix, class Vector>
-std::string PreconditionSelector<Matrix,Vector>::get_precondition_names()
+template <class MATRIX, class VECTOR>
+std::string PreconditionSelector<MATRIX,VECTOR>::get_precondition_names()
 {
   return "none|jacobi|sor|ssor";
 }
index a0c9d52c78a3bb1a247b3d79cc25210dc2c55e20..10bb351867deb7d263e50c4f8dd2b044464e9fd8 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -183,19 +183,19 @@ class SchurMatrix : public Subscriptor
                                      /**
                                       * Pointer to inverse of upper left block.
                                       */
-    const SmartPointer<const MA_inverse> Ainv;
+    const SmartPointer<const MA_inverse,SchurMatrix<MA_inverse,MB,MDt,MC> > Ainv;
                                      /**
                                       * Pointer to lower left block.
                                       */
-    const SmartPointer<const MB> B;
+    const SmartPointer<const MB,SchurMatrix<MA_inverse,MB,MDt,MC> > B;
                                      /**
                                       * Pointer to transpose of upper right block.
                                       */
-    const SmartPointer<const MDt> Dt;
+    const SmartPointer<const MDt,SchurMatrix<MA_inverse,MB,MDt,MC> > Dt;
                                      /**
                                       * Pointer to lower right block.
                                       */
-    const SmartPointer<const MC> C;
+    const SmartPointer<const MC,SchurMatrix<MA_inverse,MB,MDt,MC> > C;
                                      /**
                                       * Auxiliary memory for vectors.
                                       */
index 8f51b0947beb9044e4235c6a1c97cf2e883302d8..57c91cf105a74dae17ce073ba732004e7e0c6522 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -68,7 +68,7 @@ class ShiftedMatrix
                                     /**
                                      * Storage for base matrix.
                                      */
-    SmartPointer<const MATRIX> A;
+    SmartPointer<const MATRIX,ShiftedMatrix<MATRIX> > A;
 
                                     /**
                                      * Auxiliary vector.
@@ -127,11 +127,11 @@ class ShiftedMatrixGeneralized
                                     /**
                                      * Storage for base matrix.
                                      */
-    SmartPointer<const MATRIX> A;
+    SmartPointer<const MATRIX,ShiftedMatrixGeneralized<MATRIX,MASSMATRIX,VECTOR> > A;
                                     /**
                                      * Storage for mass matrix.
                                      */
-    SmartPointer<const MASSMATRIX> M;
+    SmartPointer<const MASSMATRIX,ShiftedMatrixGeneralized<MATRIX,MASSMATRIX,VECTOR> > M;
 
                                     /**
                                      * Auxiliary vector.
index 3079f17f1896a9702057ea6f46fd3eb69b2a3137..3c5f581fe556eb5470af9552c9e5913799eda874 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -183,14 +183,14 @@ class SolverSelector : public Subscriptor
                                      * is needed in the constructor of
                                      * each @p Solver class.
                                      */
-    SmartPointer<SolverControl> control;
+    SmartPointer<SolverControl,SolverSelector<VECTOR> > control;
 
                                     /**
                                      * Stores the @p VectorMemory that
                                      * is needed in the constructor of
                                      * each @p Solver class.
                                      */
-    SmartPointer<VectorMemory<VECTOR> > vector_memory;
+    SmartPointer<VectorMemory<VECTOR>,SolverSelector<VECTOR> > vector_memory;
 
   private:
                                     /**
index 8ad51e6e3166ba52d0ea23a8d0f4d0b4e75bd88e..86be9770aed02dc6c05ad4cbb72b0e4a6ee30e01 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -444,7 +444,7 @@ class SparseDirectMA27 : public Subscriptor
                                      * that we use the same thing for
                                      * all calls.
                                      */
-    SmartPointer<const SparsityPattern> sparsity_pattern;
+    SmartPointer<const SparsityPattern,SparseDirectMA27> sparsity_pattern;
     
                                     /**
                                      * Number of nonzero elements in
@@ -879,7 +879,7 @@ class SparseDirectMA47 : public Subscriptor
                                      * to make sure that we use the
                                      * same thing for all calls.
                                      */
-    SmartPointer<const SparseMatrix<double> > matrix;
+    SmartPointer<const SparseMatrix<double>,SparseDirectMA47> matrix;
     
                                     /**
                                      * Number of nonzero elements in
index 62fadd1b5791248d2c0c9c0a3bd08b7fa5c17b39..4759efb28cd09535692911a6d3289f73fb073e2f 100644 (file)
@@ -1871,12 +1871,15 @@ class SparseMatrix : public virtual Subscriptor
                                     /**
                                      * Print the matrix to the given
                                      * stream, using the format
-                                     * <tt>(line,col) value</tt>,
+                                     * <tt>(row,column) value</tt>,
                                      * i.e. one nonzero entry of the
-                                     * matrix per line.
+                                     * matrix per line. If @p across
+                                     * is true, print all entries on
+                                     * a single line, using the
+                                     * format row,column:value
                                      */
     template <class STREAM>
-    void print (STREAM &out) const;
+    void print (STREAM &out, bool across=false) const;
 
                                     /**
                                      * Print the matrix in the usual
@@ -2070,7 +2073,7 @@ class SparseMatrix : public virtual Subscriptor
                                      * it using the SmartPointer
                                      * class.
                                      */
-    SmartPointer<const SparsityPattern> cols;
+    SmartPointer<const SparsityPattern,SparseMatrix<number> > cols;
 
                                     /**
                                      * Array of values for all the
@@ -2925,14 +2928,22 @@ SparseMatrix<number>::end (const unsigned int r)
 template <typename number>
 template <class STREAM>
 inline
-void SparseMatrix<number>::print (STREAM &out) const
+void SparseMatrix<number>::print (STREAM &out, bool across) const
 {
   Assert (cols != 0, ExcNotInitialized());
   Assert (val != 0, ExcNotInitialized());
 
-  for (unsigned int i=0; i<cols->rows; ++i)
-    for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j)
-      out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl;
+  if (across)
+    {
+      for (unsigned int i=0; i<cols->rows; ++i)
+       for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j)
+         out << ' ' << i << ',' << cols->colnums[j] << ':' << val[j];
+      out << std::endl;
+    }
+  else
+    for (unsigned int i=0; i<cols->rows; ++i)
+      for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j)
+       out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl;
 }
 
 
index f91ab733568277b98cd199fd9e8ed1e87864bfff..2f9175fddc432cbb41a73457c67c8fcb60314d96 100644 (file)
@@ -264,7 +264,7 @@ class SparseVanka
                                     /**
                                      * Pointer to the matrix.
                                      */
-    SmartPointer<const SparseMatrix<number> > matrix;
+    SmartPointer<const SparseMatrix<number>,SparseVanka<number> > matrix;
     
                                     /**
                                      * Conserve memory flag.
@@ -291,7 +291,7 @@ class SparseVanka
                                      * Only those elements will be used
                                      * that are tagged in @p selected.
                                      */
-    mutable std::vector<SmartPointer<FullMatrix<float> > > inverses;
+    mutable std::vector<SmartPointer<FullMatrix<float>,SparseVanka<number> > > inverses;
 
                                     /**
                                      * Compute the inverses of all
index a0cd767ffa82f6e4738c1c52fc07215ea56df8a2..c27f44f51d465bac2d91eaee11691549fa415469 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -32,7 +32,7 @@ SparseVanka<number>::SparseVanka(const SparseMatrix<number> &M,
                                 const bool                  conserve_mem,
                                 const unsigned int          n_threads)
                :
-               matrix (&M),
+               matrix (&M, typeid(*this).name()),
                conserve_mem (conserve_mem),
                selected (selected),
                n_threads (n_threads),
@@ -49,7 +49,7 @@ SparseVanka<number>::SparseVanka(const SparseMatrix<number> &M,
 template<typename number>
 SparseVanka<number>::~SparseVanka()
 {
-  std::vector<SmartPointer<FullMatrix<float> > >::iterator i;
+  typename std::vector<SmartPointer<FullMatrix<float>,SparseVanka<number> > >::iterator i;
   for(i=inverses.begin(); i!=inverses.end(); ++i)
     {
       FullMatrix<float> *p = *i;
index 0aaf0bf00f2fd9e385da54849ab7743a2a010fad..6315e4571bbb160c3a516da36a578dff1644158d 100644 (file)
@@ -123,7 +123,7 @@ TransposeMatrix : public PointerMatrixBase<VECTOR>
                                     /**
                                      * The pointer to the actual matrix.
                                      */
-    SmartPointer<const MATRIX> m;
+    SmartPointer<const MATRIX,TransposeMatrix<MATRIX,VECTOR> > m;
 };
 
 
@@ -132,7 +132,7 @@ TransposeMatrix : public PointerMatrixBase<VECTOR>
 
 template<class MATRIX, class VECTOR>
 TransposeMatrix<MATRIX, VECTOR>::TransposeMatrix (const MATRIX* M)
-  : m(M, typeid(*this).name())
+  : m(M)
 {}
 
 
index 82c7208d4688c9eb183afb153377bbef53619ed4..de1eee59059088e25c0c48c9ad52fe75426d25af 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 2005, 2006, 2007, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -15,7 +15,6 @@
 
 #include <base/config.h>
 #include <base/subscriptor.h>
-#include <base/smartpointer.h>
 #include <lac/lapack_support.h>
 
 #include <vector>
index 85cc842c3f24161c27af7ee30083bbc33dadbbc2..166e951de55fb76ccb8865dfc1a1356283d3b3a7 100644 (file)
@@ -156,7 +156,7 @@ class VectorMemory : public Subscriptor
                                         /**
                                          * The memory pool used.
                                          */
-       SmartPointer<VectorMemory<VECTOR> > pool;
+       SmartPointer<VectorMemory<VECTOR>,Pointer> pool;
                                         /**
                                          * The pointer to the vector.
                                          */
@@ -403,7 +403,7 @@ template <typename VECTOR>
 inline
 VectorMemory<VECTOR>::Pointer::Pointer(VectorMemory<VECTOR>& mem)
                :
-               pool(&mem), v(0)
+               pool(&mem, typeid(*this).name()), v(0)
 {
   v = pool->alloc();
 }
index 808bb138a1abfae0758b186cf0abcfbb6994ee23..567052469a78781c9413da03313ff4e511e40d41 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -392,7 +392,7 @@ SparseDirectMA27::SparseDirectMA27 (const double LIW_factor_1,
                LA_increase_factor (LA_increase_factor),
                initialize_called (false),
                factorize_called (false),
-               sparsity_pattern (0)
+               sparsity_pattern (0, typeid(*this).name())
 {}
 
 
@@ -1073,7 +1073,7 @@ SparseDirectMA47::SparseDirectMA47 (const double LIW_factor_1,
                LA_increase_factor (LA_increase_factor),
                initialize_called (false),
                factorize_called (false),
-               matrix (0)
+               matrix (0, typeid(*this).name())
 {}
 
 

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.