From e9a3cf2a041e92d2e0d0858ad95761b43569306e Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Fri, 1 Dec 2023 15:33:21 +0100 Subject: [PATCH] export/pythonfmu no start values --- otfmi/function_exporter.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/otfmi/function_exporter.py b/otfmi/function_exporter.py index 304ae6c..c46ffc7 100644 --- a/otfmi/function_exporter.py +++ b/otfmi/function_exporter.py @@ -687,11 +687,11 @@ def export_model(self, model_path, gui=False, verbose=False, binary=True, mode=" - cxx: the function is directly evaluated trough the OpenTURNS C++ API; even faster but requires the OpenTURNS development headers and libraries (not just the Python module that would be installed by pip for example). - move : bool - Move the model from temporary folder to user folder (default=True) - For internal use. """ + # "move" argument moves the the model from temporary folder to user folder (default=True) + # not documented on purpose (private) + assert isinstance(model_path, str), "model_path must be str" rawClassName, extension = os.path.splitext(os.path.basename(model_path)) className = rawClassName[0].upper() + rawClassName[1:] @@ -791,9 +791,8 @@ def __init__(self, **kwargs): self._function = ot.PointToFieldFunction() if {{ field }} else ot.Function() study.fillObject("function", self._function) - start = {{ start }} for i, var in enumerate(self._function.getInputDescription()): - setattr(self, var, start[i]) + setattr(self, var, 0.0) self.register_variable(Real(var, causality=Fmi2Causality.input)) for var in self._function.getOutputDescription(): @@ -817,8 +816,7 @@ def do_step(self, current_time, step_size): field = hasattr(self._function, "getOutputMesh") data = jinja2.Template(tdata).render({"className": className, "xml_path": self._xml_path, - "field": field, - "start": self._start}) + "field": field}) slave_file = os.path.join(self._workdir, className + ".py") with open(slave_file, "w") as fslave: fslave.write(data)