Hello,
I am working on an adaptivity algorithm and I am facing an issue that is reproduced in the following dummy code:
from dolfin import *
M=UnitSquareMesh(10,10)
File('us.xml')<<M
for i in xrange(2):
M1=Mesh('us.xml')
plot(M1)
interactive()
The first time the mesh is loaded correctly, but the second time is totally wrong, and looks like this:
Using more complicated meshes the result is basically random, but I noticed that the second mesh has the same vertex numbering around each element (i.e. M1.cells() is identical).
On the other hand the second mesh has vertices coordinates that are integer values corresponding to the first non-zero digit of the first mesh coordinates.. for example:
from dolfin import *
M=UnitSquareMesh(20,20)
File('us.xml')<<M
for i in xrange(2):
M1=Mesh('us.xml')
plot(M1)
print M1.coordinates()[0:4]
interactive()
gives this output:
[[ 0. 0. ]
[ 0.05 0. ]
[ 0.1 0. ]
[ 0.15 0. ]]
[[ 0. 0.]
[ 5. 0.]
[ 1. 0.]
[ 1. 0.]]
The strange thing is also that the following code plots the meshes correctly:
from dolfin import *
M=UnitSquareMesh(10,10)
for i in xrange(2):
plot(M)
interactive()
And this code gives the correct output:
from dolfin import *
M=UnitSquareMesh(20,20)
File('us.xml')<<M
for i in xrange(2):
M1=Mesh('us.xml')
print M1.coordinates()[0:4]
its output is, as expected:
[[ 0. 0. ]
[ 0.05 0. ]
[ 0.1 0. ]
[ 0.15 0. ]]
[[ 0. 0. ]
[ 0.05 0. ]
[ 0.1 0. ]
[ 0.15 0. ]]
soooo probably is causing the problem is the combination of a mesh loaded from a file, and
interactive(). What am I doing wrong? Any Idea?
thanks a lot.