← Back to team overview

dolfin team mailing list archive

pyDolfin Function inheritance

 

Hi

I have been away from my work for a while and am now trying to get my code
working with the new dolfin including the concept of a FunctionSpace.  I am
mostly working in Python.

Consider the following python class


*class MyFunction(Function):
    def __init__(self, V, other_param):
        Function.__init__(self, V)
        self.set_other_param(other_param)

    def set_other_param(self, param):
        self._other_param = param*

*    def get_other_param(self):
        return self._other_param
*

The problem I have is that the code above (which worked up until now)
results in the following error

 File "/usr/local/lib/python2.5/site-packages/dolfin/cpp.py", line 5528, in
<lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Function, name)
  File "/usr/local/lib/python2.5/site-packages/dolfin/cpp.py", line 34, in
_swig_getattr
    raise AttributeError,name
AttributeError: set_other_param

>From what I can tell, the methods set_other_param and get_other_param are
being handled using swig and not by calling the python methods as I would
expect.

I must be overlooking something in the new implementation, so if someone
could point me in the right direction it would be much appreciated.

Thanks
Evan

Follow ups