Date: 2016-07-24T16:47:36+00:00

Actual source code: gtype.c
petsc-3.7.3 2016-07-24
Report Typos and Errors

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

      9: /*@C
     10:    PetscObjectGetType - Gets the object type of any PetscObject.

     12:    Not Collective

     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);

     19:    Output Parameter:
     20: .  type - the object type

     22:    Level: advanced

     24:    Concepts: object type
     25: @*/
     26: PetscErrorCode  PetscObjectGetType(PetscObject obj, const char *type[])
     27: {
     31:   *type = obj->type_name;
     32:   return(0);
     33: }

     37: /*@C
     38:    PetscObjectSetType - Sets the object type of any PetscObject.

     40:    Not Collective

     42:    Input Parameters:
     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: -  type - the object type

     48:    Note: This does not currently work since we need to dispatch by type.

     50:    Level: advanced

     52:    Concepts: object type
     53: @*/
     54: PetscErrorCode  PetscObjectSetType(PetscObject obj, const char type[])
     55: {
     59:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "Cannot set the type of a generic PetscObject");
     60: }