# Error of splitmesh( )

**URL:** <https://community.freefem.org/t/error-of-splitmesh/2662>\
**Category:** General Discussion\
**Created:** [August 21, 2023, 2:13pm UTC](https://community.freefem.org/t/error-of-splitmesh/2662 "2023-08-21T14:13:18Z")\
**Posts on this page:** 1\
**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:** [August 21, 2023, 2:13pm UTC](https://community.freefem.org/t/error-of-splitmesh/2662/1 "2023-08-21T14:13:18Z")

</div>

splitmesh () cannot work for a region with a hole, for example:

```auto
border a1(t=0,1) {x=t; y=0 ;label=1;};
border a2(t=0,1) {x=1; y=t ;label=2;};
border a3(t=1,0) {x=t; y=1 ;label=3;};
border a4(t=1,0) {x=0; y=t ;label=4;};

//hole
real r=0.15, x0=0.5, y0=0.5;
border disc(t=0, 2*pi) {x=x0+r*cos(t); y=y0+r*sin(t); label=5;};  

int m=30;
mesh Th = buildmesh(a1(10)+a2(10)+a3(10)+a4(10)+disc(-m));
plot(Th, wait=1);

func SplitRegion= x<0.15? 3:1;
Th = splitmesh(Th, SplitRegion);

plot(Th,wait=1);

```

The above code works perfectly well if there is not hole, such as

> disc(m)

instead of

> disc(-m)

Anyone ideas? Thanks a lot in advance.
