Given a conforming triangulation as as matrix of vertices numbers corresponding to each triangular element , the algorithm generates and numbers edges of triangulation, so that edges shared by two elements are counted only once. It also generates list of edges belonging to each triangle a list of elements sharing the same edge.
Knowledge of edges is useful e.g. for the implementation of adaptive mesh refinements and edge-based finite elements such as Raviart-Thomas, Crouzeix-Raviart or Nedelec elements.
To test the functionality of the algorithm, run "test.m".
Performance of my notebook:
2D triangulation: 524288 elements, 263169 nodes --> 787456 edges numbered. Time= 1.23 seconds.
3D triangulation: 196608 elements, 35937 nodes --> 238688 edges numbered. Time= 1.12 seconds.
Yes, you can use it for tetrahedral meshes, see the file test.m in cases 4 and 5. I rewrote this file for better understanding.
have any one used this code for 3D tetrahedral element?
Works nicely and very fast for 3D also. The updated code is even more short and elegant than before. Nice.
I am still working on extension to 3D, I already know one way, how to do it. Hope to provide the code soon.
Greetings from Finland!
Thanks for sharing this code. I have been using it alongside a 2D Nedelec-FEM implementation.
This kind of code could be useful in 3D also. It seems that mesh generators always provide elements in terms of nodes, but for edge-based finite elements it is necessary to have the information in terms of edges.
test.m updated for better readability
Extended to 3D (many thanks to John D'Errico for his speed up advice)
function entryInWhichRows added
better description, difference to other methods