Skip to main content
`Ctrl`+`K`

# PetscCheckAbort

Check that a particular condition is true, otherwise prints error and aborts

## Synopsis

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

Collective; No Fortran Support

## 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 the `printf()` format

## Notes

Enabled in both optimized and debug builds.

Calls `SETERRABORT()` if the assertion fails, can be called from a function that does not return an error code, such as a C++ constructor. usually `PetscCheck()` should be used.

## See Also

`PetscAssertAbort()`, `PetscAssert()`, `SETERRQ()`, `PetscError()`, `PetscCall()`, `PetscCheck()`, `SETERRABORT()`, `PetscErrorCode`

## Level

developer

## Location

include/petscerror.h

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