PetscObjectGetName — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# PetscObjectGetName

Gets a string name associated with a PETSc object.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscObjectGetName(PetscObject obj, const char *name[])

Not Collective unless `obj` has not yet been named

## Input Parameters

- obj - the PETSc variable. It must be cast with a (`PetscObject`), for example, `PetscObjectGetName`((`PetscObject`)mat,&name);

- name - the name associated with `obj`, do not free

## Note

Calls `PetscObjectName()` if a name has not yet been provided to the object.

## See Also

`PetscObjectSetName()`, `PetscObjectName()`, `PetscObject`, `PetscObjectGetId()`

## Level

intermediate

## Location

src/sys/objects/pgname.c

## Examples

src/sys/tutorials/ex6.c
src/dm/impls/plex/tutorials/ex19.c
src/snes/tutorials/ex36.c
src/dm/impls/plex/tutorials/ex8.c
src/dm/tutorials/ex10.c
src/sys/tutorials/ex7.c
src/dm/impls/plex/tutorials/ex11.c
src/dm/impls/plex/tutorials/ex17.c
src/dm/label/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex18.c

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