Subject: [Ffc] More optimisation bugs

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 02 Feb 2010 09:15:07 +0000

I still have a problem with fractions + quadrature + optimisation. The
script I sent yesterday now works, but the below scripts leads to a FFC
error

    File
  "/usr/local/lib/python2.6/dist-packages/ffc/quadrature/sumobj.py",
  line 495, in reduce_vartype
    f, r = v.reduce_vartype(var_type)
  ValueError: too many values to unpack

when using foo/2.0 rather than 0.5*foo.

Garth

from dolfin import *

mesh = UnitSquare(3, 3)
n = FacetNormal(mesh)

PV = VectorFunctionSpace(mesh, "CG", 1)
P0 = FunctionSpace(mesh, "Discontinuous Lagrange", 0)
mixed_space = MixedFunctionSpace([PV, P0])

# Function spaces and functions
r  = TestFunction(P0)
U0 = Function(mixed_space)
u0, s0 = split(U0)

U0.vector()[:] = 1.0

F    = 1.0/(s0**2 + 1.0)

# This breaks FFC
un   = (dot(u0, n) + sqrt(dot(u0, n)*dot(u0, n)))/2.0
un_h = (dot(u0, n) - sqrt(dot(u0, n)*dot(u0, n)))/2.0

# This works
#un   = 0.5*(dot(u0, n) + sqrt(dot(u0, n)*dot(u0, n)))
#un_h = 0.5*(dot(u0, n) - sqrt(dot(u0, n)*dot(u0, n)))

L = jump(r)*(un('+')*F('+') - un('-')*F('-'))*dS

param0 = {"representation": "quadrature", "optimize": False}
param1 = {"representation": "quadrature", "optimize": True}
print "Vec norm (no opt):   ", assemble(L,
                             form_compiler_parameters=param0).norm("l2")
print "Vec norm (with opt): ", assemble(L,
                             form_compiler_parameters=param1).norm("l2")

---

From: Kristian Oelgaard <[email-masked]>
Date: Tue, 2 Feb 2010 10:25:14 +0100 (CET)

> script I sent yesterday now works, but the below scripts leads to a FFC

OK, I'll take a look now since my work on evaluate_basis is done.

Kristian

> _______________________________________________
> Mailing list: https://launchpad.net/~ffc
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~ffc
> More help   : https://help.launchpad.net/ListHelp
>

---

From: Anders Logg <[email-masked]>
Date: Tue, 2 Feb 2010 10:32:06 +0100

> OK, I'll take a look now since my work on evaluate_basis is done.

Good work btw! I'm happy I didn't have to touch it. :-)

--
Anders

---

From: Kristian Oelgaard <[email-masked]>
Date: Tue, 2 Feb 2010 17:28:11 +0100

> when using foo/2.0 rather than 0.5*foo.

Fixed, and the norms are even equal.
I think we should release and quickly.

Kristian

---

From: Anders Logg <[email-masked]>
Date: Tue, 2 Feb 2010 17:28:56 +0100

> I think we should release and quickly.

ok, one release coming up. :-)

--
Anders

---

From: Harish Narayanan <[email-masked]>
Date: Tue, 02 Feb 2010 18:03:31 +0000

> I think we should release and quickly.

Sounds like someone's release enthusiasm has rubbed off on you. :)

Harish