On Mon, Feb 27, 2012 at 10:48 AM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm getting lost with too many ways to do the same thing. The DM has only one slot for a residual function, I'm not wild about having TS overwrite that. So TS uses SNESSetFunction(), but now I need it on levels and I want coloring to work. But the coloring setup code is inside DMComputeJacobian() and I'd rather not duplicate it in SNES<div>

<br></div><div>if (snes->ops->computefunction && !snes->ops->computejacobian && snes->dm && !snes->dm->ops->function) {</div><div>  /* set up coloring using DM, but apply using snes->ops->computefunction */</div>

<div>}</div><div><br></div><div>or some such nastiness.</div><div><br></div><div>I would like to either _always_ use DM (possibly created implicitly by TS/SNES/KSP and just used to hold function pointers) or _never_ use DM.</div>

<div><br></div><div>The problem with never using DM is that we need a way for the user to decide to implement different physics on coarse levels. They currently do this by implementing DMCoarsen() or using DMCoarsenHookAdd(). If the function pointers are stored in SNES and TS, the hook would have to be able to access them somehow.</div>

<div><br></div><div>The problem with always using DM is that we effectively create a dependency loop because the user is telling DM about a nonlinear or transient problem even though that concept is not part of the DM interface.</div>
</blockquote><div><br></div><div>I don't see why this is a dependency loop.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>As a related matter, I'm stuck with a reference counting loop where I want to attach special Vecs to a DM. I can wrap them in a PetscContainer to circumvent the code that checks for reference cycles, but that makes freeing them delicate. We could make a named cache similar to DM work vectors, but where restored Vecs are not available for reuse.</div>

</blockquote></div><br>I know that rationale for having Vecs know about a DM (output), which I don't like. What is the rationale for having DMs know about a certain Vec?<div><br></div><div>    Matt<br clear="all"><div>
<br></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>
</div>