I would like to have some feedback about implementing new finite element in FreeFEM.
How difficult and how long it is to implement new finite element (in particular non conforming) in FreeFEM ?

For anyone who has already done (or tried it), feel free to share your feedback (the type of finite element, the difficulties you have faced with, if it works well or not, …)

P2pnc piecewise quadratic plus a bubble P3 element with the continuity of the 2 moments on each edge (version 3.59) (need load “Element_P2pnc” is exactly you element in case 1 .

So you can start form this and call it P3pnc for exemple.

you can see in the test testFE-P2pnc.edp
the 2 dof on edge E = (i,j) are \int_E \lambda_i v and \int_E \lambda_j v where \lambda_i and \lambda_j are barycentric
coordinate

I think in the FE definition, these doF are defined there:

for (int i = 0; i < 3; i++) {
for (int p = 0; p < QFE.n; ++p) {
R l1 = QFE[p].x, l0 = 1 - QFE[p].x;
if (oe[i] < 0) {
swap(l0, l1);
}
if (ddd < 3) {
cout << p << " " << oe[i] << " " << l0 << " " << l1 << endl;
}
R p0 = l0, p1 = l1;
R cc1 = p0 * QFE[p].a;
R cc0 = p1 * QFE[p].a;
v[k++] = cc0;
v[k++] = cc1;
}
}
for (int p = 0; p < QFK.n; ++p) {
double w = QFK[p].a;
R l1 = QFK[p].x, l2 = QFK[p].y, l0 = 1 - l1 - l2;
R b = 1;
v[k++] = b * w;
}
ffassert(k == this->pij_alpha.N( ));

}

But in my case I want that my DoF are \int_E v L_k where L_k are the k-th Legendre polynomial. Thus in case n=1, the 2 polynomial should be 1 and \lambda.

Yes the degree of freedom are not exactly the same but a the end the space are exactly the same because we have same constraint;
But it is trivial to change