diff --git a/.bumpversion.toml b/.bumpversion.toml index 1398bf1..52acb77 100644 --- a/.bumpversion.toml +++ b/.bumpversion.toml @@ -1,5 +1,5 @@ [tool.bumpversion] -current_version = "v0.6.4" +current_version = "v0.7.0" commit = true commit_args = "--no-verify" tag = true diff --git a/README.md b/README.md index 0a25c7e..71c26d3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # totypes - Custom types for topology optimization -`v0.6.4` +`v0.7.0` ## Overview diff --git a/pyproject.toml b/pyproject.toml index e7869f9..3559d69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "totypes" -version = "v0.6.4" +version = "v0.7.0" description = "Custom datatypes useful in a topology optimization context" keywords = ["topology", "optimization", "jax", "inverse design"] readme = "README.md" diff --git a/src/totypes/__init__.py b/src/totypes/__init__.py index 68c13b7..e8a4782 100644 --- a/src/totypes/__init__.py +++ b/src/totypes/__init__.py @@ -3,7 +3,7 @@ Copyright (c) 2023 The INVRS-IO authors. """ -__version__ = "v0.6.4" +__version__ = "v0.7.0" __author__ = "Martin F. Schubert " __all__ = ["json_utils", "symmetry", "types"] diff --git a/src/totypes/types.py b/src/totypes/types.py index f17c57e..136fe89 100644 --- a/src/totypes/types.py +++ b/src/totypes/types.py @@ -80,9 +80,14 @@ def __post_init__(self) -> None: @property def shape(self) -> Tuple[int, ...]: - """Returns the shape of the array.""" + """Return the shape of the array.""" return jnp.shape(self.array) # type: ignore[no-any-return] + @property + def ndim(self) -> int: + """Return the number of dimensions of the array.""" + return int(jnp.ndim(self.array)) + def _flatten_bounded_array( bounded_array: BoundedArray, @@ -252,9 +257,14 @@ def __post_init__(self) -> None: @property def shape(self) -> Tuple[int, ...]: - """Returns the shape of the array.""" + """Return the shape of the array.""" return jnp.shape(self.array) # type: ignore[no-any-return] + @property + def ndim(self) -> int: + """Return the number of dimensions of the array.""" + return int(jnp.ndim(self.array)) + def _flatten_density_2d( density: Density2DArray,