[petsc-users] petsc4py getVecArray magic
Gianluca Meneghello
gianmail at gmail.com
Fri Aug 22 21:15:09 CDT 2014
Dear all,
I just discovered that
x = da.getVecArray(X)
does not return a numpy array but rather a _DMDA_Vec_array, which has (I
guess) the great advantage of allowing for a starting index which is not
zero. So x[87] makes sense even if the actual length of x is only 50.
What I would like to do is to split the _DMDA_Vec_array x into multiple
variables, e.g.
x1,x2,x3 = x[:,0:12] , x[:,12:16], x[:,16:28]
which, written in this way, returns x1,x2,x3 as numpy view() arrays
starting from zero and of length equal to the length of the global X
divided by the number of processors. The arrays x1,x2,x3 thus becomes
unaccessible when using global indices. Using local indices does not look
like a good idea because of the presence of ghost entries.
I was wondering if there is any good way to address this situation besides
not splitting x in x1,x2,x3.
Thanks for your help,
Gianluca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140822/eab6ecda/attachment.html>
More information about the petsc-users
mailing list