1 #define PETSC_DLL 2 /* 3 Provides utility routines for manulating any type of PETSc object. 4 */ 5 #include "petscsys.h" /*I "petscsys.h" I*/ 6 7 #undef __FUNCT__ 8 #define __FUNCT__ "PetscObjectGetType" 9 /*@C 10 PetscObjectGetType - Gets the object type of any PetscObject. 11 12 Not Collective 13 14 Input Parameter: 15 . obj - any PETSc object, for example a Vec, Mat or KSP. 16 Thus must be cast with a (PetscObject), for example, 17 PetscObjectGetType((PetscObject)mat,&type); 18 19 Output Parameter: 20 . type - the object type 21 22 Level: advanced 23 24 Concepts: object type 25 @*/ 26 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectGetType(PetscObject obj, const char *type[]) 27 { 28 PetscFunctionBegin; 29 PetscValidHeader(obj,1); 30 PetscValidPointer(type,2); 31 *type = obj->type_name; 32 PetscFunctionReturn(0); 33 } 34 35 #undef __FUNCT__ 36 #define __FUNCT__ "PetscObjectSetPrecision" 37 /*@C 38 PetscObjectSetPrecision - sets the precision of numerical values used within a PetscObject 39 40 Not Collective 41 42 Input Parameter: 43 + obj - any PETSc object, for example a Vec, Mat or KSP. 44 Thus must be cast with a (PetscObject), for example, 45 PetscObjectGetType((PetscObject)mat,&type); 46 - precision - currently either PETSC_PRECISION_SINGLE or PETSC_PRECISION_DOUBLE 47 48 49 Level: advanced 50 51 Concepts: object type 52 @*/ 53 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectSetType(PetscObject obj, PetscPrecision precision) 54 { 55 PetscFunctionBegin; 56 PetscValidHeader(obj,1); 57 if (obj->type_name && obj->precision != precision) SETERRQ(obj->comm,PETSC_ERR_SUP,"Cannot change precision after object type is set"); 58 obj->precision = precision; 59 PetscFunctionReturn(0); 60 } 61 62 #undef __FUNCT__ 63 #define __FUNCT__ "PetscObjectSetType" 64 /*@C 65 PetscObjectSetType - Sets the object type of any PetscObject. 66 67 Not Collective 68 69 Input Parameters: 70 + obj - any PETSc object, for example a Vec, Mat or KSP. 71 Thus must be cast with a (PetscObject), for example, 72 PetscObjectGetType((PetscObject)mat,&type); 73 - type - the object type 74 75 Note: This does not currently work since we need to dispatch by type. 76 77 Level: advanced 78 79 Concepts: object type 80 @*/ 81 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectSetType(PetscObject obj, const char type[]) 82 { 83 PetscFunctionBegin; 84 PetscValidHeader(obj,1); 85 PetscValidCharPointer(type,2); 86 SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "Cannot set the type of a generic PetscObject"); 87 } 88