xref: /petsc/src/sys/objects/gtype.c (revision 9371c9d470a9602b6d10a8bf50c9b2280a79e45a)
1 
2 /*
3      Provides utility routines for manulating any type of PETSc object.
4 */
5 #include <petsc/private/petscimpl.h> /*I   "petscsys.h"    I*/
6 
7 /*@C
8    PetscObjectGetType - Gets the object type of any PetscObject.
9 
10    Not Collective
11 
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          PetscObjectGetType((PetscObject)mat,&type);
16 
17    Output Parameter:
18 .  type - the object type
19 
20    Level: advanced
21 
22 @*/
23 PetscErrorCode PetscObjectGetType(PetscObject obj, const char *type[]) {
24   PetscFunctionBegin;
25   PetscValidHeader(obj, 1);
26   PetscValidPointer(type, 2);
27   *type = obj->type_name;
28   PetscFunctionReturn(0);
29 }
30