← Back to team overview

ffc team mailing list archive

Re: format: [...]

 

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


On Wed, Jan 25, 2006 at 02:12:00PM +0100, ffc@xxxxxxxxxx wrote:
> Commit from johanjan (2006-01-25 14:11 CET)
> --------------------
> 
> format:
> 
> Constants passed (and stored) by value for DOLFIN-SWIG format. Python
> seems to pass stack-allocated values which won't work with storing
> references. Perhaps a Python/SWIG fix can be found for this later.
> 
>   ffc  src/ffc/format/dolfinswig.py  1.2
> 
> _______________________________________________
> FFC-dev mailing list
> FFC-dev@xxxxxxxxxx
> http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev
> 

-- 
Anders Logg
Research Assistant Professor
Toyota Technological Institute at Chicago
http://www.tti-c.org/logg/



Follow ups

References