A collapsed function space lacks the python layer
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
DOLFIN |
Fix Released
|
Critical
|
Johan Hake |
Bug Description
When trying to convert a VariationalProblem based solve
to using solve(), I created a Function for the solution,
and got the message that I should collapse the function
space (which was a subspace). So I call V.collapse(),
but the new function space is not wrapped in the python
layer. Details:
In [23]: V = VectorFunctionS
In [24]: U = V.sub(0)
In [25]: W = U.collapse()
In [26]: f = Function(V)
In [27]: g = Function(U)
-------
RuntimeError Traceback (most recent call last)
/home/martinal/
/opt/fenics/
139 if len(args) == 1:
140 # Instantiate cpp base classes
--> 141 cpp.Function.
142 elif len(args) == 2:
143 # If passing FunctionSpace together with cpp.Function
/opt/fenics/
16161
16162 """
> 16163 _cpp.Function_
16164 __swig_destroy__ = _cpp.delete_
16165 def assign(self, *args):
RuntimeError: *** Error: Cannot create Functions using subspaces. Consider collapsing the FunctionSpace.
In [28]: h = Function(W)
-------
TypeError Traceback (most recent call last)
/home/martinal/
/opt/fenics/
104
105 if not isinstance(args[0], (FunctionSpaceBase, Function)):
--> 106 raise TypeError, "expected a FunctionSpace or a Function as argument 1"
107
108 # If using the copy constuctor
TypeError: expected a FunctionSpace or a Function as argument 1
In [29]: type(V)
Out[29]: <class 'dolfin.
In [30]: type(U)
Out[30]: <class 'dolfin.
In [31]: type(W)
Out[31]: <class 'dolfin.
Changed in dolfin: | |
importance: | Undecided → Critical |
milestone: | none → 1.0-beta2 |
Changed in dolfin: | |
status: | New → Confirmed |
status: | Confirmed → In Progress |
assignee: | nobody → Johan Hake (johan-hake) |
Changed in dolfin: | |
status: | Fix Committed → Fix Released |
Would it help if 'collapse' returned a shared_ptr rather than a plain pointer, as it does now?