# Computing node, cell and face incidence in 3D structured meshes

I'm developing a PDE discretization algorithm that works on 3D uniform structured meshes. For this algorithm, I often have to traverse the mesh nodes and get the ids of all the faces and all the cells connected to the node. Another common operation is to traverse the cells and get the ids of their faces.

Because my grid is of the simplest type, I don't want to use a mesh generator. Instead, knowing that I have only these three operations (let's call them get_node_cells(node_id), get_node_faces(node_id), get_cell_faces(cell_id)), I would like to assume a consistent numbering system and work out explicit expressions for these. In 2D this is relatively easy to be done. I have simply sketched a simple example (5 cells x 5 cells) and figured out the general rule for these operations based on the number of cells in x and y direction. In 3D it gets complicated because you can barely visualize or sketch a simple example.

Has anyone faced a similar challenge and would be able to shed light on this problem? Maybe there's a mathematical "shortcut" to get these node and cell entities?

Thanks!

• It's seems you are trying to reinvent the wheel... I suggest to use a well known library that does all the thing that you are trying to do for you free and efficiently: vtk.org – Alone Programmer Mar 25 at 5:28
• Hello, I appreciate your reply, and I understand this is done in several meshers and libraries. But it is a restriction that I have right now, NOT to use any specific library. Specially due to the simpleness of my mesh, being 3D structured and uniform. I'm about to nail down these things manually, so instead of linking a cannon to kill a bird, I'll be able to relate node, cell and faces ids in one line of code. Cheers! – Rafael March Mar 25 at 19:32