Skip to content

Commit

Permalink
Merge pull request #131 from tataratat/no-splines
Browse files Browse the repository at this point in the history
move spline functionalities to splinepy
  • Loading branch information
j042 authored Jun 27, 2023
2 parents 38d482a + 0ab1e3f commit feb32c0
Show file tree
Hide file tree
Showing 40 changed files with 130 additions and 8,103 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 1 addition & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
samples
43 changes: 0 additions & 43 deletions examples/create_basic_splines.py

This file was deleted.

34 changes: 34 additions & 0 deletions examples/load_sample_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Helper file for examples. Loads sample files from the tataratat/samples."""
import pathlib

import requests

base_url = "https://raw.githubusercontent.com/tataratat/samples/main/"
local_path = pathlib.Path(__file__).parent / "samples/"


def load_sample_file(filename: str, force_reload: bool = False) -> bool:
"""Loads a sample file from the tataratat/samples repository.
Args:
filename (str): Path of the file to load.
force_reload (bool, optional): Loads the file even if it already
exists. Defaults to False.
Returns:
bool: File could be loaded.
"""
local_file = local_path / filename
if local_file.exists() and not force_reload:
return True
pathlib.Path.mkdir(local_file.parent, parents=True, exist_ok=True)

url = base_url + filename
response = requests.get(url)
if response.status_code == 200:
with open(local_file, "wb") as f:
f.write(response.content)
return True
else:
print(f"Cant load {url}, status code: {response.status_code}.")
return False
1 change: 0 additions & 1 deletion examples/samples
Submodule samples deleted from 170914
135 changes: 0 additions & 135 deletions examples/show_ffd.py

This file was deleted.

22 changes: 11 additions & 11 deletions examples/show_gmsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@
"""
import pathlib

import load_sample_file

from gustaf import io

if __name__ == "__main__":
base_samples_path = pathlib.Path("samples/faces")
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():
raise RuntimeError(
"The geometries could not be found. Please initialize the "
"samples submodule, instructions can be found in the "
"README.md."
)
mesh_file_tri = pathlib.Path("samples/faces/tri/2DChannelTria.msh")
mesh_file_quad = pathlib.Path("samples/faces/quad/2DChannelQuad.msh")
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(mesh_file_tri)
loaded_mesh_tri = io.meshio.load(base_samples_path / mesh_file_tri)

loaded_mesh_tri.show()

# load the .msh file directly with the correct io module (meshio)
loaded_mesh_quad = io.meshio.load(mesh_file_quad)
loaded_mesh_quad = io.meshio.load(base_samples_path / mesh_file_quad)

loaded_mesh_quad.show()

# load the .msh file with the default load function which needs to find out
# it self which module is the correct one.
loaded_mesh_default = io.load(mesh_file_tri)
loaded_mesh_default = io.load(base_samples_path / mesh_file_tri)

loaded_mesh_default.show()
129 changes: 0 additions & 129 deletions examples/show_gus.py

This file was deleted.

Loading

0 comments on commit feb32c0

Please sign in to comment.