Actual source code: ex1.c

  1: /*$Id: ex1.c,v 1.23 2001/03/23 23:20:59 balay Exp $*/

  3: /* 
  4:    Demonstrates PETSc error handlers.
  5:  */

 7:  #include petsc.h

 11: int CreateError(int n)
 12: {
 14:   if (!n) SETERRQ(1,"Error Created");
 15:   CreateError(n-1);
 16:   return 0;
 17: }

 21: int main(int argc,char **argv)
 22: {
 24:   PetscInitialize(&argc,&argv,(char *)0,0);
 25:   PetscFPrintf(PETSC_COMM_WORLD,stdout,"Demonstrates PETSc Error Handlers\n");
 26:   PetscFPrintf(PETSC_COMM_WORLD,stdout,"The error is a contrived error to test error handling\n");
 27:   PetscSynchronizedFlush(PETSC_COMM_WORLD);
 28:   CreateError(5);
 29:   PetscFinalize();
 30:   return 0;
 31: }
 32: