From 7bff26933d7237bcb394ab6d089c52264037ebdc Mon Sep 17 00:00:00 2001 From: hartmann Date: Wed, 19 May 2004 09:41:01 +0000 Subject: [PATCH] New MGLevelObject & operator = (const double d) function to distinguish from the clear function which now (as in the past) calles clear on each element of the MGLevelObject class. git-svn-id: https://svn.dealii.org/trunk@9267 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/multigrid/mg_level_object.h | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 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 4b643df2d3..b721513f71 100644 --- a/deal.II/deal.II/include/multigrid/mg_level_object.h +++ b/deal.II/deal.II/include/multigrid/mg_level_object.h @@ -65,22 +65,23 @@ class MGLevelObject : public Subscriptor */ void resize (const unsigned int new_minlevel, const unsigned int new_maxlevel); + + /** + * Call operator = (s) + * on all objects stored by this + * object. This is particularly + * useful for + * e.g. Object==Vector@ + */ + MGLevelObject & operator = (const double d); /** * Call @p clear on all objects * stored by this object. This * function is only implemented * for some @p Object classes, - * most notably for vectors and - * matrices. Note that if - * Object==Vector@, - * clear() will set all entries - * to zero, while if - * Object==vector@, - * clear() deletes the elements - * of the vectors. This class - * might therefore not be useful - * for STL vectors. + * e.g. the PreconditionBlockSOR + * and similar classes. */ void clear(); @@ -163,13 +164,24 @@ MGLevelObject::resize (const unsigned int new_minlevel, } +template +MGLevelObject & +MGLevelObject::operator = (const double d) +{ + typename std::vector >::iterator v; + for (v = objects.begin(); v != objects.end(); ++v) + **v=d; + return *this; +} + + template void MGLevelObject::clear () { typename std::vector >::iterator v; for (v = objects.begin(); v != objects.end(); ++v) - **v = 0; + (*v)->clear(); } -- 2.39.5