Subject: [FFC-dev] 0.3.3 on NavierStokes.form with -O throws an error

From: osman b <[email-masked]>
Date: Wed, 6 Sep 2006 19:48:02 -0400

Hi,
Just installed 0.3.3 on my SuSE10.0 AMD 64, tried 
ffc  NavierStokes.form
it worked.
But -O gives an error:
osman@linux:~/SRC/ffc-0.3.3/src/demo> ffc -O -d1 NavierStokes.form
This is FFC, the FEniCS Form Compiler, version 0.3.3.
For further information, go to http://www/fenics.org/ffc/.
Parsing NavierStokes.form
Output written to NavierStokes.py

Compiling form: w0_a1(dXa2/dxa0) | vi0[b0]*va1[a0]*((d/dXa2)vi1[b0])*dX
Number of terms in form: 1
Number of functions (coefficients): 1
Number of projections (coefficients): 1
Number of constants: 0
Finite element of test space:  Vector Lagrange finite element of degree 1 on a 
tetrahedron with 3 components
Finite element of trial space: Vector Lagrange finite element of degree 1 on a 
tetrahedron with 3 components
Finite elements for functions: [Vector Lagrange finite element of degree 1 on 
a tetrahedron with 3 components]
Compiling tensor representation for interior
Compiling term 0
Created geometry tensor: a[3, 12, 3], b[]
Pretabulating basis functions at quadrature points
Initializing quadrature.
Total degree is 2, using 2 quadrature point(s) in each dimension
Precomputing table of basis functions at quadrature points.
Computing table for factor v = vi0[b0]
Computing table for factor v = va1[a0]
Computing table for factor v = ((d/dXa2)vi1[b0])
Computing product of tables
Computing the reference tensor (15552 entries), this may take some time...
................................................................................
Reference tensor computed in 0.0685 seconds
Created reference tensor: i[12, 12], a[3, 12, 3], b[3]
All terms compiled
Generating code for reference tensor
Generating optimized code for element tensor
Computing optimization, this may take some time...
Traceback (most recent call last):
  File "/usr/bin/ffc", line 128, in ?
    main(sys.argv[1:])
  File "/usr/bin/ffc", line 82, in main
    execfile(outname, ns)
  File "NavierStokes.py", line 32, in ?
    compile([a, L, M], name, "dolfin", {'blas': False, 'no-gpl': False, 
'optimize': True, 'debug-no-geometry-tensor': False, 
'debug-no-element-tensor': False})
  File "/usr/lib/python2.4/site-packages/ffc/compiler/compiler.py", line 55, 
in compile
    forms = build(sums, name, language, options)
  File "/usr/lib/python2.4/site-packages/ffc/compiler/compiler.py", line 124, 
in build
    form.AKi = ElementTensor(form.sum, "interior", format, cKi_used, gKi_used, 
options, None)
  File "/usr/lib/python2.4/site-packages/ffc/compiler/elementtensor.py", line 
70, in __init__
    self.aK = self.__compute_element_tensor(format, options)
  File "/usr/lib/python2.4/site-packages/ffc/compiler/elementtensor.py", line 
124, in __compute_element_tensor
    return self.__compute_element_tensor_optimized(format)
  File "/usr/lib/python2.4/site-packages/ffc/compiler/elementtensor.py", line 
184, in __compute_element_tensor_optimized
    return optimize(self.terms, format)
  File "/usr/lib/python2.4/site-packages/ffc/compiler/optimization.py", line 
54, in optimize
    (value, num_mult) = build_rhs(rhs, j, iindices, aindices, num_terms, 
format, num_mult)
ValueError: too many values to unpack

Also get the same error with:
NeumannProblem.form, Mass.form, Elasticity.form, PoissonSystem.form, 
Optimization.form, and Stokes.form

Do I need new Ferrari? (Mine is 0.1.0)
-- 
Osman F. Buyukisik

---

From: Anders Logg <[email-masked]>
Date: Thu, 7 Sep 2006 09:16:40 +0200

This is a bug in FFC, thanks for noticing. Pull the latest hg version
or make the following fix in the function build_rhs in the file
src/ffc/compiler/optimization.py.

Where it says

  # Special case, no terms
  if len(terms) == 0:
      return "0.0"

change to

  # Special case, no terms
  if len(terms) == 0:
      return ("0.0", 0)

/Anders

---

From: osman b <[email-masked]>
Date: Thu, 7 Sep 2006 20:00:36 -0400

> src/ffc/compiler/optimization.py.

Ok. That fixed it. Thanks.

-- 
Osman F. Buyukisik