Find if a node is on a given border

Hello,
I’ve built a mesh using the border function

border f0(t=0,1){P.x=nodes(1,0)*t + nodes(0,0)*(1-t);P.y=nodes(1,1)*t + nodes(0,1)*(1-t); label=11;};
 border f1(t=0,1){P.x=nodes(2,0)*t + nodes(1,0)*(1-t);P.y=nodes(2,1)*t + nodes(1,1)*(1-t); label=22;};
 border f2(t=0,1){P.x=nodes(0,0)*t + nodes(2,0)*(1-t);P.y=nodes(0,1)*t + nodes(2,1)*(1-t); label=33;};

Now, I have a vector or coordinates and I would like to find if a certain coord belogs to one of the borders f0, f1 or f2.

How can I do this?

The problem is some node ca be on 2 border.

but P1 finite element function is def on vertices of mesh,

so on mesh Th,

  fespace Vh(Th,P1):;
 varf von11(u,v) = on(11,u=1);  //  set 1 on border 1 
 Vh u11; u11[]=von11(0,Vh);

// now u11[][i] == 1 if the vertex i is on border 11.

Actually, I’m working with P1Edge and I know the coordinates for those degrees of freddom. Then, I would like to know which border they belong to

func Pm = P1edge; 
fespace LambdaH(calP, Pm);
real[int, int] coordDofLambda(nDoFl0K,2);
 
 for(int i=0; i<nDoFl0K; i++){
 for(int j=0;j<nDoFl0;j++){
   if(locationMatrix(K,i) = j){
    coordDofLambda(i,0) = coordDoFl0(i,0);
    coordDofLambda(i,1) = coordDoFl0(i,1);
   }
  }
 }
 //cout << coordDofLambda << "\n";
border f0(t=0,1){P.x=nodes(1,0)*t + nodes(0,0)*(1-t);P.y=nodes(1,1)*t + nodes(0,1)*(1-t); label=11;};
 border f1(t=0,1){P.x=nodes(2,0)*t + nodes(1,0)*(1-t);P.y=nodes(2,1)*t + nodes(1,1)*(1-t); label=22;};
 border f2(t=0,1){P.x=nodes(0,0)*t + nodes(2,0)*(1-t);P.y=nodes(0,1)*t + nodes(2,1)*(1-t); label=33;};

 Th[K] = buildmesh(f0(1) + f1(1) + f2(1));
 Th[K] = trunc(Th[K], abs(u0 -K) < 1e-5, split=subMesh);

 int NbTrianglesLocal = Th[K].nt;
 int[int] localLabels = [22,33,11];

So, given the coords in coordDofLambda, I would like to know which border they belong to

to get the coordinate and the label of each dof of the P1edge Finite Element you can do:

mesh Th=square(2,2);

func Pm = P1edge; 
fespace Lh(Th, Pm);

varf von(u,v) = on(1,2,3,4,u=label);
Lh onl,xl=x,yl=y;
onl[]=von(0,Lh,tgv=1); // to have the labelof the dof.
cout << onl[] <<endl; 

cout << xl[] << " " << yl[]<< endl;

// xl[] , yl[] the coordinitae of dof
// onl[]  the label of dot