# How to 1d intergrate along x/y direction in 2d mesh

**URL:** https://community.freefem.org/t/how-to-1d-intergrate-along-x-y-direction-in-2d-mesh/986
**Category:** General Discussion
**Created:** [May 20, 2021, 12:15pm UTC](https://community.freefem.org/t/how-to-1d-intergrate-along-x-y-direction-in-2d-mesh/986 "2021-05-20T12:15:54Z")
**Posts on this page:** 1
**Showing post:** 4

<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: [May 25, 2021, 9:48am UTC](https://community.freefem.org/t/how-to-1d-intergrate-along-x-y-direction-in-2d-mesh/986/4 "2021-05-25T09:48:08Z")

</div>

This is a other story,

One idea : use the levelest integral

```
load "msh3"
mesh Th=square(10,10);
meshL Lyh=segment(10,[0,x,0]);
fespace Vh(Th,P1);
fespace Lh(Lyh,P1);
Vh u =y+x; // 
Lh yy=y; 
Lh v ;
for [i,vi:v[]] {
	vi = int1d(Th,levelset=y-yy[][i])(u); // integral on y = yy[][i] of u ..
}
cout << v[] << endl; 

```

remark, we miss the last line y= 1 due to roundoff error.

---

_[View the full topic](https://community.freefem.org/t/how-to-1d-intergrate-along-x-y-direction-in-2d-mesh/986)._
