[petsc-dev] GASM

Jed Brown jedbrown at mcs.anl.gov
Thu Mar 29 08:28:53 CDT 2012


On Thu, Mar 29, 2012 at 07:16, Dmitry Karpeev <karpeev at mcs.anl.gov> wrote:

> Here the problem isn't in needing to call PCReset() twice per se.  The
> issue is that if the user uses the same PC object in
> two different KSPs and destroys one ksp, that will cause a PCReset() and
> invalidate the pc for the other ksp -- all despite increfing the pc.
>

Yeah, this is tricky. In this case, is it acceptable to break the
dependency explicitly using

PCSetType(ksp,PCNONE); // will decrement the reference count, but not
PCReset()
KSPDestroy(&ksp);


Skipping the reset means that KSPReset() is basically always incorrect if
the user created the PC (for example). I think a top-level KSPReset()
should always reset the PC. Now maybe ksp->pc should  be withheld by
KSPDestroy() before calling KSPReset(); if the PC refct hits 0, it will be
destroyed in the subsequent PCDestroy().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120329/b47360ae/attachment.html>


More information about the petsc-dev mailing list