Skip to content

Commit

Permalink
export/pythonfmu no start values
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Dec 1, 2023
1 parent 2e0cd04 commit e9a3cf2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions otfmi/function_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
Expand Down Expand Up @@ -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():
Expand All @@ -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)
Expand Down

0 comments on commit e9a3cf2

Please sign in to comment.