Actual source code: ex95f90.F90
1: program ex95f90
2: #include "petsc/finclude/petsc.h"
3: use petsc
4: implicit none
5: #include "exodusII.inc"
7: ! Get the Fortran kind associated with PetscInt and PetscReal so that we can use literal constants.
8: PetscInt :: dummyPetscInt
9: PetscReal :: dummyPetscreal
10: PetscBool :: flg
11: integer, parameter :: kPI = kind(dummyPetscInt)
12: integer, parameter :: kPR = kind(dummyPetscReal)
13: integer :: nNodalVar = 4
14: integer :: nZonalVar = 3
15: integer :: i
17: PetscErrorCode :: ierr
18: type(tDM) :: dm, pdm
19: character(len=PETSC_MAX_PATH_LEN) :: ifilename, ofilename, IOBuffer
20: PetscInt :: order = 1
21: type(tPetscViewer) :: viewer
22: character(len=MXNAME), dimension(4) :: nodalVarName = ["U_x ", &
23: "U_y ", &
24: "Alpha", &
25: "Beta "]
26: character(len=MXNAME), dimension(3) :: zonalVarName = ["Sigma_11", &
27: "Sigma_12", &
28: "Sigma_22"]
29: character(len=MXNAME) :: varName
31: PetscCallA(PetscInitialize(PETSC_NULL_CHARACTER, ierr))
32: if (ierr /= 0) then
33: print *, 'Unable to initialize PETSc'
34: stop
35: end if
37: PetscCallA(PetscOptionsBegin(PETSC_COMM_WORLD, PETSC_NULL_CHARACTER, 'PetscViewer_ExodusII test', 'ex95f90', ierr))
38: PetscCallA(PetscOptionsString("-i", "Filename to read", "ex95f90", ifilename, ifilename, flg, ierr))
39: PetscCheckA(flg, PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, 'missing input file name -i ')
40: PetscCallA(PetscOptionsString("-o", "Filename to write", "ex95f90", ofilename, ofilename, flg, ierr))
41: PetscCheckA(flg, PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, 'missing output file name -o