← Back to team overview

dolfin team mailing list archive

Re: No data.x in overloaded Expression.eval_data

 

Johan Hake wrote:
On Wednesday 16 December 2009 09:28:21 David Beacham wrote:
Hi,

I'm not sure if it's my relative inexperience with python, but I can't
find the coordinates x in data, when overloading eval_data in
Expression. I'm guessing from doxygen/pydoc that they should be available?

Have you tried:

  x = data.x()

No, I don't seem to have the Data.x() method either:

(Pdb) p data.x()
*** AttributeError: AttributeError("'Data' object has no attribute 'x'",)

although everything else from the cpp side is showing up and is useable:

(Pdb) p dir(data)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__swig_destroy__', '__weakref__', 'cell', 'clear', 'facet', 'geometric_dimension', 'normal', 'on_facet', 'set', 'this', 'thisown', 'ufc_cell']

FWIW, I can get Data.x to work in cpp.

We needed to make the x attribute a method returning the x array in Python.

Johan

David

_______________________________________________
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