2d integral over one triangle element

Hi, I am a question about using int2d to calculate integral over one element(triangle). I have a mesh Th, how could I find integral only over Th[0]( the first triangle element) ?
Any help is appreciated.

Hi !

In lack of the better idea, you can always use the trick with P0 finite elements (Finite element) - dofs of P0 elements are the numbering of mesh elements (triangle in 2d and tetrahedra in 3d). Hence, you can multiply whatever you have under the integral with characteristic function of certain element. E.g.

   mesh Th=square(5,6);

   fespace Vh(Th,P0);
   Vh      th;

   th[][15]=1;   // th is zero everywhere except on triangle number 15
   cout << int2d(Th)(th*x) << " " << int2d(Th)(x) << endl;

There is also mentioning of characteristic function in this section in documentation: Finite element

if

It works. Thanks very much ! @fivanci