Actual source code: ex47f.F90
petsc-3.11.3 2019-06-26
1: ! Example for PetscOptionsInsertFileYAML: Fortran Example
3: program main
5: #include <petsc/finclude/petscsys.h>
6: use petscsys
7:
8: implicit none
9: PetscErrorCode :: ierr
10: character(len=256) :: filename
11: PetscBool :: flg
13: call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
14: if (ierr /= 0) then
15: write(6,*)'Unable to initialize PETSc'
16: stop
17: endif
18:
19: call PetscOptionsGetString(PETSC_NULL_OPTIONS,PETSC_NULL_CHARACTER,"-f",filename,flg,ierr)
20: if (flg) then
21: call PetscOptionsInsertFileYAML(PETSC_COMM_WORLD,filename,PETSC_TRUE,ierr)
22: end if
24: call PetscOptionsView(PETSC_NULL_OPTIONS,PETSC_VIEWER_STDOUT_WORLD,ierr)
25: call PetscFinalize(ierr)
26:
27: ! build:
28: ! requires: yaml
30: ! test:
31: ! suffix: 1
32: ! requires: yaml args: -f petsc.yml
33: ! filter: grep -v saws_port_auto_select |grep -v malloc_dump | grep -v display
34: ! localrunfiles: petsc.yml
36: ! test:
37: ! suffix: 2
38: ! requires: yaml
39: ! filter: grep -v saws_port_auto_select
40: ! args: -options_file_yaml petsc.yml |grep -v malloc_dump | grep -v display
41: ! localrunfiles: petsc.yml
42:
43: end program main