[petsc-users] Extracting Vec from VecNest

Amneet Bhalla mail2amneet at gmail.com
Wed Feb 27 18:09:28 CST 2013


I have packaged few vectors into a single Vec. I want to extract
components of this composite Vec at some time in the code. Doing things
this way is giving me an error.

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);

VecGetSubVector(x, iset, &sub_x);
       //*ERROR: Index set not found in nested Vec!*

        ISDestroy(&iset);

}

What's the proper way of extracting components?

-- 
Amneet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130227/39b3f552/attachment.html>


More information about the petsc-users mailing list