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: /*@C
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`.
13: Thus must be cast with a (`PetscObject`), for example,
14: `PetscObjectGetType`((`PetscObject`)mat,&type);
16: Output Parameter:
17: . type - the object type, for example, `MATSEQAIJ`
19: Level: advanced
21: .seealso: `PetscObject`, `PetscClassId`, `PetscObjectGetClassName()`, `PetscObjectGetClassId()`
22: @*/
23: PetscErrorCode PetscObjectGetType(PetscObject obj, const char *type[])
24: {
25: PetscFunctionBegin;
27: PetscAssertPointer(type, 2);
28: *type = obj->type_name;
29: PetscFunctionReturn(PETSC_SUCCESS);
30: }