Hello,

I’d like to create an array of Vecs in petsc4py by calling VecDuplicateVecs but 
I can’t find the corresponding method (I’ve tried various iterations such as q 
= x.duplicateVecs(4), etc). 
Is this not implemented in petsc4py? One workaround I’ve come up with is 
something like:

q={}
for i in range(0, 3):
    q[i]=x.duplicate()

Is there another/better way? And how do I then use PETSc functions that operate 
on Vecs (e.g., VecMAXPY)? Would I just call VecAXPY in a loop as above?

Ultimately, what I really want to do is wrap my own C functions with Cython 
that take an array of Vecs as an argument and then operate on them. (The 
function needs the entire array 
of Vecs to do its thing so I can’t loop over the elements of the array.) For 
instance, I want to pass the q above to myCfunc(Vec *q, Vec *qout). How do I go 
about doing that?

Thanks very much!

Best,

Samar

Reply via email to