From 5f76e392dd9188c99d2fc6bc672af0fccee34209 Mon Sep 17 00:00:00 2001 From: bangerth Date: Fri, 12 Sep 2008 15:24:08 +0000 Subject: [PATCH] Move a few functions inline again and into the header file since otherwise one can't use GrowingVectorMemory with self-defined vector types. git-svn-id: https://svn.dealii.org/trunk@16819 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/vector_memory.h | 53 +++++++++++++++++++++++++ deal.II/lac/source/vector_memory.cc | 50 ----------------------- 2 files changed, 53 insertions(+), 50 deletions(-) diff --git a/deal.II/lac/include/lac/vector_memory.h b/deal.II/lac/include/lac/vector_memory.h index a5ad1bd49c..5f44ee8e23 100644 --- a/deal.II/lac/include/lac/vector_memory.h +++ b/deal.II/lac/include/lac/vector_memory.h @@ -351,6 +351,59 @@ class GrowingVectorMemory : public VectorMemory /* --------------------- inline functions ---------------------- */ +template +inline +GrowingVectorMemory::Pool::Pool() + : + data(0) +{} + + + +template +inline +GrowingVectorMemory::Pool::~Pool() +{ + // Nothing to do if memory was unused. + if (data == 0) return; + + // First, delete all remaining + // vectors. Actually, there should + // be none, if there is no memory + // leak + unsigned int n=0; + for (typename std::vector::iterator i=data->begin(); + i != data->end(); + ++i) + { + if (i->first == true) + ++n; + delete i->second; + } + delete data; +} + + +template +inline +void +GrowingVectorMemory::Pool::initialize(const unsigned int size) +{ + if (data == 0) + { + data = new std::vector(size); + + for (typename std::vector::iterator i= data->begin(); + i != data->end(); + ++i) + { + i->first = false; + i->second = new VECTOR; + } + } +} + + template inline GrowingVectorMemory::GrowingVectorMemory (const unsigned int initial_size, diff --git a/deal.II/lac/source/vector_memory.cc b/deal.II/lac/source/vector_memory.cc index 6c9019a378..ff1f563ed8 100644 --- a/deal.II/lac/source/vector_memory.cc +++ b/deal.II/lac/source/vector_memory.cc @@ -25,56 +25,6 @@ DEAL_II_NAMESPACE_OPEN -template -GrowingVectorMemory::Pool::Pool() - : - data(0) -{} - - - -template -GrowingVectorMemory::Pool::~Pool() -{ - // Nothing to do if memory was unused. - if (data == 0) return; - - // First, delete all remaining - // vectors. Actually, there should - // be none, if there is no memory - // leak - unsigned int n=0; - for (typename std::vector::iterator i=data->begin(); - i != data->end(); - ++i) - { - if (i->first == true) - ++n; - delete i->second; - } - delete data; -} - - -template -void -GrowingVectorMemory::Pool::initialize(const unsigned int size) -{ - if (data == 0) - { - data = new std::vector(size); - - for (typename std::vector::iterator i= data->begin(); - i != data->end(); - ++i) - { - i->first = false; - i->second = new VECTOR; - } - } -} - - template typename GrowingVectorMemory::Pool GrowingVectorMemory::pool; -- 2.39.5