Skip to content

Commit

Permalink
Merge pull request #106 from simbilod/87-allow-different-resolutions-…
Browse files Browse the repository at this point in the history
…for-same-physical

87 allow different resolutions for same physical
  • Loading branch information
simbilod authored Dec 30, 2024
2 parents 2a35cc9 + 2a05b86 commit e112375
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/generate_references.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source .venv/bin/activate

# Install reference version of the package in editable mode
sudo apt-get install libglu1-mesa
uv pip install git+https://github.com/simbilod/meshwell.git@be4fc001cd573982690c178eb9334b41f64decdd[dev]
uv pip install git+https://github.com/simbilod/meshwell.git@ee10c5ab5da9c1311f5925907e08e494157c702d[dev]

# Execute all Python files in the current directory
python generate_references.py --references-path ./references/
46 changes: 45 additions & 1 deletion tests/test_fuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import numpy as np
from meshwell.utils import compare_meshes
from pathlib import Path
from shapely.geometry import box
from meshwell.resolution import ThresholdField


def test_fuse():
Expand Down Expand Up @@ -61,5 +63,47 @@ def test_fuse():
compare_meshes(Path("mesh_unfused.msh"))


def test_different_resolutions_same_physical():
model = Model(n_threads=1)

# Create two different boxes
box1 = box(0, 0, 1, 1)
box2 = box(2, 0, 3, 1)

# Create resolution specifications
resolution1 = ThresholdField(
apply_to="curves", sizemin=0.01, sizemax=0.05, distmax=0.2
)

resolution2 = ThresholdField(
apply_to="curves", sizemin=0.1, sizemax=0.2, distmax=0.2
)

# Create two polysurfaces with same physical name but different resolutions
surface1 = PolySurface(
polygons=box1,
model=model,
physical_name="test_surface",
resolutions=[resolution1],
)

surface2 = PolySurface(
polygons=box2,
model=model,
physical_name="test_surface",
resolutions=[resolution2],
)

# Mesh the model
model.mesh(
entities_list=[surface1, surface2],
default_characteristic_length=10,
filename="test_different_resolutions_same_physical.msh",
)

compare_meshes(Path("test_different_resolutions_same_physical.msh"))


if __name__ == "__main__":
test_fuse()
# test_fuse()
test_different_resolutions_same_physical()

0 comments on commit e112375

Please sign in to comment.