diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d16386367f7cd7dd3c1842c484239e9e82a25efc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+build/
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e766b7fa84f77068f0eba62ddfe9a9eeaa5ba86d
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.10)
+
+project(go)
+
+set(CMAKE_CXX_STANDARD 11)
+
+include_directories(src)
+
+add_executable(go src/msh.h src/msh.cpp src/main.cpp)
\ No newline at end of file
diff --git a/catfiles.py b/catfiles.py
new file mode 100644
index 0000000000000000000000000000000000000000..4b0e32a37ea6909edaf50022818ebab8beec6a84
--- /dev/null
+++ b/catfiles.py
@@ -0,0 +1,12 @@
+# small utility for concatenating files
+# the filenames are given in the list "name"
+# each file is preceded by "////////// filename" and followed by a newline
+# the output file is "output.txt"
+
+name = [ "CMakeLists.txt", "src/msh.h", "src/msh.cpp", "src/main.cpp"]
+with open("output.txt", "w") as outfile:
+    for fname in name:
+        with open(fname) as infile:
+            outfile.write("/////////// " + fname + "\n")
+            outfile.write(infile.read())
+            outfile.write("\n\n")            
\ No newline at end of file
diff --git a/doc/info-s6-l3math-tp2.tex b/doc/info-s6-l3math-tp2.tex
new file mode 100644
index 0000000000000000000000000000000000000000..deff489e4caed38777f5794484ec6541fbe77824
--- /dev/null
+++ b/doc/info-s6-l3math-tp2.tex
@@ -0,0 +1,120 @@
+% !TeX ltex: language=fr
+\documentclass[a4paper,12pt]{article}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{amsmath}
+\usepackage{amsfonts}
+\usepackage{amssymb}
+\usepackage{graphicx}
+\usepackage{listings}
+\usepackage{xcolor}
+\usepackage[french]{babel}
+
+\synctex=1
+
+% pas d'indentation en début de paragraphe
+\setlength{\parindent}{0pt}
+% ... mais un petit espace entre les paragraphes
+\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
+
+% listing parameters (use scriptsize font)
+\lstset{
+  basicstyle=\ttfamily\scriptsize,
+  breaklines=true,
+  frame=single,
+  numbers=left,
+  numberstyle=\tiny,
+  stepnumber=1,
+  numbersep=5pt,
+  showspaces=false,
+  showstringspaces=false,
+  tabsize=2,
+  captionpos=b,
+  escapeinside={(*@}{@*)},
+  literate={á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1 {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1 {à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1 {À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1 {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1 {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1 {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1 {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1 {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1 {ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1 {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1 {€}{{\EUR}}1 {£}{{\pounds}}1
+}
+
+\lstdefinelanguage{cmake}{
+  keywords={
+    project, cmake\_minimum\_required, add\_executable, add\_library,
+    target\_link\_libraries, include\_directories, find\_package, find\_library,
+    find\_path, find\_file, set, message, option, if, elseif, else, endif,
+    foreach, endforeach, while, endwhile, function, endfunction, macro,
+    endmacro, install, configure\_file, add\_subdirectory, include,
+    file, list, string, target\_include\_directories, target\_compile\_options,
+    target\_compile\_definitions, target\_sources
+  },
+  keywordstyle=\color{blue}\bfseries,
+  morecomment=[l]{\#},  % Line comments start with #
+  commentstyle=\color{gray}\ttfamily,
+  morestring=[b]",      % Double-quoted strings
+  morestring=[b]',      % Single-quoted strings
+  stringstyle=\color{red}\ttfamily,
+  sensitive=true        % CMake is case-sensitive
+}
+
+\title{Travaux Pratiques : Manipulation de Maillages en C++}
+\author{}
+\date{}
+
+\begin{document}
+
+\maketitle
+
+\section{Programmes fournis}
+
+Le code fourni comprend une classe \texttt{Mesh} qui représente un maillage 2D composé de nœuds et de triangles. Le maillage est lu à partir d'un fichier au format Gmsh (.msh). Le programme principal lit un fichier de maillage nommé \texttt{square.msh} et génère un fichier lisible par Gnuplot pour visualiser le maillage.
+
+Pour compiler et lancer le programme, utilisez les commandes suivantes dans le terminal :
+\begin{verbatim}
+mkdir build
+cd build
+cmake ..
+make
+./go
+gnuplot gnu.plt
+\end{verbatim}
+
+Pour générer un maillage plus fin, modifier le paramètre \texttt{raf} du fichier \texttt{square.geo} et relancer Gmsh. Puis taper (dans le bon dossier) :
+\begin{verbatim}
+gmsh square.geo -format msh2 -2 -o square.msh
+\end{verbatim}
+
+\section{Questions}
+
+\subsection{Écrire une fonction naïve pour trouver le triangle contenant un point}
+
+Écrivez une fonction qui, étant donné un point, retrouve le numéro d'un triangle qui le contient. Commencez par une fonction naïve qui parcourt tous les triangles du maillage.
+
+\subsection{Écrire une fonction efficace utilisant une hashmap}
+
+Écrivez une fonction plus efficace qui utilise une hashmap pour accélérer la recherche du triangle contenant un point. Vous pouvez découper l'espace en un quadrillage dont le pas sera choisi judicieusement. Pour chaque carré, il faut construire la liste des triangles qui l'intersectent. Vérifiez l'accélération du nouvel algorithme par rapport à la version naïve en fonction de la finesse du maillage.
+
+\subsection{Écrire une fonction naïve pour trouver les triangles voisins}
+
+Écrivez une fonction qui construit la liste des triangles voisins d'un triangle donné par les arêtes. Commencez par une fonction naïve qui parcourt tous les triangles du maillage.
+
+\subsection{Écrire une fonction efficace utilisant une hashmap}
+
+Écrivez une fonction plus efficace qui utilise une hashmap pour accélérer la recherche des triangles voisins. Vérifiez l'accélération du nouvel algorithme par rapport à la version naïve en fonction de la finesse du maillage.
+
+\section{Annexes}
+
+\subsection{Code fourni}
+
+\subsubsection{CMakeLists.txt}
+\lstinputlisting[language=cmake]{../CMakeLists.txt}
+
+\subsubsection{src/msh.h}
+\lstinputlisting[language=c++]{../src/msh.h}
+
+\subsubsection{src/msh.cpp}
+\lstinputlisting[language=c++]{../src/msh.cpp}
+
+\subsubsection{src/main.cpp}
+\lstinputlisting[language=c++]{../src/main.cpp}
+
+\subsubsection{square.geo}
+\lstinputlisting[language=c++]{../square.geo}
+
+\end{document}
diff --git a/square.geo b/square.geo
new file mode 100644
index 0000000000000000000000000000000000000000..ae188b74ac0d5a7ae66915504ce5523d2b086476
--- /dev/null
+++ b/square.geo
@@ -0,0 +1,19 @@
+// maillage avec gmsh square.geo -2 -format msh2
+raf= 0.1;
+L=1;
+Point(1)= {0,0,0,raf};
+Point(2)= {L,0,0,raf};
+Point(3)= {L,L,0,raf};
+Point(4)= {0,L,0,raf};
+
+Line(1)= {1,2};
+Line(2)= {2,3};
+Line(3)= {3,4};
+Line(4)= {4,1};
+
+Line Loop(1)= {1,2,3,4};
+Plane Surface(1)= {1};
+
+Mesh.ElementOrder=1 ;
+Mesh.SecondOrderIncomplete=1;
+
diff --git a/square.msh b/square.msh
new file mode 100644
index 0000000000000000000000000000000000000000..3aab3e9d699c60f444fe845a75ab61bef7664452
--- /dev/null
+++ b/square.msh
@@ -0,0 +1,437 @@
+$MeshFormat
+2.2 0 8
+$EndMeshFormat
+$Nodes
+142
+1 0 0 0
+2 1 0 0
+3 1 1 0
+4 0 1 0
+5 0.09999999999981467 0 0
+6 0.1999999999995579 0 0
+7 0.2999999999992664 0 0
+8 0.3999999999989749 0 0
+9 0.4999999999986943 0 0
+10 0.5999999999989468 0 0
+11 0.69999999999921 0 0
+12 0.7999999999994734 0 0
+13 0.8999999999997368 0 0
+14 1 0.09999999999981467 0
+15 1 0.1999999999995579 0
+16 1 0.2999999999992664 0
+17 1 0.3999999999989749 0
+18 1 0.4999999999986943 0
+19 1 0.5999999999989468 0
+20 1 0.69999999999921 0
+21 1 0.7999999999994734 0
+22 1 0.8999999999997368 0
+23 0.8999999999995836 1 0
+24 0.7999999999999998 1 0
+25 0.7000000000006934 1 0
+26 0.6000000000013869 1 0
+27 0.5000000000020587 1 0
+28 0.4000000000016644 1 0
+29 0.3000000000012483 1 0
+30 0.2000000000008322 1 0
+31 0.100000000000416 1 0
+32 0 0.8999999999995836 0
+33 0 0.7999999999999998 0
+34 0 0.7000000000006934 0
+35 0 0.6000000000013869 0
+36 0 0.5000000000020587 0
+37 0 0.4000000000016644 0
+38 0 0.3000000000012483 0
+39 0 0.2000000000008322 0
+40 0 0.100000000000416 0
+41 0.4500000000018615 0.9133974596216763 0
+42 0.09236792741065183 0.4605742807381246 0
+43 0.5499999999988205 0.08660254037843171 0
+44 0.9152217186777626 0.5468402906274979 0
+45 0.6500000000008003 0.9133974596219512 0
+46 0.08885430207258679 0.6509201999022066 0
+47 0.9133974596218086 0.3499999999991206 0
+48 0.3475303635242553 0.08190748804974723 0
+49 0.9103703875043376 0.758672565470732 0
+50 0.250817301762687 0.9138693290130382 0
+51 0.7459788032314767 0.07959225689678917 0
+52 0.0866025403788042 0.2500000000010402 0
+53 0.0905697247447483 0.8408174380938657 0
+54 0.8495762630717529 0.9153227954948183 0
+55 0.1504237369277891 0.08467720450543256 0
+56 0.9170502595852439 0.150593231699023 0
+57 0.3501362169619658 0.9134761045201358 0
+58 0.4000227028286922 0.8268080267265111 0
+59 0.5000037838059685 0.8267971038241898 0
+60 0.4500044144404198 0.7401949275428532 0
+61 0.5500013663751487 0.7401931677420533 0
+62 0.5000009634704362 0.6535903947466354 0
+63 0.3996660322685217 0.6539624100660314 0
+64 0.4492890262150219 0.5674132367139483 0
+65 0.5498816649485163 0.5670583805869818 0
+66 0.4998617818618977 0.4804675945786102 0
+67 0.5999572411359392 0.480410410952493 0
+68 0.3992029949383342 0.4808333042715239 0
+69 0.4498441294682413 0.3938707812513984 0
+70 0.3508014145113754 0.3944261231392706 0
+71 0.6499731510146841 0.5670034207262444 0
+72 0.7044542185661737 0.4836609274158974 0
+73 0.6507352432846275 0.3943325211712253 0
+74 0.2989417123120313 0.4807819782420582 0
+75 0.4001075906650122 0.3073017552560429 0
+76 0.3000000000029333 0.3071796769753512 0
+77 0.4999919533568896 0.3072147840053003 0
+78 0.450000000002497 0.2205771365973901 0
+79 0.7516124797967327 0.5701303236396059 0
+80 0.7002642718023641 0.6541163631790485 0
+81 0.75353581093975 0.3987254670893927 0
+82 0.7000000000012374 0.3071796769756577 0
+83 0.8000000000003887 0.6535898384882726 0
+84 0.7471434102059782 0.7386054505286095 0
+85 0.5500000000021412 0.2205771365975499 0
+86 0.8109810542586333 0.3047536098154711 0
+87 0.7487737367126546 0.2215627586077861 0
+88 0.3001627035935244 0.8268888562051476 0
+89 0.1994089234458853 0.8296981761685946 0
+90 0.2499286045088536 0.7410578833522045 0
+91 0.1494939110587456 0.7431601482469269 0
+92 0.1967429917984385 0.6534863612147317 0
+93 0.147506470839524 0.5596891567283326 0
+94 0.2461396475416216 0.5647585225755524 0
+95 0.2006125504552571 0.4738835212418011 0
+96 0.1629581819743509 0.3803886475363472 0
+97 0.3488732355465843 0.5672558538991082 0
+98 0.6000008583640311 0.8267954148199791 0
+99 0.8994183955992582 0.6528983889292932 0
+100 0.6499999999991334 0.08660254037864022 0
+101 0.9157740970141776 0.4494733817703521 0
+102 0.8167956118738322 0.4899817334731325 0
+103 0.4498499977837827 0.08393456559302377 0
+104 0.5500007736960177 0.9133979063146327 0
+105 0.2471893802660855 0.08407329706072977 0
+106 0.1856343100128921 0.1794039491425673 0
+107 0.9132469817449553 0.250891140252 0
+108 0.600020236268652 0.65369235097448 0
+109 0.7499293771789073 0.9137183489341745 0
+110 0.3492006954957146 0.2288327370242558 0
+111 0.5500650581848782 0.3939126281557883 0
+112 0.6495716905027346 0.7400329444146918 0
+113 0.6994408893754025 0.8265574229272837 0
+114 0.6001320424719059 0.3072989805838407 0
+115 0.8150407418201517 0.8183024367054094 0
+116 0.6500000000016618 0.2205771365975225 0
+117 0.3499640762739979 0.7407829625697138 0
+118 0.2985524313230029 0.6535506656128902 0
+119 0.1530678781041704 0.9178724624824317 0
+120 0.9167537064254057 0.8508718537559957 0
+121 0.08296629115975593 0.1498875452108657 0
+122 0.1890575670468489 0.294084236215794 0
+123 0.8440933898604551 0.09385434397709344 0
+124 0.2503952377171327 0.3884573638917703 0
+125 0.07972803913531336 0.3493512757062616 0
+126 0.8380531170040466 0.1999999999995609 0
+127 0.8406928938275633 0.3992789991981976 0
+128 0.2898261153518068 0.1633999302292042 0
+129 0.06578358757521613 0.7469795572487384 0
+130 0.6999999999992164 0.1535898384871379 0
+131 0.5999999999988372 0.1535898384867515 0
+132 0.4999999999989005 0.1535898384865984 0
+133 0.3977345286928261 0.1553736159967032 0
+134 0.832596189432156 0.730144284150142 0
+135 0.06525626353167122 0.5500000000017229 0
+136 0.8366096411895949 0.5826881150315604 0
+137 0.2613872612265488 0.2359890604552143 0
+138 0.926794919243098 0.9267949192431389 0
+139 0.07320508075687601 0.9267949192431241 0
+140 0.9267949192432314 0.07320508075664824 0
+141 0.07320508075662228 0.07320508075678341 0
+142 0.7753798093615698 0.1497198395936735 0
+$EndNodes
+$Elements
+286
+1 15 2 0 1 1
+2 15 2 0 2 2
+3 15 2 0 3 3
+4 15 2 0 4 4
+5 1 2 0 1 1 5
+6 1 2 0 1 5 6
+7 1 2 0 1 6 7
+8 1 2 0 1 7 8
+9 1 2 0 1 8 9
+10 1 2 0 1 9 10
+11 1 2 0 1 10 11
+12 1 2 0 1 11 12
+13 1 2 0 1 12 13
+14 1 2 0 1 13 2
+15 1 2 0 2 2 14
+16 1 2 0 2 14 15
+17 1 2 0 2 15 16
+18 1 2 0 2 16 17
+19 1 2 0 2 17 18
+20 1 2 0 2 18 19
+21 1 2 0 2 19 20
+22 1 2 0 2 20 21
+23 1 2 0 2 21 22
+24 1 2 0 2 22 3
+25 1 2 0 3 3 23
+26 1 2 0 3 23 24
+27 1 2 0 3 24 25
+28 1 2 0 3 25 26
+29 1 2 0 3 26 27
+30 1 2 0 3 27 28
+31 1 2 0 3 28 29
+32 1 2 0 3 29 30
+33 1 2 0 3 30 31
+34 1 2 0 3 31 4
+35 1 2 0 4 4 32
+36 1 2 0 4 32 33
+37 1 2 0 4 33 34
+38 1 2 0 4 34 35
+39 1 2 0 4 35 36
+40 1 2 0 4 36 37
+41 1 2 0 4 37 38
+42 1 2 0 4 38 39
+43 1 2 0 4 39 40
+44 1 2 0 4 40 1
+45 2 2 0 1 72 81 102
+46 2 2 0 1 122 76 124
+47 2 2 0 1 115 49 120
+48 2 2 0 1 106 52 121
+49 2 2 0 1 52 106 122
+50 2 2 0 1 49 115 134
+51 2 2 0 1 96 122 124
+52 2 2 0 1 47 86 107
+53 2 2 0 1 52 122 125
+54 2 2 0 1 93 42 95
+55 2 2 0 1 89 53 91
+56 2 2 0 1 122 96 125
+57 2 2 0 1 102 81 127
+58 2 2 0 1 107 86 126
+59 2 2 0 1 79 72 102
+60 2 2 0 1 42 93 135
+61 2 2 0 1 91 53 129
+62 2 2 0 1 91 46 92
+63 2 2 0 1 92 46 93
+64 2 2 0 1 86 47 127
+65 2 2 0 1 95 42 96
+66 2 2 0 1 54 115 120
+67 2 2 0 1 55 106 121
+68 2 2 0 1 83 99 134
+69 2 2 0 1 53 89 119
+70 2 2 0 1 123 56 126
+71 2 2 0 1 86 87 126
+72 2 2 0 1 128 48 133
+73 2 2 0 1 68 64 97
+74 2 2 0 1 92 94 118
+75 2 2 0 1 99 83 136
+76 2 2 0 1 74 94 95
+77 2 2 0 1 99 49 134
+78 2 2 0 1 94 97 118
+79 2 2 0 1 64 63 97
+80 2 2 0 1 74 68 97
+81 2 2 0 1 92 93 94
+82 2 2 0 1 123 126 142
+83 2 2 0 1 46 91 129
+84 2 2 0 1 74 95 124
+85 2 2 0 1 110 128 133
+86 2 2 0 1 76 122 137
+87 2 2 0 1 94 93 95
+88 2 2 0 1 94 74 97
+89 2 2 0 1 41 57 58
+90 2 2 0 1 41 28 57
+91 2 2 0 1 27 28 41
+92 2 2 0 1 88 50 89
+93 2 2 0 1 36 37 42
+94 2 2 0 1 98 45 104
+95 2 2 0 1 44 19 99
+96 2 2 0 1 45 26 104
+97 2 2 0 1 57 50 88
+98 2 2 0 1 88 89 90
+99 2 2 0 1 43 10 100
+100 2 2 0 1 27 41 104
+101 2 2 0 1 29 50 57
+102 2 2 0 1 18 19 44
+103 2 2 0 1 9 10 43
+104 2 2 0 1 41 58 59
+105 2 2 0 1 28 29 57
+106 2 2 0 1 26 27 104
+107 2 2 0 1 18 44 101
+108 2 2 0 1 48 8 103
+109 2 2 0 1 9 43 103
+110 2 2 0 1 47 17 101
+111 2 2 0 1 90 89 91
+112 2 2 0 1 20 49 99
+113 2 2 0 1 41 59 104
+114 2 2 0 1 45 98 113
+115 2 2 0 1 8 9 103
+116 2 2 0 1 11 51 100
+117 2 2 0 1 17 18 101
+118 2 2 0 1 90 91 92
+119 2 2 0 1 19 20 99
+120 2 2 0 1 59 98 104
+121 2 2 0 1 10 11 100
+122 2 2 0 1 29 30 50
+123 2 2 0 1 109 113 115
+124 2 2 0 1 20 21 49
+125 2 2 0 1 38 39 52
+126 2 2 0 1 101 44 102
+127 2 2 0 1 109 45 113
+128 2 2 0 1 11 12 51
+129 2 2 0 1 59 58 60
+130 2 2 0 1 23 24 54
+131 2 2 0 1 7 8 48
+132 2 2 0 1 70 68 74
+133 2 2 0 1 32 33 53
+134 2 2 0 1 16 17 47
+135 2 2 0 1 62 60 63
+136 2 2 0 1 66 64 68
+137 2 2 0 1 58 57 88
+138 2 2 0 1 7 48 105
+139 2 2 0 1 80 84 112
+140 2 2 0 1 34 35 46
+141 2 2 0 1 66 68 69
+142 2 2 0 1 69 75 77
+143 2 2 0 1 16 47 107
+144 2 2 0 1 65 67 71
+145 2 2 0 1 25 26 45
+146 2 2 0 1 80 83 84
+147 2 2 0 1 15 16 107
+148 2 2 0 1 71 79 80
+149 2 2 0 1 71 72 79
+150 2 2 0 1 62 63 64
+151 2 2 0 1 6 7 105
+152 2 2 0 1 71 67 72
+153 2 2 0 1 65 64 66
+154 2 2 0 1 65 66 67
+155 2 2 0 1 77 75 78
+156 2 2 0 1 71 80 108
+157 2 2 0 1 62 64 65
+158 2 2 0 1 77 78 85
+159 2 2 0 1 59 61 98
+160 2 2 0 1 62 65 108
+161 2 2 0 1 65 71 108
+162 2 2 0 1 14 15 56
+163 2 2 0 1 78 75 110
+164 2 2 0 1 98 61 112
+165 2 2 0 1 72 73 81
+166 2 2 0 1 69 70 75
+167 2 2 0 1 81 82 86
+168 2 2 0 1 66 69 111
+169 2 2 0 1 61 60 62
+170 2 2 0 1 5 6 55
+171 2 2 0 1 72 67 73
+172 2 2 0 1 67 66 111
+173 2 2 0 1 59 60 61
+174 2 2 0 1 61 62 108
+175 2 2 0 1 54 24 109
+176 2 2 0 1 69 68 70
+177 2 2 0 1 24 25 109
+178 2 2 0 1 56 15 107
+179 2 2 0 1 69 77 111
+180 2 2 0 1 61 108 112
+181 2 2 0 1 80 79 83
+182 2 2 0 1 81 73 82
+183 2 2 0 1 75 76 110
+184 2 2 0 1 73 67 111
+185 2 2 0 1 55 6 105
+186 2 2 0 1 86 82 87
+187 2 2 0 1 25 45 109
+188 2 2 0 1 75 70 76
+189 2 2 0 1 112 84 113
+190 2 2 0 1 55 105 106
+191 2 2 0 1 108 80 112
+192 2 2 0 1 98 112 113
+193 2 2 0 1 111 77 114
+194 2 2 0 1 88 90 117
+195 2 2 0 1 73 111 114
+196 2 2 0 1 113 84 115
+197 2 2 0 1 77 85 114
+198 2 2 0 1 114 85 116
+199 2 2 0 1 82 73 114
+200 2 2 0 1 82 114 116
+201 2 2 0 1 60 58 117
+202 2 2 0 1 54 109 115
+203 2 2 0 1 63 60 117
+204 2 2 0 1 87 82 116
+205 2 2 0 1 58 88 117
+206 2 2 0 1 95 96 124
+207 2 2 0 1 97 63 118
+208 2 2 0 1 90 92 118
+209 2 2 0 1 63 117 118
+210 2 2 0 1 96 42 125
+211 2 2 0 1 117 90 118
+212 2 2 0 1 89 50 119
+213 2 2 0 1 30 31 119
+214 2 2 0 1 21 22 120
+215 2 2 0 1 39 40 121
+216 2 2 0 1 12 13 123
+217 2 2 0 1 76 70 124
+218 2 2 0 1 42 37 125
+219 2 2 0 1 38 52 125
+220 2 2 0 1 93 46 135
+221 2 2 0 1 101 102 127
+222 2 2 0 1 81 86 127
+223 2 2 0 1 50 30 119
+224 2 2 0 1 49 21 120
+225 2 2 0 1 52 39 121
+226 2 2 0 1 51 12 123
+227 2 2 0 1 105 48 128
+228 2 2 0 1 70 74 124
+229 2 2 0 1 53 33 129
+230 2 2 0 1 34 46 129
+231 2 2 0 1 115 84 134
+232 2 2 0 1 36 42 135
+233 2 2 0 1 46 35 135
+234 2 2 0 1 44 99 136
+235 2 2 0 1 3 23 138
+236 2 2 0 1 4 32 139
+237 2 2 0 1 22 3 138
+238 2 2 0 1 2 14 140
+239 2 2 0 1 13 2 140
+240 2 2 0 1 1 5 141
+241 2 2 0 1 40 1 141
+242 2 2 0 1 31 4 139
+243 2 2 0 1 37 38 125
+244 2 2 0 1 56 107 126
+245 2 2 0 1 122 106 137
+246 2 2 0 1 47 101 127
+247 2 2 0 1 110 76 137
+248 2 2 0 1 79 102 136
+249 2 2 0 1 106 105 128
+250 2 2 0 1 83 79 136
+251 2 2 0 1 130 116 131
+252 2 2 0 1 48 103 133
+253 2 2 0 1 131 85 132
+254 2 2 0 1 85 78 132
+255 2 2 0 1 116 85 131
+256 2 2 0 1 33 34 129
+257 2 2 0 1 87 116 130
+258 2 2 0 1 43 100 131
+259 2 2 0 1 100 130 131
+260 2 2 0 1 100 51 130
+261 2 2 0 1 43 131 132
+262 2 2 0 1 103 43 132
+263 2 2 0 1 78 110 133
+264 2 2 0 1 132 78 133
+265 2 2 0 1 103 132 133
+266 2 2 0 1 84 83 134
+267 2 2 0 1 35 36 135
+268 2 2 0 1 102 44 136
+269 2 2 0 1 51 123 142
+270 2 2 0 1 119 31 139
+271 2 2 0 1 121 40 141
+272 2 2 0 1 120 22 138
+273 2 2 0 1 123 13 140
+274 2 2 0 1 23 54 138
+275 2 2 0 1 32 53 139
+276 2 2 0 1 14 56 140
+277 2 2 0 1 5 55 141
+278 2 2 0 1 128 110 137
+279 2 2 0 1 53 119 139
+280 2 2 0 1 54 120 138
+281 2 2 0 1 55 121 141
+282 2 2 0 1 56 123 140
+283 2 2 0 1 106 128 137
+284 2 2 0 1 126 87 142
+285 2 2 0 1 87 130 142
+286 2 2 0 1 130 51 142
+$EndElements
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9e8851aac5991d764ccf7647e774f991c9af2332
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,10 @@
+#include <msh.h>
+
+
+int main()
+{
+    Mesh m("../square.msh");
+    //cout << m << endl;
+    m.writeGnuplot("gnu.plt");
+    return 0;
+}
\ No newline at end of file
diff --git a/src/msh.cpp b/src/msh.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5ddb7b1bf13177199e0ea0bf2d85d300d35148d0
--- /dev/null
+++ b/src/msh.cpp
@@ -0,0 +1,94 @@
+#include "msh.h"
+#include <cassert>
+
+// classe maillage 2d avec liste de noeuds et liste de triangles
+Mesh::Mesh(string gmsh2_filename)
+{
+    ifstream file = ifstream(gmsh2_filename);
+    if (!file.is_open()) {
+        throw runtime_error("file not found");
+    }
+    string line;
+    while (getline(file, line))
+    {
+        if (line == "$Nodes")
+        {
+            int n;
+            file >> n;
+            node.resize(n);
+            for (int i = 0; i < n; i++)
+            {
+                int id;
+                double z;
+                file >> id;
+                file >> node[id - 1][0] >> node[id - 1][1] >> z;
+            }
+        }
+        if (line == "$Elements")
+        {
+            int n;
+            file >> n;
+            for (int i = 0; i < n; i++)
+            {
+                int id, type, ntags;
+                file >> id >> type >> ntags;
+                for (int j = 0; j < ntags; j++)
+                {
+                    int tag;
+                    file >> tag;
+                }
+                if (type == 2)
+                {
+                    array<int, 3> t;
+                    file >> t[0] >> t[1] >> t[2];
+                    t[0]--;
+                    t[1]--;
+                    t[2]--;
+                    triangle.push_back(t);
+                } // sinon sauter la ligne (on ne connait pas sa taille)
+                else
+                {
+                    string line;
+                    getline(file, line);
+                }
+            }
+        }
+    }
+};
+// affichage dans un fichier lisible par gnuplot
+void Mesh::writeGnuplot(const string &filename) const
+{
+    ofstream file(filename);
+    // file << "set terminal postscript eps enhanced color" << endl;
+    // file << "set output '" << filename << ".eps'" << endl;
+    //  file << "set xrange [-1:1]" << endl;
+    //  file << "set yrange [-1:1]" << endl;
+    //  freeze aspect ratio
+    file << "set size ratio -1" << endl;
+    file << "plot '-' with linespoints" << endl;
+    for (int i = 0; i < triangle.size(); i++)
+    {
+        file << node[triangle[i][0]][0] << " " << node[triangle[i][0]][1] << endl;
+        file << node[triangle[i][1]][0] << " " << node[triangle[i][1]][1] << endl;
+        file << node[triangle[i][2]][0] << " " << node[triangle[i][2]][1] << endl;
+        file << node[triangle[i][0]][0] << " " << node[triangle[i][0]][1] << endl;
+        file << endl;
+    }
+    file << "e" << endl;
+    file << "pause -1";
+    file.close();
+}
+
+ostream &operator<<(ostream &os, const Mesh &m)
+{
+    os << "Mesh with " << m.node.size() << " nodes and " << m.triangle.size() << " triangles" << endl;
+    for (int i = 0; i < m.node.size(); i++)
+    {
+        os << "Node " << i << ": " << m.node[i][0] << " " << m.node[i][1] << endl;
+    }
+    for (int i = 0; i < m.triangle.size(); i++)
+    {
+        os << "Triangle " << i << ": " << m.triangle[i][0] << " " << m.triangle[i][1] << " " << m.triangle[i][2] << endl;
+    }
+    return os;
+}
diff --git a/src/msh.h b/src/msh.h
new file mode 100644
index 0000000000000000000000000000000000000000..4ee327cce3fc6108f6556cafb6a1f8546547110f
--- /dev/null
+++ b/src/msh.h
@@ -0,0 +1,24 @@
+#ifndef MESH_H
+#define MESH_H
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <array>
+
+using namespace std;
+
+// classe maillage 2d avec liste de noeuds et liste de triangles
+class Mesh
+{
+private:
+    vector<array<double, 2>> node;
+    vector<array<int, 3>> triangle;
+
+public:
+    Mesh(string gmsh2_filename);
+    friend ostream &operator<<(ostream &os, const Mesh &m);
+    // affichage dans un fichier lisible par gnuplot
+    void writeGnuplot(const string &filename) const;
+};
+
+#endif