Subject: [FFC-dev] format: [...]

From: [email-masked]
Date: Wed, 25 Jan 2006 14:12:00 +0100

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

---

From: Anders Logg <[email-masked]>
Date: Wed, 25 Jan 2006 08:25:56 -0600

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, [email-masked] wrote:
> _______________________________________________
> FFC-dev mailing list
> [email-masked]
> 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/

---

From: Johan Jansson <[email-masked]>
Date: Wed, 25 Jan 2006 15:40:08 +0100

> DOLFIN (Function -- Function, Constant -- Constant).

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