Subject: [Ufl] Patch to coefficient derivative of conditional

From: Jan Blechta <[email-masked]>
Date: Wed, 3 Oct 2012 22:55:33 +0200

Hello,
I suggest change in ForwardAD algorithm for conditional. Let us
calculate derivative of conditional this way
  op = conditional(c[0], 1, 0)*t[1] + conditional(c[0], 0, 1)*f[1]
rather than like that
  op = conditional(c[0], t[1], f[1])

I think this patch enables other ffc/ufl algorithms to see linearity of
this derivative in variation and enables compiling of this example:
  elem = FiniteElement("CG", triangle, 1)
  u  = Coefficient(elem)
  v  = TestFunction(elem)
  du = TrialFunction(elem)
  F = conditional(ge(u, 0), u*u, 0)*v*dx
  J = derivative(F, u, du)

Best regards,
Jan Blechta

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Mon, 8 Oct 2012 10:34:18 +0200

Hi Jan, looks good. Have you signed the copyright consent form?
http://fenicsproject.org/contributing/contributing_code.html

Martin

On 3 October 2012 22:55, Jan Blechta <[email-masked]> wrote:
> _______________________________________________
> Mailing list: https://launchpad.net/~ufl
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~ufl
> More help   : https://help.launchpad.net/ListHelp
>