pythonfmu3 0.3.4__py3-none-any.whl → 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. pythonfmu3/__main__.py +8 -0
  2. pythonfmu3/_version.py +1 -1
  3. pythonfmu3/builder.py +96 -24
  4. pythonfmu3/fmi3slave.py +23 -19
  5. pythonfmu3/modelexchange.py +17 -2
  6. pythonfmu3/osutil.py +34 -9
  7. pythonfmu3/pythonfmu-export/CMakeLists.txt +36 -4
  8. pythonfmu3/pythonfmu-export/generate_shim.py +88 -0
  9. pythonfmu3/pythonfmu-export/src/CMakeLists.txt +41 -13
  10. pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_common.hpp +3 -0
  11. pythonfmu3/pythonfmu-export/src/cppfmu/fmi_functions.cpp +6 -4
  12. pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.cpp +560 -571
  13. pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.hpp +20 -7
  14. pythonfmu3/pythonfmu-export/src/shim/fmi3_forwarders.cpp +612 -0
  15. pythonfmu3/pythonfmu-export/src/shim/shim_loader.cpp +157 -0
  16. pythonfmu3/pythonfmu-export/src/shim/shim_loader.hpp +29 -0
  17. pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-backend.so +0 -0
  18. pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so +0 -0
  19. pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll +0 -0
  20. pythonfmu3/studio/__init__.py +1 -0
  21. pythonfmu3/studio/server.py +358 -0
  22. pythonfmu3/studio/static/app.css +179 -0
  23. pythonfmu3/studio/static/app.js +613 -0
  24. pythonfmu3/studio/static/index.html +141 -0
  25. pythonfmu3/studio/static/logo.svg +8 -0
  26. pythonfmu3/studio/templates/bouncing_ball.py +75 -0
  27. pythonfmu3/studio/templates/dahlquist.py +31 -0
  28. pythonfmu3/studio/templates/pid_controller.py +42 -0
  29. pythonfmu3/studio/templates/signal_generator.py +40 -0
  30. pythonfmu3/studio/templates/surrogate.py +37 -0
  31. pythonfmu3/studio/templates/thermostat.py +45 -0
  32. pythonfmu3/studio/templates/van_der_pol.py +34 -0
  33. pythonfmu3/studio/worker.py +519 -0
  34. pythonfmu3/tests/data/fmi3_host.c +31 -0
  35. pythonfmu3/tests/fmi3_ctypes_driver.py +137 -0
  36. pythonfmu3/tests/test_builder.py +48 -2
  37. pythonfmu3/tests/test_docs.py +70 -61
  38. pythonfmu3/tests/test_example_pipe_cht.py +200 -0
  39. pythonfmu3/tests/test_migration_doc.py +34 -0
  40. pythonfmu3/tests/test_non_python_host.py +75 -0
  41. pythonfmu3/tests/test_osutil.py +23 -0
  42. pythonfmu3/tests/test_studio.py +149 -0
  43. pythonfmu3/tests/test_variables.py +1 -1
  44. pythonfmu3/tests/test_wrapper_ctypes.py +61 -0
  45. pythonfmu3/variables.py +4 -3
  46. {pythonfmu3-0.3.4.dist-info → pythonfmu3-1.1.0.dist-info}/METADATA +69 -25
  47. pythonfmu3-1.1.0.dist-info/RECORD +87 -0
  48. {pythonfmu3-0.3.4.dist-info → pythonfmu3-1.1.0.dist-info}/WHEEL +1 -1
  49. pythonfmu3-0.3.4.dist-info/RECORD +0 -60
  50. {pythonfmu3-0.3.4.dist-info → pythonfmu3-1.1.0.dist-info}/entry_points.txt +0 -0
  51. {pythonfmu3-0.3.4.dist-info → pythonfmu3-1.1.0.dist-info}/licenses/LICENSE +0 -0
  52. {pythonfmu3-0.3.4.dist-info → pythonfmu3-1.1.0.dist-info}/top_level.txt +0 -0
@@ -95,7 +95,8 @@ fmi3Instance fmi3InstantiateCoSimulation(
95
95
  fmi3IntermediateUpdateCallback intermediateUpdate )
96
96
  {
97
97
  try {
98
- auto component = new Component(
98
+ // Owned until fully constructed, so a failing instantiation does not leak it.
99
+ auto component = std::make_unique<Component>(
99
100
  environment,
100
101
  logMessage,
101
102
  loggingOn);
@@ -108,7 +109,7 @@ fmi3Instance fmi3InstantiateCoSimulation(
108
109
  visible,
109
110
  cppfmu::FMIFalse,
110
111
  component->logger);
111
- return component;
112
+ return component.release();
112
113
  } catch (const cppfmu::FatalError& e) {
113
114
  if (logMessage)
114
115
  {
@@ -134,7 +135,8 @@ fmi3Instance fmi3InstantiateModelExchange(
134
135
  fmi3LogMessageCallback logMessage)
135
136
  {
136
137
  try {
137
- auto component = new Component(
138
+ // Owned until fully constructed, so a failing instantiation does not leak it.
139
+ auto component = std::make_unique<Component>(
138
140
  environment,
139
141
  logMessage,
140
142
  loggingOn);
@@ -147,7 +149,7 @@ fmi3Instance fmi3InstantiateModelExchange(
147
149
  visible,
148
150
  cppfmu::FMIFalse,
149
151
  component->logger);
150
- return component;
152
+ return component.release();
151
153
  } catch (const cppfmu::FatalError& e) {
152
154
  if (logMessage)
153
155
  {