2 %
function Mesh=
GetMesh(cFileName)
3 % Initialization of the Mesh structure from a FreeFEM++ mesh file
7 % cFileName: FreeFEM++ mesh file name (
string)
10 % Mesh: mesh structure
12 % Generated fields of Mesh:
13 % q: Array of vertices coordinates, `2\times\nq` array. <br/>
14 % `{\q}(\il,j)` is the
15 % `\il`-th coordinate of the `j`-th vertex, `\il\in\{1,2\}` and
17 % me: Connectivity array, `3\times\nme` array. <br/>
18 % `\me(\jl,k)` is the storage index of the
19 % `\jl`-th vertex of the `k`-th triangle in the array `\q` of vertices coordinates, `\jl\in\{1,2,3\}` and
20 % `k\in{\ENS{1}{\nme}}`.
21 % ql: Array of vertices labels, `1\times\nq` array.
22 % mel: Array of elements labels, `1\times\nme` array.
23 % be: Connectivity array
for boundary edges, `2\times\nbe` array.<br/>
24 % `\be(\il,l)` is the storage index of the
25 % `\il`-th vertex of the `l`-th edge in the array `\q` of vertices coordinates, `\il\in\{1,2\}` and
26 % `l\in{\ENS{1}{\nbe}}`.
27 % bel: Array of boundary edges labels, `1\times\nbe` array.
28 % nq: total number of vertices, also denoted by `\nq`.
29 % nme: total number of elements, also denoted by `\nme`.
30 % nbe: total number of boundary edges, also denoted by `\nbe`.
31 % areas: Array of areas, `1\times\nme` array. areas(k) is the area of the `k`-th triangle.
32 % lbe: Array of edges lengths, `1\times\nbe` array. `lbe(j)` is the length of the `j`-th edge.
39 % OptFEM2DP1 [V1.2b1] - Copyright (C) 2013 CJS (LAGA)
41 % This file is part of OptFEM2DP1.
42 % OptFEM2DP1 is free software: you can redistribute it and/or modify
43 % it under the terms of the GNU General Public License as published by
44 % the Free Software Foundation, either version 3 of the License, or
45 % (at your option) any later version.
47 % OptFEM2DP1 is distributed in the hope that it will be useful,
48 % but WITHOUT ANY WARRANTY; without even the implied warranty of
49 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50 % GNU General Public License for more details.
52 % You should have received a copy of the GNU General Public License
53 % along with this program. If not, see <http:
54 [fid,message]=fopen(cFileName,'r');
56 error([message,' : ',cFileName]);
58 n=fscanf(fid,'%d',3); ; % n(1) -> number of vertices
59 % n(2) -> number of triangles
60 % n(3) -> number of boundary edges
66 d_tmp=fscanf(fid,'%g',2);
69 ql(i)=fscanf(fid,'%d',1);
72 i_tmp=fscanf(fid,'%d',4);
80 i_tmp=fscanf(fid,'%d',3);
88 Mesh=struct('q',q,'me',me,'ql',ql,'mel',mel,'be',be,'bel',bel, ...