dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #14724
BoundaryConditions and shared_ptr constructor
Hello!
Is it possible to store the internals of BoundaryConditions and its derived
classes using shared_ptr?
This would be nice for the python interface where both Functions and
FunctionSpaces are stored using shared_ptr.
As it is now will following break when the return bc is used.
def create_Dirichlet_bc(value):
# Define boundary condition in terms of a local variable u0
# that goes out of scope when the execution of this function is done
u0 = Constant(mesh, value)
bc = DirichletBC(V, u0, DirichletBoundary())
return bc
If DirichletBC could store the passed Function using shared_ptr we would avoid
this problem.
It should be straight forward to add shared_ptr constructor for both
FunctionSpace and Function, as these are already defined as such in PyDOLFIN.
However we should also consider doing the same for SubDomain. This will
introduce a new class we need to wrap using shared_ptr in PyDOLFIN.
Johan
Follow ups