Components#

class components.BeamSpec(center: Point2D, angle: float | jnp.ndarray, length: float | jnp.ndarray, thickness: float | jnp.ndarray)[source]#

Bases: NamedTuple

Design Variables for a beam.

angle: float | Array#

Alias for field number 1

center: Point2D#

Alias for field number 0

length: float | Array#

Alias for field number 2

thickness: float | Array#

Alias for field number 3

class components.CircleSpec(center: Point2D, radius: float | jnp.ndarray)[source]#

Bases: NamedTuple

Design variables for a circle.

center: Point2D#

Alias for field number 0

radius: float | Array#

Alias for field number 1

class components.ComponentGroup(topology_description_function: Callable[[NamedTuple], np.float64 | jnp.ndarray], variable_initial: NDArray[np.float64], variable_mins: NDArray[np.float64], variable_maxes: NDArray[np.float64], frozen_variables: list[int] | None = None)[source]#

Bases: object

A collection of components that share the same topology description function and design variables.

property bounds_flattened: tuple[NDArray[np.float64], NDArray[np.float64]]#

Return a tuple containing the bounds for each design variable in the group.

E.g. a group of two circles defined by [Point2D(x,y), radius] could have bounds as follows:

([Point2D(0.0, 0.0), 0.0, Point2D(0.0, 0.0), 0.0],

[Point2D(2.0, 1.0), 2.0, Point2D(2.0, 1.0), 2.0])

The first array is the min for each variable, and the second array is the max.

property free_variable_col_indexes: NDArray#

Indexes of non-frozen design variables.

frozen_variables: list[int] | None = None#
property num_components: int#

Number of components in the group.

property num_design_variables: int#

Number of free (non-frozen) design variables for the whole group.

property tdf: Callable[[NamedTuple], float64 | Array]#

Allow abbreviated access to the topology description function.

topology_description_function: Callable[[NamedTuple], np.float64 | jnp.ndarray]#
variable_initial: NDArray[np.float64]#
property variable_initials_flattened: NDArray#

Starting values of the design variables for each component.

Stacked into a flat array.

variable_maxes: NDArray[np.float64]#
variable_mins: NDArray[np.float64]#
class components.Point2D(x: np.float64 | jnp.ndarray, y: np.float64 | jnp.ndarray)[source]#

Bases: NamedTuple

Point in 2D space.

x: float64 | Array#

Alias for field number 0

y: float64 | Array#

Alias for field number 1

components.circle(point: Point2D) Callable[[CircleSpec], float64 | Array][source]#

Create a topological description function for a circle.

components.uniform_beam(point: Point2D) Callable[[BeamSpec], float64 | Array][source]#

Create Topological Description Function for a beam with a uniform width.