[petsc-users] vector of struct

Matthew Knepley knepley at gmail.com
Tue Mar 25 05:21:46 CDT 2014


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 *.

   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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140325/5dbe0127/attachment.html>


More information about the petsc-users mailing list