Actual source code: gcookie.c


  2: /*
  3:      Provides utility routines for manulating any type of PETSc object.
  4: */
  5: #include <petsc/private/petscimpl.h>

  7: /*@
  8:    PetscObjectGetClassId - Gets the classid for any PetscObject

 10:    Not Collective

 12:    Input Parameter:
 13: .  obj - any PETSc object, for example a Vec, Mat or KSP.
 14:          Thus must be cast with a (PetscObject), for example,
 15:          PetscObjectGetClassId((PetscObject)mat,&classid);

 17:    Output Parameter:
 18: .  classid - the classid

 20:    Level: developer

 22: @*/
 23: PetscErrorCode  PetscObjectGetClassId(PetscObject obj,PetscClassId *classid)
 24: {
 27:   *classid = obj->classid;
 28:   return 0;
 29: }

 31: /*@C
 32:    PetscObjectGetClassName - Gets the class name for any PetscObject

 34:    Not Collective

 36:    Input Parameter:
 37: .  obj - any PETSc object, for example a Vec, Mat or KSP.
 38:          Thus must be cast with a (PetscObject), for example,
 39:          PetscObjectGetClassName((PetscObject)mat,&classname);

 41:    Output Parameter:
 42: .  classname - the class name

 44:    Level: developer

 46: @*/
 47: PetscErrorCode  PetscObjectGetClassName(PetscObject obj, const char *classname[])
 48: {
 51:   *classname = obj->class_name;
 52:   return 0;
 53: }