<div dir="ltr">Here's a somewhat radical proposal: move all calls to PetscOptionsGetXXX() to XXXSetUp().<div>At the time of XXXSetUp() all of the nested objects are create or can be create, if they are not.<br><div><div>
XXXSetFromOptions() will only set a flag for XXX to look in the options database at setup time.</div><div>This should help PCFieldSplit, for example.</div><div>What is the need for having the intermediate state where the object is "set-from-options" but "not-yet-setup"?</div>
<div>So that XXXView() can report the options before the data structures are built? </div><div><br></div><div><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 22, 2013 at 5:36 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> writes:<br>
<br>
>> Indeed, but I thought we wanted to avoid this because it can lead to<br>
>> options being checked on each iteration<br>
><br>
> No, no, and no. Look in mg.c<br>
><br>
> if (!pc->setupcalled) {<br>
> for (i=0; i<n; i++) {<br>
> ierr = KSPSetFromOptions(mglevels[i]->smoothd);CHKERRQ(ierr);<br>
<br>
</div>In gamg.c:<br>
<br>
PetscBool redo_mesh_setup = (PetscBool)(!pc_gamg->reuse_prol);<br>
<br>
if (redo_mesh_setup) {<br>
/* reset everything */<br>
ierr = PCReset_MG(pc);CHKERRQ(ierr);<br>
pc->setupcalled = 0;<br>
<br>
The number of levels can change because the strength of connection and<br>
thus thresholding changes.<br>
<div class="im"><br>
> You are correct that currently there are other unprotected calls in<br>
> fieldsplit.c but I think they can be easily fixed so that the inner<br>
> SetFromOptions() is called only when setup called is zero. Having<br>
> non-nested XXXSetFromOptions() has nothing to do with things being<br>
> check every iteration stuff.<br>
<br>
</div>Fair enough, the case above is a different issue and I agree that your<br>
other points are at the very least, pragmatic.<br>
</blockquote></div><br></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Dmitry Karpeev</div><div>Mathematics and Computer Science</div><div>Argonne National Laboratory</div><div>Argonne, Illinois, USA</div>
<div>and</div><div>Computation Institute</div><div>University of Chicago</div><div>5735 S. Ellis Avenue</div><div>Chicago, IL 60637</div><div>-----------------------</div><div>Phone: 630-252-1229</div><div>Fax: 630-252-5986</div>
</div>