Skip to content

Commit

Permalink
Gmsh example hardened, against calling from outside of parent folder,…
Browse files Browse the repository at this point in the history
… against samples folder exists but has not needed files.
  • Loading branch information
clemens-fricke committed Sep 7, 2023
1 parent 24b71f4 commit 197cb9b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions examples/show_gmsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
mesh_file_tri = pathlib.Path("faces/tri/2DChannelTria.msh")
mesh_file_quad = pathlib.Path("faces/quad/2DChannelQuad.msh")

base_samples_path = pathlib.Path("samples")
if not base_samples_path.exists():
load_sample_file.load_sample_file(str(mesh_file_tri))
load_sample_file.load_sample_file(str(mesh_file_quad))
base_samples_path = pathlib.Path(__file__).parent / "samples"
load_sample_file.load_sample_file(str(mesh_file_tri))
load_sample_file.load_sample_file(str(mesh_file_quad))

# load the .msh file directly with the correct io module (meshio)
loaded_mesh_tri = io.meshio.load(base_samples_path / mesh_file_tri)
Expand Down

0 comments on commit 197cb9b

Please sign in to comment.