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 @*/
PetscObjectGetType(PetscObject obj,const char * type[])23 PetscErrorCode  PetscObjectGetType(PetscObject obj, const char *type[])
24 {
25   PetscFunctionBegin;
26   PetscValidHeader(obj,1);
27   PetscValidPointer(type,2);
28   *type = obj->type_name;
29   PetscFunctionReturn(0);
30 }
31 
32 /*@C
33    PetscObjectSetType - Sets the object type of any PetscObject.
34 
35    Not Collective
36 
37    Input Parameters:
38 +  obj - any PETSc object, for example a Vec, Mat or KSP.
39          Thus must be cast with a (PetscObject), for example,
40          PetscObjectGetType((PetscObject)mat,&type);
41 -  type - the object type
42 
43    Note: This does not currently work since we need to dispatch by type.
44 
45    Level: advanced
46 
47 @*/
PetscObjectSetType(PetscObject obj,const char type[])48 PetscErrorCode  PetscObjectSetType(PetscObject obj, const char type[])
49 {
50   PetscFunctionBegin;
51   PetscValidHeader(obj,1);
52   PetscValidCharPointer(type,2);
53   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "Cannot set the type of a generic PetscObject");
54 }
55