dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #16482
Pointer/constructor mystery
I'm debugging the adaptive machinery and I'm seeing some strange
behaviour.
Take a look at the following simple test code:
from dolfin import *
mesh = UnitSquare(2, 2)
V = FunctionSpace(mesh, "CG", 1)
print
v = Function(V)
print
v.function_space()
print
v.function_space()
I would expect that the FunctionSpace constructor is called only once.
But it seems to be called three times. Once at the top as expected and
then every time function_space() is called:
Debug: creating function space [at
dolfin/function/FunctionSpace.cpp:42 in FunctionSpace()]
this = 0x335e190
registering V = 0x335e190
Debug: creating function [at dolfin/function/Function.cpp:49 in
Function()]
V = 0x335e190
registering v = 0x33622d0 for V = 0x335e218
Debug: creating function space [at
dolfin/function/FunctionSpace.cpp:64 in FunctionSpace()]
this = 0x336c420
registering V = 0x336c420
Debug: creating function space [at
dolfin/function/FunctionSpace.cpp:64 in FunctionSpace()]
this = 0x336c420
registering V = 0x336c420
Is this expected? Note that the constructor is called three times but
the pointer (this) is the same in the two last calls.
--
Anders
Attachment:
signature.asc
Description: Digital signature
Follow ups