dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #17207
[Question #97842]: Extra parameters in pyDolfin Expression
New question #97842 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/97842
Is there a less hacked way to add extra parameter values to be used in an Expression in python than:
class MyExp(Expression):
def __new__(cls, *args, **kwargs):
obj = Expression.__new__(cls, **kwargs)
return obj
def __init__(self, *args):
....
....
where *args are my extra parameters (ie mesh, mesh functions etc.) and __new__ might have to be better worked if I had included my own kwargs. The above seems to work ok, but let me know of any major problems with it.
I could always use a MyExp.init(...) function after I've created an instance to set up class variables, but just curious as to whether I missed something obvious for a one line initiation.
David.
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.
Follow ups