1: #include <petsc/private/petscimpl.h> 3: /*@ 4: PetscObjectGetName - Gets a string name associated with a PETSc object. 6: Not Collective unless `obj` has not yet been named 8: Input Parameters: 9: + obj - the PETSc variable. It must be cast with a (`PetscObject`), for example, 10: `PetscObjectGetName`((`PetscObject`)mat,&name); 11: - name - the name associated with `obj`, do not free 13: Level: intermediate 15: Note: 16: Calls `PetscObjectName()` if a name has not yet been provided to the object. 18: .seealso: `PetscObjectSetName()`, `PetscObjectName()`, `PetscObject`, `PetscObjectGetId()` 19: @*/ 20: PetscErrorCode PetscObjectGetName(PetscObject obj, const char *name[]) 21: { 22: PetscFunctionBegin; 24: PetscAssertPointer(name, 2); 25: PetscCall(PetscObjectName(obj)); 26: *name = obj->name; 27: PetscFunctionReturn(PETSC_SUCCESS); 28: }