Date: 2025-03-29T05:58:44+00:00

Actual source code: gtype.c

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

      6: /*@
      7:   PetscObjectGetType - Gets the object type of any `PetscObject`.

      9:   Not Collective

     11:   Input Parameter:
     12: . obj - any PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example,
     13:         `PetscObjectGetType`((`PetscObject`)mat,&type);

     15:   Output Parameter:
     16: . type - the object type, for example, `MATSEQAIJ`

     18:   Level: advanced

     20: .seealso: `PetscObject`, `PetscClassId`, `PetscObjectGetClassName()`, `PetscObjectGetClassId()`
     21: @*/
     22: PetscErrorCode PetscObjectGetType(PetscObject obj, const char *type[])
     23: {
     24:   PetscFunctionBegin;
     26:   PetscAssertPointer(type, 2);
     27:   *type = obj->type_name;
     28:   PetscFunctionReturn(PETSC_SUCCESS);
     29: }