Classification of integration in residual error estimator

Dear NGsolve community,

I tried to implement the residual-type error estimator for DG method.

In the tutorial on recovery type error estimator, the element integration is done in the following way

err = 1/lam*(flux-gf_flux)*(flux-gf_flux)
elerr = Integrate (err, mesh, VOL, element_wise=True)

I notice that for residual type, one suggestion is to use the following for the edge and volume contribution

h = specialcf.mesh_size
n = specialcf.normal(2)

resT = hh(Laplace(gfu)+f)**2dx
resE = h
( (grad(gfu)-grad(gfu).Other())*n )**2 *dx(element_vb=BND)
eta1 = Integrate(resT+resE, mesh, element_wise=True)

According to my understanding, the function “Integrate” already did something for the integration (like in the recovery type), but why “*dx” is included in the resT and resE, will this give the wrong scaling? Many thanks.

Best regards,