I have a CG2 function on a triangular mesh. I need to check whether all jumps of the gradient over all interior edges are non-negative. Since the jump (in normal direction) of the gradient is linear at the edges, it is sufficient to check the two end-points.
Is there any (easy) possibility to assemble a matrix $A$, such that $A\,x \ge 0$
iff the P2-function represented by $x$ has the above property?
That would be easy if there would be a function space of functions that live on edges, are linear on each edge, and discontinuous. Then one could project the gradient jump into that space along the lines of
u = TrialFunction("FancyBoundarySpace", triangle, 1)
v = TestFunction("FancyBoundarySpace", triangle, 1)
y = Coefficient("CG", triangle, 2)
a = u*v*dS
L = jump(grad(y),n)*v*dS