← Back to team overview

dolfin team mailing list archive

Re: [Question #152702]: indices in an expression?

 

Question #152702 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/152702

B. Emek Abali posted a new comment:
probably not the coolest way but I solved it as that way, one can also
implement it like dolfin.Identity class

class levicivita2(Expression):
	def eval(self, out, x):
		out[0,0] = 0.0
		out[0,1] = 1.0
		out[1,1] = 0.0
		out[1,0] = -1.0
	def value_shape(self):
		return (3,3)

class levicivita3(Expression):
	def eval(self, out, x):
		out[0,0,0] = 0.0
		out[1,1,1] = 0.0
		out[2,2,2] = 0.0
		out[0,1,2] = 1.0
		out[1,2,0] = 1.0
		out[2,0,1] = 1.0
		out[2,1,0] = -1.0
		out[1,0,2] = -1.0
		out[0,2,1] = -1.0
	def value_shape(self):
		return (3,3,3)

e=levicivita3()
form = v[j]*w[i]*e[i,j,l]*v[l]*dx

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.



Follow ups