xref: /petsc/src/sys/tests/ex47f.F90 (revision 030f984af8d8bb4c203755d35bded3c05b3d83ce)
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      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,PETSC_NULL_OPTIONS,filename,PETSC_TRUE,ierr)
22      end if
23
24      call  PetscOptionsView(PETSC_NULL_OPTIONS,PETSC_VIEWER_STDOUT_WORLD,ierr)
25      call  PetscFinalize(ierr)
26
27!/*TEST
28!
29! testset:
30!   filter: egrep -v "(options_left|malloc_dump|malloc_test|saws_port_auto_select|display|check_pointer_intensity|error_output_stdout|nox|vecscatter_mpi1|checkstack|use_gpu_aware_mpi)"
31!
32!   test:
33!      suffix: 1
34!      args: -f petsc.yml -options_left 0
35!      localrunfiles: petsc.yml
36!      output_file: output/ex47_1.out
37!
38!   test:
39!      suffix: 2
40!      args: -options_file_yaml petsc.yml -options_left 0
41!      localrunfiles: petsc.yml
42!      output_file: output/ex47_2.out
43!
44!TEST*/
45end program main
46