← Back to team overview

dolfin team mailing list archive

Re: python: xml read for vector / std::vector

 

Patrick!

On Wednesday August 4 2010 09:13:24 Patrick Riesen wrote:
> hello dolfin developers
> 
> I write out a std::vector in XML file format from cpp. Can I read the
> XML file in again in python and construct a numpy array?
> I know how to do it with a dolfin Vector, but is it possible with a
> std::vector<double>? I could not figure out the syntax, i tried
> 
> # this is ok
> fn = File("data/norm.xml")
> div_vec = d.Vector()
> a = n.array((11,1))
> 
> # fails
> fn >> a
> # fails
> fn >> div_vec.array()

Have you tried:

  fn >> div_vec
  a = div_vec.array()

Johan

> 
> thanks for the help,
> 
> patrick
> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References