# Mesh connectivity in 3d

**URL:** https://community.freefem.org/t/mesh-connectivity-in-3d/223
**Category:** General Discussion
**Created:** [January 15, 2020, 3:38pm UTC](https://community.freefem.org/t/mesh-connectivity-in-3d/223 "2020-01-15T15:38:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jacoban90](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Jacoban90](https://community.freefem.org/u/Jacoban90)
#### Post date: [January 15, 2020, 3:38pm UTC](https://community.freefem.org/t/mesh-connectivity-in-3d/223/1 "2020-01-15T15:38:03Z")

</div>

Hi FreeFem community,

I have a 3d mesh and I need to get the data about the number of tetrahedrons and to obtain the adjacent elements of each one. According to the documentation, in 2d i can compute the number of triangles according to the command Th.nt and the adjacencies by Th.adj

[https://doc.freefem.org/documentation/mesh-generation.html#mesh-connectivity-and-data](https://doc.freefem.org/documentation/mesh-generation.html#mesh-connectivity-and-data)

However, it is not specified how to obtain the number of tetrahedrons in 3d. Also, I need to specify each element by its number to compute its adjacencies by using the above command.

Best Regards  
Jacob

---

<div class="post-metadata">

### Author: ![wbreganh](https://avatars.discourse-cdn.com/v4/letter/w/74df32/32.png) [@wbreganh](https://community.freefem.org/u/wbreganh)
#### Post date: [January 23, 2020, 9:29am UTC](https://community.freefem.org/t/mesh-connectivity-in-3d/223/2 "2020-01-23T09:29:40Z")

</div>

Hello,  
You can use the following code to test and visualize:

```auto
load "msh3"

mesh3 Th = cube(2, 1, 1);
cout << "Volume: " << Th.measure << endl;
cout << "Number of tetrahedron: " << Th.nt << endl;
cout << "Number of vertex: " << Th.nv << endl;
cout << "Number of boundary triangle: " << Th.nbe << endl;
plot(Th);

```

This [section](https://doc.freefem.org/documentation/mesh-generation.html#d-mesh-generation) explains a little bit.

---

<div class="post-metadata">

### Author: ![Jacoban90](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Jacoban90](https://community.freefem.org/u/Jacoban90)
#### Post date: [February 3, 2020, 4:09pm UTC](https://community.freefem.org/t/mesh-connectivity-in-3d/223/3 "2020-02-03T16:09:20Z")

</div>

Hello,

Thank you very much for your reply. Yes, finally worked by using the commands you mentioned in the previous post.

Best regards
