# Dofmap\[icell\] and links(icell) return different local connectivities in parallel

**URL:** <https://fenicsproject.discourse.group/t/dofmap-icell-and-links-icell-return-different-local-connectivities-in-parallel/15936>\
**Category:** General\
**Created:** [September 30, 2024, 4:13pm UTC](https://fenicsproject.discourse.group/t/dofmap-icell-and-links-icell-return-different-local-connectivities-in-parallel/15936 "2024-09-30T16:13:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ordinary-slim](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/ordinary-slim/32/4821_2.png) [@ordinary-slim](https://fenicsproject.discourse.group/u/ordinary-slim)\
**Post date:** [September 30, 2024, 4:13pm UTC](https://fenicsproject.discourse.group/t/dofmap-icell-and-links-icell-return-different-local-connectivities-in-parallel/15936/1 "2024-09-30T16:13:12Z")

</div>

For this particular mesh of dimension `cdim=2`, when ran in parallel across 3 processors, the local connectivities obtained from `domain.geometry.dofmap[icell]` and `domain.topology.connectivity(cdim,0).links(icell)` are different for `icell=3` on the first (zeroth) rank:

```auto
from dolfinx import mesh
from mpi4py import MPI
import numpy as np

comm = MPI.COMM_WORLD
rank = comm.Get_rank()

tdim = 2
domain = mesh.create_unit_square(
    MPI.COMM_WORLD, 4, 4, mesh.CellType.triangle, dtype=np.float64,
)
domain.topology.create_connectivity(tdim,0)
cpc = domain.topology.connectivity(tdim,0)
if (rank == 0):
    icell = 3
    local_nodes_con = cpc.links(icell)
    local_nodes_dofmap = domain.geometry.dofmap[icell]
    print(f"incident nodes 3rd element:\n",
          f"As computed from connectivity : {local_nodes_con}\n",#[9 1 3]
          f"As computed from dofmap : {local_nodes_dofmap}",)#[8 1 3]

```

The correct nodes of the cell are [8, 1, 3] but `domain.topology.connectivity(cdim,0).links(3)` outputs [9,1,3]. Note that both nodes 8 and 9 are ghost nodes.

I tried this from the latest commit and from a commit from the 23rd of September.

Am I doing something wrong?

---

<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:** [September 30, 2024, 5:43pm UTC](https://fenicsproject.discourse.group/t/dofmap-icell-and-links-icell-return-different-local-connectivities-in-parallel/15936/2 "2024-09-30T17:43:01Z")

</div>

The geometry and topology dofmap does not necessarily use the same ghost ordering.

You need to use the function `dolfinx.mesh.entities_to_geometry` to map vertices to geoemtry nodes. See for instance

> [@Locate\_entities returning incorrect points with MPI](https://fenicsproject.discourse.group/t/locate-entities-returning-incorrect-points-with-mpi/15853/4):
>
> Since entities can be edges, facets or cells, it would return (num entities, num nodes per entity). Since your case is a vertex, there is only one node (1-1 map). I would call: idx = entities\_to\_geometry(mesh, 0, entity\_idx).flatten() Rather than doing it after
