]> https://gitweb.dealii.org/ - dealii.git/commitdiff
PETScWrappers: don't call deprecated viewer functions. 17422/head
authorDavid Wells <drwells@email.unc.edu>
Fri, 2 Aug 2024 11:25:49 +0000 (07:25 -0400)
committerDavid Wells <drwells@email.unc.edu>
Fri, 2 Aug 2024 11:36:57 +0000 (07:36 -0400)
This was deprecated in PETSc 3.7 - since we require at least that version we can
use the new function.

source/lac/petsc_matrix_base.cc
source/lac/petsc_vector_base.cc

index fbe83127167f1e2f30e3786fafaace32bd6f390b..d4afe87756f62334258e14a41bb1d05d0e10a519 100644 (file)
@@ -726,12 +726,14 @@ namespace PETScWrappers
 
     // Set options
     PetscErrorCode ierr =
-      PetscViewerSetFormat(PETSC_VIEWER_STDOUT_(comm), format);
+      PetscViewerPushFormat(PETSC_VIEWER_STDOUT_(comm), format);
     AssertThrow(ierr == 0, ExcPETScError(ierr));
 
     // Write to screen
     ierr = MatView(matrix, PETSC_VIEWER_STDOUT_(comm));
     AssertThrow(ierr == 0, ExcPETScError(ierr));
+    ierr = PetscViewerPopFormat(PETSC_VIEWER_STDOUT_(comm));
+    AssertThrow(ierr == 0, ExcPETScError(ierr));
   }
 
   void
index 2b46418dc140042de301b751680aa7b9a36df7f9..f4feee2e0a9b7fa183063ccc36444ed2c51b1641 100644 (file)
@@ -956,12 +956,14 @@ namespace PETScWrappers
 
     // Set options
     PetscErrorCode ierr =
-      PetscViewerSetFormat(PETSC_VIEWER_STDOUT_(comm), format);
+      PetscViewerPushFormat(PETSC_VIEWER_STDOUT_(comm), format);
     AssertThrow(ierr == 0, ExcPETScError(ierr));
 
     // Write to screen
     ierr = VecView(vector, PETSC_VIEWER_STDOUT_(comm));
     AssertThrow(ierr == 0, ExcPETScError(ierr));
+    ierr = PetscViewerPopFormat(PETSC_VIEWER_STDOUT_(comm));
+    AssertThrow(ierr == 0, ExcPETScError(ierr));
   }
 
 

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.