On Thu, Jul 23, 2009 at 8:15 AM, Jed Brown <span dir="ltr"><<a href="mailto:jed@59a2.org">jed@59a2.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Matthew Knepley wrote:<br>
> On Wed, Jul 22, 2009 at 3:57 PM, Jed Brown <<a href="mailto:jed@59a2.org">jed@59a2.org</a>> wrote:<br>
><br>
>> Matthew Knepley wrote:<br>
>>> No comments? Not even "This is complete shit!"?<br>
>> Heh, it might be overkill and, if I understand you correctly, I think it<br>
>> could be a headache.  There is a reasonable amount of code in the<br>
>> various interfaces to ensure some sequencing, but delayed evaluation is<br>
>> tough to reason about.  When I call a function, I expect strict<br>
>> evaluation, but if you somehow store that call away until it's<br>
>> dependencies are satisfied, I'm likely to see confusing behavior.<br>
>><br>
><br>
> They way we resole this in configure is to have an "execute"<br>
> function. I think this would be pretty much the behavior people<br>
> expect.<br>
<br>
</div>What would the calling sequence look like for getting a Mat from a DM?</blockquote><div><br>MatCreate()<br><in any order the setup functions, such as<br>  MatSetSizes()<br>  MatPreallocate()<br>  MatSetType()<br>
each one of these calls a private function like<br>  MatSetSizes_outoforder()<br>which registers the method and user data for later processing><br>MatSetUp() (which can be called by anyone, executes)<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Who calls execute?  Am I not allowed to call MatSetXXX() after</blockquote><div><br>Whoever calls setup. This allows the user to choose to do it, or not,<br>and its the current paradigm for most objects in PETSc.<br> </div>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
MatExecute()?  What about MatGetXXX() before MatExecute()?</blockquote><div>It will reregister that function, so you would need another SetUp()<br>call, exactly the same interface we have now.<br><br>MatGet() has exactly the same interface too, namely things might not<br>
be available.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<div class="im"><br>
> That object would not have to be seen. You would just have a<br>
><br>
>   pc.require("SetSizes", m, n);<br>
>   pc.require(...)<br>
>   pc.setup()<br>
<br>
</div>Is the Mat/PC/whatever interface or implementation calling this?</blockquote><div><br>No, wrappers as I show above. The user interface would not change.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
The config object would need to take ownership of the various arguments,<br>
including those that are not PetscObject (like preallocation arrays).</blockquote><div><br>No, the registered call would.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
The fact that someone has to explicitly call execute makes this solution<br>
look a lot like a factory, minus the type-level distinction.  With<br>
configure, the environment is fixed and once a given set of dependencies<br>
are satisfied, an immutable object can be created.  With PETSc objects,<br>
the user might insert arbitrary imperative code (including queries and<br>
setting up one object based on the state of another) during the<br>
definition of the environment.  I fear that a "set properties, then<br>
execute" model would be frusratingly restrictive.</blockquote><div><br>It is what we have now. I do not understand any of your objections.<br><br>  Matt<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<font color="#888888"><br>
Jed<br>
<br></font></blockquote></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>