- removed responsible
- removed milestone
Introduce explicit interpolation operator instead of hidden interpolation
Issue #103
new
Following DOLFIN code
from dolfin import *
mesh1 = UnitIntervalMesh(1)
mesh2 = UnitIntervalMesh(2)
P1 = FiniteElement("P", mesh1.ufl_cell(), 1)
V2 = FunctionSpace(mesh2, P1)
u2 = Function(V2)
u2.vector()[:] = 1
DirichletBC(V2, 0, lambda x,b:b).apply(u2.vector())
print(assemble(u2*dx(mesh2))) # Ok
print(assemble(u2*dx(mesh1))) # Should raise
gives
0.5
0.0
which shows that hidden interpolation happens. (FFC generates code assuming u2
lives on ufl.FunctionSpace(mesh1, P1)
. This is not true and DOLFIN interpolates there by calling Function::restrict()
). Arguably this should not happen behind the scene and the last line should raise. Current behaviour should be recovered by
# Explicit interpolation (gives current behaviour)
space_on_mesh1 = ufl.FunctionSpace(mesh1, P1)
interpolant_on_mesh1 = ufl.interpolate(u2, space_on_mesh1)
F = ufl.interpolate(interpolant_on_mesh1*dx(mesh1))
assert assemble(F) == 0
In conclusion ufl.interpolate(coefficient, space)
needs to be added.
Furthermore, this operator will allow FC/FE library to implement further interpolation operators. FFC/DOLFIN currently has only interpolation from one mesh to another with the same element. Different elements are possible.
Comments (1)
-
reporter - Log in to comment