Hi everybody,

working with a-posteriori error estimates, I am interested in edge-cell connectivity to compute gradient fluxes over edges and edge-vertex connectivity to compute edge normals fast.

Is there a way to avoid a for loop to obtain these connectivities as arrays to work with them in vectorized computations?

Currently I am doing it as in the code example below, separating by boundary/non-boundary edges, but it slows down the vectorized a-posteriori error estimation quite bit.

Any help is appreciated! Thank you very much.

```
import fenics as fn
import numpy as np
from time import time
N = 400
mesh = fn.UnitSquareMesh(N,N)
time_init = 0
time_cells = 0
time_append = 0
start = time()
mesh.init(1,2) # Initialise mesh for edgewise computations
mesh.init(1,0)
top = mesh.topology()
c12 = top(1,2)
c10 = top(1,0)
num_edges = mesh.num_facets()
time_init = time() - start
inner_edge_cells = []
outer_edge_cells = []
inner_edge_vertices = []
outer_edge_vertices = []
for ind_edge in range(num_edges):
start = time()
cells = c12(ind_edge) # get cell/cells adjacent to edge
time_cells += time() - start
if(len(cells)==1):
start = time()
outer_edge_cells.append(cells[0])
outer_edge_vertices.append(c10(ind_edge)) # get vertices adjacent to edge
time_append += time() - start
else:
start = time()
inner_edge_cells.append([cells[0], cells[1]])
inner_edge_vertices.append(c10(ind_edge)) # get vertices adjacent to edge
time_append += time() - start
outer_edge_vertices_arr = np.array(outer_edge_vertices)
inner_edge_vertices_arr = np.array(inner_edge_vertices)
inner_edge_cells_arr = np.array(inner_edge_cells)
outer_edge_cells_arr = np.array(outer_edge_cells)
print("Time init: ", time_init)
print("Time cells: ", time_cells)
print("Time append: ", time_append)
```