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

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 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
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