Skip to content

Commit

Permalink
Fixes issue #14.
Browse files Browse the repository at this point in the history
For a binary GMSH file formart we now give a message that this is not
supported and to try to generate an ASCII version.
  • Loading branch information
ruebenko committed Oct 17, 2023
1 parent ee3c207 commit 617f0f5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions FEMAddOns/ImportMesh/Kernel/ImportMesh.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
ImportMesh::abaqus="Incremental node or element generation (*NGEN and *ELGEN keywords) is not supported.";
ImportMesh::fail="Failed to extract mesh from ``";
ImportMesh::gmshfrmt="GMSH file format version `1` is not supported.";
ImportMesh::gmshbin="The file is a binary GMSH file. The binary file format is not supported. Try to generate an ASCII file format.";


(* ::Subsection:: *)
Expand Down Expand Up @@ -762,12 +763,22 @@ extract element topology (e.g. HexahedronElement) and its order from element typ

importGmshMesh[list_List, opts:OptionsPattern[]]:=Module[
{version,nodes,markers,allElements,ret},

version=First@StringSplit@Part[list,getStartPosition[list,"$MeshFormat"]+1];

startPos = getStartPosition[list,"$MeshFormat"]+1;
prolog = StringSplit@Part[list,startPos];

version=First[prolog];
If[
Not@MemberQ[{"2.2"},version],
Message[ImportMesh::gmshfrmt,version];Return[$Failed]
];

If[ Length[prolog] > 1,
binaryQ = prolog[[2]] === "1";
If[ binaryQ,
Message[ImportMesh::gmshbin];Return[$Failed]
];
];

ret=OptionValue["ReturnElement"];

Expand Down

0 comments on commit 617f0f5

Please sign in to comment.