← Back to team overview

dolfin team mailing list archive

Re: New Expression syntax

 


Johan Hake wrote:
> On Friday 27 November 2009 11:53:00 Garth N. Wells wrote:
>> Johan Hake wrote:
>>> On Friday 27 November 2009 03:02:08 Anders Logg wrote:
>>>> On Fri, Nov 27, 2009 at 09:41:03AM +0000, Garth N. Wells wrote:
>>>>> Anders Logg wrote:
>>>>>> On Fri, Nov 27, 2009 at 08:37:08AM +0000, Garth N. Wells wrote:
>>>>>>> Is it still possible with the new Expression syntax to do something
>>>>>>> like:
>>>>>>>
>>>>>>>  f2, f3 = Expressions("sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])",
>>>>>>>                       "1.0 + 3.0*x[0] + 4.0*x[1] + 0.5*x[2]", V=V)
>>>>>>>
>>>>>>> The above is used in the unit tests. Or to keep things simple should
>>>>>>> we remove this kind of fancy feature?
>>>>>> I guess it's a nice feature to have but it's nothing I care that much
>>>>>> for.
>>>>> All tests except the unit test for function are working. Expression
>>>>> needs to be updated for some of the fancier syntax.
>>>>>
>>>>> Garth
>>>> I made a very simple fix in expression.py to get Expressions()
>>>> working.
>>>>
>>>> It currently createas a separate Expression class for each argument so
>>>> it will call compile_expressions() for each one, which is less
>>>> efficient than compiling a bunch of expressions at once.
>> Doesn't seem to work when I tried.
>>
>>> The whole point of using Expressions, is to avoid double compilations :)
>>>
>>>> Johan, could you have a look at this function?
>>>>
>>>> I also commented out the unit test testSameBases since I couldn't
>>>> figure out what it's supposed to do or if it is still valid after the
>>>> interface changes.
>>>>
>>>> Please have a look.
>>> Will do!
>> I had a look, but haven't committed anything yet.
> 
> Commit anything if you like. I have time to look at it this evening (night for 
> you ;))
>

I'll leave it to you because expression.py is leaving me confused,
namely why does Expression involve the metaclass ExpressionMetaClass,
but Expressions doesn't? As a result why do we want the __init__
function defined inside create_expression_class to be called for an
Expression but not the expressions in an Expressions?

There is a lot of magic going on which makes it hard to follow.

Garth

> Johan
> 
> 
>> Garth
>>
>>> Johan
>>>
>>>> --
>>>> Anders





Follow ups

References