About quad elements connectivity

Hello everyone!

Looking at the basix documentation (Basix documentation) I can see that the connectivity of a quadrilateral element is

2 ------ 3
| … … |
0 ------ 1

however, after creating a mesh using the mesh::create_rectangle, the obtained connectivity looks like

1 ------ 3
| … … |
0 ------ 2

Notice that this is not just a planar rotation of the one above.

Actually, looking at the DOLFINx code in charge of generating the rectangle mesh for quads the obtained connectivity makes perfect sense (see https://github.com/FEniCS/dolfinx/blob/8eefd77b79b8ddadfd7d320c0cae4665b61287e3/cpp/dolfinx/mesh/generation.h#L624C15-L624C15)

I am clueless about this. Are both connectivities right? Can I trust that the meshes always follow the second one?



The main take-away is that DOLFINx uses a tensor product ordering of the mesh vertices, as opposed to a clockwise or counter clockwise traversal of the nodes. We take the difference in the cell ordering into the cell by computing cell permutations, as described in detail in @mscroggs paper: Construction of Arbitrary Order Finite Element Degree-of-Freedom Maps on Polygonal and Polyhedral Cell Meshes | ACM Transactions on Mathematical Software

1 Like