Actual source code: petscviewersaws.h

  1: #pragma once

  3: #include <petscviewer.h>
  4: #include <SAWs.h>

  6: /* MANSEC = Viewer */

  8: PETSC_EXTERN PetscErrorCode PetscViewerSAWsOpen(MPI_Comm, PetscViewer *);
  9: PETSC_EXTERN PetscViewer    PETSC_VIEWER_SAWS_(MPI_Comm);
 10: #define PETSC_VIEWER_SAWS_WORLD PETSC_VIEWER_SAWS_(PETSC_COMM_WORLD)
 11: #define PETSC_VIEWER_SAWS_SELF  PETSC_VIEWER_SAWS_(PETSC_COMM_SELF)

 13: /*MC
 14:   PetscCallSAWs - Calls a SAWs function and then checks the resulting error code, if it is
 15:   non-zero it calls the error handler and returns from the current function with the error
 16:   code `PETSC_ERR_LIB`.

 18:   Synopsis:
 19: #include <petscviewersaws.h>
 20:   void PetscCallSAWs(func, args)

 22:   Not Collective

 24:   Input Parameters:
 25: + func - any SAWs function that returns an error code
 26: - args - the arguments to the function

 28:   Level: beginner

 30: .seealso: `PetscCall()`, `SETERRQ()`, `PetscCheck()`, `PetscAssert()`, `PetscTraceBackErrorHandler()`, `PetscCallMPI()`,
 31:           `PetscPushErrorHandler()`, `PetscError()`, `CHKMEMQ`, `CHKERRA()`,
 32:           `CHKERRMPI()`, `PetscCallBack()`, `PetscCallAbort()`, `PetscCallVoid()`, `PetscCallNull()`
 33: M*/
 34: #define PetscCallSAWs(func, args) \
 35:   do { \
 36:     int _ierr; \
 37:     PetscStackPushExternal(#func); \
 38:     _ierr = func args; \
 39:     PetscStackPop; \
 40:     PetscCheck(!_ierr, PETSC_COMM_SELF, PETSC_ERR_LIB, "Error in %s() %d", #func, _ierr); \
 41:   } while (0)