# What is the difference between compute\_incident\_entities and entities\_to\_geometry?

**URL:** <https://fenicsproject.discourse.group/t/what-is-the-difference-between-compute-incident-entities-and-entities-to-geometry/14867>\
**Category:** dolfinx\
**Created:** [June 2, 2024, 1:13am UTC](https://fenicsproject.discourse.group/t/what-is-the-difference-between-compute-incident-entities-and-entities-to-geometry/14867 "2024-06-02T01:13:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![French\_fries](https://avatars.discourse-cdn.com/v4/letter/f/71c47a/32.png) [@French\_fries](https://fenicsproject.discourse.group/u/French_fries)\
**Post date:** [June 2, 2024, 1:13am UTC](https://fenicsproject.discourse.group/t/what-is-the-difference-between-compute-incident-entities-and-entities-to-geometry/14867/1 "2024-06-02T01:13:21Z")

</div>

When I run the following code：

```auto
boundary_vertices = dolfinx.mesh.compute_incident_entities(mesh.topology, boundary_facets, mesh.topology.dim-1, 0)
print(boundary_vertices)
vertex_to_geometry = dolfinx.cpp.mesh.entities_to_geometry(mesh._cpp_object, 0, boundary_vertices, False) 
print(vertex_to_geometry)

```

the results are as follows：

```auto
[16 23 26 28 29]
[[16]
 [23]
 [26]
 [28]
 [29]]

```

with these numbers representing vertex indices. I’ve looked at the source code of the functions, but I’m still not clear on the difference between these two functions. Could someone help explain?

 ![ddea76440b75d9ac652959c8daba137](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/2/2e521dbed860eed4b21a1a0c44a6860913068fde.png)  
 ![de51fcc6b3397254850088aaec4a77a](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/e/e2430b1683d5e479bf2bb47a05ab6e1071682950.png)

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [June 2, 2024, 3:38am UTC](https://fenicsproject.discourse.group/t/what-is-the-difference-between-compute-incident-entities-and-entities-to-geometry/14867/2 "2024-06-02T03:38:05Z")

</div>

entities to geometry computes the geometry (node indices) of an entity of any dimension (vertex, Edge, facet, cell). The nodes are listed per entity.

Compute incident entities takes in a list of entities, and returns a single list of all entities of dimension d1 connected to these.

In the case of a linear geometry, all nodes = vertices, and the connectivities might be the same for your call (not always guaranteed).

---

<div class="post-metadata">

**Author:** ![French\_fries](https://avatars.discourse-cdn.com/v4/letter/f/71c47a/32.png) [@French\_fries](https://fenicsproject.discourse.group/u/French_fries)\
**Post date:** [June 2, 2024, 7:27am UTC](https://fenicsproject.discourse.group/t/what-is-the-difference-between-compute-incident-entities-and-entities-to-geometry/14867/3 "2024-06-02T07:27:44Z")

</div>

Thank you, this explanation is very clear.
