← Back to team overview

ufl team mailing list archive

updating an index

 

Hello,

I am just started examining ufl to expand integrands. To perform the
expansion, I have defined a transformation derived form
ReusedTransformer. I succeeded expanding ufl integrands for scaler
functions, but I encountered a problem while trying to work with vector
functions.

Assume that I have a linear form defined as,

element = VectorElement("Lagrange", triangle, 1)

u = TrialFunction(element)
v = TestFunction(element)

f = Coefficient(element)
g = Coefficient(element)

L = inner(f + g, v)*dx

which will be interpersonal as,
sum_{i_0} ((v_0)[i_0]) * ((w_0 + w_1)[i_0]) 

I want to use ufl to expand linear form to, 

L = inner(f, v)*dx + inner(g, v)*dx
which should be interpreted as,

sum_{i_0} ((v_0)[i_0]) * ((w_0)[i_0]) + sum_{i_1} ((v_0)[i_1]) *
(( w_1)[i_1]) 

Now I am getting
sum_{i_0} ((v_0)[i_0]) * ((w_0)[i_0]) + sum_{i_0} ((v_0)[i_0]) *
(( w_1)[i_0])

which fails by an error message as,

FAILURE in reuse_if_possible:
type(o) = <class 'ufl.indexsum.IndexSum'>
operands =

sum_{i_0} ((v_0)[i_0]) * ((w_0)[i_0])  + sum_{i_0} ((v_0)[i_0]) *
((w_1)[i_0]) 


It seems to perform this extension, I need to update indices defined for
summation. My question is how I can update an index like i_0 to i_1? 

I hope that my question was clear enough.
Mehdi



Follow ups