# How to define the label of boundary(3D cylinder with hole)

**URL:** <https://community.freefem.org/t/how-to-define-the-label-of-boundary-3d-cylinder-with-hole/1322>\
**Category:** General Discussion\
**Created:** [November 13, 2021, 7:47am UTC](https://community.freefem.org/t/how-to-define-the-label-of-boundary-3d-cylinder-with-hole/1322 "2021-11-13T07:47:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yikouyi](https://avatars.discourse-cdn.com/v4/letter/y/3d9bf3/32.png) [@Yikouyi](https://community.freefem.org/u/Yikouyi)\
**Post date:** [November 13, 2021, 7:47am UTC](https://community.freefem.org/t/how-to-define-the-label-of-boundary-3d-cylinder-with-hole/1322/1 "2021-11-13T07:47:57Z")

</div>

Hi,

I have question towards 3d mesh.  
I want to build a mesh of 3d cylinder with a hole. So I build a 2d mesh of the circle with a hole first and then use buildlayers() to expand it to 3d.

how to define the label of boundary?

Here is my code.

load “msh3”  
load “medit”  
load “tetgen”  
//--------------------------------------------------------------------  
//Builds a mesh on 3d cylinder with a hole.  
real cx1 = 0.0;  
real cy1 = 0.0;  
real r1 = 1.0;  
real cx2 = 0.5;  
real cy2 = 0.0;  
real r2 = 0.1;  
real zmin=0,zmax=1;  
int[int] rup=[0,1], rdown=[0,2], rmid=[1,3];  
border C1(t1=0,2_pi){x=cx1+r1_cos(t1);y=cy1+r1_sin(t1);};  
border C2(t1=0,2_pi){x=cx2+r2_cos(t1);y=cy2+r2_sin(t1);};

int m=5;  
mesh Thcercle = buildmesh(C1(4\*m)+C2(-m));  
//plot(Thcercle,wait =1);

mesh3 ThF=buildlayers(Thcercle,  
4\*m,  
zbound=[zmin,zmax],  
labelmid=rmid,  
labelup = rup,  
labeldown = rdown);

---

<div class="post-metadata">

**Author:** ![Yangshen](https://avatars.discourse-cdn.com/v4/letter/y/838e76/32.png) [@Yangshen](https://community.freefem.org/u/Yangshen)\
**Post date:** [August 23, 2022, 11:00am UTC](https://community.freefem.org/t/how-to-define-the-label-of-boundary-3d-cylinder-with-hole/1322/2 "2022-08-23T11:00:26Z")

</div>

hello  
I have the same question as you.Have you solved this question?

---

<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:** [August 23, 2022, 8:04pm UTC](https://community.freefem.org/t/how-to-define-the-label-of-boundary-3d-cylinder-with-hole/1322/3 "2022-08-23T20:04:18Z")

</div>

a solution: put label 3 on circle C1 and label 4 on circle C2.

[cyl-hole.edp](https://community.freefem.org/uploads/short-url/u3Ve6wNoV9qcKEOkbevsR7sTBiW.edp) (655 Bytes)

---

<div class="post-metadata">

**Author:** ![Yangshen](https://avatars.discourse-cdn.com/v4/letter/y/838e76/32.png) [@Yangshen](https://community.freefem.org/u/Yangshen)\
**Post date:** [August 24, 2022, 1:57am UTC](https://community.freefem.org/t/how-to-define-the-label-of-boundary-3d-cylinder-with-hole/1322/4 "2022-08-24T01:57:16Z")

</div>

Thank you.But I got more questions.  
1.Why the label of C2 is 4,I don’t see the label of C2 defined in rmid.  
2.In my understanding, the label on the upper surface is 1 and the label on the lower surface is 2,is my understanding correct？

---

<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:** [August 24, 2022, 8:10am UTC](https://community.freefem.org/t/how-to-define-the-label-of-boundary-3d-cylinder-with-hole/1322/5 "2022-08-24T08:10:43Z")

</div>

```auto
rmid=[1,3,2,4];
border C1(t1=0,2*pi){x=cx1+r1*cos(t1);y=cy1+r1*sin(t1);label=1;};
border C2(t1=0,2*pi){x=cx2+r2*cos(t1);y=cy2+r2*sin(t1);;label=2;};

```

in array mid say 1 become 3 and 2 become 4. on vertical face of the 3d object.  
See page 140 of the documentation. on The command buildlayers

---

<div class="post-metadata">

**Author:** ![Yangshen](https://avatars.discourse-cdn.com/v4/letter/y/838e76/32.png) [@Yangshen](https://community.freefem.org/u/Yangshen)\
**Post date:** [August 24, 2022, 10:19am UTC](https://community.freefem.org/t/how-to-define-the-label-of-boundary-3d-cylinder-with-hole/1322/6 "2022-08-24T10:19:15Z")

</div>

Thank you very much.I got it.
