From a2a71097630321346ee7432c01ddbe84cfb35720 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 2 Jan 2013 17:03:23 +0000 Subject: [PATCH] Patch by Fahad Alrashed: Add a possibly different PETSc Viewer object to PETScWrappers::MatrixBase::write_ascii(). git-svn-id: https://svn.dealii.org/trunk@27898 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 7 ++++++- deal.II/include/deal.II/lac/petsc_matrix_base.h | 14 ++++++++------ deal.II/source/lac/petsc_matrix_base.cc | 6 +++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 2c4dd85bec..17bae09848 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -127,7 +127,12 @@ DoFHandler, in particular removal of specializations.

Specific improvements

    -
  1. New: The PETScWrappers::MPI::Vector::print function overloads the +
  2. New: The PETScWrappers::MatrixBase::write_ascii() now takes a +(defaulted) argument allowing to select the PETSc Viewer style. +
    +(Fahad Alrashed, 2013/1/2) + +
  3. New: The PETScWrappers::MPI::Vector::print() function overloads the function of same name in the base class to ensure that the output generated by a parallel vector makes sense.
    diff --git a/deal.II/include/deal.II/lac/petsc_matrix_base.h b/deal.II/include/deal.II/lac/petsc_matrix_base.h index a4bfe4d4c5..a8f137b846 100644 --- a/deal.II/include/deal.II/lac/petsc_matrix_base.h +++ b/deal.II/include/deal.II/lac/petsc_matrix_base.h @@ -1137,12 +1137,14 @@ namespace PETScWrappers is_hermitian (const double tolerance = 1.e-12); /** - * Abstract PETSc object that helps view - * in ASCII other PETSc objects. Currently - * this function simply writes non-zero - * elements of a matrix to the terminal. - */ - void write_ascii (); + * Prints the PETSc matrix object values + * using PETSc internal matrix viewer function + * MatView. The default format prints + * the non-zero matrix elements. For other valid + * view formats, consult + * http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatView.html + */ + void write_ascii (const PetscViewerFormat format = PETSC_VIEWER_DEFAULT); /** * Returns the number bytes consumed diff --git a/deal.II/source/lac/petsc_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index dca843a3cb..a49bc7cb43 100644 --- a/deal.II/source/lac/petsc_matrix_base.cc +++ b/deal.II/source/lac/petsc_matrix_base.cc @@ -595,17 +595,17 @@ namespace PETScWrappers } void - MatrixBase::write_ascii () + MatrixBase::write_ascii (const PetscViewerFormat format) { // First flush PETSc caches compress (); // Set options PetscViewerSetFormat (PETSC_VIEWER_STDOUT_WORLD, - PETSC_VIEWER_DEFAULT); + format); // Write to screen - MatView (matrix,PETSC_VIEWER_STDOUT_WORLD); + MatView (matrix, PETSC_VIEWER_STDOUT_WORLD); } -- 2.39.5