Subject: [Ufl] conditionals

From: "Garth N. Wells" <[email-masked]>
Date: Sat, 30 Jan 2010 10:56:12 +0000

In the UFL manual, there is a section on 'conditionals' (sec 2.11) but
I'm unsure of the what the intention is. Is the idea that they can be
used in forms? It would be really useful if I could do something like:

  un   = dot(u, n)
  cond = lt(un, 0.0)

and use 'cond' (= 0 or 1) in a form.

Garth

---

From: Anders Logg <[email-masked]>
Date: Sat, 30 Jan 2010 13:07:49 +0100

> and use 'cond' (= 0 or 1) in a form.

Yes, I think that's the idea. I also think Kristian implemented it at
some point but don't know if it works currently.

--
Anders

---

From: Kristian Oelgaard <[email-masked]>
Date: Sat, 30 Jan 2010 15:09:22 +0100 (CET)

> and use 'cond' (= 0 or 1) in a form.

As I recall it, we (you and I) thought it would be nice to have conditionals so we could use it to determine if a facet was an outflow facet or not at runtime in the generated C++ code. I think the idea was to simply translate the conditionals in a form into

if ( condition )
{
  do something
}  

blocks in the generated code.
However, due to other improvements in the UFL language we can now determine the outflow facets in a more elegant way, in my opinion, so we didn't look further into the conditionals. That being said, there might be other cases where it will still be useful.

Kristian
> Garth
>
> _______________________________________________
> 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, 30 Jan 2010 14:11:18 +0000

Kristian Oelgaard wrote:
> As I recall it, we (you and I) thought it would be nice to have
> conditionals so we could use it to determine if a facet was an outflow
> facet or not at runtime in the generated C++ code. I think the idea was
> to simply translate the conditionals in a form into
> 
> if ( condition )
> {
>  do something
> } 
> However, due to other improvements in the UFL language we can now
> determine the outflow facets in a more elegant way, in my opinion, 

The problem is that it doesn't generalise well to time-dependent
problems. I would like to a function that can return the sign of a function.

Garth

> so we
> didn't look further into the conditionals. That being said, there might
> be other cases where it will still be useful.
> 
> Kristian
>> Garth
>>

---

From: Kristian Oelgaard <[email-masked]>
Date: Sat, 30 Jan 2010 15:18:43 +0100 (CET)

> problems. I would like to a function that can return the sign of a function.

... which is one of the cases where conditionals will be useful. :) My best guess is that they will not be supported in the upcoming release of FFC, but maybe 0.9.3? You can add a blueprint to FFC, I think it should work on the UFL side?

Kristian

---

From: "Garth N. Wells" <[email-masked]>
Date: Sat, 30 Jan 2010 14:19:55 +0000

Kristian Oelgaard wrote:
> ... which is one of the cases where conditionals will be useful. :) My
> best guess is that they will not be supported in the upcoming release of
> FFC, but maybe 0.9.3? You can add a blueprint to FFC, I think it should
> work on the UFL side?
>

I'm not sure that it's working on the UFL side.

Garth