xref: /petsc/src/sys/tutorials/ex17f.F90 (revision 3f02e49b19195914bf17f317a25cb39636853415)
1! Demonstrates PetscGetVersionNumber(): Fortran Example
2
3program main
4#include <petsc/finclude/petscsys.h>
5  use petscsys
6
7  implicit none
8  PetscErrorCode                    :: ierr
9  PetscInt                          :: major, minor, subminor, release
10  character(len=PETSC_MAX_PATH_LEN) :: outputString
11
12  ! Every PETSc routine should begin with the PetscInitialize() routine.
13
14  PetscCallA(PetscInitialize(ierr))
15  PetscCallA(PetscGetVersionNumber(major, minor, subminor, release, ierr))
16
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  end if
21
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  end if
26
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  end if
31
32  PetscCallA(PetscFinalize(ierr))
33end program main
34
35!/*TEST
36!
37!   test:
38!     output_file: output/empty.out
39!
40!TEST*/
41