From: Ralf Hartmann Date: Tue, 27 May 2003 14:59:24 +0000 (+0000) Subject: Store a vector > rather than a vector. This change is... X-Git-Tag: v8.0.0~16502 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd5fbaa92cb2e5cf2420588a928f61a6cc1d808e;p=dealii.git 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 --- 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(); }