From cd8bf40cf9f31092f6301f200e4d9a959b0a60b3 Mon Sep 17 00:00:00 2001 From: hartmann Date: Tue, 27 May 2003 14:59:24 +0000 Subject: [PATCH] Store a vector > rather than a vector. This change is necessary as Object might also be a SparseMatrix. The problem came up through the patch 1.94 of sparse_matrix.h git-svn-id: https://svn.dealii.org/trunk@7676 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/multigrid/mg_level_object.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/deal.II/deal.II/include/multigrid/mg_level_object.h b/deal.II/deal.II/include/multigrid/mg_level_object.h index f381bf4d73..f3ddd24d1e 100644 --- a/deal.II/deal.II/include/multigrid/mg_level_object.h +++ b/deal.II/deal.II/include/multigrid/mg_level_object.h @@ -17,6 +17,8 @@ #include +#include + /** * An array with an object for each level. The purpose of this class @@ -95,7 +97,7 @@ class MGLevelObject : public Subscriptor /** * Array of the objects to be held. */ - std::vector objects; + std::vector > objects; }; @@ -118,7 +120,7 @@ MGLevelObject::operator[] (const unsigned int i) { Assert((i>=minlevel) && (i::operator[] (const unsigned int i) const { Assert((i>=minlevel) && (i::resize (const unsigned int new_minlevel, const unsigned int new_maxlevel) { Assert (new_minlevel <= new_maxlevel, ExcInternalError()); + // note that on clear(), the + // shared_ptr class takes care of + // deleting the object it points to + // by itself objects.clear (); minlevel = new_minlevel; - objects.resize (new_maxlevel - new_minlevel + 1); + for (unsigned int i=0; i (new Object)); } @@ -149,9 +156,9 @@ template void MGLevelObject::clear () { - typename std::vector::iterator v; + typename std::vector >::iterator v; for (v = objects.begin(); v != objects.end(); ++v) - v->clear(); + (*v)->clear(); } -- 2.39.5