Alan,
I'm not sure what you are getting at but we commonly use tricks like (see
src/snes/examples/tutorials/ex19.c)
typedef struct {
PetscScalar u,v,omega,temp;
} Field;
Then in this case use a DMDAVecGetArray() to get f and x and then have nice
notation like
f[j][i].u = x[j][i].u;
f[j][i].v = x[j][i].v;
f[j][i].omega = x[j][i].omega - (x[j][i+1].v - x[j][i].v)*dhx;
f[j][i].temp = x[j][i].temp;
note that this means the values are stored interlaced in the vector.
Barry
On Aug 18, 2011, at 9:03 PM, Alan Wei wrote:
> Dear All,
> I'm trying to 'draw' a 2-D cylinder in PETSc. It simply restore the x and
> y coordinate values in two arrays. I wonder if I can use Vec in PETSc to
> implement it (i.e. defining a vec circle) so that I can call its x or y
> coordinate by circle.x or circle.y. Is this possible? also, is this a better
> way than just defining it as two arrays, i.e. x[ ] and y[ ].
>
> thanks in advance,
> Alan