Interpolation and prolongation/restriction

Hello,

Is is possible to do both (1) interpolation to/from a boundary and (2) restriction/prolongation between FE spaces with different numbers of components? For example, switch between [P2,P1] on Th and [P2] on a boundary of Th?
Should one use two distinct matrices or can a single matrix do both operations simultaneously?

Is there any example showing how to achieve that?
I have found several examples that do either (1) or (2), but I could not find one with (1)+(2).

Thank you.

To be more specific: actually this example in the section “Finite Element → Interpolation Matrix” of the documentation does (1)+(2) in a serial setting.

What is the correct way to translate that in a parallel setting (to use PETSc for example)? Can one use something like Mat B(A,restriction=...); to create a distributed parallel matrix?

$ git grep -n "restriction =" examples/hpddm/
examples/hpddm/elasticity-block-hpddm-2d-PETSc.edp:48:    int[int] restriction = restrict(Wh, WhUnneeded, n2o);
examples/hpddm/elasticity-block-hpddm-2d-PETSc.edp:55:Mat A(AUnneeded, restriction = two2one); // proper Mat for the velocity with a single layer of overlap
examples/hpddm/helmholtz-coupled-2d-PETSc-complex.edp:119:Mat<complex> ASurf(A, restriction = RVtoS);
examples/hpddm/helmholtz-coupled-2d-PETSc-complex.edp:123:    Mat<complex> TSurf(T, restriction = PVtoS);
examples/hpddm/mf-2d-SLEPc.edp:33:Mat B(A, restriction = R); // if the above condition is not met,
examples/hpddm/restriction-2d-PETSc.edp:63:Mat B(A, restriction = R);
$ git grep MatInterpolate examples/hpddm/
examples/hpddm/PtAP-2d-PETSc.edp:MatInterpolate(ThNew, Pk, B, Th, Pk, A, P);
examples/hpddm/diffusion-mg-2d-PETSc.edp:        MatInterpolate(Th1, Pk, A[1], Th0, Pk, A[0], P[0]);
examples/hpddm/diffusion-mg-2d-PETSc.edp:        MatInterpolate(Th2, Pk, A[2], Th1, Pk, A[1], P[1]);
examples/hpddm/diffusion-mg-2d-PETSc.edp:        MatInterpolate(Th1, Pk, A[1], Th0, Pk, A[0], P[0]);
examples/hpddm/diffusion-mg-2d-PETSc.edp:        MatInterpolate(Th2, Pk, A[2], Th1, Pk, A[1], P[1]);
examples/hpddm/diffusion-mg-2d-PETSc.edp:        MatInterpolate(Th1, Pk, B, Th0, Pk, A[0], P[0]);
examples/hpddm/diffusion-mg-2d-PETSc.edp:        MatInterpolate(Th2, Pk, C, Th1, Pk, B, P[1]);
examples/hpddm/diffusion-mg-2d-PETSc.edp:        MatInterpolate(Th1, Pk, B, Th0, Pk, A[0], P[0]);
examples/hpddm/diffusion-mg-2d-PETSc.edp:        MatInterpolate(Th2, Pk, C, Th1, Pk, B, P[1]);