Actual source code: ex47f.F90

petsc-3.15.0 2021-03-30
Report Typos and Errors
  1: ! Example for PetscOptionsInsertFileYAML: Fortran Example

  3: program main

  5: #include <petsc/finclude/petscsys.h>
  6:       use petscsys

  8:       implicit none
  9:       PetscErrorCode                    :: ierr
 10:       character(len=PETSC_MAX_PATH_LEN) :: 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

 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

 24:       call  PetscOptionsView(PETSC_NULL_OPTIONS,PETSC_VIEWER_STDOUT_WORLD,ierr)
 25:       call  PetscFinalize(ierr)

 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|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*/
 45: end program main