Actual source code: ex47f.F90
petsc-3.12.4 2020-02-04
Report Typos and Errors

      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: !/*TEST
     28: !
     29: !   build:
     30: !      requires: yaml
     31: !
     32: !   test:
     33: !      suffix: 1
     34: !      requires: yaml
     35: !      args: -f petsc.yml -options_left 0
     36: !      filter:   egrep -v "(malloc_dump|malloc_test|saws_port_auto_select|display|check_pointer_intensity|error_output_stdout|nox)"
     37: !      localrunfiles: petsc.yml
     38: !      output_file: output/ex47_1.out
     39: !
     40: !   test:
     41: !      suffix: 2
     42: !      requires: yaml
     43: !      args: -options_file_yaml petsc.yml -options_left 0
     44: !      filter:   egrep -v "(malloc_dump|malloc_test|saws_port_auto_select|display|check_pointer_intensity|error_output_stdout|nox)"
     45: !      localrunfiles: petsc.yml
     46: !      output_file: output/ex47_2.out
     47: !
     48: !TEST*/
     49: end program main