Mesh entities connectivities

Asked by Yi Jiang

Hi all,

I would like to find the relationships between a mesh entities (facets and edges) and mesh vertices. I know that mesh.cells() can provide the connectivities of all cells of a mesh. Is there any similar functions to get those information of facets and edges? If not, how can I get it? I am using python interface.

Any hint would be highly appreciated.

Best Regards,

Yi

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Yi Jiang
Solved:
Last query:
Last reply:
Revision history for this message
Johan Hake (johan-hake) said :
#1

This can be done in two ways:

mesh = UnitCube(2,2,2)

# First initialize the connection information
mesh.init(2)
mesh.init(1)

# Method 1
# Get Topology object
top = mesh.topology()

# Create the two Connectivities you are interested in
conn10 = top(1,0)
conn20 = top(2,0)

# Then you just call the Connectivity objects

print "Vertices connected to the second edge", conn10(1)
print "Vertices connected to the first face", conn20(0)

# Method 2

for face in faces(mesh):
  print "Vertices connected to face:", face.index(), face.entities(0)

for edge in edges(mesh):
  print "Vertices connected to edge:", edge.index(), edge.entities(0)

Johan

On Tuesday May 10 2011 19:55:48 Yi Jiang wrote:
> New question #156964 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/156964
>
> Hi all,
>
> I would like to find the relationships between a mesh entities (facets and
> edges) and mesh vertices. I know that mesh.cells() can provide the
> connectivities of all cells of a mesh. Is there any similar functions to
> get those information of facets and edges? If not, how can I get it? I am
> using python interface.
>
> Any hint would be highly appreciated.
>
> Best Regards,
>
> Yi

Revision history for this message
Yi Jiang (yijiang) said :
#2

Thanks Johan, that solved my problem.