xref: /petsc/src/sys/tests/ex47f.F90 (revision df4cd43f92eaa320656440c40edb1046daee8f75)
1! Example for PetscOptionsInsertFileYAML: Fortran Example
2
3program main
4
5#include <petsc/finclude/petscsys.h>
6      use petscsys
7
8      implicit none
9      PetscErrorCode                    :: ierr
10      character(len=PETSC_MAX_PATH_LEN) :: filename
11      PetscBool                         ::  flg
12
13      PetscCallA(PetscInitialize(ierr))
14      PetscCallA(PetscOptionsGetString(PETSC_NULL_OPTIONS,PETSC_NULL_CHARACTER,"-f",filename,flg,ierr))
15      if (flg) then
16        PetscCallA(PetscOptionsInsertFileYAML(PETSC_COMM_WORLD,PETSC_NULL_OPTIONS,filename,PETSC_TRUE,ierr))
17      end if
18
19      PetscCallA(PetscOptionsView(PETSC_NULL_OPTIONS,PETSC_VIEWER_STDOUT_WORLD,ierr))
20      PetscCallA(PetscFinalize(ierr))
21
22!/*TEST
23!
24! testset:
25!   filter: grep -E -v "(options_left)"
26!
27!   test:
28!      suffix: 1
29!      args: -f petsc.yml -options_left 0
30!      localrunfiles: petsc.yml
31!      output_file: output/ex47_1.out
32!
33!   test:
34!      suffix: 2
35!      args: -options_file_yaml petsc.yml -options_left 0
36!      localrunfiles: petsc.yml
37!      output_file: output/ex47_2.out
38!
39!TEST*/
40end program main
41