""" Entry point for the MORe APIThis module is the sole entry point to the MORe API."""frommore.api.postprocessorimportPostprocessorSetupfrommore.api.project_handlingimportProjectHandlerSetupfrommore.api.simulationimportSimulationSetupfrommore.api.utils.interface_registriesimportget_api_setup_klass
[docs]classApiGateway:""" Entry point for the MORe API Only this object needs to be imported and initialized by the API user. All other objects are created by this object. Parameters ---------- proj : Project The project instance """def__init__(self,proj):self._proj=proj
[docs]defcreate_simulation_setup(self)->SimulationSetup:""" Creates a :class:`~api.simulation.simulation_setup.SimulationSetup` object for managing simulations .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> setup = ApiGateway(proj=proj).create_simulation_setup() .. >>> isinstance(setup, SimulationSetup) True Returns ------- :class:`~api.simulation.simulation_setup.SimulationSetup` A :class:`~api.simulation.simulation_setup.SimulationSetup` instance for managing the simulation state """api_class=get_api_setup_klass(SimulationSetup)returnapi_class(proj=self._proj)
[docs]defcreate_postprocessor_setup(self)->PostprocessorSetup:""" Creates a :class:`~api.postprocessor.postprocessor_setup.PostprocessorSetup` object for managing postprocessing of experiments .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> setup = ApiGateway(proj=proj).create_postprocessor_setup() .. >>> isinstance(setup, PostprocessorSetup) True Returns ------- :class:`~api.postprocessor.postprocessor_setup.PostprocessorSetup` A :class:`~api.postprocessor.postprocessor_setup.PostprocessorSetup` instance for managing the postprocessor state """api_class=get_api_setup_klass(PostprocessorSetup)returnapi_class(proj=self._proj)
[docs]defcreate_project_handler_setup(self)->ProjectHandlerSetup:""" Creates a :class:`~api.project_handling.project_handler_setup.ProjectHandlerSetup` object for file handling operations, such as import, export, save and load .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> setup = ApiGateway(proj=proj).create_project_handler_setup() .. >>> isinstance(setup, ProjectHandlerSetup) True Returns ------- :class:`~api.project_handling.project_handler_setup.ProjectHandlerSetup` A :class:`~api.project_handling.project_handler_setup.ProjectHandlerSetup` instance for managing file operations """api_class=get_api_setup_klass(ProjectHandlerSetup)returnapi_class(proj=self._proj)