:orphan:
# PetscObjectTypeCompare
Determines whether a PETSc object is of a particular type.
## Synopsis
```
#include "petscsys.h"
PetscErrorCode PetscObjectTypeCompare(PetscObject obj, const char type_name[], PetscBool *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,
`PetscObjectTypeCompare`((`PetscObject`)mat);
- ***type_name -*** string containing a type name
## Output Parameter
- ***same -*** `PETSC_TRUE` if they are the same, else `PETSC_FALSE`
## See Also
`PetscObject`, `VecGetType()`, `KSPGetType()`, `PCGetType()`, `SNESGetType()`, `PetscObjectBaseTypeCompare()`, `PetscObjectTypeCompareAny()`, `PetscObjectBaseTypeCompareAny()`, `PetscObjectObjectTypeCompare()`
## Level
intermediate
## Location
src/sys/objects/destroy.c
## Examples
src/dm/impls/swarm/tutorials/ex1.c
src/ksp/ksp/tutorials/ex19.c
src/ksp/ksp/tutorials/ex27.c
src/ksp/ksp/tutorials/ex42.c
src/ksp/ksp/tutorials/ex43.c
src/ksp/ksp/tutorials/ex62.c
src/ksp/ksp/tutorials/ex7.c
src/ksp/ksp/tutorials/ex70.c
src/ksp/ksp/tutorials/ex71.c
src/ksp/ksp/tutorials/ex72.c
src/ksp/ksp/tutorials/ex73.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/destroy.c)
[Index of all Sys routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)