[petsc-dev] DMGetMatrix --> DMGetMatrices?

Matthew Knepley knepley at gmail.com
Fri Feb 10 15:38:45 CST 2012


On Fri, Feb 10, 2012 at 3:24 PM, Dmitry Karpeev <karpeev at mcs.anl.gov> wrote:

>
>
> On Fri, Feb 10, 2012 at 12:13 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
>> On Fri, Feb 10, 2012 at 00:05, Dmitry Karpeev <karpeev at mcs.anl.gov>wrote:
>>
>>> I don't think so.  Preallocating doesn't set any values and seems to
>>> leave the matrix marked !assembled.
>>> MatDuplicate for such a matrix will fail.  Assemblying it before setting
>>> values (just to force an assembled flag)
>>> will squeeze out the extra values, won't it?  I think it would just be
>>> reasonable to allow to duplicate unassembled
>>> matrices, or, better yet, have a matrix be "assembled" by default until
>>> MatSetValues has been called.
>>> But I'm not sure whether either solution will break something else.
>>>
>>
>> Are you calling DMSetMatrixPreallocateOnly()?
>>
>
> So, as I understand, this behavior is reasonable for the use with SNES,
> since the matrix is assembled with a call to SNES(DM)ComputeJacobian.
> DMGetMatrix is also used with KSP, when  it is also expected to assemble
> the matrix.
> This seems to make the behavior of DMGetMatrix a bit schizophrenic and
> dependent on whether it is used from a SNES or a KSP.  Should we try to
> unify this instead?  One option is to assume that DMGetMatrix (or
> DMGetOperators) merely preallocates the matrix of a DM-preferred type,
> while a call to SNESDMComputeJacobian or (the  new method)
> KSPDMFormOperators, respectively, would actually compute the values and
> assemble or do the equivalent thing for MF.  In fact, one could unify this
> behavior already by treating linear problems as nonlinear.
>

It responds the same whether you use it from KSP or SNES. Are actually
running an example which has
the behavior you are talking about?

   Matt


> Dmitry.
>
> Dmitry.
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120210/0f08ccf3/attachment.html>


More information about the petsc-dev mailing list