[petsc-users] petsc4py getVecArray magic
Lisandro Dalcin
dalcinl at gmail.com
Sun Aug 24 04:02:33 CDT 2014
On 23 August 2014 05:15, Gianluca Meneghello <gianmail at gmail.com> wrote:
> 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.
>
Sorry, but I'm not following you.
--
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Numerical Porous Media Center (NumPor)
King Abdullah University of Science and Technology (KAUST)
http://numpor.kaust.edu.sa/
4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 4332
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa
Office Phone: +966 12 808-0459
More information about the petsc-users
mailing list