petsc-3.14.5 2021-03-03
Report Typos and Errors

# PetscOptionsInsertFileYAML

Insert a YAML-formatted file in the option database

### Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscOptionsInsertFileYAML(MPI_Comm comm,const char file[],PetscBool require)

Collective

### Input Parameter

| comm | - the processes that will share the options (usually PETSC_COMM_WORLD)
| file | - name of file
| require | - if PETSC_TRUE will generate an error if the file does not exist

Only a small subset of the YAML standard is implemented. Sequences are NOT supported; aliases and the merge key "<<" are. The algorithm recursively parses the yaml file, pushing and popping prefixes and inserting key + values pairs using PetscOptionsInsertString().

PETSc will generate an error condition that stops the program if a YAML error is detected, hence the user should check that the YAML file is valid before supplying it, for instance at http://www.yamllint.com/ .

Inspired by https://stackoverflow.com/a/621451

### See Also

PetscOptionsSetValue(), PetscOptionsView(), PetscOptionsHasName(), PetscOptionsGetInt(),
PetscOptionsGetReal(), PetscOptionsGetString(), PetscOptionsGetIntArray(), PetscOptionsBool(), PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), PetscOptionsBoolGroupBegin(), PetscOptionsBoolGroup(), PetscOptionsBoolGroupEnd(), PetscOptionsFList(), PetscOptionsEList(), PetscOptionsInsertFile(), PetscOptionsInsertStringYAML()

### Level

intermediate

### Location

src/sys/yaml/yamlimpls.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages