]> https://gitweb.dealii.org/ - dealii.git/commitdiff
adjust OutputOperator for AnyData
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 22 May 2014 20:20:24 +0000 (20:20 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 22 May 2014 20:20:24 +0000 (20:20 +0000)
git-svn-id: https://svn.dealii.org/trunk@32967 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/algorithms/operator.h
deal.II/include/deal.II/algorithms/operator.templates.h

index 5dbe64a4b7b80a1be9755f50e60c4a74c7c7bd5f..bad83a96dd6554ab5f6b4cbdc58e0d734b8cac23 100644 (file)
@@ -208,7 +208,7 @@ namespace Algorithms
     /**
      * @deprecated Output all the vectors in NamedData.
      */
-    virtual OutputOperator<VECTOR> &operator<< (const NamedData<VECTOR *> &vectors);
+    OutputOperator<VECTOR> &operator<< (const NamedData<VECTOR *> &vectors);
   protected:
     unsigned int step;
   private:
index eed6e1a984cf6c91a3701919fcb11c48b4e9ec70..0a941933ed22c6ea269fce644094113b8c863c4c 100644 (file)
@@ -128,29 +128,27 @@ namespace Algorithms
   {
     if (os == 0)
       {
-        //TODO: make this possible
-        //deallog << ' ' << step;
-        //for (unsigned int i=0;i<vectors.size();++i)
-        //  vectors(i)->print(deallog);
-        //deallog << std::endl;
+        deallog << "Step " << step << std::endl;
+        for (unsigned int i=0; i<vectors.size(); ++i)
+         {
+           const VECTOR* v = vectors.try_read_ptr<VECTOR>(i);
+           if (v == 0) continue;
+           for (unsigned int j=0; j<v->size(); ++j)
+             (*os) << ' ' << (*v)(j);
+           deallog << std::endl;
+         }
+        deallog << std::endl;
       }
     else
       {
         (*os) << ' ' << step;
         for (unsigned int i=0; i<vectors.size(); ++i)
          {
-           if (vectors.is_type<VECTOR*>(i))
-             {
-               const VECTOR& v = *vectors.entry<VECTOR*>(i);
-               for (unsigned int j=0; j<v.size(); ++j)
-                 (*os) << ' ' << v(j);
-             }
-           else if (vectors.is_type<const VECTOR*>(i))
-             {
-               const VECTOR& v = *vectors.entry<const VECTOR*>(i);
-               for (unsigned int j=0; j<v.size(); ++j)
-                 (*os) << ' ' << v(j);
-             }
+           const VECTOR* v = vectors.try_read_ptr<VECTOR>(i);
+           if (v == 0) continue;
+           for (unsigned int j=0; j<v->size(); ++j)
+             (*os) << ' ' << (*v)(j);
+           (*os) << std::endl;
          }
         (*os) << std::endl;
       }
@@ -162,22 +160,8 @@ namespace Algorithms
   OutputOperator<VECTOR> &
   OutputOperator<VECTOR>::operator<< (const NamedData<VECTOR *> &vectors)
   {
-    if (os == 0)
-      {
-        //TODO: make this possible
-        //deallog << ' ' << step;
-        //for (unsigned int i=0;i<vectors.size();++i)
-        //  vectors(i)->print(deallog);
-        //deallog << std::endl;
-      }
-    else
-      {
-        (*os) << ' ' << step;
-        for (unsigned int i=0; i<vectors.size(); ++i)
-          for (unsigned int j=0; j<vectors(i)->size(); ++j)
-            (*os) << ' ' << (*vectors(i))(j);
-        (*os) << std::endl;
-      }
+    const AnyData newdata = vectors;
+    (*this) << newdata;
     return *this;
   }
 }

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.