Skip to content

Commit

Permalink
Added Japan inputs and mat2msh.m conversion utility
Browse files Browse the repository at this point in the history
  • Loading branch information
jploveless committed Feb 7, 2022
1 parent 94bda44 commit 942b5de
Show file tree
Hide file tree
Showing 8 changed files with 11,706 additions and 0 deletions.
20 changes: 20 additions & 0 deletions data/convert/mat2msh.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function mat2msh(matfile)
% Writes a Gmsh 2.0.8 .msh file from a .mat file

% Load mesh geometry
p = ReadPatches(matfile);

% Initialize msh file
[~, fname] = fileparts(matfile);
fid = fopen([fname '.msh'], 'w');
fprintf(fid, '$MeshFormat\n2 0 8\n$EndMeshFormat\n$Nodes\n');
% Write nodes
fprintf(fid, '%g\n', p.nc);
fprintf(fid, '%g %g %g %g\n', [1:p.nc; p.c']);
fprintf(fid, '$EndNodes\n$Elements\n');
% Write elements (triangles only)
fprintf(fid, '%g\n', p.nEl);
fprintf(fid, '%g %g %g %g %g %g %g %g %g\n', [1:p.nEl; repmat([2 3 0 1 0]', 1, p.nEl); p.v']);
fprintf(fid, '$EndElements');
fclose(fid);
fprintf(1, 'Wrote %s\n', [fname '.msh'])
2,178 changes: 2,178 additions & 0 deletions data/japan/All_in_Apel2006_RF_trim_Tog_Tog_sta_data.csv

Large diffs are not rendered by default.

4,307 changes: 4,307 additions & 0 deletions data/japan/HirosePSP2008-new_0-50_LL.msh

Large diffs are not rendered by default.

Loading

0 comments on commit 942b5de

Please sign in to comment.