PETSc version 3.17.4
Fix/Edit manual page

PetscCheck

Check that a particular condition is true

Synopsis

#include <petscerror.h>
void PetscCheck(bool cond, MPI_Comm comm, PetscErrorCode ierr, const char *message, ...)
Collective

Input Parameters

cond - The boolean condition
comm - The communicator on which the check can be collective on
ierr - A nonzero error code, see include/petscerror.h for the complete list
message - Error message in printf format

Notes

Enabled in both optimized and debug builds.

Calls SETERRQ() if the assertion fails, so can only be called from functions returning a PetscErrorCode (or equivalent type after conversion).

See Also

PetscAssert(), SETERRQ(), PetscError(), PetscCall()

Level

beginner

Location

src/sys/error/../../../include/petscerror.h

Examples

src/vec/vec/tutorials/ex6.c.html
src/vec/vec/tutorials/ex9.c.html
src/vec/vec/tutorials/ex10.c.html
src/vec/vec/tutorials/ex19.c.html
src/vec/is/is/tutorials/ex3.c.html
src/mat/tutorials/ex1.c.html
src/mat/tutorials/ex10.c.html
src/mat/tutorials/ex11.c.html
src/mat/tutorials/ex12.c.html
src/mat/tutorials/ex15.c.html
src/mat/tutorials/ex16.c.html

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages