# Building a mesh from meshL and mesh

**URL:** <https://community.freefem.org/t/building-a-mesh-from-meshl-and-mesh/3011>\
**Category:** General Discussion\
**Created:** [March 1, 2024, 2:07pm UTC](https://community.freefem.org/t/building-a-mesh-from-meshl-and-mesh/3011 "2024-03-01T14:07:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![larismartins](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/larismartins/32/2712_2.png) [@larismartins](https://community.freefem.org/u/larismartins)\
**Post date:** [March 1, 2024, 2:07pm UTC](https://community.freefem.org/t/building-a-mesh-from-meshl-and-mesh/3011/1 "2024-03-01T14:07:06Z")

</div>

Hi guys,

I was wondering if it’s possible to create a mesh combining meshL and normal mesh or if there’s a way to make these two meshes compatible.

For exemple, say I have a triangle  
meshL would be the mesh over the edges of this triangle  
mesh would be the mesh inside the triangle

Is there a way to guarantee that nodes from mesh are nodes from the meshL?

If anyone know something about this, I would be greatful!  
Thanks!

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [March 1, 2024, 8:32pm UTC](https://community.freefem.org/t/building-a-mesh-from-meshl-and-mesh/3011/2 "2024-03-01T20:32:30Z")

</div>

Perhaps the `emptymesh` command is helpful?  
[https://doc.freefem.org/documentation/mesh-generation.html#d-finite-element-space-on-a-boundary](https://doc.freefem.org/documentation/mesh-generation.html#d-finite-element-space-on-a-boundary)

---

<div class="post-metadata">

**Author:** ![larismartins](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/larismartins/32/2712_2.png) [@larismartins](https://community.freefem.org/u/larismartins)\
**Post date:** [March 4, 2024, 5:57pm UTC](https://community.freefem.org/t/building-a-mesh-from-meshl-and-mesh/3011/3 "2024-03-04T17:57:04Z")

</div>

Unfortunally, no.  
What I need is two independent meshes but they need to be compatible.  
For example, on the first mesh I need a polynomial space over the partitioned edge, it would be something like a P0 over each pice, in total, 10 dofs  
For the second square, P0 over the edges would give me 20 dofs  
But the mesh inside, I can refine as much as I want, as long as the nodes for the edge partition matches the mesh in the volume

 ![IMG_0529](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/6/6d77cfa68a4342f51e2340ac7026c7e8716f090e.png)

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [March 4, 2024, 6:15pm UTC](https://community.freefem.org/t/building-a-mesh-from-meshl-and-mesh/3011/4 "2024-03-04T18:15:08Z")

</div>

I believe what you are asking for could be achieved with `emptymesh` + `movemesh`, as long as the geometry is as simple as the one you’ve sketched.

Suppose the lower triangle is called `ThL`. Then do the following to create the upper triangle:

1. Use `emptymesh` to create a copy of `ThL` without any internal triangles: (e.g.: `ThLcopy = emptymesh(ThL);`)
2. Use `movemesh` to reflect this copy across the diagonal edge.

---

<div class="post-metadata">

**Author:** ![larismartins](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/larismartins/32/2712_2.png) [@larismartins](https://community.freefem.org/u/larismartins)\
**Post date:** [March 5, 2024, 10:00am UTC](https://community.freefem.org/t/building-a-mesh-from-meshl-and-mesh/3011/5 "2024-03-05T10:00:26Z")

</div>

I’m sorry, but I don’t think I explained myself right.

 ![Screenshot from 2024-03-05 09-58-16](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/3/340be53a822bcc24b68d94042501335a05e29362.png)  
This is the scenario, it’s two different meshes, but they need to be compatible

I tried to use emptymesh, but it’s not doing this
