# Change boundary labels

**URL:** <https://community.freefem.org/t/change-boundary-labels/1590>\
**Category:** General Discussion\
**Created:** [March 8, 2022, 10:59pm UTC](https://community.freefem.org/t/change-boundary-labels/1590 "2022-03-08T22:59:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![larismartins](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/larismartins/32/2712_2.png) [@larismartins](https://community.freefem.org/u/larismartins)\
**Post date:** [March 8, 2022, 10:59pm UTC](https://community.freefem.org/t/change-boundary-labels/1590/1 "2022-03-08T22:59:15Z")

</div>

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.

```auto
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

```auto
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

```auto
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?

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [March 11, 2022, 1:01pm UTC](https://community.freefem.org/t/change-boundary-labels/1590/2 "2022-03-11T13:01:15Z")

</div>

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 .
