From: David Wells Date: Fri, 2 Aug 2024 11:25:49 +0000 (-0400) Subject: PETScWrappers: don't call deprecated viewer functions. X-Git-Tag: v9.6.0-rc2~5^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F17429%2Fhead;p=dealii.git 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. --- 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)); }