See the following example:
from dolfin import *
mesh = UnitSquareMesh(2, 2)
V = FunctionSpace(mesh, 'CG', 1)
W = MixedFunctionSpace([V, V])
w = Function(W)
v1, v2 = w.split(deepcopy=True)
print v1.vector().array()
I would like to avoid the deepcopy, since this occurs many times in my program. However, just setting deepcopy=False, this gives:
*** -------------------------------------------------------------------------
*** Error: Unable to access vector of degrees of freedom.
*** Reason: Cannot access a non-const vector from a subfunction.
*** Where: This error was encountered inside Function.cpp.
*** Process: unknown
*** DOLFIN version: 1.4.0
*** Git changeset:
*** -------------------------------------------------------------------------
I encountered some similar questions here, eg. some involving FunctionAssigner, but it seems to use deepcopies also. Is there any method of getting the components of v1 and v2 here without copying the data?