On Sun, Dec 13, 2009 at 6:41 PM, 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">On Sun, 13 Dec 2009 18:06:04 -0600, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
> I will explain the history since I am to blame for this one. I needed<br>
> coarsenHierarchy because repeated coarsening can cause degradation of<br>
> the meshes. Thus all coarse meshes must be made at once. I added the<br>
> hierarchy option, but only the coarsen branch was used.<br>
<br>
</div>I suspected something like that.  So one real difference with hierarchy<br>
is that (in principle) DMRefine can move to a different communicator.<br>
Is this flexibility used (it seems like this could be quite powerful for<br>
additive multigrid, but I'm not aware of such a thing working now)?  If<br>
so, DMRefineHierarchy and DMCoarsenHierarchy should also take an array<br>
of communicators (passing NULL would mean to use the same communicator).<br>
<div class="im"><br>
> > DMCoarsenHierarchy is implemented for Mesh, but the array is currently<br>
> > leaking (DMMGSetDM forgets a PetscFree).  Is it indeed preferred that<br>
> > the caller does not allocate the array (despite knowing how much is<br>
> > needed) but is responsible for freeing it (I ask because this is clumsy<br>
> > for a single level of refinement).  Either way, I'll document the choice<br>
> > and fix the leak.<br>
> ><br>
><br>
> Cool. I guess we could have caller allocation, but that is harder to<br>
> check for correctness.<br>
<br>
</div>The alternative (unless we want two ways to do the same thing) seems<br>
much worse:<br>
<br>
  DM *tmp;<br>
  DMRefineHierarchy(dmc,1,&tmp);<br>
  dmf = *tmp;<br>
  PetscFree(tmp);<font color="#888888"><br></font></blockquote><div><br>I am not sure why this is much worse. There are many things users are required to destroy.<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">
Jed<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>