There is a distinct split in DOLFINx between topology and geometry.
The topology describes a cell and its connectivity to vertices, ridges and facets. These will always be linear cells and described through vertices.
The geometry contains information about potentially higher order, curved cells, and thus what you find in mesh.geometry.x does not link 1-1 with the vertices in mesh.topology.index_map(0).
You can use entities_to_geometry to map between the two.
from mpi4py import MPI
import dolfinx
import numpy as np
domain = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 10, 10)
vertex_map = domain.topology.index_map(0)
num_owned_vertices = vertex_map.size_local
local_start = vertex_map.local_range[0]
domain.topology.create_connectivity(0, domain.topology.dim)
geometry_indices = dolfinx.mesh.entities_to_geometry(
domain, 0, np.arange(num_owned_vertices, dtype=np.int32)
).flatten()
coordinates = domain.geometry.x[geometry_indices]
for i in range(num_owned_vertices):
print(
f"Global Vertex {local_start + i} local geom index {geometry_indices[i]} {coordinates[i]}"
)