DA question

Amit.Itagi at seagate.com Amit.Itagi at seagate.com
Tue May 6 16:04:03 CDT 2008


Barry,

You are right. The VecGetArray followed by the Blitz constructor works
fine.

Thanks

Rgds,
Amit

owner-petsc-users at mcs.anl.gov wrote on 05/06/2008 04:47:37 PM:

>
> On 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 ?
>
>     The value returned by VecGetArray() returns a simple contiguous,
> regularly
> >
> > ordered storage format that Blitz expects. I highly recommend you
> > simply
> call the VecGetArray() and then the Blitz constructor; there is
> absolutely no reason
> to use the 3d array returned by DAVecGetArray() for this.
>
>     Barry
>
> >
> >
> > Thanks
> >
> > Rgds,
> > Amit
> >
>




More information about the petsc-users mailing list