# Label each boundary edge with the natural numbering

**URL:** <https://community.freefem.org/t/label-each-boundary-edge-with-the-natural-numbering/2106>\
**Category:** General Discussion\
**Created:** [November 7, 2022, 7:34am UTC](https://community.freefem.org/t/label-each-boundary-edge-with-the-natural-numbering/2106 "2022-11-07T07:34:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://community.freefem.org/u/Loic)\
**Post date:** [November 7, 2022, 7:34am UTC](https://community.freefem.org/t/label-each-boundary-edge-with-the-natural-numbering/2106/1 "2022-11-07T07:34:51Z")

</div>

Hello all,

Given a domain with N boundary edge, I would like to assign to each boundary edge the label corresponding to the natural numbering (label 0 for boundary edge 0, label 1 for boundary edge 1, …).

For example we consider the domain is a triangle with 3 boundary edges.  
Potentially, initially all boundary edges of the domain have the same label, so I cannot do:

```auto
int[int] NewLab = [lab[0],0,lab[1],1,lab[2],2];

```

Thus I have tried another approach: I have assigned a value to each boundary edge such as

```auto
fespace Lh0(THK, P0edge);
Lh0 l0;
l0[][0]=0;
l0[][1]=1;
l0[][2]=2;

```

and I ave tried to use `l0` as defined to label each boundary edge but I did not succeed.

Could some one help me or suggest another approach ?

Thank you in advance,

Best regards,

Loïc,

---

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://community.freefem.org/u/Loic)\
**Post date:** [November 7, 2022, 9:07am UTC](https://community.freefem.org/t/label-each-boundary-edge-with-the-natural-numbering/2106/2 "2022-11-07T09:07:29Z")

</div>

It works by doing this:

```auto

func int Mylab(int i){
  return i;
}

```

And then

```auto
int j=0; 
THK = change(THK, flabel=Mylab(j++));

```

Best regards,

Loïc,
