[petsc-users] use of VecGetArray() with dof>1 (block size > 1)
Ed Bueler
elbueler at alaska.edu
Sat May 28 13:08:30 CDT 2016
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 <jed at jedbrown.org> wrote:
> Ed Bueler <elbueler at alaska.edu> 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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160528/ffbfec18/attachment.html>
More information about the petsc-users
mailing list