Main#
The main loop of the MMC method.
- main.compose_structure_tdf(group_tdfs: list[Callable], component_list: list[ComponentGroup]) Callable[[NDArray[np.float64]], NDArray[np.float64]][source]#
Return a function that unravels the design variables and calculates the combined TDF for the structure.
- main.compose_tdfs(tdf: Callable[[NDArray[np.float64]], jnp.ndarray]) Callable[[NDArray[np.float64]], jnp.ndarray][source]#
Compose a group-level topology description function.
Group tdf takes in an num_components by num_design_variables array
- main.connected_components(singed_distance_functions: NDArray[np.float64]) NDArray[np.bool][source]#
Find connected components in the list of components.
- Parameters:
singed_distance_functions – NDArray[np.float64] - The stack of TDFs
- Returns:
NDArray[bool] - The connectivity matrix
- main.is_converged(iteration, objective_tolerance, objective_history, constraint_value, window_size) bool[source]#
Check if the optimisation has converged.
- main.main(max_iterations: int, domain: Domain2D, boundary_conditions: dict, volume_fraction_limit: float, component_list: list[ComponentGroup]) None[source]#
Do MMC method.
- main.make_heaviside(tdf: Callable[[NDArray[np.float64]], NDArray[np.float64]], transition_width: float, minimum_value: float = 0.0) Callable[[NDArray[np.float64]], NDArray[np.float64]][source]#
Smoothed Heaviside function.
https://en.wikipedia.org/wiki/Heaviside_step_function.
An element-wise function that 1 when x > 0, and minimum_value when x < 0. The step is smoothed over the transition_width.
- Parameters:
tdf – Callable - The topology description function to make crisp
minimum_value – float - The lower value for areas where x<0
transition_width – float - The size of the transition region
- Returns:
NDArray - The smoothed Heaviside of the input array