Actual source code: ex2.c

  1: /*
  2:       Tests the signal handler.
  3: */
 4:  #include petscsys.h

  8: int CreateError(int n)
  9: {
 11:   PetscReal      *x = 0;
 12:   if (!n) x[0] = 100.;
 13:   CreateError(n-1);
 14:   return 0;
 15: }

 19: int main(int argc,char **argv)
 20: {
 22:   PetscInitialize(&argc,&argv,(char *)0,0);
 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);
 26:   CreateError(5);
 27:   PetscFinalize();
 28:   return 0;
 29: }
 30: