dokken
March 14, 2021, 10:49am
2
You need to be more specific. What kind of mesh connectivity do you want, and what would you like to use it for?
There are already posts regarding how to initialize mesh connectivity in the forum, see for instance:
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))
or
Instead of using the filter function, you can simply unwrap it in multiple loops:
from dolfin import *
mesh = UnitSquareMesh(2, 2)
# Init facet-cell connectivity
tdim = mesh.topology().dim()
mesh.init(tdim - 1, tdim)
# For every cell, build a list of cells that are connected to its facets
# but are not the iterated cell
cell_neighbours = {}
for cell in cells(mesh):
index = cell.index()
cell_neighbours[index] = []
for facet in facets(cell):
facet_cells = facet.entities(tdiā¦
1 Like