On Sun, 24 Jan 2021 at 10:08, Stefano Zampini <[email protected]> wrote:
> You actually do not need a RestoreStages if you use a scratch > > Vec stages[2]; > > in TS_theta, and pass it back with TSGetStages_Theta. I understand PETSc > philosophy is that every Get should have a Restore method, but is this > really necessary for TSGetStages? > If the only purpose of TSGetStages() is to just give access to other internal PETSc objects (like KSPGetPC() for example), then there is absolutely no need for a Restore. The Get/Restore pattern is not universal, it is only used when you need to manage internal resources or state. Unless the semantics of TSGetStages() are going to change to manage extra internal stage in TS, the proper implementation is the one Stefano suggested. Add a `Vec stages[2];` in the TSTheta struct, fill it as appropriate in TSGetStages(), and return the `stages` array to the caller. Easy and clean, no API changes, no impact in third party code. -- Lisandro Dalcin ============ Senior Research Scientist Extreme Computing Research Center (ECRC) King Abdullah University of Science and Technology (KAUST) http://ecrc.kaust.edu.sa/
