[petsc-dev] DMGetMatrix --> DMGetMatrices?
Dmitry Karpeev
karpeev at mcs.anl.gov
Fri Feb 10 18:37:32 CST 2012
On Fri, Feb 10, 2012 at 5:06 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> On Feb 10, 2012, at 5:00 PM, Jed Brown wrote:
>
> > On Fri, Feb 10, 2012 at 16:56, Barry Smith <bsmith at mcs.anl.gov> wrote:
> > I realize that since the DMs may often share "the grid information" and
> only be different in the stencil width or box type or something Jed (or
> maybe it is Matt) is going to get all upset that their are two DMs with
> common information sometimes. My response is "get over it" :-).
> >
> > Lots of objects share PetscLayouts, ISLocalToGlobalMappings, etc.,
> without forcing this sharing on users (or, in most cases, even exposing the
> existence of these shared objects to the user). I think DM should work the
> same way.
>
> I have no objection in principle for there being a way to construct two
> DMs that share most information, but have only stencil width difference and
> stuff like that. But I would like the result to be two first class PETSc DM
> objects that each can be independently passed around and used, I believe
> this is exactly what you are suggesting so we are in agreement.
>
> >
> > In this case, we are interpreting Vecs as being part of both spaces. I'm
> less keen on that, but it's not a deal breaker.
> >
> > What about DMDAFormJacobianLocal()? Should it have both matrices? How
> does the user manage the two DMs if they want to assemble both matrices in
> the same mesh traversal?
>
> I guess it can be changed from
>
> DMDAFormJacobianLocal(DM da, DMDALocalFunction1 func, Vec X, Mat J, void
> *ctx)
>
> to
>
> DMDAFormJacobianLocal(DM da, DM dap, DMDALocalFunction1 func, Vec X, Mat
> J, Mat B, void *ctx)
>
I disagree. The DMs don't even have to be the same type. Your own example
(modulo its trouble with the two operators acting in different spaces) is
an example. The *two* calls should be SNESDMComputeJacobian() (or
similar), which will dispatch based on the DM type and, for the DM of type
DMDA, will dispatch to DMDAFormJacobianLocal(DM da, DMDALocalFunction1
func, Vec X, Mat J, void *ctx). Although, do we really need the ctx?
There is a user context attached to each DM anyhow.
Dmitry.
>
> Barry
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120210/aaa3901c/attachment.html>
More information about the petsc-dev
mailing list