:orphan: # PetscObjectStateGet Gets the state of any `PetscObject`, regardless of the type. ## Synopsis ``` #include "petscsys.h" PetscErrorCode PetscObjectStateGet(PetscObject obj, PetscObjectState *state) ``` Not Collective ## Input Parameter - ***obj -*** any PETSc object, for example a `Vec`, `Mat` or `KSP`. This must be cast with a (`PetscObject`), for example, `PetscObjectStateGet`((`PetscObject`)mat,&state); ## Output Parameter - ***state -*** the object state ## Note Object state is an integer which gets increased every time the object is changed. By saving and later querying the object state one can determine whether information about the object is still current. Currently, state is maintained for `Vec` and `Mat` objects. ## See Also `PetscObjectStateIncrease()`, `PetscObjectStateSet()` ## Level advanced ## Location src/sys/objects/state.c --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/state.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)