Actual source code: ex17f.F90

      1: ! Demonstrates PetscGetVersionNumber(): Fortran Example

      3: program main
      4: #include <petsc/finclude/petscsys.h>
      5:       use petscsys

      7:       implicit none
      8:       PetscErrorCode                    :: ierr
      9:       PetscInt                          :: major,minor,subminor,release
     10:       character(len=PETSC_MAX_PATH_LEN) :: outputString

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

     14:       PetscCallA(PetscInitialize(ierr))
     15:       PetscCallA(PetscGetVersionNumber(major,minor,subminor,release,ierr))

     17:       if (major /= PETSC_VERSION_MAJOR) then
     18:         write(outputString,*)'Library major',major,'does not equal include',PETSC_VERSION_MAJOR
     19:         SETERRA(PETSC_COMM_SELF,PETSC_ERR_PLIB,trim(outputString))
     20:       endif

     22:       if (minor /= PETSC_VERSION_MINOR) then
     23:         write(outputString,*)'Library minor',minor,'does not equal include',PETSC_VERSION_MINOR
     24:         SETERRA(PETSC_COMM_SELF,PETSC_ERR_PLIB,trim(outputString))
     25:       endif

     27:       if (subminor /= PETSC_VERSION_SUBMINOR) then
     28:         write(outputString,*)'Library subminor',subminor,'does not equal include',PETSC_VERSION_SUBMINOR
     29:         SETERRA(PETSC_COMM_SELF,PETSC_ERR_PLIB,trim(outputString))
     30:       endif

     32:       PetscCallA(PetscFinalize(ierr))
     33: end program main

     35: !/*TEST
     36: !
     37: !   test:
     38: !
     39: !TEST*/