Setting options on matrices obtained from a DM

Jed Brown jed at 59A2.org
Thu Jul 23 08:15:51 CDT 2009


Matthew Knepley wrote:
> On Wed, Jul 22, 2009 at 3:57 PM, Jed Brown <jed at 59a2.org> wrote:
> 
>> Matthew Knepley wrote:
>>> No comments? Not even "This is complete shit!"?
>> Heh, it might be overkill and, if I understand you correctly, I think it
>> could be a headache.  There is a reasonable amount of code in the
>> various interfaces to ensure some sequencing, but delayed evaluation is
>> tough to reason about.  When I call a function, I expect strict
>> evaluation, but if you somehow store that call away until it's
>> dependencies are satisfied, I'm likely to see confusing behavior.
>>
> 
> They way we resole this in configure is to have an "execute"
> function. I think this would be pretty much the behavior people
> expect.

What would the calling sequence look like for getting a Mat from a DM?
Who calls execute?  Am I not allowed to call MatSetXXX() after
MatExecute()?  What about MatGetXXX() before MatExecute()?

> That object would not have to be seen. You would just have a
> 
>   pc.require("SetSizes", m, n);
>   pc.require(...)
>   pc.setup()

Is the Mat/PC/whatever interface or implementation calling this?

The config object would need to take ownership of the various arguments,
including those that are not PetscObject (like preallocation arrays).

The fact that someone has to explicitly call execute makes this solution
look a lot like a factory, minus the type-level distinction.  With
configure, the environment is fixed and once a given set of dependencies
are satisfied, an immutable object can be created.  With PETSc objects,
the user might insert arbitrary imperative code (including queries and
setting up one object based on the state of another) during the
definition of the environment.  I fear that a "set properties, then
execute" model would be frusratingly restrictive.

Jed

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20090723/94a04cd4/attachment.sig>


More information about the petsc-dev mailing list