dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #07212
Re: access to solution vectors as python objects
On Mon, Apr 07, 2008 at 05:40:03PM +0100, pedro wrote:
> i am interested in accessing the solution vectors as python objects
> (e.g. numpy arrays), e.g. to impose streamfunction based vorticity
> boundary conditions in a wall, or to link solution values to python
> based output routines i had previously developed (e.g. to .msh format).
> is there a way to make this access?
The following should work if x is a Vector:
from dolfin import *
from numpy import zeros
xx = zeros((x.size(),))
x.get(xx)
We're working on adding some missing pieces to get the DOLFIN linear
algebra fully functional in Python, including interaction with NumPy.
Any suggestions for how to do this? There are some options:
1. x.get(xx), x.set(xx)
2. xx = to_array(xx)
3. xx = x.array()
4. Something else
How is this done in PyCC?
--
Anders
References