Subject: Re: [Ufl] [Branch ~ufl-core/ufl/main] Rev 967: Update repr string in set_cell and set_degree, fixes strange cache problem.

From: "Garth N. Wells" <[email-masked]>
Date: Sat, 12 Mar 2011 09:48:49 +0000

This change has broken the FFC tests.

Garth

On 11/03/11 20:28, [email-masked] wrote:
> ------------------------------------------------------------
> revno: 967
> committer: Anders Logg <[email-masked]>
> branch nick: ufl-main
> timestamp: Fri 2011-03-11 21:26:25 +0100
> message:
>   Update repr string in set_cell and set_degree, fixes strange cache problem.
> modified:
>   ChangeLog
>   ufl/finiteelement.py
> 
> 
> --
> lp:ufl
> https://code.launchpad.net/~ufl-core/ufl/main
> 
> Your team UFL Core Team is subscribed to branch lp:ufl.
> To unsubscribe from this branch go to https://code.launchpad.net/~ufl-core/ufl/main/+edit-subscription

---

From: Anders Logg <[email-masked]>
Date: Sat, 12 Mar 2011 10:58:13 +0100

Will fix.

--
Anders

On Sat, Mar 12, 2011 at 09:48:49AM +0000, Garth N. Wells wrote:
> _______________________________________________
> Mailing list: https://launchpad.net/~ufl
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~ufl
> More help   : https://help.launchpad.net/ListHelp

---

From: "Garth N. Wells" <[email-masked]>
Date: Sat, 12 Mar 2011 10:12:43 +0000

> Will fix.

I fixed one bug, but one remains.

Garth

---

From: Anders Logg <[email-masked]>
Date: Sat, 12 Mar 2011 11:16:35 +0100

> I fixed one bug, but one remains.

I know, working on it.

--
Anders

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Sat, 12 Mar 2011 11:28:15 +0100

Changing repr is incorrect, and the bugs you're finding will never end.

It is a fundamental design choice in UFL to make everything
immutable, and the repr strings can never change. This is a
critical property for lots of things to work, and it is assumed
all over the place. It cannot ever be changed.

Instead of modifying an UFL object, always create a
new one with the changes you want. This is how every
algorithm in UFL works, and this is how every future
algorithm working on UFL objects must work.

--
Martin

-- 
Martin

---

From: Anders Logg <[email-masked]>
Date: Sat, 12 Mar 2011 11:36:16 +0100

> algorithm working on UFL objects must work.

ok, good point.

The reason for these changes are the two functions set_cell and
set_degree in the finite element classes, which are used to set the
cell and degree of an element when they are unspecified ("?"). They
have been around for a long time.

--
Anders

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Sat, 12 Mar 2011 11:41:23 +0100

They should be removed. If used on an element used by an expression, subtle
incorrectness issues will appear, sometimes... Cache issues are only a
symptom here, the real problems will be wrong results with no crash.

Martin

---

From: Anders Logg <[email-masked]>
Date: Sat, 12 Mar 2011 11:44:25 +0100

On Sat, Mar 12, 2011 at 11:41:23AM +0100, Martin Sandve Alnæs wrote:
> incorrectness issues will appear, sometimes... Cache issues are only a symptom
> here, the real problems will be wrong results with no crash.

Yes I agree, no objections. The only problem is someone needs to write
a transformer that replaces the element degree/shape throughout a form
and I won't have time to dig into that just now.

--
Anders

> Martin
>
> Den 12. mars 2011 11.36 skrev "Anders Logg" <[email-masked]> f lgende:
> > On Sat, Mar 12, 2011 at 11:28:15AM +0100, Martin Sandve Aln s wrote:

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Sat, 12 Mar 2011 11:49:10 +0100

I don't have time now either, but I think it can be done easier:

Find all arguments and coefficients in form or expression.

Make new ones and make a dict mapping from old to new.

Use the existing function replace().

Martin
>> incorrectness issues will appear, sometimes... Cache issues are only a
symptom

---

From: "Garth N. Wells" <[email-masked]>
Date: Sat, 12 Mar 2011 10:54:02 +0000

I've registered this as a bug,

   https://bugs.launchpad.net/ufl/+bug/733774

The discussion will get lost on the list.

Garth

On 12/03/11 10:49, Martin Sandve Alnæs wrote:
> Den 12. mars 2011 11.44 skrev "Anders Logg" <[email-masked]
> <mailto:[email-masked]>> følgende:
>>> Den 12. mars 2011 11.36 skrev "Anders Logg" <[email-masked]
> <mailto:[email-masked]>> f lgende:

---

From: Anders Logg <[email-masked]>
Date: Sat, 12 Mar 2011 12:22:57 +0100

> Use the existing function replace().

ok, sounds good.

--
Anders

> Martin
>
> Den 12. mars 2011 11.44 skrev "Anders Logg" <[email-masked]> f lgende:
> > On Sat, Mar 12, 2011 at 11:41:23AM +0100, Martin Sandve Aln s wrote: