[petsc-users] dmda and vec distribution

Gideon Simpson gideon.simpson at gmail.com
Wed Jan 1 13:37:05 CST 2014


Suppose I have a 1D dmda structure distributed across N processors, where there are some number of degrees of freedom (dof) associated with each element.  Now, suppose I want to have a vec also distributed across the N processors, but distributed "in the same way" as the dmda.  That is to say, if I call

DMDAGetCorners(da, &idx_lo, NULL, NULL, &idx_width, NULL, NULL);

idx_lo to idx_lo+ idx_width

are the same indices I'd get if I called

VecGetOwnershipRange(vec, &idx_low, &idx_hi);

Can I do this?  How?

The idea here is that I am doing monte carlo where the dmda holds all the random samples.  I then want to apply functionals to each of the samples, storing the results of each realization in a vector.  Obviously, I can just store this as part of the dmda, but it would be cleaner if I could put it right into a vec.

-gideon



More information about the petsc-users mailing list