PetscOptionsInsertFile — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# PetscOptionsInsertFile

Inserts options into the database from a file.

## Synopsis

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

Collective

## Input Parameters

- comm - the processes that will share the options (usually `PETSC_COMM_WORLD`)

- options - options database, use `NULL` for default global database

- file - name of file, “.yml” and “.yaml” filename extensions are inserted as YAML options, append “:yaml” to filename to force YAML options.

- require - if `PETSC_TRUE` will generate an error if the file does not exist

## Notes

Use # for lines that are comments and which should be ignored. Usually, instead of using this command, one should list the file name in the call to `PetscInitialize()`, this insures that certain options such as `-log_view` or `-malloc_debug` are processed properly. This routine only sets options into the options database that will be processed by later calls to `XXXSetFromOptions()`, it should not be used for options listed under PetscInitialize(). The collectivity of this routine is complex; only the MPI processes in comm will have the effect of these options. If some processes that create objects call this routine and others do not the code may fail in complicated ways because the same parallel solvers may incorrectly use different options on different ranks.

## See Also

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

## Level

developer

## Location

src/sys/objects/options.c

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages