<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 22, 2013 at 4:43 PM, Boyce Griffith <span dir="ltr"><<a href="mailto:griffith@cims.nyu.edu" target="_blank">griffith@cims.nyu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sorry for the delay. The thing that "owns" the data that the Vec represents also manages regridding and interpolation between grids. So if you had something that did time stepping, the old Vec would get the rug pulled out from under it if YourSolver(X) regridded things. (It doesn't have to be this way --- you could have different AMR grids floating around --- but this is how all of the transient solvers currently work in the code.)</blockquote>
</div><br>Okay, so in light of this, I don't want to allow dynamically sized Vecs in PETSc. I know it's complicated to have multiple AMR grids and try to difference between them while preserving linear algebraic invariants so unless there is a real code that works that way, it's just going to encourage misuse. Instead, I'd like you to make the top-level interfaces (beneath which regridding could occur) return new Vecs. (If you don't regrid, you can return the old Vec.)<br>
<br>You can also keep a reference count on your old AMR grid so that if the user holds any Vecs beyond the regridding and tries to use them for anything that cannot be done after the "rug was pulled out from under it", you'll be able to fail with a useful error message.<br>
</div></div>