Subject: [FFC-dev] mixed elements broken

From: "Garth N. Wells" <[email-masked]>
Date: Thu, 02 Aug 2007 16:44:17 +0200

Mixed elements with more than two fields appear to be broken.

   C = FiniteElement("Lagrange", "triangle", 1)
   U = FiniteElement("Lagrange", "triangle", 1)
   E = FiniteElement("Lagrange", "triangle", 1)
   element = U + C + E

   (v0, v1, v2) = TestFunctions(element)

gives the error

   Traceback (most recent call last):
     File "/usr/bin/ffc", line 180, in <module>
       sys.exit(main(sys.argv[1:]))
     File "/usr/bin/ffc", line 107, in main
       execfile(outname, ns)
     File "test.py", line 15, in <module>
       (v0, v1, v2) = TestFunctions(element)
   ValueError: need more than 2 values to unpack

Garth

---

From: Anders Logg <[email-masked]>
Date: Thu, 02 Aug 2007 17:16:37 +0200

It's not broken. It's a feature. :-)

You need to do

     element = MixedElement([U, C, E])

This is because we can have nested mixed elements. When you write

     element = U + C + E

you will get

     element = (U + C) + E

so it will be a mixed element consisting of two elements and the first 
of those will be mixed.

/Anders

Garth N. Wells wrote:
> _______________________________________________
> FFC-dev mailing list
> [email-masked]
> http://www.fenics.org/mailman/listinfo/ffc-dev

---

From: "Garth N. Wells" <[email-masked]>
Date: Thu, 02 Aug 2007 17:31:04 +0200

>     element = MixedElement([U, C, E])

OK, great.

> so it will be a mixed element consisting of two elements and the first 

This is what I was seeing after trawling through the code for some time :(.

Garth