bluemira.base.designer
Interface for designer classes.
Attributes
Classes
Base class for 'Designers' that solver design problems as part of |
Functions
|
Make and run a designer, returning the result. |
Module Contents
- bluemira.base.designer._DesignerReturnT
- class bluemira.base.designer.Designer(params: bluemira.base.parameter_frame.typed.ParameterFrameLike, build_config: bluemira.base.builder.BuildConfig | None = None, *, verbose: bool = True)
Bases:
abc.ABC,Generic[_DesignerReturnT]Base class for ‘Designers’ that solver design problems as part of building a reactor component.
- Parameters:
params (bluemira.base.parameter_frame.typed.ParameterFrameLike) – The parameters required by the designer.
build_config (bluemira.base.builder.BuildConfig | None) – The build configuration options for the designer.
verbose (bool) – control how much logging the designer will output
Notes
If there are no parameters associated with a concrete builder, set param_cls to None and pass None into this class’s constructor.
- KEY_RUN_MODE = 'run_mode'
- params
- build_config
- _verbose = True
- execute() _DesignerReturnT
Execute the designer with the run mode specified by the build config.
By default the run mode is ‘run’.
- Returns:
The result of the designer’s run_mode method.
- Return type:
_DesignerReturnT
- abstract run() _DesignerReturnT
Run the design problem.
- Return type:
_DesignerReturnT
- abstract mock() _DesignerReturnT
Return a mock of a design.
Optionally implemented.
- Return type:
_DesignerReturnT
- abstract read() _DesignerReturnT
Read a design from a file.
The file path should be specified in the build config.
Optionally implemented.
- Return type:
_DesignerReturnT
- property param_cls: type[bluemira.base.parameter_frame.typed.ParameterFrameT]
- Abstractmethod:
- Return type:
type[bluemira.base.parameter_frame.typed.ParameterFrameT]
The ParameterFrame class defining this designer’s parameters.
- property run_mode: str
Get the run mode of this designer.
- Return type:
str
- _get_run_func(mode: str) collections.abc.Callable
Retrieve the function corresponding to the given run mode.
- Parameters:
mode (str) – The run mode to retrieve the function for.
- Returns:
The function corresponding to the given run mode.
- Raises:
ValueError – Run mode doesnt exist
- Return type:
collections.abc.Callable
- bluemira.base.designer.run_designer(designer_cls: type[Designer[_DesignerReturnT]], params: bluemira.base.parameter_frame.typed.ParameterFrameLike, build_config: dict, **kwargs) _DesignerReturnT
Make and run a designer, returning the result.
- Parameters:
designer_cls (type[Designer[_DesignerReturnT]]) – The designer class to use.
params (bluemira.base.parameter_frame.typed.ParameterFrameLike) – The parameters required by the designer.
build_config (dict) – The build configuration options for the designer.
kwargs – Additional keyword arguments to pass to the designer.
- Returns:
The result of the designer’s run_mode method.
- Return type:
_DesignerReturnT