ffc team mailing list archive
-
ffc team
-
Mailing list archive
-
Message #00493
Re: format: [...]
On Wed, Jan 25, 2006 at 08:25:56AM -0600, Anders Logg wrote:
> Will it help if we instead of passing a real& as argument to the form
> pass a reference of type Constant (which we could need to create)?
>
> The new class Constant would be very simple, just having a member
> variable of type real called value. It would have a contstructor that
> takes a real as argument, so a user could still just pass a constant
> 1.24 or so as the argument and have it automatically cast to a
> Constant. Other users can do
>
> Constant t = 0.0;
>
> and pass t as an argument to the form and have it automatically
> updated in the form when doing
>
> t += k;
>
> Then I suspect SWIG would not go in and assume pass-by-value, or does
> it?
>
> This would also make the treatment of Constant the same as for
> Function, so that everything in FFC has a direct correspondance in
> DOLFIN (Function -- Function, Constant -- Constant).
>
> /Anders
>
>
Yes, I think this definitely would help. I'm pretty sure the basic
types (double in this case) are a special case. And I agree that a
Constant would fit better in with the current coefficient system.
Johan
References