Write dolfin::Function into Mixed Function

Hi,

I have given the setting
V = VectorElement(“Lagrange”, triangle, 2)
Q = FiniteElement(“Lagrange”, triangle, 1)
TH = V*Q

Now, I have given a dolfin::Function y which belongs to V.
I now want to create a dolfin::Function yp in TH where I write the function y into the mixed function yp. How is the syntax in c++?

lets say something like this (but this doesnt work unfortunately…)
std::shared_ptr < dolfin::Function> yp(new dolfin::Function(TH));
yp->operator [] (0).vector() = y.vector()

I have seen some guides for dolfin::assing or using collapsing the dofmap for python, but I am not able to construct something similar in c++. It would be of great help if anyone could give me advise…!

Many thanks in advance

I have only done this in Python, but I believe that FunctionAssigner is the way to go :slight_smile:

The receiving_space is TH.sub(0) (or something similar to that) and the assigning_space is V

1 Like