Hi,
I have some problems with the vector() method in the new release 1.5.0.
If I run this simple code:
from dolfin import*
mesh = UnitSquareMesh(10, 10)
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.interpolate(Expression("1+x[0]"))
plot(f)
print 'a1 =', f.vector().array()
print 'a2 =', f.compute_vertex_values()
interactive()
What I get is:
a1 = [ 1. 1. 1.1 1. 1.1 1.2 1. 1.1 1.2 1.3 1. 1.1 1.2 1.3 1.4
1. 1.1 1.2 1.3 1.4 1.5 1. 1.1 1.2 1.3 1.4 1.5 1.6 1. 1.1
1.2 1.3 1.4 1.5 1.6 1.7 1. 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8
1. 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1. 1.1 1.2 1.3 1.4
1.5 1.6 1.7 1.8 1.9 2. 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9
2. 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2. 1.3 1.4 1.5 1.6 1.7
1.8 1.9 2. 1.4 1.5 1.6 1.7 1.8 1.9 2. 1.5 1.6 1.7 1.8 1.9
2. 1.6 1.7 1.8 1.9 2. 1.7 1.8 1.9 2. 1.8 1.9 2. 1.9 2.
2. ]
a2 = [ 1. 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2. 1. 1.1 1.2 1.3
1.4 1.5 1.6 1.7 1.8 1.9 2. 1. 1.1 1.2 1.3 1.4 1.5 1.6 1.7
1.8 1.9 2. 1. 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2. 1.
1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2. 1. 1.1 1.2 1.3 1.4
1.5 1.6 1.7 1.8 1.9 2. 1. 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8
1.9 2. 1. 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2. 1. 1.1
1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2. 1. 1.1 1.2 1.3 1.4 1.5
1.6 1.7 1.8 1.9 2. 1. 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9
2. ]
In the case of a2, obtained with the new method compute_vertex_values(), vertex values are ordered with the number of vertex in the mesh, while concerning a1 values are ordered in a different way. How can I get the same result with the vector() method and fix this? This never happened in older releases.
Thank you very much
Lisa