← Back to team overview

ufl team mailing list archive

Re: updating an index

 



On 21 April 2010 12:09, Mehdi Nikbakht <m.nikbakht@xxxxxxxxxx> wrote:
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 don't see why you need one of the indices to be i_1, the above code seems to make just as much sense.
I think there is something else going wrong in your transformer class.

Kristian

I hope that my question was clear enough.
Mehdi

_______________________________________________
Mailing list: https://launchpad.net/~ufl
Post to     : ufl@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~ufl
More help   : https://help.launchpad.net/ListHelp


Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References