Open jrmaddison opened 6 years ago
This is a mixed space, a mixed space is a bag of function spaces, I suppose that's why you have tuples. Observe what x.vector()
, x.vector().dat
, and x.vector().dat.data
.
I guess what you want to do is: x.assign(y)
.
It is an ongoing issue that the vector api is not compatible with dolfin.
Can't we just allocate mixed Dats as a continuous array, and then slice and reshape sections for individual Dats?
"Just" is a stretch, but something like that could be done. Or, given that I think the vector API operates on assembled objects, one could just expose the Vec
objects.
The assign method would probably suffice, but there are use cases where it is desirable to modify the vector directly -- the axpy (now corrected) is probably a better example.
FWIW, Function.assign
handles arbitrary (pointwise, nonlinear even) combinations of fields. So you can write:
x.assign(x + alpha*y)
if you like. I realise this doesn't help for compatibility purposes.
Attempting to update Vectors directly leads to errors when mixed elements are used. For example:
Either the assignment or the axpy leads to an error, e.g.