Actual source code: ex16.c

petsc-3.7.5 2017-01-01
Report Typos and Errors
  2: static char help[] = "Tests calling PetscOptionsSetValue() before PetscInitialize()\n\n";

  4: /*T
  5:    Concepts: introduction to PETSc;
  6:    Concepts: printing^in parallel
  7:    Processors: n
  8: T*/

 10: #include <petscsys.h>
 11: int main(int argc,char **argv)
 12: {
 14:   PetscMPIInt    rank,size;

 16:   /*
 17:     Every PETSc routine should begin with the PetscInitialize() routine.
 18:     argc, argv - These command line arguments are taken to extract the options
 19:                  supplied to PETSc and options supplied to MPI.
 20:     help       - When PETSc executable is invoked with the option -help,
 21:                  it prints the various options that can be applied at
 22:                  runtime.  The user can use the "help" variable place
 23:                  additional help messages in this printout.
 24:   */
 25:   PetscOptionsSetValue(NULL,"-no_signal_handler","true");
 26:   PetscInitialize(&argc,&argv,(char*)0,help);

 28:   MPI_Comm_size(PETSC_COMM_WORLD,&size);
 29:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
 30:   PetscPrintf(PETSC_COMM_WORLD,"Number of processors = %d, rank = %d\n",size,rank);

 32:   PetscFinalize();
 33:   return 0;
 34: }