# Mixed Elements MeshConnectivity in python

**URL:** <https://fenicsproject.discourse.group/t/mixed-elements-meshconnectivity-in-python/3612>\
**Category:** Uncategorized\
**Created:** [June 23, 2020, 11:35am UTC](https://fenicsproject.discourse.group/t/mixed-elements-meshconnectivity-in-python/3612 "2020-06-23T11:35:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![odysgros](https://avatars.discourse-cdn.com/v4/letter/o/ba9def/32.png) [@odysgros](https://fenicsproject.discourse.group/u/odysgros)\
**Post date:** [June 23, 2020, 11:35am UTC](https://fenicsproject.discourse.group/t/mixed-elements-meshconnectivity-in-python/3612/1 "2020-06-23T11:35:47Z")

</div>

Hello. I am using mixed elements formulation (Lagrange and Raviart - Thomas ) and my domain is a 3D box inside another 3D box. I would like to ask how can i get nodes from one specific surface. For example i expect 6 nodes in every cell (3 from Lagrange and another 3 from Raviart Thomas) or in other words 4 nodes in every surface (3 from Lagrange and 1 from Raviart Thomas). With the following code i get only 3 nodes in every surface. I want something similar for my problem. Thank you very much !!!  
mesh = Mesh(“dolfinmesh.xml”)  
mesh\_file\_boundary=MeshFunction(‘size\_t’,mesh,“dolfinmesh\_bcfunc.xml”)

```
CG0 = FiniteElement("CG", mesh.ufl_cell(), 1)
RT1 = FiniteElement("RT", mesh.ufl_cell(), 1)
W = FunctionSpace(mesh, MixedElement((RT1, CG0)))

bcs = [DirichletBC(W.sub(0), Constant((0.0, 0.0, 10.0)), mesh_file_boundary, 6), 
  DirichletBC(W.sub(0), Constant((0.0, 0.0, -10.0)), mesh_file_boundary, 7)]

PecSurface = list()		
PmcSurface = list()		          
Pec_vertices = list()		
Pmc_vertices = list()		

mesh.init(3, 2)
c2f = mesh.topology()(3,2)
mesh.init(2,0)
f2v = mesh.topology()(2,0)

for cell in range(mesh.num_cells()):
	facets = c2f(cell)
	for facet in facets:
		vertices = f2v(facet)
		print(len(vertices))
		if mesh_file_boundary[facet] == 6:
			PecSurface.append(facet)
			PecSurface = list(dict.fromkeys(PecSurface))
			#ipologismos twn komvwn twn eswterikwn epifaneiwn
			for i in range(0,3):
				Pec_vertices.append(vertices[i])
				Pec_vertices = list(dict.fromkeys(Pec_vertices))
		elif mesh_file_boundary[facet] == 7:
			PmcSurface.append(facet)
			PmcSurface = list(dict.fromkeys(PmcSurface))
			for j in range(0,3):
				Pmc_vertices.append(vertices[j])
				Pmc_vertices = list(dict.fromkeys(Pmc_vertices))
```

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [June 23, 2020, 12:17pm UTC](https://fenicsproject.discourse.group/t/mixed-elements-meshconnectivity-in-python/3612/2 "2020-06-23T12:17:51Z")

</div>

Please following the instructions in [Read before posting: How do I get my question answered?](https://fenicsproject.discourse.group/t/read-before-posting-how-do-i-get-my-question-answered/21)  
Creating a minimal example with the appropriate spaces on a mesh such that it is easier for people to help you.
