Missing FunctionSpace::sub in C++
Why did we never add FunctionSpace::sub()
in C++ for setting BC for subspaces.
I suggest we add this for consistency with the Python interface. Objections?
Comments (10)
-
-
reporter It should just do the same thing as
operator[]
does now, i.e., return ashared_ptr
. There's no harm in keeping theoperator[]
for now but it could be removed later. -
Let's then deprecate
operator[]
.We'll also be to remove
dolfin.Function.sub(..)
from the Python layer and just let SWIG wrap it, -
reporter OK let's do this.
-
We'll also be to remove dolfin.Function.sub(..) from the Python layer and just let SWIG wrap it,
I'm not sure about this. Both
dolfin.functions.function.Function
anddolfin.functions.functionspace.FunctionSpace
inherit fromufl.(Coefficient|FunctionSpace)
anddolfin.cpp.Function[Space]
. The trick is that when any method returns just its cpp variant then it is manually wrapped into Py version. I'm not saying that it is impossible. We just need to be careful.One aspect is to avoid copying. One-argument versions of
dolfin.functions.function.Function.__init__
anddolfin.functions.functionspace.FunctionSpace.__init__
accepts cpp variant and return wrapped Py variant without copying. At the same time they should fail with anything else, thus forbidding copy construction AFAIK. -
reporter I suggest we don't touch how things are wrapped to Python but just make an interface change in the C++ interface: add
sub
and deprecate (warning)operator[]
. -
I suggest that the deprecation is set to epochs
deprecation(what, "1.7.0", "2.0.0", why)
, i.e. the same as pull request #251. -
How about we don't do this (not as originally planned, anyway) , and move towards the FooView (see issue #531) design to clean a load of things up. I've just felt first-hand how confusing it is to get a shared_ptr to a sub-Function.
-
- changed status to resolved
Fixes in b25348c. Still need to deprecate [].
-
reporter - removed milestone
Removing milestone: 1.7 (automated comment)
- Log in to comment
I don't know why it's missing.
What will the return type be? I would like
std::shared_ptr
. If we have an option for deep vs shallow copy, it would be nice if this is an enum.