]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a print function for Trilinos block vector.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Jan 2010 15:57:21 +0000 (15:57 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Jan 2010 15:57:21 +0000 (15:57 +0000)
git-svn-id: https://svn.dealii.org/trunk@20362 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/trilinos_block_vector.h
deal.II/lac/source/trilinos_block_vector.cc

index be5006675d437785e2c33a953bc84403e5cfa024..0b7e7bf068596fa202d4c0957ec5b5ca569c6003 100644 (file)
@@ -361,6 +361,14 @@ namespace TrilinosWrappers
                                           */
         void swap (BlockVector &v);
 
+                                    /**
+                                     * Print to a stream.
+                                     */
+       void print (std::ostream       &out,
+                   const unsigned int  precision = 3,
+                   const bool          scientific = true,
+                   const bool          across = true) const;
+
                                          /**
                                           * Exception
                                           */
@@ -827,6 +835,14 @@ namespace TrilinosWrappers
                                           */
       void swap (BlockVector &v);
 
+                                    /**
+                                     * Print to a stream.
+                                     */
+      void print (std::ostream       &out,
+                 const unsigned int  precision = 3,
+                 const bool          scientific = true,
+                 const bool          across = true) const;
+
                                          /**
                                           * Exception
                                           */
index b4c4d038a88fad40af3049902394eacc74f27776..f353f7b4f9889e93e43811cead3bc139fcbd3420 100644 (file)
@@ -181,6 +181,23 @@ namespace TrilinosWrappers
        components[i].compress();
     }
 
+
+
+    void BlockVector::print (std::ostream       &out,
+                            const unsigned int  precision,
+                            const bool          scientific,
+                            const bool          across) const
+    {
+      for (unsigned int i=0;i<this->n_blocks();++i)
+       {
+         if (across)
+           out << 'C' << i << ':';
+         else
+           out << "Component " << i << std::endl;
+         this->components[i].print(out, precision, scientific, across);
+       }
+    }
+
   } /* end of namespace MPI */
 
 
@@ -334,6 +351,23 @@ namespace TrilinosWrappers
     return *this;
   }
 
+
+
+  void BlockVector::print (std::ostream       &out,
+                          const unsigned int  precision,
+                          const bool          scientific,
+                          const bool          across) const
+  {
+    for (unsigned int i=0;i<this->n_blocks();++i)
+      {
+       if (across)
+         out << 'C' << i << ':';
+       else
+         out << "Component " << i << std::endl;
+       this->components[i].print(out, precision, scientific, across);
+      }
+  }
+
 }
 
 

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.