From cd1475f91cd788495a9f8c378a4086d613bb157a Mon Sep 17 00:00:00 2001 From: kanschat Date: Thu, 15 Oct 2009 22:19:51 +0000 Subject: [PATCH] Smartpointer got a second template argument and ALL deal.II Smartpointers now identify the pointing class git-svn-id: https://svn.dealii.org/trunk@19894 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/named_data.h | 46 +++- deal.II/base/include/base/smartpointer.h | 208 +++++++++++---- deal.II/deal.II/include/dofs/dof_handler.h | 6 +- deal.II/deal.II/include/fe/fe_values.h | 8 +- .../deal.II/include/fe/mapping_q1_eulerian.h | 8 +- .../deal.II/include/fe/mapping_q_eulerian.h | 10 +- deal.II/deal.II/include/grid/grid_in.h | 2 +- deal.II/deal.II/include/grid/intergrid_map.h | 6 +- .../deal.II/include/grid/persistent_tria.h | 4 +- deal.II/deal.II/include/grid/tria.h | 4 +- deal.II/deal.II/include/hp/dof_handler.h | 4 +- deal.II/deal.II/include/hp/fe_values.h | 8 +- deal.II/deal.II/include/hp/q_collection.h | 3 +- deal.II/deal.II/include/multigrid/mg_coarse.h | 4 +- deal.II/deal.II/include/multigrid/mg_matrix.h | 6 +- .../include/multigrid/mg_transfer_block.h | 4 +- deal.II/deal.II/include/multigrid/multigrid.h | 22 +- deal.II/deal.II/include/numerics/data_out.h | 4 +- .../deal.II/include/numerics/data_out_stack.h | 4 +- .../include/numerics/fe_field_function.h | 4 +- .../deal.II/include/numerics/mesh_worker.h | 2 +- .../include/numerics/mesh_worker_assembler.h | 251 +++++++++++++++++- .../include/numerics/mesh_worker_info.h | 10 +- .../numerics/mesh_worker_vector_selector.h | 4 +- .../mesh_worker_vector_selector.templates.h | 10 +- .../include/numerics/point_value_history.h | 2 +- .../include/numerics/solution_transfer.h | 34 +-- .../deal.II/include/numerics/time_dependent.h | 8 +- deal.II/deal.II/source/fe/fe_values.cc | 8 +- .../deal.II/source/fe/mapping_q1_eulerian.cc | 2 +- .../deal.II/source/fe/mapping_q_eulerian.cc | 4 +- deal.II/deal.II/source/grid/grid_in.cc | 2 +- .../deal.II/source/grid/persistent_tria.cc | 2 +- deal.II/deal.II/source/grid/tria.cc | 7 +- deal.II/deal.II/source/hp/dof_handler.cc | 2 +- deal.II/deal.II/source/hp/fe_values.cc | 2 +- deal.II/deal.II/source/numerics/data_out.cc | 4 +- .../source/numerics/point_value_history.cc | 11 +- .../source/numerics/solution_transfer.cc | 96 +++---- .../deal.II/source/numerics/time_dependent.cc | 14 +- deal.II/lac/include/lac/block_matrix.h | 4 +- deal.II/lac/include/lac/block_matrix_array.h | 4 +- deal.II/lac/include/lac/block_matrix_base.h | 2 +- deal.II/lac/include/lac/block_sparse_matrix.h | 4 +- .../lac/block_sparse_matrix.templates.h | 6 +- .../lac/include/lac/block_sparsity_pattern.h | 2 +- deal.II/lac/include/lac/chunk_sparse_matrix.h | 4 +- deal.II/lac/include/lac/filtered_matrix.h | 8 +- deal.II/lac/include/lac/lapack_full_matrix.h | 6 +- deal.II/lac/include/lac/matrix_lib.h | 16 +- deal.II/lac/include/lac/pointer_matrix.h | 10 +- deal.II/lac/include/lac/precondition.h | 10 +- deal.II/lac/include/lac/precondition_block.h | 2 +- .../lac/precondition_block.templates.h | 2 +- .../lac/include/lac/precondition_selector.h | 40 +-- deal.II/lac/include/lac/schur_matrix.h | 10 +- deal.II/lac/include/lac/shifted_matrix.h | 8 +- deal.II/lac/include/lac/solver_selector.h | 6 +- deal.II/lac/include/lac/sparse_direct.h | 6 +- deal.II/lac/include/lac/sparse_matrix.h | 27 +- deal.II/lac/include/lac/sparse_vanka.h | 4 +- .../lac/include/lac/sparse_vanka.templates.h | 6 +- deal.II/lac/include/lac/transpose_matrix.h | 4 +- deal.II/lac/include/lac/tridiagonal_matrix.h | 3 +- deal.II/lac/include/lac/vector_memory.h | 4 +- deal.II/lac/source/sparse_direct.cc | 6 +- 66 files changed, 693 insertions(+), 351 deletions(-) diff --git a/deal.II/base/include/base/named_data.h b/deal.II/base/include/base/named_data.h index 6fba2c1ccc..f8c747dc46 100644 --- a/deal.II/base/include/base/named_data.h +++ b/deal.II/base/include/base/named_data.h @@ -48,6 +48,15 @@ class NamedData : public Subscriptor * an empty object. */ NamedData(); + + /** + * Assignment operator, copying + * conversible data from another + * object. + */ + template + NamedData& operator = (const NamedData& 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 + void merge(NamedData&); /** * 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 + void merge(const NamedData&); //@} /** * \name Accessing and querying @@ -243,35 +254,52 @@ NamedData::add(const DATA& v, const std::string& n) template +template inline void -NamedData::merge(NamedData& other) +NamedData::merge(NamedData& other) { Assert(!is_constant, ExcConstantObject()); for (unsigned int i=0;i +template inline void -NamedData::merge(const NamedData& other) +NamedData::merge(const NamedData& other) { Assert(!is_constant, ExcConstantObject()); for (unsigned int i=0;i +template +inline +NamedData& +NamedData::operator= (const NamedData& other) +{ + is_constant = false; + merge(other); + is_constant = other.is_const(); + return *this; +} + + template inline unsigned int diff --git a/deal.II/base/include/base/smartpointer.h b/deal.II/base/include/base/smartpointer.h index 8b2ad54bcb..4f3bd1b873 100644 --- a/deal.II/base/include/base/smartpointer.h +++ b/deal.II/base/include/base/smartpointer.h @@ -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 Subscriptor 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 dont_do_this = new T; + * SmartPointer 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(p, "mypointer"); + * SmartPointer t(p); * ... * } * delete p; @@ -52,17 +56,15 @@ DEAL_II_NAMESPACE_OPEN * @ingroup memory * @author Guido Kanschat, Wolfgang Bangerth, 1998 - 2009 */ -template +template 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, but subscribe * ourselves to it again. - * - * The id is used in the - * call to - * Subscriptor::subscribe(typeid(*this).name()). The #id of - * the object copied is used here. */ - SmartPointer (const SmartPointer &tt); + template + SmartPointer (const SmartPointer &tt); + + /* + * Copy constructor for + * SmartPointer. We do now + * copy the object subscribed to + * from tt, but subscribe + * ourselves to it again. + */ + SmartPointer (const SmartPointer &tt); /** * Constructor taking a normal @@ -92,11 +99,25 @@ class SmartPointer * * The id 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 & operator= (T *tt); + SmartPointer & 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 + SmartPointer & operator= (const SmartPointer &tt); /** * Assignment operator for @@ -124,7 +155,7 @@ class SmartPointer * automatically and unsubscribes * to an old one if it exists. */ - SmartPointer & operator= (const SmartPointer &tt); + SmartPointer & operator= (const SmartPointer &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 &tt); + template + void swap (SmartPointer &tt); /** * Swap pointers between this @@ -209,16 +247,30 @@ class SmartPointer /* --------------------------- inline Template functions ------------------------------*/ -template -SmartPointer::SmartPointer () +template +inline +SmartPointer::SmartPointer () : - t (0), id(0) + t (0), id(typeid(P).name()) {} -template -SmartPointer::SmartPointer (T *t, const char* id) +template +inline +SmartPointer::SmartPointer (T *t) + : + t (t), id(typeid(P).name()) +{ + if (t != 0) + t->subscribe(id); +} + + + +template +inline +SmartPointer::SmartPointer (T *t, const char* id) : t (t), id(id) { @@ -228,8 +280,22 @@ SmartPointer::SmartPointer (T *t, const char* id) -template -SmartPointer::SmartPointer (const SmartPointer &tt) +template +template +inline +SmartPointer::SmartPointer (const SmartPointer &tt) + : + t (tt.t), id(tt.id) +{ + if (t != 0) + t->subscribe(id); +} + + + +template +inline +SmartPointer::SmartPointer (const SmartPointer &tt) : t (tt.t), id(tt.id) { @@ -239,8 +305,9 @@ SmartPointer::SmartPointer (const SmartPointer &tt) -template -SmartPointer::~SmartPointer () +template +inline +SmartPointer::~SmartPointer () { if (t != 0) t->unsubscribe(id); @@ -248,8 +315,9 @@ SmartPointer::~SmartPointer () -template -SmartPointer & SmartPointer::operator = (T *tt) +template +inline +SmartPointer & SmartPointer::operator = (T *tt) { // optimize if no real action is // requested @@ -266,9 +334,32 @@ SmartPointer & SmartPointer::operator = (T *tt) -template -SmartPointer & -SmartPointer::operator = (const SmartPointer& tt) +template +template +inline +SmartPointer & +SmartPointer::operator = (const SmartPointer& 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(tt); + if (tt != 0) + tt->subscribe(id); + return *this; +} + + + +template +inline +SmartPointer & +SmartPointer::operator = (const SmartPointer& tt) { // if objects on the left and right // hand side of the operator= are @@ -286,18 +377,18 @@ SmartPointer::operator = (const SmartPointer& tt) -template +template inline -SmartPointer::operator T* () const +SmartPointer::operator T* () const { return t; } -template +template inline -T & SmartPointer::operator * () const +T & SmartPointer::operator * () const { Assert(t != 0, ExcNotInitialized()); return *t; @@ -305,9 +396,9 @@ T & SmartPointer::operator * () const -template +template inline -T * SmartPointer::operator -> () const +T * SmartPointer::operator -> () const { Assert(t != 0, ExcNotInitialized()); return t; @@ -315,12 +406,13 @@ T * SmartPointer::operator -> () const -template +template +template inline -void SmartPointer::swap (SmartPointer &tt) +void SmartPointer::swap (SmartPointer &tt) { #ifdef DEBUG - SmartPointer aux(t,id); + SmartPointer aux(t,id); *this = tt; tt = aux; #else @@ -330,9 +422,9 @@ void SmartPointer::swap (SmartPointer &tt) -template +template inline -void SmartPointer::swap (T *&tt) +void SmartPointer::swap (T *&tt) { if (t != 0) t->unsubscribe (id); @@ -345,11 +437,11 @@ void SmartPointer::swap (T *&tt) -template +template inline -unsigned int SmartPointer::memory_consumption () const +unsigned int SmartPointer::memory_consumption () const { - return sizeof(SmartPointer); + return sizeof(SmartPointer); } @@ -360,9 +452,9 @@ unsigned int SmartPointer::memory_consumption () const * objects to which the pointers point retain to be subscribed to, we * do not have to change their subscription count. */ -template +template inline -void swap (SmartPointer &t1, SmartPointer &t2) +void swap (SmartPointer &t1, SmartPointer &t2) { t1.swap (t2); } @@ -376,9 +468,9 @@ void swap (SmartPointer &t1, SmartPointer &t2) * Note that we indeed need a reference of a pointer, as we want to * change the pointer variable which we are given. */ -template +template inline -void swap (SmartPointer &t1, T *&t2) +void swap (SmartPointer &t1, T *&t2) { t1.swap (t2); } @@ -392,9 +484,9 @@ void swap (SmartPointer &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 +template inline -void swap (T *&t1, SmartPointer &t2) +void swap (T *&t1, SmartPointer &t2) { t2.swap (t1); } diff --git a/deal.II/deal.II/include/dofs/dof_handler.h b/deal.II/deal.II/include/dofs/dof_handler.h index 20fe30e31d..523e6a9db9 100644 --- a/deal.II/deal.II/include/dofs/dof_handler.h +++ b/deal.II/deal.II/include/dofs/dof_handler.h @@ -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 > tria; + SmartPointer,DoFHandler > 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 > selected_fe; + SmartPointer,DoFHandler > selected_fe; private: diff --git a/deal.II/deal.II/include/fe/fe_values.h b/deal.II/deal.II/include/fe/fe_values.h index 26f8c516d4..3a13434c52 100644 --- a/deal.II/deal.II/include/fe/fe_values.h +++ b/deal.II/deal.II/include/fe/fe_values.h @@ -2875,23 +2875,23 @@ class FEValuesBase : protected FEValuesData, /** * Storage for the mapping object. */ - const SmartPointer > mapping; + const SmartPointer,FEValuesBase > mapping; /** * Store the finite element for later use. */ - const SmartPointer > fe; + const SmartPointer,FEValuesBase > fe; /** * Internal data of mapping. */ - SmartPointer::InternalDataBase> mapping_data; + SmartPointer::InternalDataBase,FEValuesBase > mapping_data; /** * Internal data of finite element. */ - SmartPointer::InternalDataBase> fe_data; + SmartPointer::InternalDataBase,FEValuesBase > fe_data; /** * Initialize some update diff --git a/deal.II/deal.II/include/fe/mapping_q1_eulerian.h b/deal.II/deal.II/include/fe/mapping_q1_eulerian.h index c8f4f6a0e1..6cb5a0fcd9 100644 --- a/deal.II/deal.II/include/fe/mapping_q1_eulerian.h +++ b/deal.II/deal.II/include/fe/mapping_q1_eulerian.h @@ -84,7 +84,7 @@ DEAL_II_NAMESPACE_OPEN * * @author Michael Stadler, 2001 */ -template , int spacedim=dim > +template , int spacedim=dim > class MappingQ1Eulerian : public MappingQ1 { public: @@ -110,7 +110,7 @@ class MappingQ1Eulerian : public MappingQ1 * can be initialized by * DoFAccessor::set_dof_values(). */ - MappingQ1Eulerian (const EulerVectorType &euler_transform_vectors, + MappingQ1Eulerian (const VECTOR &euler_transform_vectors, const DoFHandler &shiftmap_dof_handler); /** @@ -165,14 +165,14 @@ class MappingQ1Eulerian : public MappingQ1 * 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 > shiftmap_dof_handler; + const SmartPointer,MappingQ1Eulerian > shiftmap_dof_handler; private: diff --git a/deal.II/deal.II/include/fe/mapping_q_eulerian.h b/deal.II/deal.II/include/fe/mapping_q_eulerian.h index e8ca37dcc6..fdbefcdff0 100644 --- a/deal.II/deal.II/include/fe/mapping_q_eulerian.h +++ b/deal.II/deal.II/include/fe/mapping_q_eulerian.h @@ -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 spacedim=dim > +template , int spacedim=dim > class MappingQEulerian : public MappingQ { public: @@ -114,7 +114,7 @@ class MappingQEulerian : public MappingQ */ MappingQEulerian (const unsigned int degree, - const EulerVectorType &euler_vector, + const VECTOR &euler_vector, const DoFHandler &euler_dof_handler); /** @@ -169,7 +169,7 @@ class MappingQEulerian : public MappingQ * shifts. */ - const EulerVectorType &euler_vector; + const VECTOR &euler_vector; /** * Pointer to the DoFHandler to @@ -177,7 +177,7 @@ class MappingQEulerian : public MappingQ * associated. */ - const SmartPointer > euler_dof_handler; + const SmartPointer,MappingQEulerian > euler_dof_handler; private: diff --git a/deal.II/deal.II/include/grid/grid_in.h b/deal.II/deal.II/include/grid/grid_in.h index 729ab09361..636afee4cb 100644 --- a/deal.II/deal.II/include/grid/grid_in.h +++ b/deal.II/deal.II/include/grid/grid_in.h @@ -441,7 +441,7 @@ class GridIn * Store address of the triangulation to * be fed with the data read in. */ - SmartPointer > tria; + SmartPointer,GridIn > tria; /** * This function can write the diff --git a/deal.II/deal.II/include/grid/intergrid_map.h b/deal.II/deal.II/include/grid/intergrid_map.h index 9f3b80a518..1ac1ed72ed 100644 --- a/deal.II/deal.II/include/grid/intergrid_map.h +++ b/deal.II/deal.II/include/grid/intergrid_map.h @@ -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 source_grid; + SmartPointer > source_grid; /** * Likewise for the destination grid. */ - SmartPointer destination_grid; + SmartPointer > destination_grid; /** * Set the mapping for the pair of diff --git a/deal.II/deal.II/include/grid/persistent_tria.h b/deal.II/deal.II/include/grid/persistent_tria.h index 4bce1e0340..da68425a75 100644 --- a/deal.II/deal.II/include/grid/persistent_tria.h +++ b/deal.II/deal.II/include/grid/persistent_tria.h @@ -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 * This grid shall be used as coarse * grid. */ - SmartPointer > coarse_grid; + SmartPointer,PersistentTriangulation > coarse_grid; /** * Vectors holding the refinement and diff --git a/deal.II/deal.II/include/grid/tria.h b/deal.II/deal.II/include/grid/tria.h index 030d201f5e..5ebfb137db 100644 --- a/deal.II/deal.II/include/grid/tria.h +++ b/deal.II/deal.II/include/grid/tria.h @@ -3264,7 +3264,7 @@ class Triangulation : public Subscriptor * and can thus never be * associated with a boundary. */ - SmartPointer > boundary[255]; + SmartPointer,Triangulation > boundary[255]; /** * Collection of ly @@ -3275,7 +3275,7 @@ class Triangulation : public Subscriptor * and can thus never be * associated with a boundary. */ - SmartPointer > manifold_description[255]; + SmartPointer,Triangulation > manifold_description[255]; /** * Flag indicating whether diff --git a/deal.II/deal.II/include/hp/dof_handler.h b/deal.II/deal.II/include/hp/dof_handler.h index 4a34f2a4b3..f8a8b4a7ad 100644 --- a/deal.II/deal.II/include/hp/dof_handler.h +++ b/deal.II/deal.II/include/hp/dof_handler.h @@ -936,7 +936,7 @@ namespace hp * Address of the triangulation to * work on. */ - SmartPointer > tria; + SmartPointer,DoFHandler > tria; /** * Store a pointer to the finite @@ -953,7 +953,7 @@ namespace hp * (this clears all data of this * object as well, though). */ - SmartPointer > finite_elements; + SmartPointer,hp::DoFHandler > finite_elements; private: diff --git a/deal.II/deal.II/include/hp/fe_values.h b/deal.II/deal.II/include/hp/fe_values.h index 0e91c643f7..3486441199 100644 --- a/deal.II/deal.II/include/hp/fe_values.h +++ b/deal.II/deal.II/include/hp/fe_values.h @@ -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 > fe_collection; + const SmartPointer, + FEValuesBase > fe_collection; /** * A pointer to the * collection of mappings to * be used. */ - const SmartPointer > mapping_collection; + const SmartPointer, + FEValuesBase > mapping_collection; /** * Copy of the quadrature diff --git a/deal.II/deal.II/include/hp/q_collection.h b/deal.II/deal.II/include/hp/q_collection.h index 009aa6377b..923bea2d4c 100644 --- a/deal.II/deal.II/include/hp/q_collection.h +++ b/deal.II/deal.II/include/hp/q_collection.h @@ -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 #include #include -#include #include #include diff --git a/deal.II/deal.II/include/multigrid/mg_coarse.h b/deal.II/deal.II/include/multigrid/mg_coarse.h index 3cc764de65..7a51c724a9 100644 --- a/deal.II/deal.II/include/multigrid/mg_coarse.h +++ b/deal.II/deal.II/include/multigrid/mg_coarse.h @@ -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 /** * Reference to the solver. */ - SmartPointer solver; + SmartPointer > solver; /** * Reference to the matrix. diff --git a/deal.II/deal.II/include/multigrid/mg_matrix.h b/deal.II/deal.II/include/multigrid/mg_matrix.h index 1949783deb..8870b16b24 100644 --- a/deal.II/deal.II/include/multigrid/mg_matrix.h +++ b/deal.II/deal.II/include/multigrid/mg_matrix.h @@ -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 /** * Pointer to the matrix objects on each level. */ - SmartPointer > matrix; + SmartPointer,MGMAtrix > matrix; }; @@ -181,7 +181,7 @@ class MGMatrixSelect : public MGMatrixBase > /** * Pointer to the matrix objects on each level. */ - SmartPointer > matrix; + SmartPointer,MGMAtrixSelect > matrix; /** * Row coordinate of selected block. */ diff --git a/deal.II/deal.II/include/multigrid/mg_transfer_block.h b/deal.II/deal.II/include/multigrid/mg_transfer_block.h index bb15a59005..8c6621478b 100644 --- a/deal.II/deal.II/include/multigrid/mg_transfer_block.h +++ b/deal.II/deal.II/include/multigrid/mg_transfer_block.h @@ -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 >, * additional multiplication * using #factors is desired. */ - SmartPointer > > memory; + SmartPointer >,MGTransferBlock > memory; }; diff --git a/deal.II/deal.II/include/multigrid/multigrid.h b/deal.II/deal.II/include/multigrid/multigrid.h index 0c56053be3..26ec75f385 100644 --- a/deal.II/deal.II/include/multigrid/multigrid.h +++ b/deal.II/deal.II/include/multigrid/multigrid.h @@ -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 > matrix; + SmartPointer,Multigrid > matrix; /** * The matrix for each level. */ - SmartPointer > coarse; + SmartPointer,Multigrid > coarse; /** * Object for grid tranfer. */ - SmartPointer > transfer; + SmartPointer,Multigrid > transfer; /** * The pre-smoothing object. */ - SmartPointer > pre_smooth; + SmartPointer,Multigrid > pre_smooth; /** * The post-smoothing object. */ - SmartPointer > post_smooth; + SmartPointer,Multigrid > post_smooth; /** * Edge matrix from fine to coarse. */ - SmartPointer > edge_down; + SmartPointer,Multigrid > edge_down; /** * Transpose edge matrix from coarse to fine. */ - SmartPointer > edge_up; + SmartPointer,Multigrid > edge_up; /** * Level for debug @@ -494,17 +494,17 @@ class PreconditionMG : public Subscriptor /** * Associated @p MGDoFHandler. */ - SmartPointer > mg_dof_handler; + SmartPointer,PreconditionMG > mg_dof_handler; /** * The multigrid object. */ - SmartPointer > multigrid; + SmartPointer,PreconditionMG > multigrid; /** * Object for grid tranfer. */ - SmartPointer transfer; + SmartPointer > transfer; }; /*@}*/ diff --git a/deal.II/deal.II/include/numerics/data_out.h b/deal.II/deal.II/include/numerics/data_out.h index cf4ce13da2..8e0d7e4774 100644 --- a/deal.II/deal.II/include/numerics/data_out.h +++ b/deal.II/deal.II/include/numerics/data_out.h @@ -873,7 +873,7 @@ class DataOut_DoFData : public DataOutInterface * object which shall be applied to * this data vector. */ - SmartPointer > postprocessor; + SmartPointer,DataOut_DoFData > postprocessor; /** * Number of output variables this @@ -1039,7 +1039,7 @@ class DataOut_DoFData : public DataOutInterface /** * Pointer to the dof handler object. */ - SmartPointer dofs; + SmartPointer > dofs; /** * List of data elements with vectors of diff --git a/deal.II/deal.II/include/numerics/data_out_stack.h b/deal.II/deal.II/include/numerics/data_out_stack.h index bd85379c91..184edbf154 100644 --- a/deal.II/deal.II/include/numerics/data_out_stack.h +++ b/deal.II/deal.II/include/numerics/data_out_stack.h @@ -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 * corresponding to the present parameter * value. */ - SmartPointer dof_handler; + SmartPointer > dof_handler; /** * List of patches of all past and diff --git a/deal.II/deal.II/include/numerics/fe_field_function.h b/deal.II/deal.II/include/numerics/fe_field_function.h index 694cb3c40c..4255ea68be 100644 --- a/deal.II/deal.II/include/numerics/fe_field_function.h +++ b/deal.II/deal.II/include/numerics/fe_field_function.h @@ -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 dh; + SmartPointer > dh; /** * A reference to the actual diff --git a/deal.II/deal.II/include/numerics/mesh_worker.h b/deal.II/deal.II/include/numerics/mesh_worker.h index 9c05d44251..3e8dff06c4 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker.h +++ b/deal.II/deal.II/include/numerics/mesh_worker.h @@ -399,7 +399,7 @@ namespace MeshWorker * Pointer to the object doing * local integration. */ - SmartPointer local; + SmartPointer > local; }; //----------------------------------------------------------------------// diff --git a/deal.II/deal.II/include/numerics/mesh_worker_assembler.h b/deal.II/deal.II/include/numerics/mesh_worker_assembler.h index b71701d1a8..eb9dea657f 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_assembler.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_assembler.h @@ -157,7 +157,7 @@ namespace MeshWorker * communicating the cell and * face vectors. */ - typedef NamedData > > DataVectors; + typedef NamedData,CellsAndFaces > > DataVectors; /** * The initialization @@ -258,7 +258,7 @@ namespace MeshWorker class ResidualSimple { public: - void initialize(NamedData >& results); + void initialize(NamedData& results); /** * Initialize the local data * in the @@ -299,7 +299,7 @@ namespace MeshWorker * The global residal vectors * filled by assemble(). */ - NamedData > residuals; + NamedData > > residuals; }; /** @@ -331,7 +331,7 @@ namespace MeshWorker * matrix pointers into local * variables. */ - void initialize(NamedData >& residuals); + void initialize(NamedData& residuals); /** * Initialize the local data * in the @@ -383,7 +383,7 @@ namespace MeshWorker * stored as a vector of * pointers. */ - NamedData > residuals; + NamedData > > 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 @@ -462,7 +470,130 @@ namespace MeshWorker * The global matrix being * assembled. */ - SmartPointer matrix; + SmartPointer > 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 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& m); + + /** + * Initialize the matrices + * #flux_up and #flux_down + * used for local refinement + * with discontinuous + * Galerkin methods. + */ + void initialize_fluxes(MGLevelObject& flux_up, + MGLevelObject& 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 + void initialize_info(DoFInfo& info, + bool interior_face) const; + + /** + * Assemble the matrix + * DoFInfo::M1[0] + * into the global matrix. + */ + template + void assemble(const DoFInfo& info); + + /** + * Assemble both local + * matrices in the info + * objects into the global + * matrices. + */ + template + void assemble(const DoFInfo& info1, + const DoFInfo& info2); + private: + /** + * Assemble a single matrix + * into a global matrix. + */ + void assemble(MATRIX& G, + const FullMatrix& M, + const std::vector& i1, + const std::vector& i2, + const bool transpose = false); + + /** + * The global matrix being + * assembled. + */ + SmartPointer,MGMatrixSimple > matrix; + + /** + * The matrix used for face + * flux terms across the + * refinement edge, coupling + * coarse to fine. + */ + SmartPointer,MGMatrixSimple > flux_up; + + /** + * The matrix used for face + * flux terms across the + * refinement edge, coupling + * fine to coarse. + */ + SmartPointer,MGMatrixSimple > flux_down; /** * The smallest positive @@ -815,7 +946,7 @@ namespace MeshWorker template inline void - ResidualSimple::initialize(NamedData >& results) + ResidualSimple::initialize(NamedData& results) { residuals = results; } @@ -861,7 +992,7 @@ namespace MeshWorker template inline void - ResidualLocalBlocksToGlobalBlocks::initialize(NamedData >& m) + ResidualLocalBlocksToGlobalBlocks::initialize(NamedData& m) { residuals = m; } @@ -994,6 +1125,106 @@ namespace MeshWorker } +//----------------------------------------------------------------------// + + template + inline + MGMatrixSimple::MGMatrixSimple(double threshold) + : + threshold(threshold) + {} + + + template + inline void + MGMatrixSimple::initialize(MGLevelObject& m) + { + matrix = &m; + } + + + template + inline void + MGMatrixSimple::initialize_fluxes( + MGLevelObject& up, MGLevelObject& down) + { + flux_up = &up; + flux_down = &down; + } + + + template + template + inline void + MGMatrixSimple::initialize_info(DoFInfo& info, + bool interior_face) const + { + info.initialize_matrices(1, interior_face); + } + + + + template + inline void + MGMatrixSimple::assemble(MATRIX& G, + const FullMatrix& M, + const std::vector& i1, + const std::vector& i2, + bool transpose) + { + AssertDimension(M.m(), i1.size()); + AssertDimension(M.n(), i2.size()); + + for (unsigned int j=0; j= threshold) + { + if (transpose) + G.add(i1[j], i2[k], M(j,k)); + else + G.add(i1[j], i2[k], M(j,k)); + } + } + + + template + template + inline void + MGMatrixSimple::assemble(const DoFInfo& info) + { + assemble(info.M1[0].matrix, info.indices, info.indices); + } + + + template + template + inline void + MGMatrixSimple::assemble(const DoFInfo& info1, + const DoFInfo& 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 @@ -1261,8 +1492,8 @@ namespace MeshWorker inline void SystemSimple::initialize(MATRIX& m, VECTOR& rhs) { - NamedData > data; - SmartPointer p = &rhs; + NamedData data; + VECTOR* p = &rhs; data.add(p, "right hand side"); MatrixSimple::initialize(m); diff --git a/deal.II/deal.II/include/numerics/mesh_worker_info.h b/deal.II/deal.II/include/numerics/mesh_worker_info.h index 1c0a1f0bea..f07d1722e9 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_info.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_info.h @@ -249,7 +249,7 @@ namespace MeshWorker /// The block structure of the system - SmartPointer block_info; + SmartPointer > block_info; private: /// Fill index vector void get_indices(const typename DoFHandler::cell_iterator c); @@ -544,11 +544,11 @@ namespace MeshWorker const FiniteElement& el, const Mapping& mapping); - template + template void initialize(const WORKER&, const FiniteElement& el, const Mapping& mapping, - const NamedData >& data); + const NamedData >& data); // private: CellInfo cell_info; @@ -843,13 +843,13 @@ namespace MeshWorker template - template + template void IntegrationInfoBox::initialize( const WORKER& integrator, const FiniteElement& el, const Mapping& mapping, - const NamedData >& data) + const NamedData >& data) { cell_info.initialize_data(data); bdry_info.initialize_data(data); diff --git a/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.h b/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.h index c4fadab0cd..4b5654ee45 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.h @@ -249,7 +249,7 @@ namespace MeshWorker public VectorDataBase { public: - void initialize(const NamedData >&); + void initialize(const NamedData&); virtual void fill( std::vector > >& values, @@ -262,7 +262,7 @@ namespace MeshWorker unsigned int start, unsigned int size) const; private: - SmartPointer > > data; + NamedData > > data; }; //----------------------------------------------------------------------// diff --git a/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.templates.h b/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.templates.h index b6cf863947..d0d3e6a6df 100644 --- a/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.templates.h +++ b/deal.II/deal.II/include/numerics/mesh_worker_vector_selector.templates.h @@ -40,9 +40,9 @@ namespace MeshWorker template void - VectorData::initialize(const NamedData >& d) + VectorData::initialize(const NamedData& d) { - data = &d; + data = d; VectorSelector::initialize(d); } @@ -62,21 +62,21 @@ namespace MeshWorker { for (unsigned int i=0;in_values();++i) { - const VECTOR& src = *(*data)(this->value_index(i)); + const VECTOR& src = *data(this->value_index(i)); VectorSlice > > dst(values[i], component, n_comp); fe.get_function_values(src, make_slice(index, start, size), dst, true); } for (unsigned int i=0;in_gradients();++i) { - const VECTOR& src = *(*data)(this->value_index(i)); + const VECTOR& src = *data(this->value_index(i)); VectorSlice > > > dst(gradients[i], component, n_comp); fe.get_function_gradients(src, make_slice(index, start, size), dst, true); } for (unsigned int i=0;in_hessians();++i) { - const VECTOR& src = *(*data)(this->value_index(i)); + const VECTOR& src = *data(this->value_index(i)); VectorSlice > > > dst(hessians[i], component, n_comp); fe.get_function_hessians(src, make_slice(index, start, size), dst, true); } diff --git a/deal.II/deal.II/include/numerics/point_value_history.h b/deal.II/deal.II/include/numerics/point_value_history.h index f005f61b80..c4768dfc80 100644 --- a/deal.II/deal.II/include/numerics/point_value_history.h +++ b/deal.II/deal.II/include/numerics/point_value_history.h @@ -527,7 +527,7 @@ class PointValueHistory * supplied to the constructor. This can be * released by calling @p clear(). */ - SmartPointer > dof_handler; + SmartPointer,PointValueHistory > dof_handler; /** * Variable to check that number of dofs diff --git a/deal.II/deal.II/include/numerics/solution_transfer.h b/deal.II/deal.II/include/numerics/solution_transfer.h index df5c7f00ec..249d86a61b 100644 --- a/deal.II/deal.II/include/numerics/solution_transfer.h +++ b/deal.II/deal.II/include/numerics/solution_transfer.h @@ -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, class DH=DoFHandler > +template, class DH=DoFHandler > 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 &all_in); + void prepare_for_coarsening_and_refinement (const std::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&all_in, - std::vector &all_out) const; + void interpolate (const std::vector&all_in, + std::vector &all_out) const; /** * Same as the previous function. @@ -322,8 +322,8 @@ class SolutionTransfer * in one step by using * interpolate (all_in, all_out) */ - 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 dof_handler; + SmartPointer > dof_handler; /** * Stores the number of DoFs before the @@ -443,7 +435,7 @@ class SolutionTransfer unsigned int memory_consumption () const; std::vector *indices_ptr; - std::vector > *dof_values_ptr; + std::vector > *dof_values_ptr; }; /** @@ -464,7 +456,7 @@ class SolutionTransfer * of all cells that'll be coarsened * will be stored in this vector. */ - std::vector > > dof_values_on_cell; + std::vector > > dof_values_on_cell; }; diff --git a/deal.II/deal.II/include/numerics/time_dependent.h b/deal.II/deal.II/include/numerics/time_dependent.h index df3fd5fa21..2f04bf087d 100644 --- a/deal.II/deal.II/include/numerics/time_dependent.h +++ b/deal.II/deal.II/include/numerics/time_dependent.h @@ -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 > timesteps; + std::vector > 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 > tria; + SmartPointer,TimeStepBase_Tria > 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 > coarse_grid; + SmartPointer,TimeStepBase_Tria > coarse_grid; /** * Some flags about how this time level diff --git a/deal.II/deal.II/source/fe/fe_values.cc b/deal.II/deal.II/source/fe/fe_values.cc index c28f55b8b6..2421ef7919 100644 --- a/deal.II/deal.II/source/fe/fe_values.cc +++ b/deal.II/deal.II/source/fe/fe_values.cc @@ -1983,10 +1983,10 @@ FEValuesBase::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; diff --git a/deal.II/deal.II/source/fe/mapping_q1_eulerian.cc b/deal.II/deal.II/source/fe/mapping_q1_eulerian.cc index 006e9dc0b8..fa37567b27 100644 --- a/deal.II/deal.II/source/fe/mapping_q1_eulerian.cc +++ b/deal.II/deal.II/source/fe/mapping_q1_eulerian.cc @@ -29,7 +29,7 @@ MappingQ1Eulerian (const EulerVectorType &euler_transform_vectors, const DoFHandler &shiftmap_dof_handler) : euler_transform_vectors(euler_transform_vectors), - shiftmap_dof_handler(&shiftmap_dof_handler) + shiftmap_dof_handler(&shiftmap_dof_handler, typeid(*this).name()) {} diff --git a/deal.II/deal.II/source/fe/mapping_q_eulerian.cc b/deal.II/deal.II/source/fe/mapping_q_eulerian.cc index 42b8ee3ffa..e810fb4c41 100644 --- a/deal.II/deal.II/source/fe/mapping_q_eulerian.cc +++ b/deal.II/deal.II/source/fe/mapping_q_eulerian.cc @@ -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(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, diff --git a/deal.II/deal.II/source/grid/grid_in.cc b/deal.II/deal.II/source/grid/grid_in.cc index d976f337ec..01677aa7b8 100644 --- a/deal.II/deal.II/source/grid/grid_in.cc +++ b/deal.II/deal.II/source/grid/grid_in.cc @@ -35,7 +35,7 @@ DEAL_II_NAMESPACE_OPEN template GridIn::GridIn () : - tria(0), default_format(ucd) + tria(0, typeid(*this).name()), default_format(ucd) {} diff --git a/deal.II/deal.II/source/grid/persistent_tria.cc b/deal.II/deal.II/source/grid/persistent_tria.cc index 36ec9cee1c..c73f84bcdf 100644 --- a/deal.II/deal.II/source/grid/persistent_tria.cc +++ b/deal.II/deal.II/source/grid/persistent_tria.cc @@ -29,7 +29,7 @@ template PersistentTriangulation:: PersistentTriangulation (const Triangulation &coarse_grid) : - coarse_grid (&coarse_grid) + coarse_grid (&coarse_grid, typeid(*this).name()) {} diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index 46bc8f93ee..6eba2e21ac 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -9814,7 +9814,6 @@ Triangulation::dimension; template Triangulation::Triangulation (const MeshSmoothing smooth_grid) : - Subscriptor (), faces(NULL), anisotropic_refinement(false), smooth_grid(smooth_grid) @@ -9827,12 +9826,12 @@ Triangulation::Triangulation (const MeshSmoothing smooth_grid) template -Triangulation::Triangulation (const Triangulation &) - : - Subscriptor () +Triangulation::Triangulation (const Triangulation &) // do not set any subscriptors; // anyway, calling this constructor // is an error! + : + Subscriptor() { Assert (false, ExcInternalError()); } diff --git a/deal.II/deal.II/source/hp/dof_handler.cc b/deal.II/deal.II/source/hp/dof_handler.cc index 5d312bcfc7..8f4203f00a 100644 --- a/deal.II/deal.II/source/hp/dof_handler.cc +++ b/deal.II/deal.II/source/hp/dof_handler.cc @@ -1586,7 +1586,7 @@ namespace hp template DoFHandler::DoFHandler (const Triangulation &tria) : - tria(&tria), + tria(&tria, typeid(*this).name()), faces (NULL), used_dofs (0) { diff --git a/deal.II/deal.II/source/hp/fe_values.cc b/deal.II/deal.II/source/hp/fe_values.cc index 7f5ef68c6f..254ecc42f4 100644 --- a/deal.II/deal.II/source/hp/fe_values.cc +++ b/deal.II/deal.II/source/hp/fe_values.cc @@ -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 diff --git a/deal.II/deal.II/source/numerics/data_out.cc b/deal.II/deal.II/source/numerics/data_out.cc index 82a92b7512..21a32a5fbb 100644 --- a/deal.II/deal.II/source/numerics/data_out.cc +++ b/deal.II/deal.II/source/numerics/data_out.cc @@ -95,7 +95,7 @@ DataEntryBase::DataEntryBase (const std::vector &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 *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 diff --git a/deal.II/deal.II/source/numerics/point_value_history.cc b/deal.II/deal.II/source/numerics/point_value_history.cc index 5abf9c8ca2..25783bbd28 100644 --- a/deal.II/deal.II/source/numerics/point_value_history.cc +++ b/deal.II/deal.II/source/numerics/point_value_history.cc @@ -40,7 +40,6 @@ namespace internal template PointValueHistory ::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 template -PointValueHistory -::PointValueHistory (const DoFHandler & dof_handler, +PointValueHistory::PointValueHistory (const DoFHandler & 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 template -PointValueHistory -::PointValueHistory (const PointValueHistory & point_value_history) +PointValueHistory::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 ::clear () { cleared = true; - dof_handler = SmartPointer > (0, "Cleared"); + dof_handler = 0; } // Need to test that the internal data has a full and complete dataset for diff --git a/deal.II/deal.II/source/numerics/solution_transfer.cc b/deal.II/deal.II/source/numerics/solution_transfer.cc index cb574b158f..a9a64caa2b 100644 --- a/deal.II/deal.II/source/numerics/solution_transfer.cc +++ b/deal.II/deal.II/source/numerics/solution_transfer.cc @@ -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 -SolutionTransfer::SolutionTransfer(const DH &dof): - dof_handler(&dof), +template +SolutionTransfer::SolutionTransfer(const DH &dof): + dof_handler(&dof, typeid(*this).name()), n_dofs_old(0), prepared_for(none) {} -template -SolutionTransfer::~SolutionTransfer() +template +SolutionTransfer::~SolutionTransfer() { clear (); } -template -SolutionTransfer::Pointerstruct::Pointerstruct(): +template +SolutionTransfer::Pointerstruct::Pointerstruct(): indices_ptr(0), dof_values_ptr(0) {} -template -void SolutionTransfer::clear () +template +void SolutionTransfer::clear () { indices_on_cell.clear(); dof_values_on_cell.clear(); @@ -65,8 +65,8 @@ void SolutionTransfer::clear () } -template -void SolutionTransfer::prepare_for_pure_refinement() +template +void SolutionTransfer::prepare_for_pure_refinement() { Assert(prepared_for!=pure_refinement, ExcAlreadyPrepForRef()); Assert(prepared_for!=coarsening_and_refinement, @@ -100,20 +100,20 @@ void SolutionTransfer::prepare_for_pure_refinement() } -template +template void -SolutionTransfer::refine_interpolate(const VectorType &in, - VectorType &out) const +SolutionTransfer::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 local_values(0); + Vector local_values(0); typename DH::cell_iterator cell = dof_handler->begin(), endc = dof_handler->end(); @@ -154,10 +154,10 @@ SolutionTransfer::refine_interpolate(const VectorType &in, } -template +template void -SolutionTransfer:: -prepare_for_coarsening_and_refinement(const std::vector &all_in) +SolutionTransfer:: +prepare_for_coarsening_and_refinement(const std::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 &all_in) for (unsigned int i=0; i &all_in) (n_cells_to_stay_or_refine) .swap(indices_on_cell); - std::vector > > + std::vector > > (n_coarsen_fathers, - std::vector > (in_size)) + std::vector > (in_size)) .swap(dof_values_on_cell); // we need counters for @@ -247,8 +247,8 @@ prepare_for_coarsening_and_refinement(const std::vector &all_in) ExcTriaPrepCoarseningNotCalledBefore()); const unsigned int dofs_per_cell=cell->get_fe().dofs_per_cell; - std::vector >(in_size, - Vector(dofs_per_cell)) + std::vector >(in_size, + Vector(dofs_per_cell)) .swap(dof_values_on_cell[n_cf]); for (unsigned int j=0; j &all_in) } -template +template void -SolutionTransfer::prepare_for_coarsening_and_refinement(const VectorType &in) +SolutionTransfer::prepare_for_coarsening_and_refinement(const VECTOR &in) { - std::vector all_in=std::vector(1, in); + std::vector all_in=std::vector(1, in); prepare_for_coarsening_and_refinement(all_in); } -template -void SolutionTransfer:: -interpolate (const std::vector &all_in, - std::vector &all_out) const +template +void SolutionTransfer:: +interpolate (const std::vector &all_in, + std::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; in_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 local_values; + Vector local_values; std::vector dofs; typename std::map, Pointerstruct>::const_iterator @@ -316,7 +316,7 @@ interpolate (const std::vector &all_in, const std::vector * const indexptr =pointerstruct->second.indices_ptr; - const std::vector > * const valuesptr + const std::vector > * 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 &all_in, -template -void SolutionTransfer::interpolate(const VectorType &in, - VectorType &out) const +template +void SolutionTransfer::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 all_in(1); + std::vector all_in(1); all_in[0] = in; - std::vector all_out(1); + std::vector all_out(1); all_out[0] = out; interpolate(all_in, all_out); @@ -414,9 +414,9 @@ void SolutionTransfer::interpolate(const VectorType &in, -template +template unsigned int -SolutionTransfer::memory_consumption () const +SolutionTransfer::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::memory_consumption () const -template +template unsigned int -SolutionTransfer::Pointerstruct::memory_consumption () const +SolutionTransfer::Pointerstruct::memory_consumption () const { return sizeof(*this); } diff --git a/deal.II/deal.II/source/numerics/time_dependent.cc b/deal.II/deal.II/source/numerics/time_dependent.cc index 534c589adc..8f7697c3de 100644 --- a/deal.II/deal.II/source/numerics/time_dependent.cc +++ b/deal.II/deal.II/source/numerics/time_dependent.cc @@ -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 >::iterator insert_position + std::vector >::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()); + /*null*/SmartPointer()); // same for "previous" pointer of next // time step if (positionset_previous_timestep ((position!=0) ? timesteps[position-1] : - /*null*/SmartPointer()); + /*null*/SmartPointer()); } @@ -411,8 +411,8 @@ TimeStepBase::memory_consumption () const template TimeStepBase_Tria::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::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) {} diff --git a/deal.II/lac/include/lac/block_matrix.h b/deal.II/lac/include/lac/block_matrix.h index a8dfe75bd8..26c9311c8f 100644 --- a/deal.II/lac/include/lac/block_matrix.h +++ b/deal.II/lac/include/lac/block_matrix.h @@ -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 matrix; + SmartPointer > matrix; }; /*@}*/ diff --git a/deal.II/lac/include/lac/block_matrix_array.h b/deal.II/lac/include/lac/block_matrix_array.h index b3eedb75e9..92faba0d20 100644 --- a/deal.II/lac/include/lac/block_matrix_array.h +++ b/deal.II/lac/include/lac/block_matrix_array.h @@ -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 > > mem; + mutable SmartPointer >,BlockMatrixArray > mem; }; /*@}*/ diff --git a/deal.II/lac/include/lac/block_matrix_base.h b/deal.II/lac/include/lac/block_matrix_base.h index 08727ff505..500a12caad 100644 --- a/deal.II/lac/include/lac/block_matrix_base.h +++ b/deal.II/lac/include/lac/block_matrix_base.h @@ -1026,7 +1026,7 @@ class BlockMatrixBase : public Subscriptor /** * Array of sub-matrices. */ - Table<2,SmartPointer > sub_objects; + Table<2,SmartPointer > > sub_objects; /** * This function collects the diff --git a/deal.II/lac/include/lac/block_sparse_matrix.h b/deal.II/lac/include/lac/block_sparse_matrix.h index ff20e5b0b3..f23ffa5c90 100644 --- a/deal.II/lac/include/lac/block_sparse_matrix.h +++ b/deal.II/lac/include/lac/block_sparse_matrix.h @@ -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 > * it using the SmartPointer * class. */ - SmartPointer sparsity_pattern; + SmartPointer > sparsity_pattern; }; diff --git a/deal.II/lac/include/lac/block_sparse_matrix.templates.h b/deal.II/lac/include/lac/block_sparse_matrix.templates.h index 6d5d06b14e..d6b84c64d5 100644 --- a/deal.II/lac/include/lac/block_sparse_matrix.templates.h +++ b/deal.II/lac/include/lac/block_sparse_matrix.templates.h @@ -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 BlockSparseMatrix::BlockSparseMatrix () - : - sparsity_pattern (0) {} @@ -32,8 +30,6 @@ BlockSparseMatrix::BlockSparseMatrix () template BlockSparseMatrix:: BlockSparseMatrix (const BlockSparsityPattern &sparsity) - : - sparsity_pattern (0) { reinit (sparsity); } diff --git a/deal.II/lac/include/lac/block_sparsity_pattern.h b/deal.II/lac/include/lac/block_sparsity_pattern.h index abb365c913..af999c3f30 100644 --- a/deal.II/lac/include/lac/block_sparsity_pattern.h +++ b/deal.II/lac/include/lac/block_sparsity_pattern.h @@ -424,7 +424,7 @@ class BlockSparsityPatternBase : public Subscriptor /** * Array of sparsity patterns. */ - Table<2,SmartPointer > sub_objects; + Table<2,SmartPointer > > sub_objects; /** * Object storing and managing diff --git a/deal.II/lac/include/lac/chunk_sparse_matrix.h b/deal.II/lac/include/lac/chunk_sparse_matrix.h index 986c53b0ae..1b9a49182e 100644 --- a/deal.II/lac/include/lac/chunk_sparse_matrix.h +++ b/deal.II/lac/include/lac/chunk_sparse_matrix.h @@ -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 cols; + SmartPointer > cols; /** * Array of values for all the diff --git a/deal.II/lac/include/lac/filtered_matrix.h b/deal.II/lac/include/lac/filtered_matrix.h index 069326161d..e249a059de 100644 --- a/deal.II/lac/include/lac/filtered_matrix.h +++ b/deal.II/lac/include/lac/filtered_matrix.h @@ -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 > matrix; diff --git a/deal.II/lac/include/lac/lapack_full_matrix.h b/deal.II/lac/include/lac/lapack_full_matrix.h index a419a81e4a..a6fbbec891 100644 --- a/deal.II/lac/include/lac/lapack_full_matrix.h +++ b/deal.II/lac/include/lac/lapack_full_matrix.h @@ -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&, const BlockVector&) const; private: - SmartPointer > matrix; - SmartPointer > > mem; + SmartPointer,PreconditionLU > matrix; + SmartPointer >,PreconditionLU > mem; }; diff --git a/deal.II/lac/include/lac/matrix_lib.h b/deal.II/lac/include/lac/matrix_lib.h index 7a86ad5f54..863ee2daa0 100644 --- a/deal.II/lac/include/lac/matrix_lib.h +++ b/deal.II/lac/include/lac/matrix_lib.h @@ -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 /** * Memory for auxiliary vector. */ - SmartPointer > mem; + SmartPointer,ProductMatrix > mem; /** * Return some kind of * identifier. @@ -297,17 +297,17 @@ class ProductSparseMatrix : public PointerMatrixBase > /** * The left matrix of the product. */ - SmartPointer m1; + SmartPointer > m1; /** * The right matrix of the product. */ - SmartPointer m2; + SmartPointer > m2; /** * Memory for auxiliary vector. */ - SmartPointer > mem; + SmartPointer,ProductSparseMatrix > mem; /** * Return some kind of * identifier. @@ -578,13 +578,13 @@ ScaledMatrix::Tvmult (VECTOR& w, const VECTOR& v) const template ProductMatrix::ProductMatrix () - : m1(0), m2(0), mem(0, typeid(*this).name()) + : m1(0), m2(0), mem(0) {} template ProductMatrix::ProductMatrix (VectorMemory& m) - : m1(0), m2(0), mem(&m, typeid(*this).name()) + : m1(0), m2(0), mem(&m) {} @@ -594,7 +594,7 @@ ProductMatrix::ProductMatrix ( const MATRIX1& mat1, const MATRIX2& mat2, VectorMemory& m) - : mem(&m, typeid(*this).name()) + : mem(&m) { m1 = new PointerMatrix(&mat1, typeid(*this).name()); m2 = new PointerMatrix(&mat2, typeid(*this).name()); diff --git a/deal.II/lac/include/lac/pointer_matrix.h b/deal.II/lac/include/lac/pointer_matrix.h index 68182aa9ab..d398afb7c7 100644 --- a/deal.II/lac/include/lac/pointer_matrix.h +++ b/deal.II/lac/include/lac/pointer_matrix.h @@ -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 /** * The pointer to the actual matrix. */ - SmartPointer m; + SmartPointer > m; }; @@ -364,12 +364,12 @@ class PointerMatrixAux : public PointerMatrixBase * Object for getting the * auxiliary vector. */ - mutable SmartPointer > mem; + mutable SmartPointer,PointerMatrixAux > mem; /** * The pointer to the actual matrix. */ - SmartPointer m; + SmartPointer > m; }; @@ -504,7 +504,7 @@ class PointerMatrixVector : public PointerMatrixBase > /** * The pointer to the actual matrix. */ - SmartPointer > m; + SmartPointer,PointerMatrixVector > m; }; diff --git a/deal.II/lac/include/lac/precondition.h b/deal.II/lac/include/lac/precondition.h index a7fd5150bf..7074b29e6e 100644 --- a/deal.II/lac/include/lac/precondition.h +++ b/deal.II/lac/include/lac/precondition.h @@ -329,7 +329,7 @@ class PreconditionRelaxation : public Subscriptor /** * Pointer to the matrix object. */ - SmartPointer A; + SmartPointer > A; /** * Relaxation parameter. @@ -740,17 +740,17 @@ class PreconditionLACSolver : public Subscriptor /** * The solver object to use. */ - SmartPointer solver; + SmartPointer > solver; /** * The matrix in use. */ - SmartPointer matrix; + SmartPointer > matrix; /** * The preconditioner to use. */ - SmartPointer precondition; + SmartPointer > precondition; }; @@ -979,7 +979,7 @@ private: * A pointer to the underlying * matrix. */ - SmartPointer matrix_ptr; + SmartPointer > matrix_ptr; /** * Internal vector used for the diff --git a/deal.II/lac/include/lac/precondition_block.h b/deal.II/lac/include/lac/precondition_block.h index 8c25ce60dc..2c7d464a77 100644 --- a/deal.II/lac/include/lac/precondition_block.h +++ b/deal.II/lac/include/lac/precondition_block.h @@ -412,7 +412,7 @@ class PreconditionBlock : public virtual Subscriptor * @p vmult function of the * derived classes. */ - SmartPointer A; + SmartPointer > A; /** * Relaxation parameter to be * used by derived classes. diff --git a/deal.II/lac/include/lac/precondition_block.templates.h b/deal.II/lac/include/lac/precondition_block.templates.h index 7ebbeae362..e86b7e04c5 100644 --- a/deal.II/lac/include/lac/precondition_block.templates.h +++ b/deal.II/lac/include/lac/precondition_block.templates.h @@ -29,7 +29,7 @@ DEAL_II_NAMESPACE_OPEN template PreconditionBlock::PreconditionBlock (): blocksize(0), - A(0), + A(0, typeid(*this).name()), store_diagonals(false), var_same_diagonal(false) {} diff --git a/deal.II/lac/include/lac/precondition_selector.h b/deal.II/lac/include/lac/precondition_selector.h index ef8e6204f6..58ceec1ce8 100644 --- a/deal.II/lac/include/lac/precondition_selector.h +++ b/deal.II/lac/include/lac/precondition_selector.h @@ -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 SparseMatrix; * * @author Ralf Hartmann, 1999 */ -template , - class Vector = dealii::Vector > +template , + class VECTOR = dealii::Vector > 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, * ~_sor, ~_ssor. */ - 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 A; + SmartPointer > 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 -PreconditionSelector +template +PreconditionSelector ::PreconditionSelector(const std::string &preconditioning, - const typename Vector::value_type &omega) : + const typename VECTOR::value_type &omega) : preconditioning(preconditioning), omega(omega) {} -template -PreconditionSelector::~PreconditionSelector() +template +PreconditionSelector::~PreconditionSelector() { // release the matrix A A=0; } -template -void PreconditionSelector::use_matrix(const Matrix &M) +template +void PreconditionSelector::use_matrix(const MATRIX &M) { A=&M; } -template -void PreconditionSelector::vmult (Vector &dst, - const Vector &src) const +template +void PreconditionSelector::vmult (VECTOR &dst, + const VECTOR &src) const { if (preconditioning=="none") { @@ -218,8 +218,8 @@ void PreconditionSelector::vmult (Vector &dst, } -template -std::string PreconditionSelector::get_precondition_names() +template +std::string PreconditionSelector::get_precondition_names() { return "none|jacobi|sor|ssor"; } diff --git a/deal.II/lac/include/lac/schur_matrix.h b/deal.II/lac/include/lac/schur_matrix.h index a0c9d52c78..10bb351867 100644 --- a/deal.II/lac/include/lac/schur_matrix.h +++ b/deal.II/lac/include/lac/schur_matrix.h @@ -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 Ainv; + const SmartPointer > Ainv; /** * Pointer to lower left block. */ - const SmartPointer B; + const SmartPointer > B; /** * Pointer to transpose of upper right block. */ - const SmartPointer Dt; + const SmartPointer > Dt; /** * Pointer to lower right block. */ - const SmartPointer C; + const SmartPointer > C; /** * Auxiliary memory for vectors. */ diff --git a/deal.II/lac/include/lac/shifted_matrix.h b/deal.II/lac/include/lac/shifted_matrix.h index 8f51b0947b..57c91cf105 100644 --- a/deal.II/lac/include/lac/shifted_matrix.h +++ b/deal.II/lac/include/lac/shifted_matrix.h @@ -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 A; + SmartPointer > A; /** * Auxiliary vector. @@ -127,11 +127,11 @@ class ShiftedMatrixGeneralized /** * Storage for base matrix. */ - SmartPointer A; + SmartPointer > A; /** * Storage for mass matrix. */ - SmartPointer M; + SmartPointer > M; /** * Auxiliary vector. diff --git a/deal.II/lac/include/lac/solver_selector.h b/deal.II/lac/include/lac/solver_selector.h index 3079f17f18..3c5f581fe5 100644 --- a/deal.II/lac/include/lac/solver_selector.h +++ b/deal.II/lac/include/lac/solver_selector.h @@ -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 control; + SmartPointer > control; /** * Stores the @p VectorMemory that * is needed in the constructor of * each @p Solver class. */ - SmartPointer > vector_memory; + SmartPointer,SolverSelector > vector_memory; private: /** diff --git a/deal.II/lac/include/lac/sparse_direct.h b/deal.II/lac/include/lac/sparse_direct.h index 8ad51e6e31..86be9770ae 100644 --- a/deal.II/lac/include/lac/sparse_direct.h +++ b/deal.II/lac/include/lac/sparse_direct.h @@ -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 sparsity_pattern; + SmartPointer 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 > matrix; + SmartPointer,SparseDirectMA47> matrix; /** * Number of nonzero elements in diff --git a/deal.II/lac/include/lac/sparse_matrix.h b/deal.II/lac/include/lac/sparse_matrix.h index 62fadd1b57..4759efb28c 100644 --- a/deal.II/lac/include/lac/sparse_matrix.h +++ b/deal.II/lac/include/lac/sparse_matrix.h @@ -1871,12 +1871,15 @@ class SparseMatrix : public virtual Subscriptor /** * Print the matrix to the given * stream, using the format - * (line,col) value, + * (row,column) value, * 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 - 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 cols; + SmartPointer > cols; /** * Array of values for all the @@ -2925,14 +2928,22 @@ SparseMatrix::end (const unsigned int r) template template inline -void SparseMatrix::print (STREAM &out) const +void SparseMatrix::print (STREAM &out, bool across) const { Assert (cols != 0, ExcNotInitialized()); Assert (val != 0, ExcNotInitialized()); - for (unsigned int i=0; irows; ++i) - for (unsigned int j=cols->rowstart[i]; jrowstart[i+1]; ++j) - out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl; + if (across) + { + for (unsigned int i=0; irows; ++i) + for (unsigned int j=cols->rowstart[i]; jrowstart[i+1]; ++j) + out << ' ' << i << ',' << cols->colnums[j] << ':' << val[j]; + out << std::endl; + } + else + for (unsigned int i=0; irows; ++i) + for (unsigned int j=cols->rowstart[i]; jrowstart[i+1]; ++j) + out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl; } diff --git a/deal.II/lac/include/lac/sparse_vanka.h b/deal.II/lac/include/lac/sparse_vanka.h index f91ab73356..2f9175fddc 100644 --- a/deal.II/lac/include/lac/sparse_vanka.h +++ b/deal.II/lac/include/lac/sparse_vanka.h @@ -264,7 +264,7 @@ class SparseVanka /** * Pointer to the matrix. */ - SmartPointer > matrix; + SmartPointer,SparseVanka > 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 > > inverses; + mutable std::vector,SparseVanka > > inverses; /** * Compute the inverses of all diff --git a/deal.II/lac/include/lac/sparse_vanka.templates.h b/deal.II/lac/include/lac/sparse_vanka.templates.h index a0cd767ffa..c27f44f51d 100644 --- a/deal.II/lac/include/lac/sparse_vanka.templates.h +++ b/deal.II/lac/include/lac/sparse_vanka.templates.h @@ -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::SparseVanka(const SparseMatrix &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::SparseVanka(const SparseMatrix &M, template SparseVanka::~SparseVanka() { - std::vector > >::iterator i; + typename std::vector,SparseVanka > >::iterator i; for(i=inverses.begin(); i!=inverses.end(); ++i) { FullMatrix *p = *i; diff --git a/deal.II/lac/include/lac/transpose_matrix.h b/deal.II/lac/include/lac/transpose_matrix.h index 0aaf0bf00f..6315e4571b 100644 --- a/deal.II/lac/include/lac/transpose_matrix.h +++ b/deal.II/lac/include/lac/transpose_matrix.h @@ -123,7 +123,7 @@ TransposeMatrix : public PointerMatrixBase /** * The pointer to the actual matrix. */ - SmartPointer m; + SmartPointer > m; }; @@ -132,7 +132,7 @@ TransposeMatrix : public PointerMatrixBase template TransposeMatrix::TransposeMatrix (const MATRIX* M) - : m(M, typeid(*this).name()) + : m(M) {} diff --git a/deal.II/lac/include/lac/tridiagonal_matrix.h b/deal.II/lac/include/lac/tridiagonal_matrix.h index 82c7208d46..de1eee5905 100644 --- a/deal.II/lac/include/lac/tridiagonal_matrix.h +++ b/deal.II/lac/include/lac/tridiagonal_matrix.h @@ -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 #include -#include #include #include diff --git a/deal.II/lac/include/lac/vector_memory.h b/deal.II/lac/include/lac/vector_memory.h index 85cc842c3f..166e951de5 100644 --- a/deal.II/lac/include/lac/vector_memory.h +++ b/deal.II/lac/include/lac/vector_memory.h @@ -156,7 +156,7 @@ class VectorMemory : public Subscriptor /** * The memory pool used. */ - SmartPointer > pool; + SmartPointer,Pointer> pool; /** * The pointer to the vector. */ @@ -403,7 +403,7 @@ template inline VectorMemory::Pointer::Pointer(VectorMemory& mem) : - pool(&mem), v(0) + pool(&mem, typeid(*this).name()), v(0) { v = pool->alloc(); } diff --git a/deal.II/lac/source/sparse_direct.cc b/deal.II/lac/source/sparse_direct.cc index 808bb138a1..567052469a 100644 --- a/deal.II/lac/source/sparse_direct.cc +++ b/deal.II/lac/source/sparse_direct.cc @@ -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()) {} -- 2.39.5