Description
Hi!
The code below should produce two arrays of all 0s and two arrays of all 1s, but I get
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
The code is
from dolfin import *
from fenicstools import interpolate_nonmatching_mesh_any
import numpy
mesh = UnitSquareMesh(2, 2)
V = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", 1)
u0=Function(V)
u0.vector().set_local( u0.vector().get_local()*0.0 )
u0.vector().apply('insert')
print(u0.vector().get_local()) # Should be all 0
i0 = interpolate_nonmatching_mesh_any(u0, V)
print(i0.vector().get_local()) # Should be all 0
u1=Function(V)
u1.vector().set_local( u1.vector().get_local()*0.0+1.0 )
u1.vector().apply('insert')
print(u1.vector().get_local()) # Should be all 1
i1 = interpolate_nonmatching_mesh_any(u1, V)
print(i1.vector().get_local()) # Should be all 1
Is this a bug or am I doing something wrong?
Best Regards,
Søren
PS This function is a really nice and useful addition to fenics. Thanks for sharing it!