Connectivity for all edges

Hi,

do we have an analog to mesh.cells() that returns an array of edge connectivities, as shown in the mwe?

from dolfin import *

mesh = UnitCubeMesh(2,2,2)
cells = mesh.cells()
#edges = mesh.edges()

Consider:

from dolfin import *

mesh = UnitCubeMesh(2,2,2)
cells = mesh.cells()
mesh.init(mesh.topology().dim()-2, 0)

edge_to_vertex = mesh.topology()(mesh.topology().dim()-2, 0)
for edge in range(mesh.num_edges()):
    print(edge, edge_to_vertex(edge))

2 Likes

Hi,

How can I convert this code to Dolfinx 0.8.0 and Fenicsx 0.7.0?

This snippet

    mesh.topology.create_connectivity(mesh.topology.dim, 0)
    cell_to_vertices = mesh.topology.connectivity(mesh.topology.dim, 0)

creates the cell to vertex connectivity of a given mesh object. Change mesh.topology.dim and/or 0 to get the connectivity of other topological dimensions.

1 Like