Hi,
please consider the attached snippet. I would assume foo() and bar()
to do the same thing but that is not the case. Is this a bug in
Function.assign() or am I missing something about the method's
behaviour?
Thanks for answer.
Regards, Miro
from dolfin import *
mesh = UnitIntervalMesh(5)
V = FunctionSpace(mesh, 'DG', 0)
f = Expression('i', i=0)
def foo():
u = Function(V)
U = u.vector()
for i in range(3):
f.i = i
ut = interpolate(f, V)
u.assign(ut)
print u.vector().norm('l2')
print ut.vector().norm('l2')
print U.norm('l2')
print
def bar():
u = Function(V)
U = u.vector()
for i in range(3):
f.i = i
ut = interpolate(f, V)
U.zero()
U.axpy(1, ut.vector())
print u.vector().norm('l2')
print ut.vector().norm('l2')
print U.norm('l2')
print
foo()
bar()
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics