[petsc-dev] MatNest updates; object state

Jed Brown jed at jedbrown.org
Thu Nov 15 13:02:58 CST 2018


A user can currently get a sub-matrix of a MatNest and modify it without
it updating the MatNest's state.  This may require a manual call to
PetscObjectStateIncrease so that the PC knows that it needs to rebuild,
but this is ugly/complicated/error-prone.  Some possible options off the
top of my head:

1. Insist that the user call MatNestSetSubMats() after any modification.

2. Make MatNestRestoreSubMats and MatNest{Get,Restore}SubMatsRead so
that mutable access is controlled.

3. Add a hook to PetscObjectStateGet that can traverse child objects in
case its own state counter is stale.  This is the most automatic, but
I'm concerned about its potential complexity.


More information about the petsc-dev mailing list