[petsc-users] Extracting Vec from VecNest

Jed Brown jedbrown at mcs.anl.gov
Fri Mar 1 13:25:25 CST 2013


On Wed, Feb 27, 2013 at 7:09 PM, Amneet Bhalla <mail2amneet at gmail.com>wrote:

> static const int NO_COMPS  = ...;
> Vec array_x[NO_COMPS] = {.....};
> Vec x;
> VecCreateNest(PETSC_COMM_WORLD, NO_COMPS, PETSC_NULL, array_x, &x);
>
> for(int n = 0; n < NO_COMPS; ++n)
> {
>        Vec sub_x;
> IS iset;
> ISCreateGeneral(PETSC_COMM_WORLD, 1, &n, PETSC_COPY_VALUES, &iset);
>

The IS is supposed to address those entries in the Vec, not the blocking
implied by the arguments to VecCreateNest. (Vec base does not have a
concept of such "blocks".) Did you look at the examples I pointed you to?

We discussed this already and since you are dedicated to not defining a
global space, you'll have to use VecNestGetSubVec().


>
> VecGetSubVector(x, iset, &sub_x);
>        //*ERROR: Index set not found in nested Vec!*
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130301/32c9e7b3/attachment.html>


More information about the petsc-users mailing list