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

  9: int CreateError(int n)
 10: {
 12:   if (!n) SETERRQ(1,"Error Created");
 13:   CreateError(n-1);
 14:   return 0;
 15: }

 17: int main(int argc,char **argv)
 18: {
 20:   PetscInitialize(&argc,&argv,(char *)0,0);
 21:   PetscFPrintf(PETSC_COMM_WORLD,stdout,"Demonstrates PETSc Error Handlersn");
 22:   PetscFPrintf(PETSC_COMM_WORLD,stdout,"The error is a contrived error to test error handlingn");
 23:   PetscSynchronizedFlush(PETSC_COMM_WORLD);
 24:   CreateError(5);
 25:   PetscFinalize();
 26:   return 0;
 27: }
 28: