releso.geometry.FFDGeometry
- class releso.geometry.FFDGeometry(*, save_location: Path, logger_name: str | None = None, shape_definition: ShapeDefinition | BSplineDefinition | NURBSDefinition | List[ShapeDefinition | BSplineDefinition | NURBSDefinition], action_based_observation: bool = True, discrete_actions: bool = True, reset_with_random_action_values: bool = False, mesh: MeshIOMesh | MixdMesh, export_mesh: MeshExporter | None = None)
Bases:
GeometryFFD based variable shape.
- __init__(**data: Any) None
Geometry based on a FFD transformation.
This geometry uses the shape parametrization to deform the given mesh, via a FFD.
- Raises:
RuntimeError – FFD can only be performed via a Spline based shape.
Methods
apply()Apply the shape via FFD on to the geometry.
apply_action(action)Function that applies a given action to the Spline.
apply_ffd([path])Apply FFD for the current shape.
apply_random_action([seed])Apply a random continuous action.
convert_to_pathlib_add_datetime(v)Add timestamp to save_location, of applicable.
get_action_definition()Return actions definition defined by the shape parametrization.
get_logger()Gets the currently defined environment logger.
get_observation()Returns the current observations.
get_observation_definition()Return the geometry observation definition.
get_parameter_values()Return all control_points of the spline.
is_geometry_changed()Checks if the geometry was changed with the previous action apply.
reset([validation_id])Resets the geometry to its initial values.
set_logger_name_recursively(logger_name)Set the logger_name variable for all child elements.
setup(environment_id)Setup with additional information from the environment.
Attributes
meshexport_meshshape_definitionDefinition of the shape used for the geometry.
action_based_observationuse the action space for the observations.
discrete_actionsWhether or not to use discrete actions if False continuous actions will be used.
reset_with_random_action_valuesWhether or not to reset the controllable control point variables to a random state (True) or the default original state (False).
save_locationDefinition of the save location of the logs and validation results.
logger_namename of the logger.
- apply() Any | None
Apply the shape via FFD on to the geometry.
- Returns:
Return the correct values.
- Return type:
Optional[Any]
- apply_action(action: List[float] | int) Any | None
Function that applies a given action to the Spline.
- Parameters:
action (Union[List[float], int]) – Action value depends on if the ActionSpace is discrete (int - Signifier of the action) or Continuous (List[float] - Value for each continuous variable.)
- apply_ffd(path: str | None = None) str | ndarray
Apply FFD for the current shape.
Might move in the future to a SPORStep. Can be deactivated with do_not_perform_ffd.
Apply the Free Form Deformation using the current spline to the mesh and export the resulting mesh to the path given.
- Parameters:
path (Optional[str], optional) – Path to where the deformed mesh was exported to or the of no export wanted the vertices of the mesh. Defaults to None.
- Returns:
- Path to the exported mesh file or the
vertices of the mesh.
- Return type:
Union[str, np.ndarray]
- setup(environment_id: UUID)
Setup with additional information from the environment.
Needs to adapt export path with the environment id.
- Parameters:
environment_id (UUID) – Environment id.