← Back to team overview

dolfin team mailing list archive

Re: Introduce a global Time class

 

On 02/15/2013 03:41 PM, Martin Sandve Alnæs wrote:
> 
> On 15 February 2013 13:06, Johan Hake <hake.dev@xxxxxxxxx
> <mailto:hake.dev@xxxxxxxxx>> wrote:
> 
>     However, I just realized that we need to store a shared_ptr in the sub
>     classed expression for the update to propagate. Then we need to grep and
>     replace in the generated code such that the first eval become one of the
>     following:
> 
>         values[0] = sin(*t);
>         values[0] = sin(((float)*t));
> 
>     The second is more explicit and should be more robust in a more complex
>     expression.
> 
>     If you have a suggestion on how to regexp->replace all t variables in an
>     expression with something I sketched above I am all ears.
> 
> 
> There is already regexp code in place for finding all variables, right?
> So that shouldn't be hard.

Yes, but that only finds the variables. Then I thought I needed to find
the one which the user had passed a Constant for so I could substitute
it with the dereferenced shared_ptr. Me and regexp are just barely
friends. But I figured a way to get around it.

J

>     > Anyway, I think I like it. I want to introduce full ufl-to-Expression
>     > compilation officially at some point as well (already available in
>     uflacs).
>     > Then it could just be
>     >   time = Constant(0.0)
>     >   time_dep_expression = Expression(sin(time))
>     > and there would be no way to access 'time' through
>     time_dep_expression.
> 
>     Nice! I have heard uflacs will eventually replace all of FEniCS :)
> 
> 
> Exactly.
> 
> Martin



References