File Exchange

image thumbnail

Edges generation

version 1.9 (2.94 MB) by

Algorithm generates edges of a conforming 2D/3D triangulation.



View License

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.

Comments and Ratings (6)

Jan Valdman

Jan Valdman (view profile)

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.

Sumit Gupta

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.

Jan Valdman

Jan Valdman (view profile)

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)


better description


function entryInWhichRows added




better description, difference to other methods


updated description

MATLAB Release
MATLAB 7.5 (R2007b)

Inspired: Double porosity model

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today