This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How do I access connectivity of a mesh?

+3 votes

In a 2D setting, suppose I have a mesh and want to know what cells (dimension 2) are neighbors to some cells (dimension 2). I can compute the connectivity by doing, in Python:

mesh.init(2,2)

Then I believe I get a string with the relevant information by:

mt = mesh.topology()
mc = mt(2,2)
mc.str(1)

Is it possible to somehow get access to this connectivity information as arrays or similar?

asked Aug 19, 2013 by hellman FEniCS Novice (360 points)
edited Aug 19, 2013 by hellman

1 Answer

+2 votes
 
Best answer

The connectivity for entity 0 is given as an array by:

connections_220 = mc(0)

and the whole connectivity array is given by:

connections_22 = mc()

but this information is useless without the offset for each entities.

answered Aug 19, 2013 by johanhake FEniCS Expert (22,480 points)
selected Aug 19, 2013 by hellman
...