:orphan: # PetscObjectStateSet Sets the state of any `PetscObject`, regardless of the type. ## Synopsis ``` #include "petscsys.h" PetscErrorCode PetscObjectStateSet(PetscObject obj, PetscObjectState state) ``` Logically Collective ## Input Parameters - ***obj -*** any PETSc object, for example a `Vec`, `Mat` or `KSP`. This must be cast with a (`PetscObject`), for example, `PetscObjectStateSet`((`PetscObject`)mat,state); - ***state -*** the object state ## Note This function should be used with extreme caution. There is essentially only one use for it: if the user calls `Mat`(`Vec`)GetRow(Array), which increases the state, but does not alter the data, then this routine can be used to reset the state. Such a reset must be collective. ## See Also `PetscObjectStateGet()`, `PetscObjectStateIncrease()` ## 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)