Interpolate DG Functions

Hi, quite a while ago I asked that question about the interpolation of Lagrange functions: Interpolating into a space of higher polynomial degree

Now I want to do something similar with DG Functions. However, the code below works (in the sense that it leads to the correct interpolation of f1 on the finer mesh) for Lagrange functions, but not DG functions. Why doesn’t it work and how could I remedy this? Kind regards, Johannes

from dolfin import *
import numpy as np
def Plot1D(mesh,u,polydegree):
	coords = mesh.coordinates()
	coords = np.sort(coords.T[0,:])
	NrInBetween = 10*(polydegree-1)
	x=[]
	y=[]
	for idx_vertex in range(1,coords.size):
		intervall_size = np.float(coords[idx_vertex] - coords[idx_vertex-1])
		step_size = intervall_size/(NrInBetween+1)
		for node in range(0,NrInBetween+1):     
			x.append(coords[idx_vertex-1] + node*step_size)
			y.append(u(x[-1]))
	x.append(coords[-1])
	y.append(u(x[-1]))
	x = np.array(x)
	y = np.array(y)
	plt.plot(x,y)

# Two different meshes and function spaces:
mesh1 = UnitIntervalMesh(3)
mesh2 = refine(refine(mesh1))
degree = 2
space = 'DG' #'Lagrange'

V1 = FunctionSpace(mesh1,space,degree)
V2 = FunctionSpace(mesh2,space,degree)

# Create some function in V1:
f1 = Function(V1)
f1.vector()[2] = 1

# Create a transfer matrix from V1 to V2, and use it to interpolate f1 in V2:
A = PETScDMCollection.create_transfer_matrix(V1,V2)
f2 = Function(V2)
f2.vector()[:] = A*f1.vector()
f3 = interpolate(f1,V2)
print(assemble((f2-f3)**2*dx))

# Plot results:
import matplotlib.pyplot as plt
plt.figure(1)
Plot1D(mesh2,f1,1)
plt.figure(2)
Plot1D(mesh2,f2,1)
plt.show()