# PetscTypeCompare

Determines whether a PETSc object is of a particular type.

### Synopsis

    #include "petsc.h"
    int PetscTypeCompare(PetscObject obj,const char type_name[],PetscTruth *same)

Not Collective

### Input Parameters

| obj | - any PETSc object, for example a Vec, Mat or KSP. This must be cast with a (PetscObject), for example, PetscObjectDestroy((PetscObject)mat);
| type_name | - string containing a type name

### Output Parameter

same -PETSC_TRUE if they are the same, else PETSC_FALSE

### See Also

VecGetType(), KSPGetType(), PCGetType(), SNESGetType()

Level:intermediate
Location: src/sys/src/objects/destroy.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/ksp/examples/tutorials/ex7.c.html
src/ksp/examples/tutorials/ex8.c.html
src/snes/examples/tutorials/ex29.c.html