-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMeshReaderGambit3D.m
More file actions
39 lines (30 loc) · 816 Bytes
/
MeshReaderGambit3D.m
File metadata and controls
39 lines (30 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function [Nv, VX, VY, VZ, K, EToV] = MeshReaderGambit3D(FileName)
% function [Nv, VX, VY, VZ, K, EToV] = MeshReaderGambit3D(FileName)
% Purpose : Read in basic grid information to build grid
% NOTE : gambit *.neu format is assumed
Fid = fopen(FileName, 'rt');
% read intro
for i=1:6
line = fgetl(Fid);
end
% fine number of nodes and number of elements
dims = fscanf(Fid, '%d');
Nv = dims(1); K = dims(2);
for i=1:2
line = fgetl(Fid);
end
% read node coordinates
xyz = fscanf(Fid, '%lf', [4, Nv]);
xyz = xyz(2:4, :);
VX = xyz(1,:); VY = xyz(2,:); VZ = xyz(3,:);
for i=1:3
line = fgetl(Fid);
end
% read element to node connectivity
EToV = zeros(K, 4);
for k = 1:K
line = fgetl(Fid);
tmpcon = sscanf(line, '%lf');
EToV(k,1:4) = tmpcon(4:7);
end
return