# DMplex can not read region number

**URL:** <https://community.freefem.org/t/dmplex-can-not-read-region-number/1368>\
**Category:** General Discussion\
**Created:** [December 6, 2021, 4:53pm UTC](https://community.freefem.org/t/dmplex-can-not-read-region-number/1368 "2021-12-06T16:53:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zcwang6](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zcwang6/32/371_2.png) [@zcwang6](https://community.freefem.org/u/zcwang6)\
**Post date:** [December 6, 2021, 4:53pm UTC](https://community.freefem.org/t/dmplex-can-not-read-region-number/1368/1 "2021-12-06T16:53:05Z")

</div>

Hello, I am trying to read a binary mesh from GMSH by DMplex; However, it seems DMplex can not read the correct region number; I also tried gmshload3 which works well. I am attaching my code and input mesh here for your information. Thx for the help.

The mesh CUBE1\_TEST.msh has region 1 inside; DMplex only have region 0 when read this file

[DMPLEX\_DEBUG.zip](https://community.freefem.org/uploads/short-url/qoiaTX42UWNom9WBOcRVEloD3Dx.zip) (1.3 MB)

---

<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:** [December 6, 2021, 7:29pm UTC](https://community.freefem.org/t/dmplex-can-not-read-region-number/1368/2 "2021-12-06T19:29:13Z")

</div>

I will have a look at this after the FreeFEM days. Thanks for the reproducer.

---

<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:** [December 10, 2021, 9:31am UTC](https://community.freefem.org/t/dmplex-can-not-read-region-number/1368/3 "2021-12-10T09:31:31Z")

</div>

This should be fixed in [Missing DMGetLabelValue(). · FreeFem/FreeFem-sources@da34345 · GitHub](https://github.com/FreeFem/FreeFem-sources/commit/da34345fa681016a399e7db966c6cb5d0755454a). In fact, `gmshload3` is wrong, I think. You can see from within Gmsh directly that there is no region 1, only region 2. The surface label is 1, however.

 ![Screenshot 2021-12-10 at 10.30.17 AM](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/2f77d98a29e4e6a2b2b7cadf97d8ee9d5cfbeaf4.jpeg)

---

<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:** [December 10, 2021, 9:54am UTC](https://community.freefem.org/t/dmplex-can-not-read-region-number/1368/4 "2021-12-10T09:54:32Z")

</div>

Indeed, just to confirm `gmshload3` is broken. If you output `labels(Th)`, you get

```auto
6
	  1 2 3 4 5
	  6

```

whereas with DMPlex, you get

```auto
1
	  1

```

---

<div class="post-metadata">

**Author:** ![zcwang6](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zcwang6/32/371_2.png) [@zcwang6](https://community.freefem.org/u/zcwang6)\
**Post date:** [December 10, 2021, 12:03pm UTC](https://community.freefem.org/t/dmplex-can-not-read-region-number/1368/5 "2021-12-10T12:03:03Z")

</div>

Thank you prj, I will go back to double check
