Subject: [FFC-dev] Bug in quadrature code generator

From: Anders Logg <[email-masked]>
Date: Thu, 2 Oct 2008 15:43:51 +0200

When running the following code:

  from dolfin import *

  mesh = UnitSquare(2, 2)
  element = FiniteElement("DG", "triangle", 0)
  u = Function(element, mesh, 0.0)

  M = u.dx(0)*dx
  print assemble(M, mesh,
                 form_compiler_options={"representation": "quadrature"})

I get

Traceback (most recent call last):
  File "dgtest.py", line 9, in <module>
    form_compiler_options={"representation": "quadrature"})
  File
  "/scratch/fenics/dolfin/dolfin-dev/local/lib/python2.5/site-packages/dolfin/assemble.py",
  line 48, in assemble
    (compiled_form, module, form_data) = jit(form,
    form_compiler_options)
  File
  "/scratch/fenics/dolfin/dolfin-dev/local/lib/python2.5/site-packages/dolfin/assemble.py",
  line 198, in jit
    return jit_compile(form, options)
  File "/usr/lib/python2.5/site-packages/ffc/jit/jit.py", line 61, in
  jit
    compile(form, signature, options)
  File "/usr/lib/python2.5/site-packages/ffc/compiler/compiler.py",
  line 68, in compile
    (form_data, form_representation) = __compile_forms(forms, prefix,
    options)
  File "/usr/lib/python2.5/site-packages/ffc/compiler/compiler.py",
  line 106, in __compile_forms
    form_code = generate_form_code(form_data, form_representation,
    options["representation"], format.format)
  File "/usr/lib/python2.5/site-packages/ffc/compiler/compiler.py",
  line 222, in generate_form_code
    code = code_generator.generate_form_code(form_data,
    form_representation, format)
  File
  "/usr/lib/python2.5/site-packages/ffc/compiler/codegeneration/common/codegenerator.py",
  line 37, in generate_form_code
    code[("cell_integral", i)] =
    self.generate_cell_integral(form_data, form_representation, i,
    format)
  File
  "/usr/lib/python2.5/site-packages/ffc/compiler/codegeneration/quadrature/quadraturegenerator.py",
  line 66, in generate_cell_integral
    (tensors, None, None, Indent, format)
  File
  "/usr/lib/python2.5/site-packages/ffc/compiler/codegeneration/quadrature/quadraturegenerator.py",
  line 199, in __generate_element_tensor
    Indent, format)
  File
  "/usr/lib/python2.5/site-packages/ffc/compiler/codegeneration/quadrature/quadraturegenerator.py",
  line 300, in __tabulate_weights
    value = format_float(weights[0])
  IndexError: index out of bounds

It works fine when I use linears, so there seems to be a problem with
computing derivatives of piecewise constants.

-- 
Anders

---

From: Kristian Oelgaard <[email-masked]>
Date: Thu, 02 Oct 2008 16:36:37 +0200

This should be fixed now.

Kristian