ufl team mailing list archive
-
ufl team
-
Mailing list archive
-
Message #00930
UFL expand indices bug?
Hi,
The following gives me an error (it used to work):
element = FiniteElement("Lagrange", triangle, 2)
v = TestFunction(element)
u = TrialFunction(element)
a = div(grad(v))*u*dx
print tree_format(a) OK
a = expand_derivatives(a)
print tree_format(a) OK
a = expand_indices(a)
print tree_format(a) ERROR:
a = expand_indices(a)
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 827,
in expand_indices
return apply_transformer(e, IndexExpander())
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 786,
in apply_transformer
return transform_integrands(e, _transform)
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 774,
in transform_integrands
for itg in form.integrals()]
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 785,
in _transform
return transformer.visit(expr)
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 112,
in visit
return h(o, *map(self.visit, o.operands()))
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 116,
in visit
return h(o)
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 694,
in index_sum
ops.append(self.visit(summand))
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 116,
in visit
return h(o)
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 718,
in indexed
result = self.visit(A)
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 116,
in visit
return h(o)
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 741,
in component_tensor
result = self.visit(expression)
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 116,
in visit
return h(o)
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 763,
in spatial_derivative
f = self.visit(f) # taking component if necessary
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 116,
in visit
return h(o)
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 764,
in spatial_derivative
j = self.visit(i) # mapping to constant if necessary
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 116,
in visit
return h(o)
File "/home/oelgaard/fenics/ufl/ufl/algorithms/transformations.py", line 708,
in multi_index
return x._uflclass(self._multi_index(x))
File "/home/oelgaard/fenics/ufl/ufl/indexing.py", line 89, in __init__
ii = tuple(as_index(j) for j in ii)
File "/home/oelgaard/fenics/ufl/ufl/indexing.py", line 89, in <genexpr>
ii = tuple(as_index(j) for j in ii)
File "/home/oelgaard/fenics/ufl/ufl/indexing.py", line 146, in as_index
error("Invalid object %s to create index from." % repr(i))
File "/home/oelgaard/fenics/ufl/ufl/log.py", line 64, in error
raise UFLException(self._format_raw(*message))
ufl.log.UFLException: Invalid object None to create index from.
I couldn't find an appropriate place to add a unit test.
Kristian
Follow ups