PetscObjectSetOptionsPrefix — PETSc 3.25.2 documentation

Skip to main content
`Ctrl`+`K`

# PetscObjectSetOptionsPrefix

Sets the prefix used for searching for all options for the given object in the database.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscObjectSetOptionsPrefix(PetscObject obj, const char prefix[])

Collective

## Input Parameters

- obj - any PETSc object, for example a `Vec`, `Mat` or `KSP`.

- prefix - the prefix string to prepend to option requests of the object.

## Note

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

## See Also

`PetscOptionsCreate()`, `PetscOptionsDestroy()`, `PetscObjectAppendOptionsPrefix()`, `PetscObjectPrependOptionsPrefix()`, `PetscObjectGetOptionsPrefix()`, `TSSetOptionsPrefix()`, `SNESSetOptionsPrefix()`, `KSPSetOptionsPrefix()`

## Level

advanced

## Location

src/sys/objects/prefix.c

## Examples

src/snes/tutorials/ex27.c
src/snes/tutorials/ex69.c
src/tao/unconstrained/tutorials/elastic_net_regularization.c
src/dm/impls/plex/tutorials/ex17.c
src/snes/tutorials/ex13.c
src/snes/tutorials/ex36.c
src/ts/tutorials/ex18.c
src/ts/tutorials/ex30.c
src/dm/impls/plex/tutorials/ex10.c
src/ts/tutorials/ex11.c

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