Actual source code: ex1.c
petsc-3.10.5 2019-03-28
2: static char help[] = "Demonstrates PETSc error handlers.\n";
4: #include <petscsys.h>
6: int CreateError(int n)
7: {
9: if (!n) SETERRQ(PETSC_COMM_SELF,1,"Error Created");
10: CreateError(n-1);
11: return 0;
12: }
14: int main(int argc,char **argv)
15: {
17: PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
18: PetscFPrintf(PETSC_COMM_WORLD,stdout,"Demonstrates PETSc Error Handlers\n");
19: PetscFPrintf(PETSC_COMM_WORLD,stdout,"The error is a contrived error to test error handling\n");
20: PetscSynchronizedFlush(PETSC_COMM_WORLD,PETSC_STDOUT);
21: CreateError(5);
22: PetscFinalize();
23: return ierr;
24: }
28: /*TEST
30: # Testing errors so only look for errors
31: test:
32: filter: Error: egrep "(PETSC ERROR)" | egrep "(Error Created|CreateError\(\)|main\(\))" | cut -f1,2,3,4,5,6 -d" "
35: TEST*/