morphopt 4.0.6__tar.gz → 4.0.8__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 (252) hide show
  1. {morphopt-4.0.6 → morphopt-4.0.8}/PKG-INFO +37 -8
  2. {morphopt-4.0.6 → morphopt-4.0.8}/README.md +35 -6
  3. {morphopt-4.0.6 → morphopt-4.0.8}/pyproject.toml +2 -2
  4. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/__init__.py +2 -0
  5. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/codesign/constraints.py +4 -4
  6. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/constants.py +38 -43
  7. morphopt-4.0.8/src/morphopt/opt_runner.py +173 -0
  8. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/controller.py +25 -11
  9. morphopt-4.0.8/src/morphopt/optcore/history.py +77 -0
  10. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/geometry.py +5 -3
  11. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/params.py +24 -29
  12. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/cad_part.py +56 -23
  13. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/objfunc.py +3 -11
  14. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/protocal.py +4 -4
  15. morphopt-4.0.8/src/morphopt/optcore/strategies.py +87 -0
  16. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/updaters.py +304 -96
  17. morphopt-4.0.8/src/morphopt/postprocess/__init__.py +59 -0
  18. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/postprocess/archive.py +6 -1
  19. morphopt-4.0.8/src/morphopt/postprocess/exports.py +440 -0
  20. morphopt-4.0.8/src/morphopt/postprocess/fields.py +508 -0
  21. morphopt-4.0.8/src/morphopt/postprocess/visualization.py +301 -0
  22. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/__init__.py +6 -4
  23. morphopt-4.0.8/src/morphopt/shapeopt/barriers.py +38 -0
  24. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/boundary_part.py +35 -74
  25. morphopt-4.0.8/src/morphopt/shapeopt/objectivefuncs/__init__.py +7 -0
  26. morphopt-4.0.8/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +150 -0
  27. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/objectivefuncs/boundarys.py +30 -29
  28. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/objectivefuncs/distancesurface.py +51 -67
  29. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/objectivefuncs/shapederivative.py +72 -71
  30. morphopt-4.0.8/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +164 -0
  31. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/objectivefuncs/volumemaximization.py +2 -3
  32. morphopt-4.0.8/src/morphopt/shapeopt/strategies.py +360 -0
  33. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/base_constraints.py +10 -3
  34. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/base_surface.py +10 -79
  35. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/brep_surface.py +2 -2
  36. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/bsp_surface.py +35 -196
  37. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/cpgeo_constraints.py +0 -1
  38. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/cpgeo_surface.py +10 -91
  39. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/mesh_surface.py +0 -1
  40. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/update_boundary_part.py +91 -205
  41. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/__init__.py +1 -1
  42. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/basefuncs.py +4 -2
  43. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/sensitivity.py +38 -18
  44. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/simp/simpmaterial.py +12 -431
  45. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/simp/update_simpmaterial.py +29 -112
  46. morphopt-4.0.8/src/morphopt/simp/void_elements.py +430 -0
  47. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/__init__.py +3 -3
  48. morphopt-4.0.8/src/morphopt/ui/app.py +114 -0
  49. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/cad.py +50 -27
  50. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/completion.py +56 -30
  51. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/definitions.py +58 -23
  52. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/devices.py +1 -0
  53. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/edit_history.py +19 -6
  54. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/editing.py +183 -51
  55. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/editor_routing.py +21 -4
  56. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/expressions.py +11 -3
  57. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/fields.py +73 -7
  58. morphopt-4.0.8/src/morphopt/ui/application/finite_element.py +300 -0
  59. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/load_cases.py +127 -36
  60. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/part_mesh.py +8 -4
  61. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/part_sets.py +84 -27
  62. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/quickstart.py +32 -63
  63. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/results.py +46 -1
  64. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/runs.py +52 -12
  65. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/updaters.py +132 -39
  66. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/validation.py +71 -16
  67. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/values.py +13 -2
  68. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/codegen/assets.py +1 -1
  69. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/codegen/custom_classes.py +2 -10
  70. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/codegen/generator.py +49 -27
  71. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/launcher.py +10 -5
  72. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/locales/en-US.json +143 -40
  73. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/locales/zh-CN.json +143 -40
  74. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/mainwindow.py +40 -11
  75. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/base_nodes.py +4 -10
  76. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/configuration.py +36 -0
  77. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/fields.py +2 -0
  78. morphopt-4.0.8/src/morphopt/ui/model/loaders.py +245 -0
  79. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/__init__.py +6 -0
  80. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/loads.py +60 -8
  81. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/materials.py +4 -0
  82. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/objectives.py +33 -14
  83. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/penalties.py +6 -2
  84. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/structural.py +60 -0
  85. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/surfaces.py +4 -46
  86. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/symmetry.py +9 -0
  87. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/problem.py +38 -27
  88. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/registry.py +15 -0
  89. morphopt-4.0.8/src/morphopt/ui/model/strategies.py +60 -0
  90. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/observe_panel.py +197 -86
  91. morphopt-4.0.8/src/morphopt/ui/presentation/history.py +71 -0
  92. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/presentation/labels.py +54 -8
  93. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/presentation/navigation.py +7 -2
  94. morphopt-4.0.6/src/morphopt/ui/worker_environment.py → morphopt-4.0.8/src/morphopt/ui/processes.py +7 -3
  95. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/schemes/base.py +3 -3
  96. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/fonts.py +30 -11
  97. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/palette.py +25 -11
  98. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/styles/base.qss +1 -0
  99. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/styles/controls.qss +5 -0
  100. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/stylesheet.py +1 -2
  101. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/themes/dark.py +9 -4
  102. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/themes/light.py +19 -5
  103. morphopt-4.0.8/src/morphopt/ui/theme/visualization.py +73 -0
  104. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/visualization/__init__.py +25 -24
  105. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/visualization/assets.py +6 -3
  106. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/visualization/geometry.py +79 -33
  107. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/visualization/loads.py +1 -4
  108. morphopt-4.0.8/src/morphopt/ui/visualization/rendering.py +61 -0
  109. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/visualization/scene.py +16 -4
  110. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/asset_browser.py +58 -29
  111. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/case_deletion.py +9 -2
  112. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/custom_classes.py +3 -1
  113. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/definition_actions.py +139 -32
  114. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/definition_manager.py +25 -7
  115. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/editor.py +21 -20
  116. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/file_dialogs.py +1 -3
  117. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/finite_element.py +41 -50
  118. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/font_settings.py +5 -2
  119. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/helper_editor.py +7 -6
  120. morphopt-4.0.8/src/morphopt/ui/widgets/history_export.py +298 -0
  121. morphopt-4.0.6/src/morphopt/ui/widgets/result_path.py → morphopt-4.0.8/src/morphopt/ui/widgets/labels.py +45 -3
  122. morphopt-4.0.8/src/morphopt/ui/widgets/load_cases.py +46 -0
  123. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/model_tree.py +60 -21
  124. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/objective_editor.py +55 -51
  125. morphopt-4.0.8/src/morphopt/ui/widgets/observation_pages.py +555 -0
  126. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/param_form.py +25 -3
  127. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/preview_renderer.py +30 -10
  128. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/quickstart.py +26 -17
  129. morphopt-4.0.8/src/morphopt/ui/widgets/sequence_input.py +146 -0
  130. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/solver_editor.py +7 -6
  131. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/template_insert_dialog.py +1 -1
  132. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/updater_editor.py +62 -8
  133. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/viewer.py +13 -30
  134. morphopt-4.0.8/src/morphopt/ui/widgets/viewport.py +159 -0
  135. morphopt-4.0.8/src/morphopt/ui/widgets/visualization_settings.py +149 -0
  136. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/workspace_objective.py +43 -11
  137. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/workbench.py +19 -10
  138. morphopt-4.0.8/src/morphopt/ui/worker.py +92 -0
  139. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/utils/__init__.py +2 -0
  140. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/utils/gradient_check.py +7 -2
  141. {morphopt-4.0.6/src/morphopt/optcore → morphopt-4.0.8/src/morphopt/utils}/quadrature.py +5 -1
  142. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt.egg-info/PKG-INFO +37 -8
  143. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt.egg-info/SOURCES.txt +19 -23
  144. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt.egg-info/requires.txt +1 -1
  145. morphopt-4.0.6/src/morphopt/opt_runner.py +0 -103
  146. morphopt-4.0.6/src/morphopt/optcore/history.py +0 -473
  147. morphopt-4.0.6/src/morphopt/postprocess/__init__.py +0 -69
  148. morphopt-4.0.6/src/morphopt/postprocess/contours.py +0 -112
  149. morphopt-4.0.6/src/morphopt/postprocess/exporters.py +0 -174
  150. morphopt-4.0.6/src/morphopt/postprocess/fields.py +0 -361
  151. morphopt-4.0.6/src/morphopt/postprocess/history_gif.py +0 -121
  152. morphopt-4.0.6/src/morphopt/postprocess/native.py +0 -106
  153. morphopt-4.0.6/src/morphopt/postprocess/rendering.py +0 -85
  154. morphopt-4.0.6/src/morphopt/postprocess/surface_export.py +0 -133
  155. morphopt-4.0.6/src/morphopt/shapeopt/objectivefuncs/__init__.py +0 -7
  156. morphopt-4.0.6/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +0 -139
  157. morphopt-4.0.6/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +0 -42
  158. morphopt-4.0.6/src/morphopt/taskoptmization.py +0 -116
  159. morphopt-4.0.6/src/morphopt/ui/app.py +0 -65
  160. morphopt-4.0.6/src/morphopt/ui/application/finite_element.py +0 -193
  161. morphopt-4.0.6/src/morphopt/ui/cad_worker.py +0 -28
  162. morphopt-4.0.6/src/morphopt/ui/fea_worker.py +0 -65
  163. morphopt-4.0.6/src/morphopt/ui/history_gif_worker.py +0 -19
  164. morphopt-4.0.6/src/morphopt/ui/model/loaders.py +0 -31
  165. morphopt-4.0.6/src/morphopt/ui/presentation/history.py +0 -83
  166. morphopt-4.0.6/src/morphopt/ui/surface_export_worker.py +0 -19
  167. morphopt-4.0.6/src/morphopt/ui/visualization/rendering.py +0 -42
  168. morphopt-4.0.6/src/morphopt/ui/widgets/elided_label.py +0 -47
  169. morphopt-4.0.6/src/morphopt/ui/widgets/history_gif_export.py +0 -241
  170. morphopt-4.0.6/src/morphopt/ui/widgets/language_selector.py +0 -43
  171. morphopt-4.0.6/src/morphopt/ui/widgets/load_cases.py +0 -153
  172. morphopt-4.0.6/src/morphopt/ui/widgets/observation_pages.py +0 -403
  173. morphopt-4.0.6/src/morphopt/ui/widgets/surface_export.py +0 -165
  174. morphopt-4.0.6/src/morphopt/ui/widgets/theme_selector.py +0 -48
  175. morphopt-4.0.6/src/morphopt/ui/widgets/values.py +0 -33
  176. {morphopt-4.0.6 → morphopt-4.0.8}/setup.cfg +0 -0
  177. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/codesign/__init__.py +3 -3
  178. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/codesign/offset_boundary_part.py +0 -0
  179. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/codesign/update_offset_boundary_part.py +2 -2
  180. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/__init__.py +0 -0
  181. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/__init__.py +0 -0
  182. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/base_model_component.py +0 -0
  183. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/baseparam.py +0 -0
  184. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/__init__.py +0 -0
  185. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/base_component.py +0 -0
  186. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/body_force.py +0 -0
  187. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/boundary_condition.py +0 -0
  188. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/contact.py +0 -0
  189. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/couple.py +0 -0
  190. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/point_load.py +0 -0
  191. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/pressure.py +0 -0
  192. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/reference_point.py +0 -0
  193. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/spring.py +0 -0
  194. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/feaparams.py +0 -0
  195. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/materials/__init__.py +0 -0
  196. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/materials/base_material.py +0 -0
  197. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/materials/homogeneous_material.py +0 -0
  198. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/materials/models.py +0 -0
  199. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/materialsparams.py +0 -0
  200. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/__init__.py +0 -0
  201. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/base_part.py +0 -0
  202. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/box_part.py +0 -0
  203. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/fixed_part.py +0 -0
  204. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/inp_part.py +0 -0
  205. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/optcore/solver.py +0 -0
  206. morphopt-4.0.6/src/morphopt/postprocess/context.py → morphopt-4.0.8/src/morphopt/postprocess/_runtime.py +0 -0
  207. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/__init__.py +0 -0
  208. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/bsp_constraints.py +1 -1
  209. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/nurbs_face.py +0 -0
  210. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/simp/__init__.py +0 -0
  211. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/boundarys.py +0 -0
  212. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/densityfield.py +0 -0
  213. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/volfrac.py +0 -0
  214. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/__main__.py +0 -0
  215. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application/__init__.py +0 -0
  216. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/application_icon.py +0 -0
  217. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/assets/morphopt.svg +0 -0
  218. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/codegen/__init__.py +0 -0
  219. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/codegen/workspace.py +0 -0
  220. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/i18n.py +0 -0
  221. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/__init__.py +0 -0
  222. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/chamberlayout.py +0 -0
  223. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/material_models.py +0 -0
  224. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/cad.py +0 -0
  225. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/custom_code.py +0 -0
  226. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/parts.py +0 -0
  227. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/presentation/__init__.py +0 -0
  228. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/presentation/edit_history.py +0 -0
  229. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/presentation/result_fields.py +0 -0
  230. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/refresh.py +0 -0
  231. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/schemes/__init__.py +0 -0
  232. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/schemes/snippets.py +0 -0
  233. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/__init__.py +0 -0
  234. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/manager.py +1 -1
  235. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/styles/__init__.py +0 -0
  236. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/styles/inputs.qss +0 -0
  237. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/theme/themes/__init__.py +0 -0
  238. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/__init__.py +0 -0
  239. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/codeeditor.py +1 -1
  240. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/collection_controls.py +0 -0
  241. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/controller_editor.py +0 -0
  242. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/edit_history.py +0 -0
  243. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/editor_pages.py +0 -0
  244. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/history_dialogs.py +0 -0
  245. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/part_set_list.py +0 -0
  246. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/run_dialogs.py +0 -0
  247. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/ui/widgets/source_view.py +0 -0
  248. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt/utils/history_read.py +0 -0
  249. {morphopt-4.0.6/src/morphopt → morphopt-4.0.8/src/morphopt/utils}/paths.py +0 -0
  250. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt.egg-info/dependency_links.txt +0 -0
  251. {morphopt-4.0.6 → morphopt-4.0.8}/src/morphopt.egg-info/entry_points.txt +0 -0
  252. {morphopt-4.0.6 → morphopt-4.0.8}/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.6
3
+ Version: 4.0.8
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,7 +18,7 @@ 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.3
21
+ Requires-Dist: torchfea>=1.1.5
22
22
  Requires-Dist: trimesh>=4.11.5
23
23
  Requires-Dist: networkx>=3.6.1
24
24
  Requires-Dist: scipy>=1.17.1
@@ -30,13 +30,16 @@ Requires-Dist: pytest>=8.0; extra == "test"
30
30
 
31
31
  **Developed by Zenan Song**
32
32
 
33
- MorphOpt is a differentiable structural optimization framework that combines the adjoint method with automatic differentiation (AD). The sensitivity corresponds to the virtual work of residual force derivatives on the adjoint displacement field, computed via a single backpropagation through the residual graph. MorphOpt provides a unified interface for geometry, load, and material definition, calls torchfea for GPU-accelerated differentiable nonlinear FEA and adjoint-AD sensitivity, and employs a trust-region optimizer with L-BFGS for design updates. Validated on SIMP topology optimization with B-spline density fields and pneumatic soft robot shape optimization with deformation-dependent follower loads.
33
+ MorphOpt is a differentiable structural optimization framework that combines the adjoint method with automatic differentiation (AD). The sensitivity corresponds to the virtual work of residual force derivatives on the adjoint displacement field, computed via a single backpropagation through the residual graph. MorphOpt provides a unified interface for geometry, load, and material definition, calls torchfea for GPU-accelerated differentiable nonlinear FEA and adjoint-AD sensitivity, and solves step-limited local surrogate subproblems with L-BFGS for design updates. Validated on SIMP topology optimization with B-spline density fields and pneumatic soft robot shape optimization with deformation-dependent follower loads.
34
34
 
35
35
  ## Features
36
36
 
37
37
  - Custom model definition covering geometry, material, and load parameters
38
38
  - Differentiable FEA via torchfea with automatic solving and sensitivity propagation
39
- - L-BFGS and trust-region methods for parameter updates within a subproblem framework
39
+ - First-order and history-based quadratic FEA surrogates with L-BFGS subproblem solves and explicit step limits
40
+ - Surface-integrated geometric penalties with fixed, sensitivity-based, or adaptive weights; native FEA sensitivities remain unscaled
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
40
43
  - Component customization through framework class inheritance
41
44
 
42
45
  ## Quick Start
@@ -67,19 +70,45 @@ Requirements: Python ≥ 3.12; a PyTorch **float64** build is recommended.
67
70
  python my_task.py
68
71
  ```
69
72
 
70
- Each run writes its results (logs, FEA files, restart script) into a timestamped result folder under the run root.
73
+ Each run writes logs, FEA files, design states, and a restart script into a timestamped result folder under the configured run root. The bending example matches `ry=2 rad` with a squared-error objective and a quadratic history surrogate.
71
74
 
72
- 3. **Graphical interface.** The GUI supports problem definition, optimization monitoring, and result inspection in one window. It also exports runnable Python scripts (`.py`) for execution in the UI or a terminal.
75
+ 3. **Graphical interface.** The GUI supports problem definition, optimization monitoring, and result inspection in one window. It exports a runnable folder containing a same-named `.py` file and `morphopt_assets/`. Geometry inputs are restored from the definition beside the script; move the whole folder when transferring a task.
73
76
 
74
77
  ```bash
75
78
  morphopt-ui # console command, available after `pip install morphopt`
76
79
  # Alternative entry point: python -m morphopt.ui
77
80
  ```
78
81
 
79
- 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 scripts.
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.
80
83
 
81
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.
82
85
 
86
+ ### Run the UI in a virtual environment
87
+
88
+ Create and activate a Conda environment, then install and launch MorphOpt:
89
+
90
+ ```bash
91
+ conda create -n morphopt python=3.12
92
+ conda activate morphopt
93
+ python -m pip install morphopt
94
+ morphopt-ui
95
+ ```
96
+
97
+ For an existing environment, activate it instead. To run the source checkout, install the project in editable mode from its root directory:
98
+
99
+ ```bash
100
+ conda activate morphopt
101
+ cd /path/to/morphopt
102
+ python -m pip install -e .
103
+ morphopt-ui
104
+ ```
105
+
106
+ Replace the environment name and project path as appropriate. Installation is required once per environment; subsequent launches require only environment activation and the launch command. The equivalent module entry point uses the active environment's Python interpreter:
107
+
108
+ ```bash
109
+ python -m morphopt.ui
110
+ ```
111
+
83
112
  ### Numeric configuration
84
113
 
85
114
  Shared UI defaults and tunable kernel parameters live in [`src/morphopt/constants.py`](src/morphopt/constants.py), grouped under `CONSTANT.UI` and `CONSTANT.KERNEL`. Code accesses them directly, for example `CONSTANT.UI.VIEWER.RENDER.LABEL_FONT_SIZE` or `CONSTANT.KERNEL.SOLVER.NUM_PROCESS`. Edit a value there to change its default; restart MorphOpt for the change to take effect. Coordinate indices, tensor dimensions, and coefficients that define mathematical formulas remain in code. UI translations remain in JSON files under `src/morphopt/ui/locales/`.
@@ -97,7 +126,7 @@ The [documentation index](docs/README.md) includes the reading order and automat
97
126
 
98
127
  - `src/morphopt/`
99
128
  - `optcore` — Core package (controller, params, solver, objective, updaters)
100
- - `shapeopt/` — B-spline shape optimization
129
+ - `shapeopt/` — Boundary-surface shape optimization, geometric penalties, and weight strategies
101
130
  - `simp/` — SIMP topology optimization
102
131
  - `codesign/` — Shell co-design (shape + material)
103
132
  - `ui/` — PySide6 graphical UI (definition + observer in one window)
@@ -2,13 +2,16 @@
2
2
 
3
3
  **Developed by Zenan Song**
4
4
 
5
- MorphOpt is a differentiable structural optimization framework that combines the adjoint method with automatic differentiation (AD). The sensitivity corresponds to the virtual work of residual force derivatives on the adjoint displacement field, computed via a single backpropagation through the residual graph. MorphOpt provides a unified interface for geometry, load, and material definition, calls torchfea for GPU-accelerated differentiable nonlinear FEA and adjoint-AD sensitivity, and employs a trust-region optimizer with L-BFGS for design updates. Validated on SIMP topology optimization with B-spline density fields and pneumatic soft robot shape optimization with deformation-dependent follower loads.
5
+ MorphOpt is a differentiable structural optimization framework that combines the adjoint method with automatic differentiation (AD). The sensitivity corresponds to the virtual work of residual force derivatives on the adjoint displacement field, computed via a single backpropagation through the residual graph. MorphOpt provides a unified interface for geometry, load, and material definition, calls torchfea for GPU-accelerated differentiable nonlinear FEA and adjoint-AD sensitivity, and solves step-limited local surrogate subproblems with L-BFGS for design updates. Validated on SIMP topology optimization with B-spline density fields and pneumatic soft robot shape optimization with deformation-dependent follower loads.
6
6
 
7
7
  ## Features
8
8
 
9
9
  - Custom model definition covering geometry, material, and load parameters
10
10
  - Differentiable FEA via torchfea with automatic solving and sensitivity propagation
11
- - L-BFGS and trust-region methods for parameter updates within a subproblem framework
11
+ - First-order and history-based quadratic FEA surrogates with L-BFGS subproblem solves and explicit step limits
12
+ - Surface-integrated geometric penalties with fixed, sensitivity-based, or adaptive weights; native FEA sensitivities remain unscaled
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
12
15
  - Component customization through framework class inheritance
13
16
 
14
17
  ## Quick Start
@@ -39,19 +42,45 @@ Requirements: Python ≥ 3.12; a PyTorch **float64** build is recommended.
39
42
  python my_task.py
40
43
  ```
41
44
 
42
- Each run writes its results (logs, FEA files, restart script) into a timestamped result folder under the run root.
45
+ Each run writes logs, FEA files, design states, and a restart script into a timestamped result folder under the configured run root. The bending example matches `ry=2 rad` with a squared-error objective and a quadratic history surrogate.
43
46
 
44
- 3. **Graphical interface.** The GUI supports problem definition, optimization monitoring, and result inspection in one window. It also exports runnable Python scripts (`.py`) for execution in the UI or a terminal.
47
+ 3. **Graphical interface.** The GUI supports problem definition, optimization monitoring, and result inspection in one window. It exports a runnable folder containing a same-named `.py` file and `morphopt_assets/`. Geometry inputs are restored from the definition beside the script; move the whole folder when transferring a task.
45
48
 
46
49
  ```bash
47
50
  morphopt-ui # console command, available after `pip install morphopt`
48
51
  # Alternative entry point: python -m morphopt.ui
49
52
  ```
50
53
 
51
- 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 scripts.
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.
52
55
 
53
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.
54
57
 
58
+ ### Run the UI in a virtual environment
59
+
60
+ Create and activate a Conda environment, then install and launch MorphOpt:
61
+
62
+ ```bash
63
+ conda create -n morphopt python=3.12
64
+ conda activate morphopt
65
+ python -m pip install morphopt
66
+ morphopt-ui
67
+ ```
68
+
69
+ For an existing environment, activate it instead. To run the source checkout, install the project in editable mode from its root directory:
70
+
71
+ ```bash
72
+ conda activate morphopt
73
+ cd /path/to/morphopt
74
+ python -m pip install -e .
75
+ morphopt-ui
76
+ ```
77
+
78
+ Replace the environment name and project path as appropriate. Installation is required once per environment; subsequent launches require only environment activation and the launch command. The equivalent module entry point uses the active environment's Python interpreter:
79
+
80
+ ```bash
81
+ python -m morphopt.ui
82
+ ```
83
+
55
84
  ### Numeric configuration
56
85
 
57
86
  Shared UI defaults and tunable kernel parameters live in [`src/morphopt/constants.py`](src/morphopt/constants.py), grouped under `CONSTANT.UI` and `CONSTANT.KERNEL`. Code accesses them directly, for example `CONSTANT.UI.VIEWER.RENDER.LABEL_FONT_SIZE` or `CONSTANT.KERNEL.SOLVER.NUM_PROCESS`. Edit a value there to change its default; restart MorphOpt for the change to take effect. Coordinate indices, tensor dimensions, and coefficients that define mathematical formulas remain in code. UI translations remain in JSON files under `src/morphopt/ui/locales/`.
@@ -69,7 +98,7 @@ The [documentation index](docs/README.md) includes the reading order and automat
69
98
 
70
99
  - `src/morphopt/`
71
100
  - `optcore` — Core package (controller, params, solver, objective, updaters)
72
- - `shapeopt/` — B-spline shape optimization
101
+ - `shapeopt/` — Boundary-surface shape optimization, geometric penalties, and weight strategies
73
102
  - `simp/` — SIMP topology optimization
74
103
  - `codesign/` — Shell co-design (shape + material)
75
104
  - `ui/` — PySide6 graphical UI (definition + observer in one window)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "morphopt"
3
- version = "4.0.6"
3
+ version = "4.0.8"
4
4
  description = "A morphing optimization framework using PyTorch and torchfea."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -19,7 +19,7 @@ dependencies = [
19
19
  "imageio>=2.37.3",
20
20
  "fonttools>=4.0",
21
21
  "bspmap>=1.0.3",
22
- "torchfea>=1.1.3",
22
+ "torchfea>=1.1.5",
23
23
  "trimesh>=4.11.5",
24
24
  "networkx>=3.6.1",
25
25
  "scipy>=1.17.1",
@@ -92,6 +92,7 @@ from .optcore.protocal import (
92
92
  ProtocalVisualizable,
93
93
  )
94
94
  from .optcore.solver import Solver
95
+ from .optcore import strategies
95
96
  from .optcore.updaters import Updaters
96
97
  from .shapeopt import (
97
98
  BaseSurfaceConstraints,
@@ -150,4 +151,5 @@ __all__ = [
150
151
  "shapeopt",
151
152
  "simp",
152
153
  "start_optimization",
154
+ "strategies",
153
155
  ]
@@ -160,7 +160,7 @@ class InwardCurvatureRadius(BaseConstraints):
160
160
  )
161
161
  )
162
162
  penalty_strong = self.penalty_scale * penalty * hard_boost
163
- loss = loss + (self.scaler[i][index] * penalty_strong).sum()
163
+ loss = loss + (self.integration_weights[i][index] * penalty_strong).sum()
164
164
 
165
165
  return loss
166
166
 
@@ -349,8 +349,8 @@ class OffsetSurfaceMinThickness(BaseConstraints):
349
349
  mindist_n = self._neighbor_mindist[sf_idx][mask_n].to(
350
350
  device=r[sf_idx].device, dtype=r[sf_idx].dtype
351
351
  )
352
- scaler_n0 = self.scaler[sf_idx][pairs_n[0]]
353
- scaler_n1 = self.scaler[sf_idx][pairs_n[1]]
352
+ weights_n0 = self.integration_weights[sf_idx][pairs_n[0]]
353
+ weights_n1 = self.integration_weights[sf_idx][pairs_n[1]]
354
354
 
355
355
  # Offset points and distance
356
356
  roff, _ = self._offset_points(
@@ -386,7 +386,7 @@ class OffsetSurfaceMinThickness(BaseConstraints):
386
386
 
387
387
  loss = (
388
388
  loss
389
- + (penalty_strong * scaler_n0[indexl] * scaler_n1[indexl]).sum()
389
+ + (penalty_strong * weights_n0[indexl] * weights_n1[indexl]).sum()
390
390
  )
391
391
 
392
392
  return loss
@@ -21,6 +21,7 @@ class _Constants:
21
21
 
22
22
  class OBSERVER:
23
23
  OUTPUT_MAXIMUM_BLOCKS = 10000
24
+ LOG_READ_MAXIMUM_BYTES = 1024 * 1024
24
25
  POLL_INTERVAL_MS = 1000
25
26
 
26
27
  class UPDATER_EDITOR:
@@ -311,11 +312,8 @@ class _Constants:
311
312
  DEFAULT = "auto"
312
313
  CHOICES = (
313
314
  "auto",
314
- "instance",
315
315
  "rp",
316
- "load",
317
- "constraint",
318
- "boundary",
316
+ "instance",
319
317
  )
320
318
 
321
319
  class BOUNDARYCONDITION:
@@ -415,17 +413,8 @@ class _Constants:
415
413
  class INIT_LOCATION:
416
414
  DEFAULT = (0.0, 0.0, 0.0)
417
415
 
418
- class MAXR:
419
- DEFAULT = 0.2
420
- MIN = 0.0
421
416
 
422
- class MAXC:
423
- DEFAULT = 1.0
424
- MIN = 0.0
425
417
 
426
- class MAXFF:
427
- DEFAULT = 0.2
428
- MIN = 0.0
429
418
 
430
419
  class PERTURBATION_L:
431
420
  DEFAULT = -1.0
@@ -454,9 +443,6 @@ class _Constants:
454
443
  class INIT_LOCATION:
455
444
  DEFAULT = (0.0, 0.0, 0.0)
456
445
 
457
- class MAXC:
458
- DEFAULT = 1.0
459
- MIN = 0.0
460
446
 
461
447
  class PERTURBATION_L:
462
448
  DEFAULT = -1.0
@@ -473,9 +459,6 @@ class _Constants:
473
459
  class INIT_LOCATION:
474
460
  DEFAULT = (0.0, 0.0, 0.0)
475
461
 
476
- class MAXC:
477
- DEFAULT = 1.0
478
- MIN = 0.0
479
462
 
480
463
  class MESH_SURFACE:
481
464
  class PATH_STL:
@@ -756,10 +739,6 @@ class _Constants:
756
739
  DEFAULT = ""
757
740
 
758
741
  class UPDATER_OBJECTIVES:
759
- class SENSITIVITY:
760
- class NORMALIZE_GRADIENT:
761
- DEFAULT = False
762
-
763
742
  class DENSITYFIELDMINIMIZE:
764
743
  class SCALE:
765
744
  DEFAULT = 1e-07
@@ -991,6 +970,9 @@ class _Constants:
991
970
  )
992
971
  DEFAULT_TARGET = 0.0
993
972
  DEFAULT_WEIGHT = 1.0
973
+ DEFAULT_WORKSPACE_KIND = "workspace_plane"
974
+ DEFAULT_WORKSPACE_GAUSS_ORDER = 2
975
+ DEFAULT_WORKSPACE_NORMALIZATION = 1.0
994
976
  TARGET_MINIMUM = -1000000.0
995
977
  TARGET_MAXIMUM = 1000000.0
996
978
  WEIGHT_MINIMUM = 0.0
@@ -1008,7 +990,7 @@ class _Constants:
1008
990
 
1009
991
  class SOLVER:
1010
992
  NUM_PROCESS = 1
1011
- STATIC_TOLERANCE_ERROR = 1e-07
993
+ STATIC_TOLERANCE_ERROR = 1e-04
1012
994
 
1013
995
  class VISUALIZATION:
1014
996
  WINDOW_SIZE = (1200, 1200)
@@ -1039,6 +1021,7 @@ class _Constants:
1039
1021
  MAXIMUM_SIZE_RATIO = 1.0
1040
1022
  MINIMUM_SIZE_RATIO = 0.5
1041
1023
  DEFAULT_CAD_MESH_SIZE = 1.0
1024
+ BOUNDARY_SEED_SIZE_VARIATION = (0.9, 1.1)
1042
1025
  DEFAULT_BOUNDARY_SEED_SIZE = 1.0
1043
1026
  DEFAULT_ELEMENT_ORDER = 1
1044
1027
 
@@ -1057,14 +1040,23 @@ class _Constants:
1057
1040
  DEFAULT_WEIGHT = 1.0
1058
1041
 
1059
1042
  class SHAPE_CONSTRAINTS:
1043
+ class FAIRNESS:
1044
+ CURVATURE_LIMIT = 1.0
1045
+ METRIC_VARIATION_LIMIT = 0.1
1046
+ NONORTHOGONALITY_LIMIT = 0.1
1047
+ ACTIVATION_RATIO = 0.8
1048
+ BSP_EXPONENT = 3
1049
+ CPGEO_EXPONENT = 3
1050
+ REFERENCE_METRIC_RATIO = 0.2
1051
+
1060
1052
  BARRIER_THRESHOLD = 0.05
1061
1053
  BARRIER_RATIO = 0.0
1062
1054
  MIN_RADIUS_EXPONENT = 3
1063
- CYLINDER_EXPONENT = 7
1055
+ CYLINDER_EXPONENT = 3
1064
1056
  DISTANCE_SEARCH_RATIO = 1.5
1065
1057
  DISTANCE_PAIR_PRUNE_RATIO = 0.3
1066
1058
  DISTANCE_BARRIER_THRESHOLD = 0.01
1067
- DISTANCE_BARRIER_EXPONENT = 5
1059
+ DISTANCE_BARRIER_EXPONENT = 3
1068
1060
  NORMAL_TRANSITION_MIN = -0.7
1069
1061
  NORMAL_TRANSITION_MAX = 0.0
1070
1062
  NORMALIZATION_TOLERANCE = 1e-08
@@ -1082,24 +1074,38 @@ class _Constants:
1082
1074
  class CODESIGN_GEOMETRY:
1083
1075
  DEFAULT_SHELL_THICKNESS = 1.0
1084
1076
 
1077
+ class UPDATER_OBJECTIVES:
1078
+ QUADRATIC_MEMORY_PAIRS = 10
1079
+
1080
+ class UPDATER_STRATEGIES:
1081
+ DEFAULT_CONSTRAINT_WEIGHT = 1.0
1082
+
1083
+ class ADAPTIVE_SHAPE_WEIGHTS:
1084
+ PROBE_FRACTION = 0.5
1085
+ SAFETY_FACTOR = 2.0
1086
+ BALANCE_RATIO = 0.25
1087
+ OBJECTIVE_TOLERANCE = 0.01
1088
+ TIGHTENING_INCREMENT = 0.001
1089
+ PENALTY_GROWTH_LIMIT = 2.0
1090
+ WEIGHT_INCREASE = 1.25
1091
+ SIGNIFICANT_PENALTY_RATIO = 0.001
1092
+ INITIAL_TOLERANCE = 0.05
1093
+ FINAL_TOLERANCE = 0.0
1094
+ DISTANCE_TRANSITION_RATIO = 0.05
1095
+
1085
1096
  class OPTIMIZER:
1086
1097
  LINE_SEARCH_C1 = 0.0001
1087
1098
  LINE_SEARCH_BACKTRACK_RATIO = 0.2
1088
1099
  LINE_SEARCH_MIN_STEP_TOLERANCE = 1e-14
1089
1100
  LBFGS_MEMORY_PAIRS = 10
1090
1101
  LBFGS_CONVERGENCE_TOLERANCE = 1e-10
1091
- LBFGS_CURVATURE_TOLERANCE = 1e-14
1102
+ BFGS_CURVATURE_TOLERANCE = 1e-8
1092
1103
  LBFGS_SHAPE_MEMORY_PAIRS = 20
1093
1104
  LBFGS_MATERIAL_MEMORY_PAIRS = 20
1094
1105
 
1095
1106
  class SHAPE_UPDATE:
1096
1107
  MAX_STEP_ITERATIONS = 100
1097
1108
  MAX_STEP_LENGTH = 0.5
1098
- INITIAL_STEP_LENGTH_RATIO = 0.5
1099
- DIRECTION_CHANGE_THRESHOLD = -0.5
1100
- MIN_STEP_LENGTH_RATIO = 0.1
1101
- STEP_LENGTH_DECAY = 0.5
1102
- STEP_LENGTH_INCREASE = 1.5
1103
1109
  LOW_STEP_LENGTH_TOLERANCE = 1e-10
1104
1110
  LOW_STEP_LENGTH_ITERATION_LIMIT = 10
1105
1111
  STATUS_LOG_INTERVAL = 10
@@ -1109,10 +1115,6 @@ class _Constants:
1109
1115
  class SIMP_UPDATE:
1110
1116
  MAX_STEP_ITERATIONS = 50
1111
1117
  MAX_STEP_LENGTH = 1.0
1112
- INITIAL_STEP_LENGTH_RATIO = 0.5
1113
- MIN_STEP_LENGTH_RATIO = 0.1
1114
- STEP_LENGTH_DECAY = 0.5
1115
- STEP_LENGTH_INCREASE = 1.5
1116
1118
  LOW_STEP_LENGTH_TOLERANCE = 1e-10
1117
1119
  LOW_STEP_LENGTH_ITERATION_LIMIT = 10
1118
1120
  STATUS_LOG_INTERVAL = 10
@@ -1122,13 +1124,6 @@ class _Constants:
1122
1124
  class SURFACE:
1123
1125
  OBJ_VERTEX_MERGE_TOLERANCE = 1e-06
1124
1126
  STEP_DISTANCE_ACCURACY_MM = 0.001
1125
- DEFAULT_CURVATURE_LIMIT = 1.0
1126
- DEFAULT_METRIC_VARIATION_LIMIT = 0.2
1127
- DEFAULT_NONORTHOGONALITY_LIMIT = 0.2
1128
- BSP_CLASS_NONORTHOGONALITY_LIMIT = 0.1
1129
- FAIRNESS_ACTIVATION_RATIO = 0.8
1130
- BSP_FAIRNESS_EXPONENT = 3
1131
- CPGEO_FAIRNESS_EXPONENT = 5
1132
1127
  CYLINDER_CIRCUMFERENTIAL_BASE_SEGMENTS = 12
1133
1128
  CYLINDER_INITIAL_PERTURBATION_RATIO = 0.04
1134
1129
  FIXED_END_CONTROL_POINT_ROWS = 5
@@ -0,0 +1,173 @@
1
+ """Optimization entry points, worker execution and checkpoint restart loop."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+ import multiprocessing as mp
7
+ import os
8
+ from multiprocessing.queues import Queue
9
+
10
+ logger = logging.getLogger(__name__)
11
+
12
+
13
+ def _main_script(path_result: str | None) -> str:
14
+ """Locate the initial task or the archived script of a resumed run."""
15
+ if path_result is None:
16
+ import __main__
17
+
18
+ return __main__.__file__
19
+ return os.path.join(path_result, "scripts", "MAIN_SCRIPT_FOR_RESTART.py")
20
+
21
+
22
+ def start_optimization(
23
+ device: str = "cpu",
24
+ restart_per_iteration: int = 20,
25
+ path_result: str | None = None,
26
+ target_iteration: int | None = None,
27
+ ) -> None:
28
+ """Run optimization in spawned processes and resume each completed segment.
29
+
30
+ ``path_result`` selects an existing run; otherwise the task in ``__main__``
31
+ starts a new run. ``target_iteration=None`` resumes its latest checkpoint.
32
+ """
33
+ mp.set_start_method("spawn", force=True)
34
+ process = mp.Process(
35
+ target=_run_task,
36
+ kwargs={
37
+ "path_result": path_result,
38
+ "main_filepath": _main_script(path_result),
39
+ "device": device,
40
+ "target_iteration": target_iteration,
41
+ "restart_per_iteration": restart_per_iteration,
42
+ },
43
+ )
44
+ process.start()
45
+ process.join()
46
+ exitcode = process.exitcode
47
+ process.close()
48
+ if exitcode != 0:
49
+ raise ChildProcessError(f"Optimization task failed with exit code {exitcode}.")
50
+
51
+
52
+ def debug_optimization(
53
+ device: str = "cpu",
54
+ restart_per_iteration: int = 20,
55
+ path_result: str | None = None,
56
+ target_iteration: int | None = None,
57
+ ) -> None:
58
+ """Run the task in the current process with serial, debugger-friendly FEA."""
59
+ mp.set_start_method("spawn", force=True)
60
+ _run_worker(
61
+ device=device,
62
+ path_result=path_result,
63
+ target_iteration=target_iteration,
64
+ restart_per_iteration=restart_per_iteration,
65
+ main_filepath=_main_script(path_result),
66
+ debug=True,
67
+ )
68
+
69
+
70
+ def _run_task(
71
+ path_result: str | None,
72
+ main_filepath: str,
73
+ device: str = "cpu",
74
+ target_iteration: int | None = None,
75
+ restart_per_iteration: int = 20,
76
+ ) -> None:
77
+ """Continue worker segments from the latest completed checkpoint."""
78
+ import warnings
79
+ from queue import Empty
80
+
81
+ from .optcore.history import History
82
+
83
+ warnings.filterwarnings("ignore", category=UserWarning)
84
+ completed = 0
85
+ if path_result is not None:
86
+ history = History()
87
+ history.load(foldpath=path_result + "/log/", iteration=target_iteration)
88
+ completed = history.iteration
89
+ path_queue = mp.Queue()
90
+ try:
91
+ while True:
92
+ process = mp.Process(
93
+ target=_run_worker,
94
+ kwargs={
95
+ "device": device,
96
+ "target_iteration": target_iteration,
97
+ "path_result": path_result,
98
+ "restart_per_iteration": restart_per_iteration,
99
+ "main_filepath": main_filepath,
100
+ "pathqueue": path_queue,
101
+ },
102
+ )
103
+ process.start()
104
+ # Drain checkpoints while the worker is alive so its queue feeder
105
+ # cannot block shutdown while the supervisor waits for completion.
106
+ while True:
107
+ try:
108
+ progress = path_queue.get(timeout=0.1)
109
+ except Empty:
110
+ if process.is_alive():
111
+ continue
112
+ break
113
+ path_result = progress["path_result"]
114
+ completed = progress["iteration"]
115
+ process.join()
116
+ exitcode = process.exitcode
117
+ process.close()
118
+ if exitcode != 0:
119
+ if completed == 0:
120
+ raise ChildProcessError(
121
+ "Optimization failed before the first completed iteration "
122
+ f"(exit code {exitcode}). See the worker traceback."
123
+ )
124
+ print(f"Process failed with exit code {exitcode}, continuing...")
125
+ target_iteration = None
126
+ finally:
127
+ path_queue.close()
128
+ path_queue.join_thread()
129
+
130
+
131
+ def _run_worker(
132
+ main_filepath: str,
133
+ device: str = "cpu",
134
+ target_iteration: int | None = None,
135
+ path_result: str | None = None,
136
+ restart_per_iteration: int = 20,
137
+ pathqueue: Queue | None = None,
138
+ debug: bool = False,
139
+ ) -> str:
140
+ """Load one task and run a new or restored controller in this process."""
141
+ os.environ["KMP_DUPLICATE_LIB_OK"] = "True"
142
+ import sys
143
+ import warnings
144
+
145
+ import torch
146
+
147
+ import morphopt
148
+
149
+ warnings.filterwarnings("ignore", category=UserWarning)
150
+ torch.set_default_dtype(torch.float64)
151
+ torch.set_default_device(device)
152
+ filename = os.path.splitext(os.path.basename(main_filepath))[0]
153
+ os.chdir(os.path.dirname(main_filepath))
154
+ sys.path.append(os.getcwd())
155
+ controller_class = __import__(filename).ThisController
156
+ controller: morphopt.Controller = controller_class()
157
+ controller.restart_per_iteration = restart_per_iteration
158
+ controller.optdevice = device
159
+ controller.dataqueue = pathqueue
160
+ controller._debug_mode = debug
161
+ try:
162
+ if target_iteration == 0 or path_result is None:
163
+ controller.start_optimization(main_filepath=main_filepath)
164
+ else:
165
+ controller.restart_optimization(
166
+ path_result=path_result, target_iteration=target_iteration
167
+ )
168
+ except Exception:
169
+ logger.exception(
170
+ "Optimization worker failed; result folder: %s", controller.path_result
171
+ )
172
+ raise
173
+ return controller.path_result