1! 2! Example of getting an enum value from the options database in Fortran 3 4#include "petsc/finclude/petsc.h" 5 use petsc 6 implicit none 7 8 PetscErrorCode :: ierr 9 Character(len=99) list1(6) 10 PetscEnum :: opt = -1 11 PetscBool :: set = PETSC_FALSE 12 13 PetscCallA(PetscInitialize(ierr)) 14 list1(1) = 'a123' 15 list1(2) = 'b456' 16 list1(3) = 'c789' 17 list1(4) = 'list1' 18 list1(5) = 'prefix_' 19 list1(6) = '' 20 21 write (*, 20) list1(1) 2220 format(A99) 23 PetscCallA(PetscOptionsGetEnum(PETSC_NULL_OPTIONS, 'joe_', '-jeff', list1, opt, set, ierr)) 24 write (*, *) 'opt is ', opt 25 write (*, *) 'set is ', set 26 27 PetscCallA(PetscFinalize(ierr)) 28 end 29 30! 31!/*TEST 32! 33! build: 34! requires: defined(PETSC_USING_F2003) defined(PETSC_USING_F90FREEFORM) 35! 36! test: 37! args: -joe_jeff b456 38! 39!TEST*/ 40