# Trunc a mesh3 from a list of regions

**URL:** <https://community.freefem.org/t/trunc-a-mesh3-from-a-list-of-regions/2323>\
**Category:** General Discussion\
**Created:** [March 9, 2023, 10:16am UTC](https://community.freefem.org/t/trunc-a-mesh3-from-a-list-of-regions/2323 "2023-03-09T10:16:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrbenson](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mrbenson](https://community.freefem.org/u/mrbenson)\
**Post date:** [March 9, 2023, 10:16am UTC](https://community.freefem.org/t/trunc-a-mesh3-from-a-list-of-regions/2323/1 "2023-03-09T10:16:23Z")

</div>

Hello,

- Is it possible to extend the `trunc`function with an array region as argument ? It could be useful to write `trunc(Th,region=listRegion` or `trunc(Th,region=[region1,region2]` instead of writing the conditional test `region=region1||region=region2`, specially when the list of regions is long and already computed.

- Why `extract` function can’t directly use an explicit array as argument, something like: `extract(Th,label=[1,2])` ?

Best regards.

---

<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 10, 2023, 4:06pm UTC](https://community.freefem.org/t/trunc-a-mesh3-from-a-list-of-regions/2323/2 "2023-03-10T16:06:55Z")

</div>

an idea:

```auto
mesh Th=square(10,10);
Th=change(Th,fregion=int(x*5)+int(y*5)*5);
plot(Th,wait=1);
int[string] ok;
for(int i=0; i<25;i+=3)
  ok[i]=1;// def region i in ok map 
Th=trunc(Th,ok&region); // check if region is defined on ok map 
plot(Th,wait=1);
cout << ok << endl;

```

for the other question on extract I will see.

---

<div class="post-metadata">

**Author:** ![mrbenson](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mrbenson](https://community.freefem.org/u/mrbenson)\
**Post date:** [March 13, 2023, 4:44pm UTC](https://community.freefem.org/t/trunc-a-mesh3-from-a-list-of-regions/2323/3 "2023-03-13T16:44:21Z")

</div>

Thanks, so cool, it works fine.
