Question on Index Sets and VecScatters

Randall Mackie randy at
Thu Dec 13 17:32:00 CST 2007

I have a situation where I've put a model vector m(i,j,k) into a parallel
PETSc vector for use in my modeling code. However, I'm now adding a bit of code
where I want to do some calculations based on the 1D average of the model.
In other words, for each k, I want to average m(i,j), and so produce a new
model vector m_avg(k).

So, to do this, it would seem that I need to create a VecScatter that will,
for each layer, scatter all the m(i,j) into a 2D vector, then I can take
the average. It would seem that I need to create an Index Set to do this,
but I'm a bit confused as to how to go about it actually, since I've never
used Index Sets.

Can someone outline the basic steps given my description above?

Thanks, Randy

Randall Mackie
PMB# 643
2261 Market St.,
San Francisco, CA 94114-1600
Tel (415) 469-8649
Fax (415) 469-5044

California Registered Geophysicist
License No. GP 1034

More information about the petsc-users mailing list