PetscObjectTypeCompare — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# 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 - a PETSc object, for example a `Vec`, `Mat` or `KSP`. It must be cast with a (`PetscObject`), for example, `PetscObjectTypeCompare`((`PetscObject`)mat);

- type_name - string containing a type name

## Output Parameter

- same - `PETSC_TRUE` if the type of `obj` and `type_name` are the same or both `NULL`, else `PETSC_FALSE`

## See Also

`PetscObject`, `VecGetType()`, `KSPGetType()`, `PCGetType()`, `SNESGetType()`, `PetscObjectBaseTypeCompare()`, `PetscObjectTypeCompareAny()`, `PetscObjectBaseTypeCompareAny()`, `PetscObjectObjectTypeCompare()`

## Level

intermediate

## Location

src/sys/objects/destroy.c

## Examples

src/ksp/ksp/tutorials/ex73.c
src/ksp/ksp/tutorials/ex75f.F90
src/ksp/ksp/tutorials/ex75.c
src/ksp/ksp/tutorials/ex79.c
src/ksp/ksp/tutorials/ex7.c
src/ksp/ksp/tutorials/ex27.c
src/ksp/ksp/tutorials/ex62.c
src/ksp/ksp/tutorials/ex77.c
src/ksp/ksp/tutorials/ex43.c
src/ksp/ksp/tutorials/ex8.c

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages