- edited description
function.function_space() looks like it creates a new FunctionSpace each time
Issue #197
resolved
This script shows that function spaces already adapted are not properly detected in adaption of functions:
from dolfin import *
mesh = UnitSquareMesh(4,4)
V = FunctionSpace(mesh, "CG", 1)
f = Function(V)
g = Function(V)
mesh2 = adapt(mesh)
V2 = adapt(V, mesh2)
#f2 = adapt(f, V2) # Missing?
#g2 = adapt(g, V2) # Missing?
f2 = adapt(f, mesh2)
g2 = adapt(g, mesh2)
print "\nmesh ids:"
print "direct:", mesh.id(), mesh2.id()
print "via function spaces:", V.mesh().id(), V2.mesh().id()
print "via functions:", f.function_space().mesh().id(), f2.function_space().mesh().id()
print "via functions:", g.function_space().mesh().id(), g2.function_space().mesh().id()
print "\nfunction space ids:"
print "direct: ", V.id(), V2.id()
print "via functions:", f.function_space().id(), f2.function_space().id()
print "via functions:", g.function_space().id(), g2.function_space().id()
On my computer this prints:
mesh ids:
direct: 0 8
via function spaces: 0 8
via functions: 0 8
via functions: 0 8
function space ids:
direct: 3 11
via functions: 20 21
via functions: 22 23
Comments (6)
-
reporter -
reporter The last two pairs of ids should be 3,11 instead of 20,21 and 22,23. However the ids 20 and 22 have nothing to do with adapt, so this seems to be an issue with f.function_space() alone:
from dolfin import * mesh = UnitSquareMesh(4,4) V = FunctionSpace(mesh, "CG", 1) f = Function(V) g = Function(V) print "\nfunction space id (no adapt involved):" print "direct: ", V.id() print "via function f:", f.function_space().id() print "via function g:", g.function_space().id() print "via function f:", f.function_space().id() print "via function g:", g.function_space().id()
prints:
function space id (no adapt involved): direct: 3 via function f: 8 via function g: 9 via function f: 10 via function g: 11
-
reporter -
- marked as critical
-
- changed status to resolved
Fixed by: 63148d4437d65cb16a43f47870b5e0d6369b972a
-
- removed milestone
Removing milestone: 1.4 (automated comment)
- Log in to comment