function save_mesh2_mini( xc, ia, e, basename) % Save the 3D triangular mesh in the minimal way (only coordinates and vertex connectivity) % in binary file. % The indexing in the connectivity is changed to C-style (starts with 0) % % coordinates xc: [2][nnode] % connectivity ia: [4][nelem] with t(4,:) are the subdomain numbers % edges e: [7][nedges] boundary edges % e([1,2],:) - start/end vertex of edge % e([3,4],:) - start/end values % e(5,:) - segment number % e([6,7],:) - left/right subdomain % basename: file name without extension % data from % output from % fname = [basename, '.bin']; offset = 1; % index difference from C to Matlab nnode = size(xc,2); ndim = size(xc,1); nelem = size(ia,2); nvert_e = 3; fileID = fopen(fname,'w'); fwrite(fileID, nnode, 'int'); % number of nodes fwrite(fileID, ndim, 'int'); % space dimension fwrite(fileID, nelem, 'int'); % number of elements fwrite(fileID, nvert_e, 'int'); % number of vertices per element fwrite(fileID, xc(:), 'double'); % coordinates tmp=ia(1:3,:)-offset; fwrite(fileID, tmp(:), 'double'); % connectivity end