From a7913bf2c0efa406bb25ff27ef6dd9bdf78e4eb6 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 2 Aug 2024 07:25:49 -0400 Subject: [PATCH] PETScWrappers: don't call deprecated viewer functions. 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 | 4 +++- source/lac/petsc_vector_base.cc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/lac/petsc_matrix_base.cc b/source/lac/petsc_matrix_base.cc index fbe8312716..d4afe87756 100644 --- a/source/lac/petsc_matrix_base.cc +++ b/source/lac/petsc_matrix_base.cc @@ -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 diff --git a/source/lac/petsc_vector_base.cc b/source/lac/petsc_vector_base.cc index 2b46418dc1..f4feee2e0a 100644 --- a/source/lac/petsc_vector_base.cc +++ b/source/lac/petsc_vector_base.cc @@ -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)); } -- 2.39.5