I want to code a 'split' and 'assign' function that would work with Vector(). I was thinking about using the dofmap().dofs for each view of the MixedFunctionSpace. That is,
V1V2 = MixedFunctionSpace([V1, V2])
V1dofs = V1V2.sub(0).dofmap().dofs()
V2dofs = V1V2.sub(1).dofmap().dofs()
To split, I then build two matrices of dimension V1xV1V2, and V2xV1V2 with 1's and 0's given by the V1dofs and V2dofs. This seems to work fine if V1 and V2 are the same FunctionSpace. However, it fails if V1 and V2 are different. And most surprisingly, at least for CG spaces that differ only by their polynomial order, it seems that the split fails b/c of a single dof (the first one).
Looking at FunctionAssigner, it appears that Fenics builds these maps by iterating over all cells; I'd rather avoid that.
So my questions are:
1) how could I get the right map between the dofs of V1V2.sub(i) and Vi? Is there any way to extract that map from FunctionAssigner?
2) Am I correct to assume that what I'm doing will work if V1=V2 (say for CG spaces only)?
3) Would there be another way to split/assign for Vector()?