# Regional attributes

**URL:** https://community.freefem.org/t/regional-attributes/3338
**Category:** General Discussion
**Created:** [June 23, 2024, 3:31am UTC](https://community.freefem.org/t/regional-attributes/3338 "2024-06-23T03:31:11Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![qingYang](https://avatars.discourse-cdn.com/v4/letter/q/9f8e36/32.png) [@qingYang](https://community.freefem.org/u/qingYang)
#### Post date: [June 23, 2024, 3:31am UTC](https://community.freefem.org/t/regional-attributes/3338/1 "2024-06-23T03:31:11Z")

</div>

Hello everyone, may I ask how the Regional attributes in the regionlist are generated when using Tetgen to generate mesh? how to get “145” as follow?

real[int] domain =[1.5,pi,0.75,145,0.0025];  
mesh3 Thfinal = tetg(Th33,switch=“paAAQY”,regionlist=domain);

---

<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: [June 24, 2024, 10:34am UTC](https://community.freefem.org/t/regional-attributes/3338/2 "2024-06-24T10:34:07Z")

</div>

I think you get a region number = 145 if the point [1.5,pi,0.75] is in the discrete domain , Pay attention to curved domain.

---

<div class="post-metadata">

### Author: ![qingYang](https://avatars.discourse-cdn.com/v4/letter/q/9f8e36/32.png) [@qingYang](https://community.freefem.org/u/qingYang)
#### Post date: [June 24, 2024, 1:02pm UTC](https://community.freefem.org/t/regional-attributes/3338/3 "2024-06-24T13:02:55Z")

</div>

> [@qingYang](#):
>
> attributes

Thank you for your reply, Professor.  
I tested using a simple case in the manual, where regional attributes=Th (x, y, z). region, but the results did not match the region list. I hope to receive your further explanation.  
[tet.edp](https://community.freefem.org/uploads/short-url/6iFcLysTIk1V1JRlU2ramYiKL0e.edp) (9.8 KB)

---

<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: [June 24, 2024, 1:30pm UTC](https://community.freefem.org/t/regional-attributes/3338/4 "2024-06-24T13:30:02Z")

</div>

Some correction, remark the region number od meshS is the surface number non a volume number.

```auto

 load "tetgen" 
  {   
    real hs = 0.1; // mesh size on sphere 
    int[int] N=[20,20,20];
    real [int,int] B=[[-1,1],[-1,1],[-1,1]];
    int [int,int] L=[[1,2],[3,4],[5,6]];
    
    ////////////////////////////////
    meshS ThH = SurfaceHex(N,B,L,1);
    meshS ThS =Sphere(0.5,hs,7,1); // "gluing" surface meshs to tolat boundary meshes
    cout << " xxxx" << ThH.nv << " " << ThS.nv << endl;
    
    meshS ThHS=ThH+ThS;
    plot(ThHS);
// soory MeshS no mesh3 wrong ..
   real voltet=(hs^3)/6.;
    cout << " voltet = " << voltet << endl;
    real[int] domaine = [0,0,0,1,voltet,0,0,0.7,2,voltet];
  
    mesh3 Th = tetg(ThHS,switch="pqaAAYYQ",nbofregions=2,regionlist=domaine);    
    cout << "3d regions " << regions(Th) << endl; 
   cout << " Th 3d = (0,0,0) " << Th(0,0,0).region<< endl;
  cout << " Th 3d = (0,0,0.7)" << Th(0,0,0.7).region<< endl;
   plot(Th,wait=1);
  }

```

---

<div class="post-metadata">

### Author: ![qingYang](https://avatars.discourse-cdn.com/v4/letter/q/9f8e36/32.png) [@qingYang](https://community.freefem.org/u/qingYang)
#### Post date: [June 24, 2024, 2:59pm UTC](https://community.freefem.org/t/regional-attributes/3338/5 "2024-06-24T14:59:51Z")

</div>

Thank you for your reply, Professor. If this number comes from a 3D mesh, but the 3D mesh requires this number to be generated, is this contradictory? For example, in the following case, how to determine this number in “int [int] domain”?  
[test.edp](https://community.freefem.org/uploads/short-url/2XlOKeWOS8ehOKBtI3CXwphiQyT.edp) (2.1 KB)

---

<div class="post-metadata">

### Author: ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)
#### Post date: [June 24, 2024, 3:31pm UTC](https://community.freefem.org/t/regional-attributes/3338/6 "2024-06-24T15:31:42Z")

</div>

The 4th argument (out of 5) of each region description in “regionlist” sets the label. You can choose it as you like!  
If you define as in your file  
`real[int] domaine = [0.2,0.2,1,0,voltet];`  
then the label of the region will be 0.  
If you set  
`real[int] domaine = [0,0,0,1,voltet,0,0,0.7,2,voltet];`  
then you will have two regions, the first with region label 1, and the second with region label 2.

---

<div class="post-metadata">

### Author: ![qingYang](https://avatars.discourse-cdn.com/v4/letter/q/9f8e36/32.png) [@qingYang](https://community.freefem.org/u/qingYang)
#### Post date: [June 25, 2024, 12:57am UTC](https://community.freefem.org/t/regional-attributes/3338/8 "2024-06-25T00:57:58Z")

</div>

Thank you for your help, Professor. In the following case, I did this, but the program process was killed without any errors，can you help me? please  
[test.edp](https://community.freefem.org/uploads/short-url/rx8UtKiQ2h0YYaZOsmVdoVIA9yX.edp) (2.2 KB)

---

<div class="post-metadata">

### Author: ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)
#### Post date: [June 25, 2024, 7:34am UTC](https://community.freefem.org/t/regional-attributes/3338/9 "2024-06-25T07:34:21Z")

</div>

I don’t see any problem in your code, it terminates normally after doing what it is asked to do!

---

<div class="post-metadata">

### Author: ![qingYang](https://avatars.discourse-cdn.com/v4/letter/q/9f8e36/32.png) [@qingYang](https://community.freefem.org/u/qingYang)
#### Post date: [June 25, 2024, 7:57am UTC](https://community.freefem.org/t/regional-attributes/3338/10 "2024-06-25T07:57:12Z")

</div>

Thank you, professor. I am looking for the reason for its abnormal termination. Have a good day

---

<div class="post-metadata">

### Author: ![qingYang](https://avatars.discourse-cdn.com/v4/letter/q/9f8e36/32.png) [@qingYang](https://community.freefem.org/u/qingYang)
#### Post date: [June 25, 2024, 11:53am UTC](https://community.freefem.org/t/regional-attributes/3338/11 "2024-06-25T11:53:07Z")

</div>

Make a brief mark here so that friends who have the same questions as me can refer to it. Thank you again to the two professors.  
Solution: 1. The number in the region list {4th} can be given freely by oneself; 2. If the program terminates inexplicably, check if (x, y, z) in the regionlist exceeds the limit
