Actual source code: ex16f.F90

      1: ! Tests calling PetscOptionsSetValue() before PetscInitialize(): Fortran Example
      2: #include <petsc/finclude/petscsys.h>
      3: program main
      4:   use petscsys

      6:   implicit none
      7:   PetscErrorCode :: ierr
      8:   PetscMPIInt  ::  rank, size
      9:   character(len=80) :: outputString

     11:   ! Every PETSc routine should begin with the PetscInitialize() routine.

     13:   PetscCallA(PetscOptionsSetValue(PETSC_NULL_OPTIONS, '-no_signal_handler', 'true', ierr))
     14:   PetscCallA(PetscInitialize(ierr))

     16:   ! We can now change the communicator universe for PETSc

     18:   PetscCallMPIA(MPI_Comm_size(MPI_COMM_WORLD, size, ierr))
     19:   PetscCallMPIA(MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr))
     20:   write (outputString, *) 'Number of processors =', size, 'rank =', rank, '\n'
     21:   PetscCallA(PetscPrintf(PETSC_COMM_WORLD, outputString, ierr))
     22:   PetscCallA(PetscFinalize(ierr))
     23: end program main

     25: !/*TEST
     26: !
     27: !   test:
     28: !      requires: defined(PETSC_USE_LOG)
     29: !      nsize: 2
     30: !      args: -options_view -get_total_flops
     31: !      filter: grep -E -v "(Total flops)"
     32: !
     33: !TEST*/