# How to use notaregion (identify if a point is within the domain)

**URL:** <https://community.freefem.org/t/how-to-use-notaregion-identify-if-a-point-is-within-the-domain/1105>\
**Category:** General Discussion\
**Created:** [July 19, 2021, 12:57pm UTC](https://community.freefem.org/t/how-to-use-notaregion-identify-if-a-point-is-within-the-domain/1105 "2021-07-19T12:57:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hezl09](https://avatars.discourse-cdn.com/v4/letter/h/f07891/32.png) [@hezl09](https://community.freefem.org/u/hezl09)\
**Post date:** [July 19, 2021, 12:57pm UTC](https://community.freefem.org/t/how-to-use-notaregion-identify-if-a-point-is-within-the-domain/1105/1 "2021-07-19T12:57:11Z")

</div>

Hi everyone,

I’m trying to identify if a point is in a working domain or not, so I write the following simple code:

mesh Th;  
Th = square(10,10,[0.+1.\*x,0.+1.\*y],region=1);  
plot(Th);  
cout \<\< "point (0.5,0.5) has a region number: " \<\< Th(0.5,0.5).region \<\< endl;  
cout \<\< "point (-100,-100) has a region number: " \<\< Th(-100,-100).region \<\< endl;

However, both of Th(0.5,0.5).region and Th(-100,-100).region return me a constant 1. I assume Th(-100,-100).region in the last line will give me a integer constant notaregion, which is a large negative value. So what is wrong with my interpretation above? Thanks!

---

<div class="post-metadata">

**Author:** ![julienG](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/julieng/32/222_2.png) [@julienG](https://community.freefem.org/u/julienG)\
**Post date:** [July 19, 2021, 2:16pm UTC](https://community.freefem.org/t/how-to-use-notaregion-identify-if-a-point-is-within-the-domain/1105/2 "2021-07-19T14:16:02Z")

</div>

You can do this

> mesh Th;  
> Th = square(10,10,[0.+1.\*x,0.+1.\*y]);  
> fespace V0h(Th,P0);  
> V0h Inside=1;  
> //  
> real xx=0.5; real yy=0.5;  
> if(!Inside(xx,yy)) cout \<\< “outside” \<\< endl;  
> else cout \<\< “inside” \<\< endl;

---

<div class="post-metadata">

**Author:** ![hezl09](https://avatars.discourse-cdn.com/v4/letter/h/f07891/32.png) [@hezl09](https://community.freefem.org/u/hezl09)\
**Post date:** [July 19, 2021, 6:19pm UTC](https://community.freefem.org/t/how-to-use-notaregion-identify-if-a-point-is-within-the-domain/1105/3 "2021-07-19T18:19:11Z")

</div>

This is a smart solution! I tried and it worked well for my problem. Thank you @julienG !
