Actual source code: pgname.c

      1: #define PETSC_DLL

     3:  #include petsc.h

      7: /*@C
      8:    PetscObjectGetName - Gets a string name associated with a PETSc object.

     10:    Not Collective

     12:    Input Parameters:
     13: +  obj - the Petsc variable
     14:          Thus must be cast with a (PetscObject), for example,
     15:          PetscObjectGetName((PetscObject)mat,&name);
     16: -  name - the name associated with obj

     18:    Level: intermediate

     20:    Concepts: object name

     22: .seealso: PetscObjectSetName()
     23: @*/
     24: PetscErrorCode PETSC_DLLEXPORT PetscObjectGetName(PetscObject obj,const char *name[])
     25: {

     29:   if (!obj) SETERRQ(PETSC_ERR_ARG_CORRUPT,"Null object");
     30:   if (!name) SETERRQ(PETSC_ERR_ARG_BADPTR,"Void location for name");
     31:   if (!obj->name) {
     32:     PetscObjectName(obj);
     33:   }
     34:   *name = obj->name;
     35:   return(0);
     36: }