# How we define a mesh in 1 D

**URL:** <https://community.freefem.org/t/how-we-define-a-mesh-in-1-d/680>\
**Category:** General Discussion\
**Created:** [December 10, 2020, 7:10pm UTC](https://community.freefem.org/t/how-we-define-a-mesh-in-1-d/680 "2020-12-10T19:10:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aicha](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Aicha](https://community.freefem.org/u/Aicha)\
**Post date:** [December 10, 2020, 7:10pm UTC](https://community.freefem.org/t/how-we-define-a-mesh-in-1-d/680/1 "2020-12-10T19:10:15Z")

</div>

Hi,  
how we define mesh of an interval [a,b] with FreeFem++?

Thank’s in advance

---

<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, 2020, 8:16pm UTC](https://community.freefem.org/t/how-we-define-a-mesh-in-1-d/680/2 "2020-12-10T20:16:41Z")

</div>

Please read the [documentation](https://doc.freefem.org/documentation/mesh-generation.html#id12), section “mesh generation”.

---

<div class="post-metadata">

**Author:** ![gero](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@gero](https://community.freefem.org/u/gero)\
**Post date:** [December 10, 2020, 8:45pm UTC](https://community.freefem.org/t/how-we-define-a-mesh-in-1-d/680/3 "2020-12-10T20:45:08Z")

</div>

Just some additional remarks:

```
load "msh3"

int n = 50;

real a = 5;
real b = 15;

meshL Th = Sline(n, [a + (1+1.0/(n-1)) * (b-a) * x, 0, 0]);

for (int i = 0; i < Th.nt; i++)
{
	cout << i << " " << Th[i][0].x << endl;
}

```

Sline seems to leave out the last point, so b is not included. Probably so that several 'Slines ’ can be linked together by simple addition. Sline does not provide a unit interval.

Thus I found that some scaling is required.

Also make sure that you use version 4.7.-1.

Kind regards  
Gerald

---

<div class="post-metadata">

**Author:** ![Aicha](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Aicha](https://community.freefem.org/u/Aicha)\
**Post date:** [December 10, 2020, 10:20pm UTC](https://community.freefem.org/t/how-we-define-a-mesh-in-1-d/680/4 "2020-12-10T22:20:07Z")

</div>

Thank you so much.

Kind regards
