From 6a5c841228030f0c17000626f45b9c4374047e42 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Mon, 17 Dec 2007 20:16:08 +0000 Subject: [PATCH] make GrowingVectorMemory default git-svn-id: https://svn.dealii.org/trunk@15606 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/include/numerics/vectors.templates.h | 4 ++-- deal.II/deal.II/source/grid/grid_generator.cc | 2 +- deal.II/examples/step-20/step-20.cc | 15 +++++---------- deal.II/lac/include/lac/filtered_matrix.h | 2 +- deal.II/lac/include/lac/solver.h | 4 ++-- deal.II/lac/include/lac/solver_bicgstab.h | 2 +- deal.II/lac/include/lac/solver_cg.h | 4 ++-- deal.II/lac/include/lac/solver_gmres.h | 4 ++-- deal.II/lac/include/lac/solver_minres.h | 4 ++-- deal.II/lac/include/lac/solver_qmrs.h | 2 +- deal.II/lac/include/lac/solver_richardson.h | 4 ++-- deal.II/lac/source/solver.cc | 6 +----- deal.II/lac/source/vector_memory.inst.in | 15 ++++++++++++++- 13 files changed, 36 insertions(+), 32 deletions(-) diff --git a/deal.II/deal.II/include/numerics/vectors.templates.h b/deal.II/deal.II/include/numerics/vectors.templates.h index c5aade3845..2a1c316714 100644 --- a/deal.II/deal.II/include/numerics/vectors.templates.h +++ b/deal.II/deal.II/include/numerics/vectors.templates.h @@ -461,7 +461,7 @@ void VectorTools::project (const Mapping &mapping, // errors may accumulate for badly // conditioned matrices ReductionControl control(5*tmp.size(), 0., 1e-12, false, false); - PrimitiveVectorMemory<> memory; + GrowingVectorMemory<> memory; SolverCG<> cg(control,memory); PreconditionSSOR<> prec; @@ -1784,7 +1784,7 @@ VectorTools::project_boundary_values (const Mapping &mapping, // errors may accumulate for badly // conditioned matrices ReductionControl control(5*rhs.size(), 0., 1.e-12, false, false); - PrimitiveVectorMemory<> memory; + GrowingVectorMemory<> memory; SolverCG<> cg(control,memory); PreconditionSSOR<> prec; diff --git a/deal.II/deal.II/source/grid/grid_generator.cc b/deal.II/deal.II/source/grid/grid_generator.cc index bca963cf98..b437e0adf7 100644 --- a/deal.II/deal.II/source/grid/grid_generator.cc +++ b/deal.II/deal.II/source/grid/grid_generator.cc @@ -2293,7 +2293,7 @@ void GridGenerator::laplace_solve (const SparseMatrix &S, FilteredMatrix > PF (prec); SolverControl control (1000, 1.e-10, false, false); - PrimitiveVectorMemory > mem; + GrowingVectorMemory > mem; SolverCG > solver (control, mem); Vector f(n_dofs); diff --git a/deal.II/examples/step-20/step-20.cc b/deal.II/examples/step-20/step-20.cc index 68a274fd73..fccd4a2d4f 100644 --- a/deal.II/examples/step-20/step-20.cc +++ b/deal.II/examples/step-20/step-20.cc @@ -817,16 +817,10 @@ void MixedLaplaceProblem::assemble_system () // management in the API reference // manual). By default, the linear // solvers use a derived class - // PrimitiveVectorMemory that, + // GrowingVectorMemory that, // ever time a vector is requested, - // allocates one using new, and - // calls delete on it again once - // the solver returns it to the - // PrimitiveVectorMemory - // object. This is the appropriate - // thing to do if we do not - // anticipate that the vectors may be - // reused any time soon. + // allocates one from its internal + // pool. // // On the other hand, for the present // case, we would like to have a @@ -887,7 +881,8 @@ class InverseMatrix : public Subscriptor private: const SmartPointer matrix; - +//TODO: GrowingVectorMemory is now the default and it can be created +//where needed. Adjust documentation and implementation here mutable GrowingVectorMemory<> vector_memory; }; diff --git a/deal.II/lac/include/lac/filtered_matrix.h b/deal.II/lac/include/lac/filtered_matrix.h index 66ac47db6b..f382e8d2d0 100644 --- a/deal.II/lac/include/lac/filtered_matrix.h +++ b/deal.II/lac/include/lac/filtered_matrix.h @@ -77,7 +77,7 @@ template class Vector; * * // set up a linear solver * SolverControl control (1000, 1.e-10, false, false); - * PrimitiveVectorMemory > mem; + * GrowingVectorMemory > mem; * SolverCG > solver (control, mem); * * // set up a preconditioner object diff --git a/deal.II/lac/include/lac/solver.h b/deal.II/lac/include/lac/solver.h index f35718cc66..efc54b8f8e 100644 --- a/deal.II/lac/include/lac/solver.h +++ b/deal.II/lac/include/lac/solver.h @@ -166,7 +166,7 @@ class Solver : public Subscriptor * contrast to the other * constructor, this constructor * denotes an internal object of - * type PrimitiveVectorMemory to + * type GrowingVectorMemory to * allocate memory. * * A reference to the control @@ -192,7 +192,7 @@ class Solver : public Subscriptor * object has been given to the * constructor. */ - static PrimitiveVectorMemory static_vector_memory; + mutable GrowingVectorMemory static_vector_memory; /** * Control structure. diff --git a/deal.II/lac/include/lac/solver_bicgstab.h b/deal.II/lac/include/lac/solver_bicgstab.h index 64f29a331b..440b34d92d 100644 --- a/deal.II/lac/include/lac/solver_bicgstab.h +++ b/deal.II/lac/include/lac/solver_bicgstab.h @@ -105,7 +105,7 @@ class SolverBicgstab : public Solver /** * Constructor. Use an object of - * type PrimitiveVectorMemory as + * type GrowingVectorMemory as * a default to allocate memory. */ SolverBicgstab (SolverControl &cn, diff --git a/deal.II/lac/include/lac/solver_cg.h b/deal.II/lac/include/lac/solver_cg.h index 092126246c..fd2b11955a 100644 --- a/deal.II/lac/include/lac/solver_cg.h +++ b/deal.II/lac/include/lac/solver_cg.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -131,7 +131,7 @@ class SolverCG : public Solver /** * Constructor. Use an object of - * type PrimitiveVectorMemory as + * type GrowingVectorMemory as * a default to allocate memory. */ SolverCG (SolverControl &cn, diff --git a/deal.II/lac/include/lac/solver_gmres.h b/deal.II/lac/include/lac/solver_gmres.h index 9256bb7f08..9ffe75872a 100644 --- a/deal.II/lac/include/lac/solver_gmres.h +++ b/deal.II/lac/include/lac/solver_gmres.h @@ -231,7 +231,7 @@ class SolverGMRES : public Solver /** * Constructor. Use an object of - * type PrimitiveVectorMemory as + * type GrowingVectorMemory as * a default to allocate memory. */ SolverGMRES (SolverControl &cn, @@ -353,7 +353,7 @@ class SolverFGMRES : public Solver /** * Constructor. Use an object of - * type PrimitiveVectorMemory as + * type GrowingVectorMemory as * a default to allocate memory. */ SolverFGMRES (SolverControl &cn, diff --git a/deal.II/lac/include/lac/solver_minres.h b/deal.II/lac/include/lac/solver_minres.h index 6cd97f9ee4..b355b04ced 100644 --- a/deal.II/lac/include/lac/solver_minres.h +++ b/deal.II/lac/include/lac/solver_minres.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, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -78,7 +78,7 @@ class SolverMinRes : public Solver /** * Constructor. Use an object of - * type PrimitiveVectorMemory as + * type GrowingVectorMemory as * a default to allocate memory. */ SolverMinRes (SolverControl &cn, diff --git a/deal.II/lac/include/lac/solver_qmrs.h b/deal.II/lac/include/lac/solver_qmrs.h index 446e50e415..28b401fad0 100644 --- a/deal.II/lac/include/lac/solver_qmrs.h +++ b/deal.II/lac/include/lac/solver_qmrs.h @@ -118,7 +118,7 @@ class SolverQMRS : public Solver /** * Constructor. Use an object of - * type PrimitiveVectorMemory as + * type GrowingVectorMemory as * a default to allocate memory. */ SolverQMRS (SolverControl &cn, diff --git a/deal.II/lac/include/lac/solver_richardson.h b/deal.II/lac/include/lac/solver_richardson.h index 4c4fbf508d..13f5494329 100644 --- a/deal.II/lac/include/lac/solver_richardson.h +++ b/deal.II/lac/include/lac/solver_richardson.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, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -87,7 +87,7 @@ class SolverRichardson : public Solver /** * Constructor. Use an object of - * type PrimitiveVectorMemory as + * type GrowingVectorMemory as * a default to allocate memory. */ SolverRichardson (SolverControl &cn, diff --git a/deal.II/lac/source/solver.cc b/deal.II/lac/source/solver.cc index 28aa36305b..ceaf76a0c7 100644 --- a/deal.II/lac/source/solver.cc +++ b/deal.II/lac/source/solver.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -24,10 +24,6 @@ DEAL_II_NAMESPACE_OPEN // a few instantiations of static members. Hope that we catch all that // are required -template -PrimitiveVectorMemory -Solver::static_vector_memory; - template class Solver >; template class Solver >; diff --git a/deal.II/lac/source/vector_memory.inst.in b/deal.II/lac/source/vector_memory.inst.in index 220711a78b..406a44be09 100644 --- a/deal.II/lac/source/vector_memory.inst.in +++ b/deal.II/lac/source/vector_memory.inst.in @@ -1,5 +1,5 @@ //--------------------------------------------------------------------------- -// $Id: vector.cc 15443 2007-11-05 03:43:52Z bangerth $ +// $Id$ // Version: $Name$ // // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors @@ -25,3 +25,16 @@ for (SCALAR : REAL_SCALARS) // GrowingVectorMemory >::pool; } +for (SCALAR : COMPLEX_SCALARS) + { + template class VectorMemory >; + template class GrowingVectorMemory >; +// template GrowingVectorMemory >::Pool +// GrowingVectorMemory >::pool; + + template class VectorMemory >; + template class GrowingVectorMemory >; +// template GrowingVectorMemory >::Pool +// GrowingVectorMemory >::pool; + } + -- 2.39.5