[petsc-users] vector of struct

Barry Smith bsmith at mcs.anl.gov
Tue Mar 25 06:51:39 CDT 2014


On Mar 25, 2014, at 5:21 AM, Matthew Knepley <knepley at gmail.com> wrote:

> On Mon, Mar 24, 2014 at 3:56 PM, Dinesh Kumar <dkumar2 at vcu.edu> wrote:
> Hi,
> 
> I am trying to implement a 3-D Surface Registration code using PetSc. I
> want to create a vector of structures i.e.
> 
> struct Point {
>         double x, y, z;
> };
> 
> Then create a PetSc vector that stores array of "Points types". Can
> someone point me to the right direction.
> 
> Make a Vec with block size 3. Then you can always address it using Point pointers,
> and you can cast the output pointer to Point *.

   Here means use either VecGetArray() or DMDAVecGetArray() to access the array inside the vector.

   Barry

> 
>    Matt
>  
> regards
> --dinesh
> 
> 
> 
> -- 
> 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