PetscOptionsStringToInt — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# PetscOptionsStringToInt

Converts a string to an integer value. Handles special cases such as “default” and “decide”

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscOptionsStringToInt(const char name[], PetscInt *a)

Not Collective

## Input Parameter

- name - the string to convert

## Output Parameter

- a - the resulting `PetscInt` value

## Note

Recognizes the special strings `PETSC_DEFAULT`, `DEFAULT`, `PETSC_DECIDE`, `DECIDE`, `PETSC_DETERMINE`, `DETERMINE`, `PETSC_UNLIMITED`, `UNLIMITED`, and `mouse` (which returns `-1`). Otherwise the value is parsed as a base-10 integer.

## See Also

`PetscOptionsStringToReal()`, `PetscOptionsStringToScalar()`, `PetscOptionsStringToBool()`, `PetscOptionsGetInt()`

## 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