2: static char help[] = "Tests the signal handler.\n";
4: #include <petscsys.h>
8: int CreateError(int n)
9: {
11: PetscReal *x = 0;
12: if (!n) {x[0] = 100.; return 0;}
13: CreateError(n-1);
14: return 0;
15: }
19: int main(int argc,char **argv)
20: {
22: PetscInitialize(&argc,&argv,(char*)0,help);
23: PetscFPrintf(PETSC_COMM_WORLD,stdout,"Demonstrates how PETSc can trap error interrupts\n");
24: PetscFPrintf(PETSC_COMM_WORLD,stdout,"The error below is contrived to test the code!\n");
25: PetscSynchronizedFlush(PETSC_COMM_WORLD,PETSC_STDOUT);
26: CreateError(5);
27: PetscFinalize();
28: return 0;
29: }