Change boundary labels

Hi there, so, I’m trying to change boundary labels. I have a global mesh with 8 triangles and in each triangle I’m building local meshs Th[i], where i represents the current global element. For now, my local mesh consists of only on element.

I used the degrees of freedom to find the boundary edge and the find the label.

fespace Lambda0(Th[i], P0edge);
 Lambda0 lk0x = x, lk0y = y;

real[int,int] coordDoFl0k(Lambda0.ndofK,2);
  for(int l= 0; l <Lambda0.ndofK; l++){
    coordDoFl0k(l,0) = lk0x[][l];
    coordDoFl0k(l,1) = lk0y[][l];
   }
   cout << coordDoFl0k << "\n";

  real[int] RNumber(Lambda0.ndofK);
  for(int l= 0; l <Lambda0.ndofK; l++){
    int TNumber = Th[i](lk0x[][l],lk0y[][l]).nuTriangle;
    RNumber(l) = Th[i][TNumber].label;
  }
  cout << RNumber << "\n";

the result is the following

3 2	
	 0.5 0.25
	 0.25 0.25
	 0.25   0
	
3	
	  0	  0	  0	

then I used the following to try to change the labels

int[int] labelChange = [0,0, 0,1, 0,2];
Th[i] = change(Th[i], label = labelChange);

but this is not working. When I try to print the label, it remains 0 0 0.
Could anyone help me?

They are 2 reason why the label do not change.

  1. the label is make to set boundary condition and on internal edge you have no label

  2. in your local mesh Th[i] now you have boundary no internal edge so you can set the label, but if the initial label are 0 it is impossible to get label 1,2,3 with your change method because all label 0 become 0 , 1 or 2 , and a usual in computer sciences the last win , so 0 become 2.

  3. Th[i][TNumber].label; is not the label in the triangle (sorry) it is label of vertices Th[i][TNumber] not use in freefem++), the label is Th.be(k).label where k in le border edge number .