Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test microstructure and -tiles #457

Open
wants to merge 52 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ed314ae
Add test for microtile classes
markriegler Aug 9, 2024
0aa09c8
Remove hollow cube's rotation parameter check since there is no rotation
markriegler Aug 9, 2024
2551b67
WIP add test if all microtiles lie in unit cube (only for default par…
markriegler Aug 9, 2024
a5373d8
Add test for microstructure closures
markriegler Aug 12, 2024
7859a87
Add test for non-default parameters of microtiles
markriegler Aug 12, 2024
6a6d402
Add test for non-default parameters plus closure of microtiles
markriegler Aug 12, 2024
a3f9d12
Restructure microstructure tests
markriegler Aug 12, 2024
693acc0
Add test for tile derivatives (WIP)
markriegler Aug 26, 2024
c7c2574
Add derivative of HollowOctagon tile
markriegler Aug 26, 2024
82caf4f
Add derivatives for closure of HollowOctagon tile
markriegler Aug 26, 2024
364c213
Add derivatives for Armadillo tile
markriegler Aug 26, 2024
88ba9dc
Fix typo which led to error
markriegler Aug 26, 2024
601994a
Add derivatives for HollowOctagonExtrude tile w/o closure
markriegler Aug 26, 2024
4d3f58c
Add test for tile derivatives with tile closure
markriegler Aug 27, 2024
d46121b
Restructure and add derivatives for InverseCross3D tile (WIP)
markriegler Aug 27, 2024
24d15d6
Fix derivative of Chi tile
markriegler Oct 9, 2024
c38a2e0
Add/fix derivative of tile InverseCross3D
markriegler Oct 9, 2024
61b3846
Fix CubeVoid derivatives
markriegler Oct 9, 2024
e418989
Fix Ellipsvoid derivatives
markriegler Oct 9, 2024
9baa5f1
Change to more appropriate name test_microtiles
markriegler Oct 10, 2024
cf13b7e
Add microstructure closure test
markriegler Oct 10, 2024
2a316ed
Add test for microstructure macro sensitivities
markriegler Oct 11, 2024
8501ad8
Add working closure to HollowOctagonExtrude
markriegler Oct 11, 2024
ee08600
Add pytest parametrization of all the microtiles
markriegler Jan 14, 2025
eff6539
Add to description that tiles are not tested
markriegler Jan 15, 2025
d07f06f
Simplify code which skips tile classes
markriegler Jan 15, 2025
d05fa5f
Failed sensitivity calculation now outputs evaluation points
markriegler Jan 15, 2025
d8ba2e9
Fixing RNG seed, sensitivity step size and number of random test points
markriegler Jan 15, 2025
42ade4e
Fix failing knot vector test
markriegler Jan 15, 2025
da02b45
Remove @classmethod when there is also @property, due to issues in Py…
markriegler Jan 15, 2025
df680e5
Refactor, add common code to TileBase
markriegler Jan 16, 2025
c2bb90c
Refactor all tile classes to make use of common functions
markriegler Jan 16, 2025
a042ca0
Add comments according to coderabbitai
markriegler Jan 16, 2025
d519adf
Add check of default tile parameters
markriegler Jan 17, 2025
c430aca
Change input to custom parameter check
markriegler Jan 17, 2025
26b4335
Add bounds for custom tile parameters to class attributes
markriegler Jan 17, 2025
77fd9d9
Add comments according to coderabbitai
markriegler Jan 17, 2025
2a8c083
Add dynamical update of parameter bounds
markriegler Jan 20, 2025
a6bbbd6
Test tile class now works with instances so that _parameter_bounds ca…
markriegler Jan 20, 2025
a34c182
Define class properties as class attribute or instance attribute
markriegler Jan 20, 2025
e29f3fb
Accept integers as tile parameters as well
markriegler Jan 20, 2025
40e08d8
Add pytest skip for unfinished/hard-to-test tiles and some coderabbit…
markriegler Jan 20, 2025
3f3263d
Ignore parameters (unused in function) for pre-commit
markriegler Jan 20, 2025
8cfa0ba
Enhance error message for unsupported closure directions
markriegler Feb 6, 2025
29310bc
Replace assert statements with proper exception handling
markriegler Feb 6, 2025
6fe00cb
Add tests to check if error is validly thrown when parameters are wrong
markriegler Feb 6, 2025
b600d6e
Enhance error message clarity
markriegler Feb 6, 2025
7ed7a5a
Add fourth order accurate Finite Difference calculation of parameter …
markriegler Feb 6, 2025
18b8589
Change some error types
markriegler Feb 6, 2025
5ecb75d
Add clarification of parameter bounds
markriegler Feb 6, 2025
087d8d1
Add some suggestions from coderabbit
markriegler Feb 7, 2025
66f3b8a
Add more suggestions from coderabbit
markriegler Feb 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/show_microstructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,13 @@ def foo(x):
generator.parametrization_function = foo

inverse_microstructure = generator.create(
closing_face="z", seperator_distance=0.4, center_expansion=1.3
closing_face="z", separator_distance=0.4, center_expansion=1.3
)

# Plot the results
_, showables_inverse = generator.show(
closing_face="z",
seperator_distance=0.4,
separator_distance=0.4,
center_expansion=1.3,
title="Parametrized Inverse Microstructure",
control_points=False,
Expand All @@ -365,7 +365,7 @@ def foo(x):
# Corresponding Structure
generator.microtile = splinepy.microstructure.tiles.get("Cross3D")
microstructure = generator.create(
closing_face="z", seperator_distance=0.4, center_expansion=1.3
closing_face="z", separator_distance=0.4, center_expansion=1.3
)
_, showables = generator.show(
closing_face="z",
Expand Down
21 changes: 11 additions & 10 deletions splinepy/microstructure/microstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class Microstructure(_SplinepyBase):
"""Helper class to facilitatae the construction of microstructures."""
"""Helper class to facilitate the construction of microstructures."""

def __init__(
self,
Expand All @@ -18,7 +18,7 @@ def __init__(
microtile=None,
parametrization_function=None,
):
"""Helper class to facilitatae the construction of microstructures.
"""Helper class to facilitate the construction of microstructures.

Parameters
----------
Expand Down Expand Up @@ -427,8 +427,8 @@ def _compute_tiling_prerequisites(
def create(
self,
closing_face=None,
knot_span_wise=None,
macro_sensitivities=None,
knot_span_wise=True,
macro_sensitivities=False,
**kwargs,
):
"""Create a Microstructure.
Expand All @@ -455,11 +455,12 @@ def create(
if not self._sanity_check():
raise ValueError("Not enough information provided, abort")

# Set default values
if knot_span_wise is None:
knot_span_wise = True
if macro_sensitivities is None:
macro_sensitivities = False
assert isinstance(
knot_span_wise, bool
), "knot_span_wise must be a bool"
assert isinstance(
macro_sensitivities, bool
), "macro_senstivities must be a bool"

# check if user wants closed structure
if closing_face is not None:
Expand Down Expand Up @@ -533,7 +534,7 @@ def create(
if macro_sensitivities or parameter_sensitivities:
spline_list_derivs = [
[]
for i in range(
for _ in range(
n_parameter_sensitivities + n_macro_sensitivities
)
]
Expand Down
2 changes: 2 additions & 0 deletions splinepy/microstructure/tiles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
armadillo,
chi,
cross_2d,
cross_3d,
cross_3d_linear,
cube_void,
double_lattice,
Expand Down Expand Up @@ -42,6 +43,7 @@
"chi",
"cross_2d",
"cube_void",
"cross_3d",
"cross_3d_linear",
"double_lattice",
"ellips_v_oid",
Expand Down
Loading
Loading