Jed -- > If you're doing something unstructured without a DM, you probably have some > analogous data structure ...
Quite so. > ... and I would suggest making a Vec accessor in the language of that discretization. > If you really think the flat array of structs that you're getting from VecGetArray (with > an awkward cast) is the best interface for your unstructured discretization, I would > still suggest making that trivial wrapper. Sounds good. Given that this is exactly the implementation of DMDAVecGetArray(), i.e. wrapper-with-awkward-cast, I'll do it. 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 ... Ed On Fri, May 27, 2016 at 6:59 PM, Jed Brown <[email protected]> wrote: > Ed Bueler <[email protected]> writes: > > Jed's "more information" answer about unstructured grids is a bit vague, > > but it must be the one that motivates the difference. > > VecGetArray is most commonly used for algebraic operations that know > nothing about the geometry/discretization. DM* functions are normally > used to access vectors in a discretization-aware way, such as DMDA with > {k,j,i} indexing or DMPlex with indexing by topological "points". If > you're doing something unstructured without a DM, you probably have some > analogous data structure and I would suggest making a Vec accessor in > the language of that discretization. If you really think the flat array > of structs that you're getting from VecGetArray (with an awkward cast) > is the best interface for your unstructured discretization, I would > still suggest making that trivial wrapper. > -- Ed Bueler Dept of Math and Stat and Geophysical Institute University of Alaska Fairbanks Fairbanks, AK 99775-6660 301C Chapman and 410D Elvey 907 474-7693 and 907 474-7199 (fax 907 474-5394)
