1 function M = load_alu3d_hexa(fn)
2 %
function M = load_alu3D_hexa(fn)
4 % load given ALU3D hexaeder file into mesh-structure M
6 % num_vertices number of vertices
7 % vertices matrix of vertex coordinates (columnwise)
8 % num_elements number of elements
9 % elements matrix of element vertex indices (columnwise)
10 % num_faces number of boundary faces
11 % faces matrix of boundary faces (columnwise)
13 % note that the numbering of the vertices in elements and faces is
14 % C-style, i.e. starting from 0
15 %
for working in matlab, the offset 1 has to be added, e.g.
16 % z-coordinates of 2nd vertex of element 5 is
17 % vertices(3,M.elements(2,5)+1);
18 % The boundary faces are coded by 6 integers (
for hexamesh)
19 % \#bndtypeId \#nvertices=4 \#vind1 \#vind2 \#vind3 \#vind4
21 % Bernard Haasdonk 13.3.2006
26 e = fscanf(fid,
'%s',1);
27 if ~isequal(e,
'!Hexaeder')
29 error('wrong file format');
33 M.num_vertices = fscanf(fid,'%d',1);
36 disp(['reading ',num2str(M.num_vertices),' vertices']);
37 M.vertices = reshape(fscanf(fid,'%f',M.num_vertices*3),3,M.num_vertices);
40 M.num_elements = fscanf(fid,'%d',1);
43 disp(['reading ',num2str(M.num_elements),' elements']);
44 M.elements = reshape(fscanf(fid,'%d',...
45 M.num_elements * 8),8,M.num_elements);
47 % load boundary segment number
48 M.num_faces = fscanf(fid,'%d',1);
50 % load boundary segments
51 disp(['reading ',num2str(M.num_faces),' boundary faces']);
52 M.faces = reshape(fscanf(fid,'%d',M.num_faces*6),6,M.num_faces);
54 % disp('ignoring occasionally processor-distribution information');
59 % TO BE ADJUSTED TO NEW SYNTAX