GridFunction data structure

Hi,

I am trying to implement some simple slope-limiting algorithm for DG and for that, I need to understand the data structure of GridFunction objects. I use a 1st-order L2-conforming finite element space and my mesh is 2D.

fes = L2(mesh, order=1)
gfu = GridFunction(fes)

I can see that the coefficient vector of a GridFunction (gfu.vec) associated with this space has three coefficients for each mesh cell. According to what I have observed after some tests, the first coefficient of each set (gfu.vec.FV().NumPy()[::3]) represents the average value of the GridFunction within each mesh cell. However, I am not sure what the other two coefficients represent. I would appreciate it if you could please explain that.

Thanks!

I figured out this problem and post this here just in case anyone else has a similar question:
The basis functions ngsolve uses for the L2 space are Dubiner basis functions. So a first-order function in a reference triangular mesh element would have the following form:
u(r,s) = a + b (3r - 1) + c(2s - 1 + r)
where a,b and c are the coefficients found in gfu.vec.