PetscOptionsStringToScalar — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# PetscOptionsStringToScalar

Converts a string to a `PetscScalar` value; when PETSc is built with complex scalars, parses an optional imaginary part

## Synopsis

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

Not Collective

## Input Parameter

- name - the string to convert

## Output Parameter

- a - the resulting `PetscScalar` value

## Note

Accepts forms such as `1.5`, `-2`, `3+4i`, `i`, or `-i`. Using an imaginary component when PETSc is built without complex scalars is an error.

## See Also

`PetscOptionsStringToInt()`, `PetscOptionsStringToReal()`, `PetscOptionsStringToBool()`, `PetscOptionsGetScalar()`

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