]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Patch by Fahad Alrashed: Add PETScWrappers::VectorBase::write_ascii.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 2 Jan 2013 16:54:31 +0000 (16:54 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 2 Jan 2013 16:54:31 +0000 (16:54 +0000)
git-svn-id: https://svn.dealii.org/trunk@27896 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/lac/petsc_vector_base.h
deal.II/source/lac/petsc_vector_base.cc

index 6ef974f94680a0d21d37dbe1340ffbb110ef5d55..486e97a696ccb59d37d1e24433a3f5fb16c557b2 100644 (file)
@@ -127,6 +127,12 @@ DoFHandler, in particular removal of specializations.
 <h3>Specific improvements</h3>
 
 <ol>
+<li> New: The PETScWrappers::VectorBase class now has a function
+PETScWrappers::VectorBase::write_ascii() that allows writing the
+vector's data to the default output stream.
+<br>
+(Fahad Alrashed, 2013/1/2)
+
 <li> Fixed: PETScWrappers::SparseDirectMUMPS forgot to release
 its memory upon destruction. This is now fixed.
 <br>
index eb265a8648547bbae69a82f9deda58936f0ac421..29391b7705bca90a2d88a5d64f245282b9ed4628 100644 (file)
@@ -1,7 +1,7 @@
 //---------------------------------------------------------------------------
 //    $Id$
 //
-//    Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 by the deal.II authors
+//    Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -734,6 +734,18 @@ namespace PETScWrappers
      */
     void update_ghost_values() const;
 
+
+    /**
+     * Prints the PETSc vector object values
+     * using PETSc internal vector viewer function
+     * <tt>VecView</tt>. The default format prints
+     * the vector's contents, including indices of
+     * vector elements. For other valid view formats,
+     * consult
+     * http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecView.html
+     */
+    void write_ascii (const PetscViewerFormat format = PETSC_VIEWER_DEFAULT) ;
+
     /**
      * Print to a
      * stream. @p precision denotes
index 4b80d74837c2981c49e74085d05e1907e49d9086..2decd9a7632eb507f98a03d900840c5831434bf1 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors
+//    Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -983,6 +983,22 @@ namespace PETScWrappers
 
 
 
+  void
+  VectorBase::write_ascii (const PetscViewerFormat format)
+  {
+    // First flush PETSc caches
+    compress();
+
+    // Set options
+    PetscViewerSetFormat (PETSC_VIEWER_STDOUT_WORLD,
+                         format);
+
+    // Write to screen
+    VecView (vector, PETSC_VIEWER_STDOUT_WORLD);
+  }
+
+
+
   void
   VectorBase::print (std::ostream      &out,
                      const unsigned int precision,

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.