Using fitted FEM to solve the interface problem, how to calculate the curve integral?

I don’t understand where you are trying to enforce the jump discontinuity of u in your code.

I would strongly suggest looking at

as your formulation will surely be of a similar flavor, either with a pure DG method, or with the mixed approach I presented in DOLFINx