xref: /petsc/src/sys/tutorials/ex17f.F90 (revision d52a580b706c59ca78066c1e38754e45b6b56e2b)
1! Demonstrates PetscGetVersionNumber(): Fortran Example
2#include <petsc/finclude/petscsys.h>
3program main
4  use petscsys
5
6  implicit none
7  PetscErrorCode                    :: ierr
8  PetscInt                          :: major, minor, subminor, release
9  character(len=PETSC_MAX_PATH_LEN) :: outputString
10
11  ! Every PETSc routine should begin with the PetscInitialize() routine.
12
13  PetscCallA(PetscInitialize(ierr))
14  PetscCallA(PetscGetVersionNumber(major, minor, subminor, release, ierr))
15
16  if (major /= PETSC_VERSION_MAJOR) then
17    write (outputString, *) 'Library major', major, 'does not equal include', PETSC_VERSION_MAJOR
18    SETERRA(PETSC_COMM_SELF, PETSC_ERR_PLIB, trim(outputString))
19  end if
20
21  if (minor /= PETSC_VERSION_MINOR) then
22    write (outputString, *) 'Library minor', minor, 'does not equal include', PETSC_VERSION_MINOR
23    SETERRA(PETSC_COMM_SELF, PETSC_ERR_PLIB, trim(outputString))
24  end if
25
26  if (subminor /= PETSC_VERSION_SUBMINOR) then
27    write (outputString, *) 'Library subminor', subminor, 'does not equal include', PETSC_VERSION_SUBMINOR
28    SETERRA(PETSC_COMM_SELF, PETSC_ERR_PLIB, trim(outputString))
29  end if
30
31  PetscCallA(PetscFinalize(ierr))
32end program main
33
34!/*TEST
35!
36!   test:
37!     output_file: output/empty.out
38!
39!TEST*/
40