View License

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

» Watch video

Highlights from
Edges generation

5.0 | 1 rating Rate this file 14 Downloads (last 30 days) File Size: 2.94 MB File ID: #22299 Version: 1.9
image thumbnail

Edges generation


Jan Valdman (view profile)


03 Dec 2008 (Updated )

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

| Watch this File

File Information

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.


This file inspired Double Porosity Model.

Required Products MATLAB Compiler
MATLAB release MATLAB 7.5 (R2007b)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
15 Sep 2016 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.

Comment only
14 Sep 2016 Sumit Gupta

have any one used this code for 3D tetrahedral element?

Comment only
06 Jun 2010 Immanuel Anjam

Works nicely and very fast for 3D also. The updated code is even more short and elegant than before. Nice.

Comment only
05 May 2009 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.

Comment only
05 May 2009 Immanuel Anjam

05 May 2009 Immanuel Anjam

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.

Comment only
04 Dec 2008 1.1

updated description

05 Dec 2008 1.2

better description, difference to other methods

05 Dec 2008 1.5


06 Dec 2008 1.6

function entryInWhichRows added

06 Dec 2008 1.7

better description

06 May 2009 1.9

Extended to 3D (many thanks to John D'Errico for his speed up advice)

15 Sep 2016 1.9

test.m updated for better readability

Contact us