Date: 2022-03-04T17:37:18+00:00

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
     10:       character(len=PETSC_MAX_PATH_LEN) :: outputString

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

     14:       call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
     15:       if (ierr /= 0) then
     16:         write(6,*)'Unable to initialize PETSc'
     17:         stop
     18:       endif

     20:       call PetscGetVersionNumber(major,minor,subminor,PETSC_NULL_INTEGER,ierr)
     21:       CHKERRA(ierr)

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

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

     33:       if (subminor /= PETSC_VERSION_SUBMINOR) then
     34:         write(outputString,*)'Library subminor',subminor,'does not equal include',PETSC_VERSION_SUBMINOR
     35:         SETERRA(PETSC_COMM_SELF,PETSC_ERR_PLIB,trim(outputString))
     36:       endif

     38:       call PetscFinalize(ierr)

     40: end program main

     42: !/*TEST
     43: !
     44: !   test:
     45: !
     46: !TEST*/