bluemira.geometry.optimisation._tools

Classes

KeepOutZone

Definition of a keep-out zone for a geometry optimisation.

Functions

to_objective(→ bluemira.optimisation.ObjectiveCallable)

Convert a geometry objective function to a normal objective function.

to_optimiser_callable(...)

Convert a geometry optimiser function to a normal optimiser function.

to_optimiser_callable_from_cls(...)

Convert a geometry optimiser function to a normal optimiser function.

to_constraint(→ bluemira.optimisation.ConstraintT)

Convert a geometry constraint to a normal one.

calculate_signed_distance(→ numpy.ndarray)

Signed distance from the parameterised shape to the keep-out/in zone.

make_keep_out_zone_constraint(...)

Make a keep-out zone inequality constraint from a wire.

get_shape_ineq_constraint(...)

Retrieve the inequality constraints registered for the given parameterisation.

Module Contents

class bluemira.geometry.optimisation._tools.KeepOutZone

Definition of a keep-out zone for a geometry optimisation.

wire: bluemira.geometry.wire.BluemiraWire

Closed wire defining the keep-out zone.

byedges: bool = True

Whether to discretise the keep-out zone by edges or not.

dl: float | None = None

The discretisation length for the keep-out zone.

This overrides n_discr if given.

n_discr: int = 100

The number of points to discretise the keep-out zone into.

shape_n_discr: int = 100

The number of points to discretise the geometry being optimised into.

tol: float = 1e-08

The tolerance for the keep-out zone constraint.

bluemira.geometry.optimisation._tools.to_objective(geom_objective: bluemira.geometry.optimisation.typed.GeomOptimiserObjective, geom: bluemira.geometry.parameterisations.GeometryParameterisation) bluemira.optimisation.ObjectiveCallable

Convert a geometry objective function to a normal objective function.

Returns:

The objective function converted from a geometry objective function.

Parameters:
Return type:

bluemira.optimisation.ObjectiveCallable

bluemira.geometry.optimisation._tools.to_optimiser_callable(geom_callable: bluemira.geometry.optimisation.typed.GeomOptimiserCallable, geom: bluemira.geometry.parameterisations.GeometryParameterisation) bluemira.optimisation.OptimiserCallable

Convert a geometry optimiser function to a normal optimiser function.

For example, a gradient or constraint.

Returns:

The optimiser function converted from a geometry optimiser function.

Parameters:
Return type:

bluemira.optimisation.OptimiserCallable

bluemira.geometry.optimisation._tools.to_optimiser_callable_from_cls(geom_callable: bluemira.geometry.optimisation.typed.GeomClsOptimiserCallable, geom: bluemira.geometry.parameterisations.GeometryParameterisation) bluemira.optimisation.OptimiserCallable

Convert a geometry optimiser function to a normal optimiser function.

For example, a gradient or constraint.

Returns:

The optimiser function converted from a geometry optimiser function.

Parameters:
Return type:

bluemira.optimisation.OptimiserCallable

bluemira.geometry.optimisation._tools.to_constraint(geom_constraint: bluemira.geometry.optimisation.typed.GeomConstraintT, geom: bluemira.geometry.parameterisations.GeometryParameterisation) bluemira.optimisation.ConstraintT

Convert a geometry constraint to a normal one.

Returns:

The consatraint constructed from the geometry constraint.

Parameters:
Return type:

bluemira.optimisation.ConstraintT

bluemira.geometry.optimisation._tools.calculate_signed_distance(parameterisation: bluemira.geometry.parameterisations.GeometryParameterisation, n_shape_discr: int, zone_points: numpy.ndarray) numpy.ndarray

Signed distance from the parameterised shape to the keep-out/in zone.

Returns:

Signed distance from the parameterised shape to the keep-out/in zone.

Parameters:
Return type:

numpy.ndarray

bluemira.geometry.optimisation._tools.make_keep_out_zone_constraint(koz: KeepOutZone) bluemira.geometry.optimisation.typed.GeomConstraintT

Make a keep-out zone inequality constraint from a wire.

Returns:

The inequality constraint for the keep-out zone.

Raises:

GeometryOptimisationError – Koz wire is not closed

Parameters:

koz (KeepOutZone)

Return type:

bluemira.geometry.optimisation.typed.GeomConstraintT

bluemira.geometry.optimisation._tools.get_shape_ineq_constraint(geom: bluemira.geometry.parameterisations.GeometryParameterisation) list[bluemira.optimisation.ConstraintT]

Retrieve the inequality constraints registered for the given parameterisation.

If no constraints are registered, return an empty list.

Returns:

The inequality constraints registered for the given parameterisation.

Parameters:

geom (bluemira.geometry.parameterisations.GeometryParameterisation)

Return type:

list[bluemira.optimisation.ConstraintT]