DA question

Matthew Knepley knepley at gmail.com
Tue May 6 14:13:13 CDT 2008


On Tue, May 6, 2008 at 12:53 PM,  <Amit.Itagi at seagate.com> wrote:
>  > > One question : How compatible is PetSc with Blitz++ ? Can I declare
>  > > the
>  > > array to be returned by DAVecGetArray to be a Blitz array ?
>  >
>  >    Likely you would need to use VecGetArray() and then somehow build
>  > the Blitz
>  > array using the pointer returned and the sizes of the local part of
>  > the DA.
>  >
>  >    If you figure out how to do this then maybe we could have a
>  > DAVecGetArrayBlitz()
>  >
>  >     Barry
>  >
>
>
>  Barry,
>
>  I did some more thinking about this. If I have a standard C array (any
>  dimension) that is stored in a contiguous block of memory (with regular
>  ordering), there is a Blitz constructor that can convert it to a Blitz
>  array.
>
>  I took a look at the source of DAVecGetArray. The array generation depends
>  (in the VecGetArray3d source) on VecGetArray, and a short code that
>  allocates storage to store the pointers and to do the pointer assignments
>  to appropriate parts of VecGetArray. Looking at the assignments, it looks
>  like the 3D array returned by DAVecGetArray has the contiguous, regularly
>  ordered storage format that Blitz expects. Is this correct ?

All DA storage is just contiguous blocks of memory, like a PETSc Vec.

  Matt

>  Thanks
>
>  Rgds,
>  Amit
-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener




More information about the petsc-users mailing list