← Back to team overview

dolfin team mailing list archive

Re: Problem with Expressions in Python

 

On Fri, Oct 16, 2009 at 01:51:18PM +0200, Anders Logg wrote:
> My fault. The problem here was that I forgot to change from Function
> to Expression in the code string. But perhaps the check needs to be
> improved? The error message does not help.
>
> My next problem now is that one needs to set the geometric dimension
> at the time of construction for a C++ expression. How can I send this
> to my Expression sub class from Python?

I found a way around this:

cppcode = """\
class MyExpression : public Expression
{
public:

  MyExpression() : Expression(%d) {}

  ...

};"""

f = Expression(cppcode % mesh.geometry().dim(), V=V)

:-)

But the other problem still remains: not being able to send in a
Function as an argument to a member of MyExpression.

Attachment: signature.asc
Description: Digital signature


References