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