# Boundary labels

**URL:** https://community.freefem.org/t/boundary-labels/938
**Category:** General Discussion
**Created:** [April 22, 2021, 9:25am UTC](https://community.freefem.org/t/boundary-labels/938 "2021-04-22T09:25:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![yongxing](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/yongxing/32/3632_2.png) [@yongxing](https://community.freefem.org/u/yongxing)
#### Post date: [April 22, 2021, 9:25am UTC](https://community.freefem.org/t/boundary-labels/938/1 "2021-04-22T09:25:16Z")

</div>

Hi all,

I realise we can loop over triangles, and print **Th(i).label** so that know which nodes are at boundaries. However, if we use of P2 element, and loop over degrees of freedom such as:  
for(int i=0; i\<Vh.ndof; i++){ … }  
How can we know which degrees of freedom sit on boundaries?

Best,  
Yongxing.

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [April 22, 2021, 9:30am UTC](https://community.freefem.org/t/boundary-labels/938/2 "2021-04-22T09:30:52Z")

</div>

```auto
varf vGamma(u, v) = on(boundaryLabel, u = 1.0);
real[int] onGamma(Vh.ndof);
onGamma = vGamma(0, Vh, tgv = -1);
for(int i = 0; i < Vh.ndof; ++i) if(abs(onGamma[i]-1.0) < 0.1) cout << "on boundaryLabel" << endl;

```

---

<div class="post-metadata">

### Author: ![yongxing](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/yongxing/32/3632_2.png) [@yongxing](https://community.freefem.org/u/yongxing)
#### Post date: [April 22, 2021, 9:33am UTC](https://community.freefem.org/t/boundary-labels/938/3 "2021-04-22T09:33:39Z")

</div>

Great! Thank you very much.  
Yongxing.
