morphopt 4.0.10__tar.gz → 4.0.11__tar.gz

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 (230) hide show
  1. {morphopt-4.0.10 → morphopt-4.0.11}/PKG-INFO +10 -8
  2. {morphopt-4.0.10 → morphopt-4.0.11}/README.md +7 -5
  3. {morphopt-4.0.10 → morphopt-4.0.11}/pyproject.toml +3 -3
  4. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/constants.py +20 -2
  5. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/controller.py +45 -43
  6. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/baseparam.py +0 -8
  7. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/geometry.py +0 -9
  8. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/params.py +1 -9
  9. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/objfunc.py +10 -62
  10. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/protocal.py +12 -0
  11. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/postprocess/__init__.py +4 -6
  12. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/postprocess/archive.py +98 -83
  13. morphopt-4.0.11/src/morphopt/postprocess/exports/__init__.py +34 -0
  14. morphopt-4.0.11/src/morphopt/postprocess/exports/animation.py +100 -0
  15. morphopt-4.0.11/src/morphopt/postprocess/exports/components.py +63 -0
  16. morphopt-4.0.11/src/morphopt/postprocess/exports/finite_element.py +168 -0
  17. morphopt-4.0.11/src/morphopt/postprocess/exports/tables.py +197 -0
  18. morphopt-4.0.11/src/morphopt/postprocess/snapshots.py +229 -0
  19. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/postprocess/visualization.py +138 -144
  20. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/boundary_part.py +14 -10
  21. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +54 -58
  22. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/base_surface.py +36 -18
  23. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/brep_surface.py +394 -153
  24. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/bsp_surface.py +26 -59
  25. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/cpgeo_surface.py +36 -56
  26. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/mesh_surface.py +18 -53
  27. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/update_boundary_part.py +6 -2
  28. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/simp/simpmaterial.py +86 -21
  29. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/__init__.py +1 -1
  30. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/app.py +18 -2
  31. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/definitions.py +26 -23
  32. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/devices.py +7 -4
  33. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/finite_element.py +6 -5
  34. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/part_sets.py +15 -4
  35. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/results.py +17 -19
  36. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/runs.py +14 -39
  37. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/validation.py +5 -3
  38. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/codegen/assets.py +41 -11
  39. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/codegen/custom_classes.py +12 -10
  40. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/i18n.py +9 -0
  41. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/locales/en-US.json +49 -23
  42. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/locales/zh-CN.json +49 -23
  43. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/mainwindow.py +88 -29
  44. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/observe_panel.py +56 -172
  45. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/presentation/labels.py +16 -1
  46. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/presentation/result_fields.py +3 -12
  47. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/refresh.py +6 -1
  48. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/palette.py +1 -0
  49. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/styles/base.qss +1 -0
  50. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/styles/controls.qss +2 -2
  51. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/styles/inputs.qss +1 -1
  52. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/themes/dark.py +1 -0
  53. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/themes/light.py +10 -9
  54. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/visualization/geometry.py +8 -2
  55. morphopt-4.0.11/src/morphopt/ui/visualization/rendering.py +166 -0
  56. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/controller_editor.py +2 -2
  57. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/finite_element.py +1 -1
  58. morphopt-4.0.11/src/morphopt/ui/widgets/history_export.py +753 -0
  59. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/model_tree.py +5 -1
  60. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/observation_pages.py +122 -69
  61. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/solver_editor.py +1 -2
  62. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/source_view.py +21 -2
  63. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/updater_editor.py +2 -1
  64. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/viewer.py +4 -2
  65. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/viewport.py +7 -3
  66. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/workbench.py +1 -0
  67. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/worker.py +7 -3
  68. morphopt-4.0.11/src/morphopt/utils/paths.py +74 -0
  69. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt.egg-info/PKG-INFO +10 -8
  70. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt.egg-info/SOURCES.txt +6 -1
  71. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt.egg-info/requires.txt +2 -2
  72. morphopt-4.0.10/src/morphopt/postprocess/exports.py +0 -551
  73. morphopt-4.0.10/src/morphopt/ui/visualization/rendering.py +0 -86
  74. morphopt-4.0.10/src/morphopt/ui/widgets/history_export.py +0 -332
  75. morphopt-4.0.10/src/morphopt/utils/paths.py +0 -22
  76. {morphopt-4.0.10 → morphopt-4.0.11}/setup.cfg +0 -0
  77. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/__init__.py +0 -0
  78. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/codesign/__init__.py +0 -0
  79. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/codesign/constraints.py +0 -0
  80. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/codesign/offset_boundary_part.py +0 -0
  81. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/codesign/update_offset_boundary_part.py +0 -0
  82. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/opt_runner.py +0 -0
  83. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/__init__.py +0 -0
  84. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/history.py +0 -0
  85. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/__init__.py +0 -0
  86. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/base_model_component.py +0 -0
  87. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/__init__.py +0 -0
  88. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/base_component.py +0 -0
  89. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/body_force.py +0 -0
  90. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/boundary_condition.py +0 -0
  91. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/contact.py +0 -0
  92. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/couple.py +0 -0
  93. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/joint.py +0 -0
  94. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/point_load.py +0 -0
  95. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/pressure.py +0 -0
  96. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/reference_point.py +0 -0
  97. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/spring.py +0 -0
  98. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/feaparams.py +0 -0
  99. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/materials/__init__.py +0 -0
  100. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/materials/base_material.py +0 -0
  101. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/materials/homogeneous_material.py +0 -0
  102. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/materials/models.py +0 -0
  103. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/materialsparams.py +0 -0
  104. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/__init__.py +0 -0
  105. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/base_part.py +0 -0
  106. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/box_part.py +0 -0
  107. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/cad_part.py +0 -0
  108. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/fixed_part.py +0 -0
  109. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/inp_part.py +0 -0
  110. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/solver.py +0 -0
  111. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/strategies.py +0 -0
  112. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/optcore/updaters.py +0 -0
  113. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/postprocess/_runtime.py +0 -0
  114. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/postprocess/fields.py +0 -0
  115. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/__init__.py +0 -0
  116. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/barriers.py +0 -0
  117. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/__init__.py +0 -0
  118. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +0 -0
  119. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/boundarys.py +0 -0
  120. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/distancesurface.py +0 -0
  121. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/shapederivative.py +0 -0
  122. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/volumemaximization.py +0 -0
  123. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/strategies.py +0 -0
  124. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/__init__.py +0 -0
  125. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/base_constraints.py +0 -0
  126. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/bsp_constraints.py +0 -0
  127. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/cpgeo_constraints.py +0 -0
  128. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/nurbs_face.py +0 -0
  129. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/simp/__init__.py +0 -0
  130. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/__init__.py +0 -0
  131. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/basefuncs.py +0 -0
  132. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/boundarys.py +0 -0
  133. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/densityfield.py +0 -0
  134. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/sensitivity.py +0 -0
  135. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/volfrac.py +0 -0
  136. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/simp/update_simpmaterial.py +0 -0
  137. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/simp/void_elements.py +0 -0
  138. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/__main__.py +0 -0
  139. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/__init__.py +0 -0
  140. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/cad.py +0 -0
  141. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/completion.py +0 -0
  142. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/edit_history.py +0 -0
  143. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/editing.py +0 -0
  144. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/editor_routing.py +0 -0
  145. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/expressions.py +0 -0
  146. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/fields.py +0 -0
  147. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/load_cases.py +0 -0
  148. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/part_mesh.py +0 -0
  149. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/quickstart.py +0 -0
  150. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/updaters.py +0 -0
  151. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application/values.py +0 -0
  152. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/application_icon.py +0 -0
  153. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/assets/morphopt.svg +0 -0
  154. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/codegen/__init__.py +0 -0
  155. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/codegen/generator.py +0 -0
  156. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/codegen/snippets.py +0 -0
  157. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/codegen/workspace.py +0 -0
  158. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/launcher.py +0 -0
  159. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/__init__.py +0 -0
  160. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/base_nodes.py +0 -0
  161. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/chamberlayout.py +0 -0
  162. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/configuration.py +0 -0
  163. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/fields.py +0 -0
  164. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/loaders.py +0 -0
  165. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/material_models.py +0 -0
  166. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/__init__.py +0 -0
  167. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/cad.py +0 -0
  168. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/custom_code.py +0 -0
  169. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/loads.py +0 -0
  170. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/materials.py +0 -0
  171. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/objectives.py +0 -0
  172. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/parts.py +0 -0
  173. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/penalties.py +0 -0
  174. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/structural.py +0 -0
  175. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/surfaces.py +0 -0
  176. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/symmetry.py +0 -0
  177. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/problem.py +0 -0
  178. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/registry.py +0 -0
  179. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/model/strategies.py +0 -0
  180. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/presentation/__init__.py +0 -0
  181. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/presentation/edit_history.py +0 -0
  182. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/presentation/history.py +0 -0
  183. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/presentation/navigation.py +0 -0
  184. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/processes.py +0 -0
  185. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/__init__.py +0 -0
  186. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/fonts.py +0 -0
  187. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/manager.py +0 -0
  188. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/styles/__init__.py +0 -0
  189. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/stylesheet.py +0 -0
  190. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/themes/__init__.py +0 -0
  191. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/theme/visualization.py +0 -0
  192. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/visualization/__init__.py +0 -0
  193. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/visualization/assets.py +0 -0
  194. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/visualization/loads.py +0 -0
  195. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/visualization/scene.py +0 -0
  196. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/__init__.py +0 -0
  197. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/asset_browser.py +0 -0
  198. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/case_deletion.py +0 -0
  199. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/codeeditor.py +0 -0
  200. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/collection_controls.py +0 -0
  201. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/custom_classes.py +0 -0
  202. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/definition_actions.py +0 -0
  203. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/definition_manager.py +0 -0
  204. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/edit_history.py +0 -0
  205. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/editor.py +0 -0
  206. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/editor_pages.py +0 -0
  207. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/file_dialogs.py +0 -0
  208. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/font_settings.py +0 -0
  209. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/helper_editor.py +0 -0
  210. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/history_dialogs.py +0 -0
  211. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/labels.py +0 -0
  212. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/load_cases.py +0 -0
  213. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/objective_editor.py +0 -0
  214. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/param_form.py +0 -0
  215. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/part_set_list.py +0 -0
  216. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/preview_renderer.py +0 -0
  217. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/problems.py +0 -0
  218. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/quickstart.py +0 -0
  219. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/run_dialogs.py +0 -0
  220. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/sequence_input.py +0 -0
  221. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/template_insert_dialog.py +0 -0
  222. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/visualization_settings.py +0 -0
  223. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/ui/widgets/workspace_objective.py +0 -0
  224. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/utils/__init__.py +0 -0
  225. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/utils/gradient_check.py +0 -0
  226. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/utils/history_read.py +0 -0
  227. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt/utils/quadrature.py +0 -0
  228. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt.egg-info/dependency_links.txt +0 -0
  229. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt.egg-info/entry_points.txt +0 -0
  230. {morphopt-4.0.10 → morphopt-4.0.11}/src/morphopt.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: morphopt
3
- Version: 4.0.10
3
+ Version: 4.0.11
4
4
  Summary: A morphing optimization framework using PyTorch and torchfea.
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -18,11 +18,11 @@ Requires-Dist: tabulate>=0.9.0
18
18
  Requires-Dist: imageio>=2.37.3
19
19
  Requires-Dist: fonttools>=4.0
20
20
  Requires-Dist: bspmap>=1.0.3
21
- Requires-Dist: torchfea>=1.1.6
21
+ Requires-Dist: torchfea>=1.1.7
22
22
  Requires-Dist: trimesh>=4.11.5
23
23
  Requires-Dist: networkx>=3.6.1
24
24
  Requires-Dist: scipy>=1.17.1
25
- Requires-Dist: cpgeo>=1.0.13
25
+ Requires-Dist: cpgeo>=1.0.15
26
26
  Provides-Extra: test
27
27
  Requires-Dist: pytest>=8.0; extra == "test"
28
28
 
@@ -39,7 +39,7 @@ MorphOpt is a differentiable structural optimization framework that combines the
39
39
  - First-order and history-based quadratic FEA surrogates with L-BFGS subproblem solves and explicit step limits
40
40
  - Surface-integrated geometric penalties with fixed, sensitivity-based, or adaptive weights; native FEA sensitivities remain unscaled
41
41
  - Named load cases, ordered solve groups, and per-worker CPU/GPU assignment (one CPU worker by default)
42
- - UI definition, asset preview, saved-log browsing, per-surface/control-net views, and current-view geometry export and history GIF export
42
+ - UI definition, asset preview, saved-log browsing, per-surface/control-net views, and component-specific history export (STEP/STL for boundary surfaces), previewable GIF animations, and Abaqus INP files
43
43
  - Component customization through framework class inheritance
44
44
 
45
45
  ## Quick Start
@@ -81,7 +81,7 @@ Requirements: Python ≥ 3.12; a PyTorch **float64** build is recommended.
81
81
 
82
82
  The GUI opens directly into the full definition workbench with its standard sections present and no problem setup prefilled. Definitions can be created directly in the workbench or generated through **Quickstart**. Quickstart provides shape and topology optimization settings, geometry definitions, and weighted objective terms with associated load conditions. Workspace terms select their driving pressure channels and use boundary integration. Generated problems stay editable and can be saved or exported as runnable folders. Load cases use named interface cards with individually labelled scalar parameters. Workspace objectives automatically register their boundary Gauss-point cases.
83
83
 
84
- The [UI quick start](docs/UIguide.md) covers the complete example from model definition to optimization and result inspection. The [script quick start](docs/scriptguide.md) provides the equivalent runnable Python task.
84
+ The [UI quick start](docs/en-US/ui-quickstart.md) covers the complete example from model definition to optimization and result inspection. The [script quick start](docs/en-US/script-quickstart.md) provides the equivalent runnable Python task.
85
85
 
86
86
  ### Run the UI in a virtual environment
87
87
 
@@ -115,12 +115,14 @@ Shared UI defaults and tunable kernel parameters live in [`src/morphopt/constant
115
115
 
116
116
  ### Documentation
117
117
 
118
+ [English documentation](docs/en-US/README.md) · [简体中文文档](docs/zh-CN/README.md)
119
+
118
120
  | Workflow | Quick start | Module and interface reference |
119
121
  |---|---|---|
120
- | Python script | [Start an optimization](docs/scriptguide.md) | [Define and extend each module](docs/scriptreference.md) |
121
- | Graphical UI | [Create and run the example](docs/UIguide.md) | [Modules, parameters and interface definitions](docs/UIreference.md) |
122
+ | Python script | [Start an optimization](docs/en-US/script-quickstart.md) | [Define and extend each module](docs/en-US/script-reference.md) |
123
+ | Graphical UI | [Create and run the example](docs/en-US/ui-quickstart.md) | [Modules, parameters and interface definitions](docs/en-US/ui-reference.md) |
122
124
 
123
- The [documentation index](docs/README.md) includes the reading order and automatic section numbering commands. Theory and code architecture are documented separately under `docs/theory/` and `docs/codestructure/`.
125
+ The [documentation index](docs/en-US/README.md) includes the reading order and automatic section numbering commands. Theory and code architecture are documented separately under `docs/en-US/theory/` and `docs/en-US/codestructure/`.
124
126
 
125
127
  ## Directory Overview
126
128
 
@@ -11,7 +11,7 @@ MorphOpt is a differentiable structural optimization framework that combines the
11
11
  - First-order and history-based quadratic FEA surrogates with L-BFGS subproblem solves and explicit step limits
12
12
  - Surface-integrated geometric penalties with fixed, sensitivity-based, or adaptive weights; native FEA sensitivities remain unscaled
13
13
  - Named load cases, ordered solve groups, and per-worker CPU/GPU assignment (one CPU worker by default)
14
- - UI definition, asset preview, saved-log browsing, per-surface/control-net views, and current-view geometry export and history GIF export
14
+ - UI definition, asset preview, saved-log browsing, per-surface/control-net views, and component-specific history export (STEP/STL for boundary surfaces), previewable GIF animations, and Abaqus INP files
15
15
  - Component customization through framework class inheritance
16
16
 
17
17
  ## Quick Start
@@ -53,7 +53,7 @@ Requirements: Python ≥ 3.12; a PyTorch **float64** build is recommended.
53
53
 
54
54
  The GUI opens directly into the full definition workbench with its standard sections present and no problem setup prefilled. Definitions can be created directly in the workbench or generated through **Quickstart**. Quickstart provides shape and topology optimization settings, geometry definitions, and weighted objective terms with associated load conditions. Workspace terms select their driving pressure channels and use boundary integration. Generated problems stay editable and can be saved or exported as runnable folders. Load cases use named interface cards with individually labelled scalar parameters. Workspace objectives automatically register their boundary Gauss-point cases.
55
55
 
56
- The [UI quick start](docs/UIguide.md) covers the complete example from model definition to optimization and result inspection. The [script quick start](docs/scriptguide.md) provides the equivalent runnable Python task.
56
+ The [UI quick start](docs/en-US/ui-quickstart.md) covers the complete example from model definition to optimization and result inspection. The [script quick start](docs/en-US/script-quickstart.md) provides the equivalent runnable Python task.
57
57
 
58
58
  ### Run the UI in a virtual environment
59
59
 
@@ -87,12 +87,14 @@ Shared UI defaults and tunable kernel parameters live in [`src/morphopt/constant
87
87
 
88
88
  ### Documentation
89
89
 
90
+ [English documentation](docs/en-US/README.md) · [简体中文文档](docs/zh-CN/README.md)
91
+
90
92
  | Workflow | Quick start | Module and interface reference |
91
93
  |---|---|---|
92
- | Python script | [Start an optimization](docs/scriptguide.md) | [Define and extend each module](docs/scriptreference.md) |
93
- | Graphical UI | [Create and run the example](docs/UIguide.md) | [Modules, parameters and interface definitions](docs/UIreference.md) |
94
+ | Python script | [Start an optimization](docs/en-US/script-quickstart.md) | [Define and extend each module](docs/en-US/script-reference.md) |
95
+ | Graphical UI | [Create and run the example](docs/en-US/ui-quickstart.md) | [Modules, parameters and interface definitions](docs/en-US/ui-reference.md) |
94
96
 
95
- The [documentation index](docs/README.md) includes the reading order and automatic section numbering commands. Theory and code architecture are documented separately under `docs/theory/` and `docs/codestructure/`.
97
+ The [documentation index](docs/en-US/README.md) includes the reading order and automatic section numbering commands. Theory and code architecture are documented separately under `docs/en-US/theory/` and `docs/en-US/codestructure/`.
96
98
 
97
99
  ## Directory Overview
98
100
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "morphopt"
3
- version = "4.0.10"
3
+ version = "4.0.11"
4
4
  description = "A morphing optimization framework using PyTorch and torchfea."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -19,11 +19,11 @@ dependencies = [
19
19
  "imageio>=2.37.3",
20
20
  "fonttools>=4.0",
21
21
  "bspmap>=1.0.3",
22
- "torchfea>=1.1.6",
22
+ "torchfea>=1.1.7",
23
23
  "trimesh>=4.11.5",
24
24
  "networkx>=3.6.1",
25
25
  "scipy>=1.17.1",
26
- "cpgeo>=1.0.13",
26
+ "cpgeo>=1.0.15",
27
27
  ]
28
28
 
29
29
  [project.scripts]
@@ -21,10 +21,14 @@ class _Constants:
21
21
 
22
22
  class OBSERVER:
23
23
  OUTPUT_MAXIMUM_BLOCKS = 10000
24
+ PREVIEW_CACHE_BYTES = (
25
+ 5 * 1024**3
26
+ ) # Shared mesh-data budget for history previews.
24
27
  LOG_READ_MAXIMUM_BYTES = 1024 * 1024
25
28
  POLL_INTERVAL_MS = 1000
26
29
 
27
30
  class CAMERA:
31
+ FIT_VIEW_FRACTION = 0.96
28
32
  FRAME_INTERVAL_MS = 16
29
33
  MOVEMENT_SPEED_RATIO = 0.3
30
34
  FAST_MULTIPLIER = 4.0
@@ -1007,6 +1011,8 @@ class _Constants:
1007
1011
 
1008
1012
  class VISUALIZATION:
1009
1013
  WINDOW_SIZE = (1200, 1200)
1014
+ SNAPSHOT_LZMA_LEVEL = 1
1015
+ SNAPSHOT_BLOCK_BYTES = 256 * 1024
1010
1016
  CAMERA_AZIMUTH_DEGREES = 210
1011
1017
  CAMERA_ELEVATION_DEGREES = 20
1012
1018
  INSTANCE_COLORS = ("#2878b5", "#edb120", "#af52cd", "#f15854", "#779548")
@@ -1045,7 +1051,15 @@ class _Constants:
1045
1051
 
1046
1052
  class FEA:
1047
1053
  SPHERICAL_JOINT_VALUES = (1.0, 0.0, 0.0, 0.0)
1048
- SINGLE_DOF_JOINT_VALUES = (*SPHERICAL_JOINT_VALUES, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0)
1054
+ SINGLE_DOF_JOINT_VALUES = (
1055
+ *SPHERICAL_JOINT_VALUES,
1056
+ 0.0,
1057
+ 0.0,
1058
+ 0.0,
1059
+ 0.0,
1060
+ 0.0,
1061
+ 1.0,
1062
+ )
1049
1063
  DEFAULT_TRANSLATION_DOFS = (0, 1, 2)
1050
1064
  CONTACT_PENALTY_THRESHOLD = 3.0
1051
1065
 
@@ -1061,12 +1075,13 @@ class _Constants:
1061
1075
 
1062
1076
  class SHAPE_CONSTRAINTS:
1063
1077
  class FAIRNESS:
1064
- CURVATURE_LIMIT = 1.5
1078
+ CURVATURE_LIMIT = 1.0
1065
1079
  METRIC_VARIATION_LIMIT = 1.0
1066
1080
  NONORTHOGONALITY_LIMIT = 0.2
1067
1081
  ACTIVATION_RATIO = 0.8
1068
1082
  BSP_EXPONENT = 3
1069
1083
  CPGEO_EXPONENT = 3
1084
+ CPGEO_STRETCH_RATIO_LIMIT = 2.5
1070
1085
 
1071
1086
  BARRIER_THRESHOLD = 0.05
1072
1087
  BARRIER_RATIO = 0.0
@@ -1169,6 +1184,9 @@ class _Constants:
1169
1184
  PROJECTION_PARAMETER_MAX = 1.0
1170
1185
 
1171
1186
  class SIMP:
1187
+ EXPORT_VOXEL_SIZE = 1.0
1188
+ EXPORT_DENSITY_THRESHOLD = 0.5
1189
+ EXPORT_SAMPLE_BATCH_SIZE = 8192
1172
1190
  DEFAULT_INITIAL_RATIO = 0.5
1173
1191
  DEFAULT_VOID_PENALTY_FACTOR = 0.01
1174
1192
  DEFAULT_MATERIAL_PENALTY = 8
@@ -3,6 +3,8 @@ from __future__ import annotations
3
3
  from typing import TYPE_CHECKING
4
4
 
5
5
  if TYPE_CHECKING:
6
+ from pyvista import MultiBlock
7
+
6
8
  from .. import ObjectiveFunction, Params, Solver, Updaters
7
9
  import datetime
8
10
  import gc
@@ -13,13 +15,14 @@ import os
13
15
  import shutil
14
16
  import time
15
17
  from multiprocessing import get_context
18
+ from pathlib import Path
16
19
 
17
20
  import torch
18
21
 
19
22
  import morphopt
20
23
 
21
24
  from ..constants import CONSTANT
22
- from ..utils.paths import sanitize_name
25
+ from ..utils.paths import sanitize_name, write_result_launcher
23
26
  from .history import History
24
27
 
25
28
  logger = logging.getLogger(__name__)
@@ -33,21 +36,18 @@ class Controller:
33
36
  task. The controller owns the outer iteration, result directory, persistence, and history
34
37
  collection; numerical responsibilities remain in the composed components.
35
38
  """
39
+
36
40
  class Params:
37
41
  """Declare the model-parameter implementation used by the task controller."""
38
- pass
39
42
 
40
43
  class Solver:
41
44
  """Declare the finite-element solver implementation used by the task controller."""
42
- pass
43
45
 
44
46
  class Updater:
45
47
  """Declare the updater collection used by the task controller."""
46
- pass
47
48
 
48
49
  class ObjectiveFunction:
49
50
  """Declare the physical objective and named metrics used by the task controller."""
50
- pass
51
51
 
52
52
  def __init__(
53
53
  self, path_result_folder: str, opt_label: str = "DefaultLabel"
@@ -104,7 +104,9 @@ class Controller:
104
104
  History: An instance of the History class from the History module to record the optimization history.
105
105
  """
106
106
 
107
- self.restart_per_iteration: int = CONSTANT.KERNEL.CONTROLLER.RESTART_PER_ITERATION
107
+ self.restart_per_iteration: int = (
108
+ CONSTANT.KERNEL.CONTROLLER.RESTART_PER_ITERATION
109
+ )
108
110
  """
109
111
  The frequency of restarting the optimization process.
110
112
  """
@@ -209,9 +211,10 @@ class Controller:
209
211
 
210
212
  main_filepath = __main__.__file__
211
213
  scripts_directory = self.path_result + "/scripts/"
212
- shutil.copy(
213
- main_filepath, scripts_directory + "MAIN_SCRIPT_FOR_RESTART.py"
214
- )
214
+ shutil.copy(main_filepath, scripts_directory + "MAIN_SCRIPT_FOR_RESTART.py")
215
+ definition = Path(main_filepath).with_suffix(".morph")
216
+ if definition.is_file():
217
+ shutil.copyfile(definition, Path(scripts_directory) / "MAIN_SCRIPT_FOR_RESTART.morph")
215
218
  asset_directory = os.path.join(
216
219
  os.path.dirname(os.path.abspath(main_filepath)), "morphopt_assets"
217
220
  )
@@ -224,6 +227,7 @@ class Controller:
224
227
  vendor_package("torchfea", target_dir=self.path_result + "/scripts/")
225
228
  vendor_package("cpgeo", target_dir=self.path_result + "/scripts/")
226
229
  vendor_package("morphopt", target_dir=self.path_result + "/scripts/")
230
+ write_result_launcher(Path(self.path_result))
227
231
 
228
232
  def initialize(self) -> None:
229
233
  """
@@ -247,7 +251,6 @@ class Controller:
247
251
  self.pools = get_context("spawn").Pool(processes=self.solver.num_process)
248
252
 
249
253
  def start_optimization(self, main_filepath: str = None) -> None:
250
-
251
254
  """Initialize a new task and run the outer optimization loop.
252
255
 
253
256
  Create the result directory and log layout, initialize the composed model and numerical
@@ -292,7 +295,6 @@ class Controller:
292
295
  def restart_optimization(
293
296
  self, path_result: str, target_iteration: int = None
294
297
  ) -> None:
295
-
296
298
  """Restore an archived task at a completed checkpoint and continue optimization.
297
299
 
298
300
  Args:
@@ -323,7 +325,7 @@ class Controller:
323
325
  # Explicitly release large objects to ensure they are collected
324
326
  self.clear_cache()
325
327
 
326
- _, t0, t1, t2, t3, t4 = self.step()
328
+ _, t0, t1, t2, t3, t4, design_snapshot = self.step()
327
329
 
328
330
  # Record the history of the optimization process
329
331
  self.record_history(t0, t1, t2, t3, t4)
@@ -332,7 +334,8 @@ class Controller:
332
334
  self.print_info(t0, t1, t2, t3, t4)
333
335
 
334
336
  # Save the current parameters and plot the figures
335
- self.save()
337
+ self.save(design_snapshot)
338
+ del design_snapshot # Release the meshes before building the next FE model.
336
339
 
337
340
  # if dataqueue is not None, send the data to the queue
338
341
  if self.dataqueue is not None:
@@ -356,13 +359,12 @@ class Controller:
356
359
  self.pools.join()
357
360
  return
358
361
 
359
- def step(self):
362
+ def step(self) -> tuple[torch.Tensor, float, float, float, float, float, MultiBlock]:
360
363
  """Execute one complete outer iteration: build, solve, differentiate, and update.
361
364
 
362
365
  Returns:
363
- tuple[torch.Tensor, float, float, float, float, float]: Physical objective and
364
- timestamps t0 through t4 delimiting model construction, FEA, sensitivity analysis,
365
- and design update.
366
+ The physical objective, timestamps t0 through t4, and the design meshes
367
+ used for this solve, captured before the design update.
366
368
  """
367
369
  t0 = time.time()
368
370
 
@@ -379,12 +381,10 @@ class Controller:
379
381
  self.updater.reinitialize(iteration=self.history.iteration)
380
382
  self.objfun.reinitialize(iteration=self.history.iteration)
381
383
 
382
- # The checkpoint saved after the update belongs to the next design.
383
- # Capture the geometry after refinement, as used by this iteration's FEA.
384
- self.params.geometry.save(
385
- foldpath=os.path.join(self.path_result, "log", "evaluated", str(self.history.iteration + 1)),
386
- iteration=self.history.iteration + 1,
387
- )
384
+ if self.history.iteration == 0:
385
+ self.params.geometry.save(
386
+ foldpath=os.path.join(self.path_result, "log"), iteration=0
387
+ )
388
388
 
389
389
  # Perform the optimization step
390
390
  logger.info(f"Creating FEA model for iteration {self.history.iteration}...")
@@ -392,6 +392,10 @@ class Controller:
392
392
  path_result=self.path_result + "/cache/", pools=self.pools
393
393
  )
394
394
 
395
+ from ..postprocess.snapshots import capture_design
396
+
397
+ with torch.no_grad():
398
+ design_snapshot = capture_design(self.params)
395
399
  t1 = time.time()
396
400
 
397
401
  # Perform finite element analysis (FEA)
@@ -416,7 +420,7 @@ class Controller:
416
420
 
417
421
  t4 = time.time()
418
422
 
419
- return loss, t0, t1, t2, t3, t4
423
+ return loss, t0, t1, t2, t3, t4, design_snapshot
420
424
 
421
425
  def record_history(
422
426
  self, t0: float, t1: float, t2: float, t3: float, t4: float
@@ -464,26 +468,24 @@ class Controller:
464
468
  logger.info(f" Total Time: {t4 - t0:.2f} seconds")
465
469
  logger.info("-" * 50)
466
470
 
467
- def save(self) -> None:
468
- """
469
- Save the current state of the optimization process.
470
- """
471
- self.params.save(
472
- foldpath=self.path_result + "/log/", iteration=self.history.iteration
473
- )
474
- self.solver.save(
475
- foldpath=self.path_result + "/log/", iteration=self.history.iteration
476
- )
477
- self.updater.save(
478
- foldpath=self.path_result + "/log/", iteration=self.history.iteration
479
- )
480
- self.objfun.save(
481
- foldpath=self.path_result + "/log/", iteration=self.history.iteration
482
- )
471
+ def save(self, design_snapshot: MultiBlock) -> None:
472
+ """Archive the completed solve and its updated design parameters.
473
+
474
+ Args:
475
+ design_snapshot: Design meshes captured for the finite-element solve.
476
+ """
477
+ from ..postprocess.snapshots import save_snapshot
478
+
479
+ log_folder = self.path_result + "/log/"
480
+ iteration = self.history.iteration
481
+ self.params.save(foldpath=log_folder, iteration=iteration)
482
+ self.solver.save(foldpath=log_folder, iteration=iteration)
483
+ self.updater.save(foldpath=log_folder, iteration=iteration)
484
+ self.objfun.save(foldpath=log_folder, iteration=iteration)
485
+ with torch.no_grad():
486
+ save_snapshot(log_folder, iteration, design_snapshot, self.objfun)
483
487
  # Publish a completed iteration only after its model and results exist.
484
- self.history.save(
485
- foldpath=self.path_result + "/log/", iteration=self.history.iteration
486
- )
488
+ self.history.save(foldpath=log_folder, iteration=iteration)
487
489
 
488
490
  def clear_cache(self) -> None:
489
491
  """
@@ -200,14 +200,6 @@ class BaseParams(
200
200
  f"{list(self.interfaces)}."
201
201
  ) from None
202
202
 
203
- def export_data(self, foldpath: str):
204
- """
205
- Export the data of parameters to file(s).
206
-
207
- Args:
208
- foldpath (str): The path to export the data.
209
- """
210
-
211
203
  def save(self, foldpath: str, iteration: int) -> None:
212
204
  """Save the state of every registered interface.
213
205
 
@@ -80,12 +80,3 @@ class GeometryParams(BaseParams):
80
80
  for interface in self.interfaces.values():
81
81
  interface.add_to_assembly(assembly, path_result=path_result, pools=pools)
82
82
  return assembly
83
-
84
- def export_data(self, foldpath: str) -> None:
85
- """Export the geometry description of every interface.
86
-
87
- Args:
88
- foldpath (str): Root log directory containing this component's namespaced state files.
89
- """
90
- for interface in self.interfaces.values():
91
- interface.export_data(interface.workdir(foldpath))
@@ -202,17 +202,9 @@ class Params(
202
202
  iteration (int): Iteration index associated with the saved or current model state.
203
203
  """
204
204
  self.geometry.load(foldpath=foldpath, iteration=iteration)
205
+ self.feamodel.load(foldpath=foldpath, iteration=iteration)
205
206
  self.materials.load(foldpath=foldpath, iteration=iteration)
206
207
 
207
- def export_data(self, filepath: str) -> None:
208
- """
209
- Export the data of parameters to file(s).
210
-
211
- Args:
212
- filepath (str): The path to export the data.
213
- """
214
- self.geometry.export_data(foldpath=filepath)
215
-
216
208
  def plot(
217
209
  self, plotter: pv.Plotter | None = None, meshes: list[pv.DataSet] | None = None
218
210
  ) -> pv.Plotter:
@@ -204,10 +204,9 @@ class ObjectiveFunction(ProtocalInitializable, ProtocalSavable, ProtocalHistory)
204
204
  """Return log subdirectories required by this component.
205
205
 
206
206
  Returns:
207
- list[str]: Relative directories required to persist deformed meshes and finite-element
208
- results.
207
+ list[str]: Relative directory containing the model and its named load-case results.
209
208
  """
210
- return ["deformation", "femodel&results"]
209
+ return ["femodel&results"]
211
210
 
212
211
  def __getitem__(self, key):
213
212
  """Get the attribute with the given key.
@@ -280,71 +279,20 @@ class ObjectiveFunction(ProtocalInitializable, ProtocalSavable, ProtocalHistory)
280
279
  plotter.show()
281
280
 
282
281
  def save(self, foldpath: str, iteration: int) -> None:
283
- """Save the figures of the FEA results.
282
+ """Archive the solved model and each load case at the same iteration.
284
283
 
285
284
  Args:
286
- foldpath (str): The path to save the figures.
287
- iteration (int): The current iteration number.
285
+ foldpath (str): Root log directory of the optimization run.
286
+ iteration (int): Completed iteration shown in the history.
288
287
  """
288
+ directory = Path(foldpath) / self.pathlog_required()[0]
289
+ self.fe.save_model(str(directory / f"femodel_{iteration}"))
290
+ for case in self.fe_results:
291
+ self.fe_results[case].save(str(directory / f"result_{case}_iter_{iteration}.npz"))
289
292
 
290
- color_list = deepcopy(CONSTANT.KERNEL.VISUALIZATION.INSTANCE_COLORS)
291
-
292
- for case_name in self.fe_results:
293
- plotter = pv.Plotter(
294
- off_screen=True,
295
- window_size=list(CONSTANT.KERNEL.VISUALIZATION.WINDOW_SIZE),
296
- )
297
-
298
- # Create faces list for pyvista
299
- # Create pyvista mesh
300
- meshes = self.get_mesh_case(case_name)
301
-
302
- for meshidx, mesh in enumerate(meshes):
303
- plotter.add_mesh(
304
- mesh, color=color_list[meshidx % len(color_list)], opacity=1.0
305
- )
306
-
307
- # Approximate view
308
- plotter.set_background("white")
309
- plotter.enable_parallel_projection()
310
- azimuth = CONSTANT.KERNEL.VISUALIZATION.CAMERA_AZIMUTH_DEGREES
311
- elevation = CONSTANT.KERNEL.VISUALIZATION.CAMERA_ELEVATION_DEGREES
312
- plotter.view_vector(
313
- (
314
- math.cos(math.radians(azimuth)) * math.cos(math.radians(elevation)),
315
- math.sin(math.radians(azimuth)) * math.cos(math.radians(elevation)),
316
- math.sin(math.radians(elevation)),
317
- )
318
- )
319
-
320
- # Save the figure as a PNG file
321
- plotter.screenshot(
322
- f"{foldpath}/{self.pathlog_required()[0]}/task_{case_name}_iter_{iteration}.png"
323
- )
324
-
325
- # # Save the deformed mesh as an STL file
326
- save_filepath = f"{foldpath}/{self.pathlog_required()[0]}/task_{case_name}_iter_{iteration}.stl"
327
- meshall = meshes[0]
328
- for meshidx in range(1, len(meshes)):
329
- meshall = meshall.merge(meshes[meshidx])
330
- meshall.save(save_filepath, binary=True)
331
- plotter.close()
332
-
333
- # The FEA model and its result must be a matched pair. A model is
334
- # rebuilt from the current design at every iteration, so retaining
335
- # only iteration 0 makes later result files impossible to inspect
336
- # against the model that produced them.
337
- self.fe.save_model(
338
- f"{foldpath}/{self.pathlog_required()[1]}/femodel_{iteration}"
339
- )
340
-
341
- mapping = Path(f"{foldpath}/{self.pathlog_required()[1]}/load_cases.json")
293
+ mapping = directory / "load_cases.json"
342
294
  temporary = mapping.with_suffix(".json.tmp")
343
295
  temporary.write_text(
344
296
  json.dumps(list(self.fe_results), ensure_ascii=False), encoding="utf-8"
345
297
  )
346
298
  temporary.replace(mapping)
347
- for case_name in self.fe_results:
348
- self.fe_results[case_name].save(
349
- f"{foldpath}/{self.pathlog_required()[1]}/result_{case_name}_iter_{iteration}.npz"
350
- )
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import os
6
6
  from abc import ABC, abstractmethod
7
+ from pathlib import Path
7
8
 
8
9
  import pyvista as pv
9
10
  import torch
@@ -142,6 +143,17 @@ class ProtocalVisualizable(ABC):
142
143
  class ProtocalUpdatable(ABC):
143
144
  """Protocol shared by updateable geometry and material interfaces."""
144
145
 
146
+ export_modes: tuple[str, ...] = ()
147
+
148
+ def export(self, directory: Path, *, mode: str) -> None:
149
+ """Write the files defined by a component export mode into a directory.
150
+
151
+ Components declare their modes and may accept additional keyword arguments.
152
+ """
153
+ raise ValueError(
154
+ f"{type(self).__name__} does not support export mode {mode!r}."
155
+ )
156
+
145
157
  @property
146
158
  @abstractmethod
147
159
  def num_variables(self) -> int:
@@ -9,13 +9,12 @@ from ._runtime import cpu_torch_defaults
9
9
  from .archive import IterationModel, OptimizationArchive, last_completed_iteration
10
10
  from .exports import (
11
11
  TABLE_WRITERS,
12
- BoundarySurfaceInfo,
13
12
  NativeResultSnapshot,
14
13
  TableWriter,
15
- boundary_surface_options,
16
- export_boundary_surfaces,
14
+ export_design_components,
17
15
  export_fields,
18
16
  export_history_gif,
17
+ export_history_inp,
19
18
  export_native_results,
20
19
  export_saved_fields,
21
20
  normalize_export_name,
@@ -35,7 +34,6 @@ __all__ = [
35
34
  "CONTOUR_FIELDS",
36
35
  "RESULT_FIELDS",
37
36
  "TABLE_WRITERS",
38
- "BoundarySurfaceInfo",
39
37
  "ContourField",
40
38
  "DesignView",
41
39
  "FiniteElementResults",
@@ -46,11 +44,11 @@ __all__ = [
46
44
  "ResultLocation",
47
45
  "ResultTable",
48
46
  "TableWriter",
49
- "boundary_surface_options",
50
47
  "cpu_torch_defaults",
51
- "export_boundary_surfaces",
48
+ "export_design_components",
52
49
  "export_fields",
53
50
  "export_history_gif",
51
+ "export_history_inp",
54
52
  "export_native_results",
55
53
  "export_saved_fields",
56
54
  "last_completed_iteration",