1 #pragma once 2 3 #include <petscviewer.h> 4 #include <SAWs.h> 5 PETSC_EXTERN PetscErrorCode PetscViewerSAWsOpen(MPI_Comm, PetscViewer *); 6 PETSC_EXTERN PetscViewer PETSC_VIEWER_SAWS_(MPI_Comm); 7 #define PETSC_VIEWER_SAWS_WORLD PETSC_VIEWER_SAWS_(PETSC_COMM_WORLD) 8 #define PETSC_VIEWER_SAWS_SELF PETSC_VIEWER_SAWS_(PETSC_COMM_SELF) 9 10 #define PetscCallSAWs(func, args) \ 11 do { \ 12 int _ierr; \ 13 PetscStackPushExternal(#func); \ 14 _ierr = func args; \ 15 PetscStackPop; \ 16 PetscCheck(!_ierr, PETSC_COMM_SELF, PETSC_ERR_LIB, "Error in %s() %d", #func, _ierr); \ 17 } while (0) 18