]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New MGLevelObject<Object> & operator = (const double d) function to distinguish from...
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 19 May 2004 09:41:01 +0000 (09:41 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 19 May 2004 09:41:01 +0000 (09:41 +0000)
git-svn-id: https://svn.dealii.org/trunk@9267 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/multigrid/mg_level_object.h

index 4b643df2d36bc084501192b4e025ecf3331d41f7..b721513f71a2afa63db60630605bef0c728564bf 100644 (file)
@@ -65,22 +65,23 @@ class MGLevelObject : public Subscriptor
                                      */
     void resize (const unsigned int new_minlevel,
                 const unsigned int new_maxlevel);
+
+                                    /**
+                                     * Call <tt>operator = (s)</tt>
+                                     * on all objects stored by this
+                                     * object.  This is particularly
+                                     * useful for
+                                     * e.g. <tt>Object==Vector@<T@></tt>
+                                     */
+    MGLevelObject<Object> & 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
-                                     * <tt>Object==Vector@<T@></tt>,
-                                     * clear() will set all entries
-                                     * to zero, while if
-                                     * <tt>Object==vector@<T@></tt>,
-                                     * 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<Object>::resize (const unsigned int new_minlevel,
 }
 
 
+template<class Object>
+MGLevelObject<Object> &
+MGLevelObject<Object>::operator = (const double d)
+{
+  typename std::vector<boost::shared_ptr<Object> >::iterator v;
+  for (v = objects.begin(); v != objects.end(); ++v)
+    **v=d;
+  return *this;
+}
+
+
 template<class Object>
 void
 MGLevelObject<Object>::clear ()
 {
   typename std::vector<boost::shared_ptr<Object> >::iterator v;
   for (v = objects.begin(); v != objects.end(); ++v)
-    **v = 0;
+    (*v)->clear();
 }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.