10 Jun
2016
10 Jun
'16
12:09 p.m.
Dear all, I have a simple function W = FunctionSpace(mesh, "DG", 0) w = Function(W) and I want to set i-th element of it manually. For this I do: for j in range((n+1)**2): w.interpolate(Expression("1")) l = [int(x) for x in bin(j)[2:]] l = ((n+1)**2 - len(l))*[0] + l w_vec = w.vector().array() for i in range(n*n): if l[i] == 1: w_vec[i] = 1 else: w_vec[i] = 0.001 File("w" + str(j) + ".pvd") << w but from the last line I see the the same picture every time. What am I doing wrong? Sincerely, George