When I do SOR I record the state, with the intent of checking that state in
MatResidual to see if we are good to use the cached Ux. But the state of the
vector is incremented after SOR so it can not be the same. So I moved the
increment before the call to MatSOR. Fine.
But I still have a stray increment of the state someplace. I looked through
the stack and could not find it. I am on my Mac and gdb is working like crap
today. So I do this:
//#define PetscObjectStateIncrease(obj) ((obj)->state++,0)
#define PetscObjectStateIncrease(obj)
((obj)->state++,PetscPrintf(PetscObjectComm((PetscObject)obj),"%s:PetscObjectStateIncrease=%d\n",__FUNCT__,(obj)->state))
and I see this:
MatSOR: vec.st=6 m.st=1
VecRestoreArray:PetscObjectStateIncrease=7
MatResidual_SeqAIJ: vec.st=6 == vstate=7; m.st=1 == mstate=1 ??? n=12100
The first and last lines are print statements that I added. And you can see
that VecRestoreArray is polluting my state.
So I need to change the semantics of state apparently or is this
VecRestoreArray:PetscObjectStateIncrease an error?