[petsc-dev] DMGetMatrix --> DMGetMatrices?

Dmitry Karpeev karpeev at mcs.anl.gov
Sun Feb 12 10:32:48 CST 2012


On Sat, Feb 11, 2012 at 8:36 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> On Sat, Feb 11, 2012 at 08:32, Dmitry Karpeev <karpeev at mcs.anl.gov> wrote:
>
>> This sounds fine to me, but what's the API for doing this? You want to do
>> KSPSetDM() and PCSetDM(),
>> so that the user has to explicitly pull out the PC to set its DM?
>>
>
> The PC *always* owns both matrices anyway.
>

I think there is a rather natural API for handling DM grouping, code reuse
and dealing with the issue of single matrix per DM:
DM should support DMGetKSPDM(), DMGetPCDM() -- similar to
DMDAGetCoordinateDA() --  each of which will compute the correct matrix.
These calls can return the original DM (or PETSC_NULL) by default.  SNES
will pull out the KSP DM out to set it on the KSP, KSP will do the same for
the PC, etc. DM already has Vec x, so all of the DMs can share x and
compute their respective matrices at the same x and reuse whatever
computation is reusable.  That's up to the implementation, though.

Dmitry.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120212/2afc1504/attachment.html>


More information about the petsc-dev mailing list