<div dir="ltr">Jed --<div><br></div><div>> <span style="font-size:16px"> </span><span style="font-size:16px">If </span><span style="font-size:16px">you're doing something unstructured without a DM, you probably have some</span></div><div><span style="font-size:16px">>  </span><span style="font-size:16px">analogous data structure ...</span></div><div><span style="font-size:16px"><br></span></div><div><span style="font-size:16px">Quite so.</span></div><div><span style="font-size:16px"><br></span></div><div><span style="font-size:16px">> </span><span style="font-size:16px"> ... </span><span style="font-size:16px">and I would suggest making a Vec accessor in </span><span style="font-size:16px">the language of that discretization.</span></div><div><span style="font-size:16px">>  If you really think the flat array </span><span style="font-size:16px">of structs that you're getting from VecGetArray (with</span></div><div><span style="font-size:16px">> an awkward cast) </span><span style="font-size:16px">is the best interface for your unstructured discretization, I would</span></div><div><span style="font-size:16px">> </span><span style="font-size:16px">still suggest making that trivial wrapper.</span></div><div><span style="font-size:16px"><br></span></div><div><span style="font-size:16px">Sounds good.  Given that this is exactly the implementation of DMDAVecGetArray(), i.e. wrapper-with-awkward-cast, I'll do it.</span></div><div><span style="font-size:16px"><br></span></div><div><span style="font-size:16px">So I guess I finally understand the principle:  VecGetArray() is roughly-speaking intended to be wrapped, so it has a "raw" interface returning a type-specific pointer for the underlying PetscScalar array.  You were saying this all along ...</span></div><div><span style="font-size:16px"><br></span></div><div><span style="font-size:16px">Ed</span></div><div><span style="font-size:16px"><br></span></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 27, 2016 at 6:59 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Ed Bueler <<a href="mailto:elbueler@alaska.edu">elbueler@alaska.edu</a>> writes:<br>
> Jed's "more information" answer about unstructured grids is a bit vague,<br>
> but it must be the one that motivates the difference.<br>
<br>
</span>VecGetArray is most commonly used for algebraic operations that know<br>
nothing about the geometry/discretization.  DM* functions are normally<br>
used to access vectors in a discretization-aware way, such as DMDA with<br>
{k,j,i} indexing or DMPlex with indexing by topological "points".  If<br>
you're doing something unstructured without a DM, you probably have some<br>
analogous data structure and I would suggest making a Vec accessor in<br>
the language of that discretization.  If you really think the flat array<br>
of structs that you're getting from VecGetArray (with an awkward cast)<br>
is the best interface for your unstructured discretization, I would<br>
still suggest making that trivial wrapper.<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Ed Bueler<br>Dept of Math and Stat and Geophysical Institute<br>University of Alaska Fairbanks<br>Fairbanks, AK 99775-6660<br>301C Chapman and 410D Elvey<br>907 474-7693 and 907 474-7199  (fax 907 474-5394)</div>
</div>