morphopt 4.0.7__tar.gz → 4.0.9__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.7 → morphopt-4.0.9}/PKG-INFO +12 -9
  2. {morphopt-4.0.7 → morphopt-4.0.9}/README.md +9 -6
  3. {morphopt-4.0.7 → morphopt-4.0.9}/pyproject.toml +3 -3
  4. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/__init__.py +21 -17
  5. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/codesign/constraints.py +148 -28
  6. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/codesign/offset_boundary_part.py +81 -6
  7. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/constants.py +67 -51
  8. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/opt_runner.py +77 -11
  9. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/__init__.py +4 -3
  10. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/controller.py +118 -60
  11. morphopt-4.0.9/src/morphopt/optcore/history.py +117 -0
  12. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/baseparam.py +97 -22
  13. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/fea/base_component.py +12 -5
  14. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/fea/body_force.py +17 -2
  15. morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/boundary_condition.py +100 -0
  16. morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/contact.py +139 -0
  17. morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/couple.py +44 -0
  18. morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/point_load.py +140 -0
  19. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/fea/pressure.py +25 -10
  20. morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/reference_point.py +37 -0
  21. morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/spring.py +305 -0
  22. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/feaparams.py +25 -11
  23. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/geometry.py +31 -6
  24. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/materials/base_material.py +51 -7
  25. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/materials/homogeneous_material.py +5 -1
  26. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/materials/models.py +10 -1
  27. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/materialsparams.py +10 -0
  28. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/params.py +90 -56
  29. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/base_part.py +115 -12
  30. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/box_part.py +31 -0
  31. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/cad_part.py +260 -46
  32. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/fixed_part.py +60 -6
  33. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/inp_part.py +26 -6
  34. morphopt-4.0.9/src/morphopt/optcore/objfunc.py +350 -0
  35. morphopt-4.0.9/src/morphopt/optcore/protocal.py +234 -0
  36. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/solver.py +101 -77
  37. morphopt-4.0.9/src/morphopt/optcore/strategies.py +144 -0
  38. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/updaters.py +499 -120
  39. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/postprocess/__init__.py +3 -0
  40. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/postprocess/_runtime.py +25 -3
  41. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/postprocess/archive.py +158 -10
  42. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/postprocess/exports.py +134 -10
  43. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/postprocess/fields.py +174 -6
  44. morphopt-4.0.9/src/morphopt/postprocess/visualization.py +371 -0
  45. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/__init__.py +6 -4
  46. morphopt-4.0.9/src/morphopt/shapeopt/barriers.py +75 -0
  47. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/boundary_part.py +256 -107
  48. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/objectivefuncs/__init__.py +1 -1
  49. morphopt-4.0.9/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +171 -0
  50. morphopt-4.0.9/src/morphopt/shapeopt/objectivefuncs/boundarys.py +137 -0
  51. morphopt-4.0.9/src/morphopt/shapeopt/objectivefuncs/distancesurface.py +172 -0
  52. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/objectivefuncs/shapederivative.py +82 -73
  53. morphopt-4.0.9/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +320 -0
  54. morphopt-4.0.9/src/morphopt/shapeopt/objectivefuncs/volumemaximization.py +63 -0
  55. morphopt-4.0.9/src/morphopt/shapeopt/strategies.py +448 -0
  56. morphopt-4.0.9/src/morphopt/shapeopt/surfaces/base_constraints.py +163 -0
  57. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/base_surface.py +331 -156
  58. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/brep_surface.py +359 -36
  59. morphopt-4.0.9/src/morphopt/shapeopt/surfaces/bsp_constraints.py +349 -0
  60. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/bsp_surface.py +247 -240
  61. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/cpgeo_constraints.py +79 -28
  62. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/cpgeo_surface.py +129 -125
  63. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/mesh_surface.py +53 -6
  64. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/nurbs_face.py +181 -24
  65. morphopt-4.0.9/src/morphopt/shapeopt/update_boundary_part.py +376 -0
  66. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/objectivefuncs/basefuncs.py +15 -48
  67. morphopt-4.0.9/src/morphopt/simp/objectivefuncs/boundarys.py +104 -0
  68. morphopt-4.0.9/src/morphopt/simp/objectivefuncs/densityfield.py +53 -0
  69. morphopt-4.0.9/src/morphopt/simp/objectivefuncs/sensitivity.py +133 -0
  70. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/objectivefuncs/volfrac.py +29 -0
  71. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/simpmaterial.py +210 -32
  72. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/update_simpmaterial.py +104 -138
  73. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/void_elements.py +127 -2
  74. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/__init__.py +6 -3
  75. morphopt-4.0.9/src/morphopt/ui/app.py +122 -0
  76. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/cad.py +103 -16
  77. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/completion.py +58 -9
  78. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/definitions.py +173 -19
  79. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/devices.py +5 -1
  80. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/edit_history.py +140 -1
  81. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/editing.py +386 -35
  82. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/editor_routing.py +26 -2
  83. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/expressions.py +19 -0
  84. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/fields.py +147 -9
  85. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/finite_element.py +76 -5
  86. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/load_cases.py +109 -5
  87. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/part_mesh.py +12 -2
  88. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/part_sets.py +117 -2
  89. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/quickstart.py +130 -65
  90. morphopt-4.0.9/src/morphopt/ui/application/results.py +199 -0
  91. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/runs.py +111 -4
  92. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/updaters.py +136 -2
  93. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/validation.py +221 -16
  94. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/values.py +33 -6
  95. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application_icon.py +15 -3
  96. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/codegen/assets.py +15 -1
  97. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/codegen/custom_classes.py +95 -14
  98. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/codegen/generator.py +326 -71
  99. {morphopt-4.0.7/src/morphopt/ui/schemes → morphopt-4.0.9/src/morphopt/ui/codegen}/snippets.py +21 -5
  100. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/codegen/workspace.py +35 -5
  101. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/i18n.py +66 -5
  102. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/launcher.py +91 -17
  103. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/locales/en-US.json +154 -57
  104. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/locales/zh-CN.json +154 -57
  105. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/mainwindow.py +123 -13
  106. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/base_nodes.py +348 -36
  107. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/chamberlayout.py +13 -0
  108. morphopt-4.0.9/src/morphopt/ui/model/configuration.py +229 -0
  109. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/fields.py +16 -0
  110. morphopt-4.0.9/src/morphopt/ui/model/loaders.py +328 -0
  111. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/__init__.py +10 -0
  112. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/custom_code.py +69 -0
  113. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/loads.py +93 -8
  114. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/materials.py +4 -0
  115. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/objectives.py +4 -19
  116. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/parts.py +94 -0
  117. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/penalties.py +6 -2
  118. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/structural.py +380 -10
  119. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/surfaces.py +6 -46
  120. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/symmetry.py +72 -0
  121. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/problem.py +634 -116
  122. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/registry.py +58 -1
  123. morphopt-4.0.9/src/morphopt/ui/model/strategies.py +83 -0
  124. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/observe_panel.py +281 -81
  125. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/presentation/edit_history.py +9 -1
  126. morphopt-4.0.9/src/morphopt/ui/presentation/history.py +99 -0
  127. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/presentation/labels.py +210 -12
  128. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/presentation/navigation.py +125 -9
  129. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/presentation/result_fields.py +25 -3
  130. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/processes.py +11 -2
  131. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/refresh.py +42 -1
  132. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/__init__.py +7 -1
  133. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/fonts.py +116 -7
  134. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/manager.py +63 -9
  135. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/palette.py +23 -0
  136. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/styles/base.qss +1 -0
  137. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/styles/controls.qss +5 -0
  138. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/stylesheet.py +9 -1
  139. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/themes/dark.py +25 -0
  140. morphopt-4.0.9/src/morphopt/ui/theme/themes/light.py +117 -0
  141. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/visualization.py +16 -0
  142. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/assets.py +9 -1
  143. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/geometry.py +531 -39
  144. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/loads.py +205 -1
  145. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/rendering.py +28 -3
  146. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/scene.py +63 -2
  147. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/asset_browser.py +65 -2
  148. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/case_deletion.py +9 -1
  149. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/codeeditor.py +90 -7
  150. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/collection_controls.py +52 -1
  151. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/controller_editor.py +29 -1
  152. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/custom_classes.py +57 -0
  153. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/definition_actions.py +309 -5
  154. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/definition_manager.py +43 -8
  155. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/edit_history.py +55 -1
  156. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/editor.py +106 -22
  157. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/editor_pages.py +34 -1
  158. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/file_dialogs.py +72 -6
  159. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/finite_element.py +69 -25
  160. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/font_settings.py +6 -0
  161. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/helper_editor.py +31 -0
  162. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/history_dialogs.py +7 -0
  163. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/history_export.py +55 -65
  164. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/labels.py +53 -0
  165. morphopt-4.0.9/src/morphopt/ui/widgets/load_cases.py +63 -0
  166. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/model_tree.py +118 -16
  167. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/objective_editor.py +75 -44
  168. morphopt-4.0.9/src/morphopt/ui/widgets/observation_pages.py +611 -0
  169. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/param_form.py +56 -5
  170. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/part_set_list.py +16 -0
  171. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/preview_renderer.py +88 -22
  172. morphopt-4.0.9/src/morphopt/ui/widgets/problems.py +119 -0
  173. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/quickstart.py +172 -48
  174. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/run_dialogs.py +11 -0
  175. morphopt-4.0.9/src/morphopt/ui/widgets/sequence_input.py +165 -0
  176. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/solver_editor.py +26 -6
  177. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/source_view.py +12 -0
  178. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/template_insert_dialog.py +36 -3
  179. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/updater_editor.py +183 -26
  180. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/viewer.py +74 -15
  181. morphopt-4.0.9/src/morphopt/ui/widgets/viewport.py +562 -0
  182. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/visualization_settings.py +11 -0
  183. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/workspace_objective.py +16 -2
  184. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/workbench.py +113 -24
  185. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/worker.py +9 -1
  186. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/utils/gradient_check.py +48 -0
  187. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/utils/history_read.py +5 -4
  188. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/utils/paths.py +8 -1
  189. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/utils/quadrature.py +17 -7
  190. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt.egg-info/PKG-INFO +12 -9
  191. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt.egg-info/SOURCES.txt +7 -3
  192. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt.egg-info/requires.txt +2 -2
  193. morphopt-4.0.7/src/morphopt/optcore/history.py +0 -473
  194. morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/boundary_condition.py +0 -76
  195. morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/contact.py +0 -117
  196. morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/couple.py +0 -35
  197. morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/point_load.py +0 -79
  198. morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/reference_point.py +0 -29
  199. morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/spring.py +0 -156
  200. morphopt-4.0.7/src/morphopt/optcore/objfunc.py +0 -240
  201. morphopt-4.0.7/src/morphopt/optcore/protocal.py +0 -130
  202. morphopt-4.0.7/src/morphopt/postprocess/visualization.py +0 -184
  203. morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +0 -141
  204. morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/boundarys.py +0 -105
  205. morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/distancesurface.py +0 -170
  206. morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +0 -42
  207. morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/volumemaximization.py +0 -41
  208. morphopt-4.0.7/src/morphopt/shapeopt/surfaces/base_constraints.py +0 -114
  209. morphopt-4.0.7/src/morphopt/shapeopt/surfaces/bsp_constraints.py +0 -89
  210. morphopt-4.0.7/src/morphopt/shapeopt/update_boundary_part.py +0 -445
  211. morphopt-4.0.7/src/morphopt/simp/objectivefuncs/boundarys.py +0 -76
  212. morphopt-4.0.7/src/morphopt/simp/objectivefuncs/densityfield.py +0 -29
  213. morphopt-4.0.7/src/morphopt/simp/objectivefuncs/sensitivity.py +0 -86
  214. morphopt-4.0.7/src/morphopt/ui/app.py +0 -68
  215. morphopt-4.0.7/src/morphopt/ui/application/results.py +0 -86
  216. morphopt-4.0.7/src/morphopt/ui/model/configuration.py +0 -112
  217. morphopt-4.0.7/src/morphopt/ui/model/loaders.py +0 -31
  218. morphopt-4.0.7/src/morphopt/ui/presentation/history.py +0 -83
  219. morphopt-4.0.7/src/morphopt/ui/schemes/__init__.py +0 -26
  220. morphopt-4.0.7/src/morphopt/ui/schemes/base.py +0 -407
  221. morphopt-4.0.7/src/morphopt/ui/theme/themes/light.py +0 -129
  222. morphopt-4.0.7/src/morphopt/ui/widgets/load_cases.py +0 -212
  223. morphopt-4.0.7/src/morphopt/ui/widgets/observation_pages.py +0 -325
  224. morphopt-4.0.7/src/morphopt/ui/widgets/viewport.py +0 -159
  225. {morphopt-4.0.7 → morphopt-4.0.9}/setup.cfg +0 -0
  226. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/codesign/__init__.py +0 -0
  227. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/codesign/update_offset_boundary_part.py +0 -0
  228. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/__init__.py +0 -0
  229. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/base_model_component.py +0 -0
  230. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/fea/__init__.py +0 -0
  231. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/materials/__init__.py +0 -0
  232. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/__init__.py +0 -0
  233. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/__init__.py +0 -0
  234. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/__init__.py +0 -0
  235. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/objectivefuncs/__init__.py +0 -0
  236. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/__main__.py +0 -0
  237. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/__init__.py +0 -0
  238. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/assets/morphopt.svg +0 -0
  239. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/codegen/__init__.py +0 -0
  240. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/__init__.py +0 -0
  241. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/material_models.py +0 -0
  242. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/cad.py +0 -0
  243. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/presentation/__init__.py +0 -0
  244. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/styles/__init__.py +0 -0
  245. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/styles/inputs.qss +0 -0
  246. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/themes/__init__.py +0 -0
  247. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/__init__.py +0 -0
  248. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/__init__.py +0 -0
  249. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/utils/__init__.py +0 -0
  250. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt.egg-info/dependency_links.txt +0 -0
  251. {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt.egg-info/entry_points.txt +0 -0
  252. {morphopt-4.0.7 → morphopt-4.0.9}/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.7
3
+ Version: 4.0.9
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.3
21
+ Requires-Dist: torchfea>=1.1.6
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.12
25
+ Requires-Dist: cpgeo>=1.0.13
26
26
  Provides-Extra: test
27
27
  Requires-Dist: pytest>=8.0; extra == "test"
28
28
 
@@ -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,16 +70,16 @@ 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
 
@@ -123,7 +126,7 @@ The [documentation index](docs/README.md) includes the reading order and automat
123
126
 
124
127
  - `src/morphopt/`
125
128
  - `optcore` — Core package (controller, params, solver, objective, updaters)
126
- - `shapeopt/` — B-spline shape optimization
129
+ - `shapeopt/` — Boundary-surface shape optimization, geometric penalties, and weight strategies
127
130
  - `simp/` — SIMP topology optimization
128
131
  - `codesign/` — Shell co-design (shape + material)
129
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,16 +42,16 @@ 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
 
@@ -95,7 +98,7 @@ The [documentation index](docs/README.md) includes the reading order and automat
95
98
 
96
99
  - `src/morphopt/`
97
100
  - `optcore` — Core package (controller, params, solver, objective, updaters)
98
- - `shapeopt/` — B-spline shape optimization
101
+ - `shapeopt/` — Boundary-surface shape optimization, geometric penalties, and weight strategies
99
102
  - `simp/` — SIMP topology optimization
100
103
  - `codesign/` — Shell co-design (shape + material)
101
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.7"
3
+ version = "4.0.9"
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.3",
22
+ "torchfea>=1.1.6",
23
23
  "trimesh>=4.11.5",
24
24
  "networkx>=3.6.1",
25
25
  "scipy>=1.17.1",
26
- "cpgeo>=1.0.12",
26
+ "cpgeo>=1.0.13",
27
27
  ]
28
28
 
29
29
  [project.scripts]
@@ -15,22 +15,22 @@ import logging as __logging
15
15
 
16
16
 
17
17
  def enable_logging(level=__logging.INFO, log_file=None, file_log_level=__logging.DEBUG):
18
- """
19
- Enable logging for the FEA package.
20
-
21
- Parameters
22
- ----------
23
- level : int
24
- the logging level (e.g., logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL)
25
- log_file : str, optional
26
- the path to a log file where logs will be written. If None, logs will only be printed to the console.
27
- file_log_level : int
28
- the logging level for the log file. Default is logging.INFO.
29
-
30
- Examples
31
- --------
32
- >>> import torchfea
33
- >>> torchfea.enable_logging(level=logging.DEBUG, log_file='fem.log')
18
+ """Configure console and optional file handlers for the MorphOpt package logger.
19
+
20
+ Existing handlers on this logger are replaced so repeated setup does not duplicate messages.
21
+
22
+ Args:
23
+ level: Console logging threshold; defaults to logging.INFO.
24
+ log_file: Optional UTF-8 log file path. Its parent directory must already exist.
25
+ file_log_level: File logging threshold; defaults to logging.DEBUG.
26
+
27
+ Returns:
28
+ logging.Logger: Configured package logger with the requested handlers.
29
+
30
+ Examples:
31
+ >>> import logging
32
+ >>> import morphopt
33
+ >>> logger = morphopt.enable_logging(level=logging.INFO)
34
34
  """
35
35
  logger = __logging.getLogger(__name__)
36
36
  logger.setLevel(min(level, file_log_level))
@@ -69,6 +69,7 @@ def enable_logging(level=__logging.INFO, log_file=None, file_log_level=__logging
69
69
  from . import codesign, shapeopt, simp
70
70
  from .codesign import OffsetBoundaryPart, UpdaterOffsetBoundaryPart
71
71
  from .opt_runner import debug_optimization, start_optimization
72
+ from .optcore import strategies
72
73
  from .optcore.controller import Controller
73
74
  from .optcore.history import History
74
75
  from .optcore.modelparams import (
@@ -76,8 +77,8 @@ from .optcore.modelparams import (
76
77
  BasePart,
77
78
  BoxPart,
78
79
  CADPart,
79
- FixedPart,
80
80
  FEAParams,
81
+ FixedPart,
81
82
  GeometryParams,
82
83
  INPPart,
83
84
  MaterialsParams,
@@ -86,6 +87,7 @@ from .optcore.modelparams import (
86
87
  from .optcore.modelparams.materials import HomogeneousMaterial
87
88
  from .optcore.objfunc import ObjectiveFunction
88
89
  from .optcore.protocal import (
90
+ ProtocalHistory,
89
91
  ProtocalInitializable,
90
92
  ProtocalSavable,
91
93
  ProtocalUpdatable,
@@ -132,6 +134,7 @@ __all__ = [
132
134
  "ObjectiveFunction",
133
135
  "OffsetBoundaryPart",
134
136
  "Params",
137
+ "ProtocalHistory",
135
138
  "ProtocalInitializable",
136
139
  "ProtocalSavable",
137
140
  "ProtocalUpdatable",
@@ -150,4 +153,5 @@ __all__ = [
150
153
  "shapeopt",
151
154
  "simp",
152
155
  "start_optimization",
156
+ "strategies",
153
157
  ]
@@ -27,21 +27,26 @@ class InwardCurvatureRadius(BaseConstraints):
27
27
  hard_violation_beta: float = CONSTANT.KERNEL.CODESIGN.HARD_VIOLATION_BETA,
28
28
  normal_sign: float = 1.0,
29
29
  ) -> None:
30
- """
31
- Initialize the inward curvature radius constraint.
30
+ """Initialize the inward curvature radius constraint.
32
31
 
33
32
  Args:
34
- surface_start (int, optional): The starting index of surfaces to apply the constraint. Defaults to 1.
35
- surface_ids (list[int] | None, optional): The specific surface indices to apply the constraint. If None, applies to all surfaces starting from surface_start. Defaults to None.
36
- margin (float, optional): The absolute margin added to thickness for curvature limit. Defaults to 0.4.
37
- margin_ratio (float, optional): The ratio of thickness to determine margin if margin is None. Defaults to 0.45.
38
- barrier_thre_ratio (float, optional): The ratio of curvature limit to determine the barrier threshold. Defaults to 0.1.
39
- barrier_ratio (float, optional): The ratio to scale the barrier penalty. Defaults to 0.0.
40
- p (int, optional): The power for the barrier function. Defaults to 8.
41
- penalty_scale (float, optional): Global multiplier for this constraint penalty. Defaults to 1e3.
42
- hard_violation_beta (float, optional): Exponential amplification factor for large violations. Defaults to 8.0.
43
- normal_sign (float, optional): The sign to determine inward direction. Use 1.0 if normals point outward, -1.0 if normals point inward. Defaults to 1.0.
44
-
33
+ surface_start (int): The starting index of surfaces to apply the constraint. Defaults to
34
+ 1.
35
+ surface_ids (list[int] | None): The specific surface indices to apply the constraint. If
36
+ None, applies to all surfaces starting from surface_start. Defaults to None.
37
+ margin (float): The absolute margin added to thickness for curvature limit. Defaults to
38
+ 0.4.
39
+ margin_ratio (float): The ratio of thickness to determine margin if margin is None.
40
+ Defaults to 0.45.
41
+ barrier_thre_ratio (float): The ratio of curvature limit to determine the barrier
42
+ threshold. Defaults to 0.1.
43
+ barrier_ratio (float): The ratio to scale the barrier penalty. Defaults to 0.0.
44
+ p (int): The power for the barrier function. Defaults to 8.
45
+ penalty_scale (float): Global multiplier for this constraint penalty. Defaults to 1e3.
46
+ hard_violation_beta (float): Exponential amplification factor for large violations.
47
+ Defaults to 8.0.
48
+ normal_sign (float): The sign to determine inward direction. Use 1.0 if normals point
49
+ outward, -1.0 if normals point inward. Defaults to 1.0.
45
50
  """
46
51
 
47
52
  super().__init__()
@@ -76,6 +81,19 @@ class InwardCurvatureRadius(BaseConstraints):
76
81
  rdu2: torch.Tensor,
77
82
  eps: float = CONSTANT.KERNEL.CODESIGN.GEOMETRY_TOLERANCE,
78
83
  ) -> tuple[torch.Tensor, torch.Tensor]:
84
+ """Compute oriented principal curvatures from the first and second fundamental forms.
85
+
86
+ Args:
87
+ rdu (torch.Tensor): Current first surface derivatives; each block has shape (num_points,
88
+ 3, 2).
89
+ rdu2 (torch.Tensor): Current second surface derivatives; each block has shape
90
+ (num_points, 3, 2, 2).
91
+ eps (float): Positive numerical regularization or finite-difference increment.
92
+
93
+ Returns:
94
+ tuple[torch.Tensor, torch.Tensor]: Principal curvature arrays k1 and k2, each with shape
95
+ (num_points,), using the cross(dv, du) normal.
96
+ """
79
97
  normal0 = torch.cross(rdu[:, :, 1], rdu[:, :, 0], dim=1)
80
98
  normal = normal0 / (normal0.norm(dim=1, keepdim=True) + eps)
81
99
 
@@ -99,8 +117,15 @@ class InwardCurvatureRadius(BaseConstraints):
99
117
  """Take the Part this constraint is evaluated for.
100
118
 
101
119
  The geometry updater hands over the Part it evaluates; only a
102
- :class:`~morphopt.codesign.OffsetBoundaryPart` carries a
103
- shell, so anything else is rejected here.
120
+ :class:`~morphopt.codesign.OffsetBoundaryPart` carries a shell, so anything else is rejected
121
+ here.
122
+
123
+ Args:
124
+ r0: Initial cylinder radius, or reference sample positions for a surface objective.
125
+ rdu0: Reference first derivatives with one surface block of shape (num_points, 3, 2).
126
+ part_interface: Kernel Part interface selected as the geometry target.
127
+ *args: Additional positional arguments accepted by the shared interface.
128
+ **kwargs: Additional keyword arguments accepted by the shared interface.
104
129
  """
105
130
  super().initialize(r0=r0, rdu0=rdu0, *args, **kwargs)
106
131
  if not isinstance(part_interface, OffsetBoundaryPart):
@@ -111,6 +136,14 @@ class InwardCurvatureRadius(BaseConstraints):
111
136
  self.shell_thickness = float(part_interface.shell_thickness)
112
137
 
113
138
  def _selected_surface_ids(self, n_surface: int) -> list[int]:
139
+ """Resolve the configured surface selection within the available boundary range.
140
+
141
+ Args:
142
+ n_surface (int): Number of boundary surfaces represented by the geometry configuration.
143
+
144
+ Returns:
145
+ list[int]: Valid zero-based surface indices in their configured order.
146
+ """
114
147
  if self.surface_ids is None:
115
148
  return [i for i in range(max(self.surface_start, 0), n_surface)]
116
149
  return [i for i in self.surface_ids if 0 <= i < n_surface]
@@ -123,6 +156,21 @@ class InwardCurvatureRadius(BaseConstraints):
123
156
  *args,
124
157
  **kwargs,
125
158
  ) -> torch.Tensor:
159
+ """Evaluate InwardCurvatureRadius for the supplied inputs.
160
+
161
+ Args:
162
+ r (list[torch.Tensor]): Current Cartesian surface samples; each surface block has shape
163
+ (num_points, 3).
164
+ rdu (list[torch.Tensor]): Current first surface derivatives; each block has shape
165
+ (num_points, 3, 2).
166
+ rdu2 (list[torch.Tensor]): Current second surface derivatives; each block has shape
167
+ (num_points, 3, 2, 2).
168
+ *args: Additional positional arguments accepted by the shared interface.
169
+ **kwargs: Additional keyword arguments accepted by the shared interface.
170
+
171
+ Returns:
172
+ torch.Tensor: One-element integrated penalty for excessive inward principal curvature.
173
+ """
126
174
  loss = torch.zeros(1, device=r[0].device, dtype=r[0].dtype)
127
175
 
128
176
  for i in self._selected_surface_ids(len(r)):
@@ -160,7 +208,7 @@ class InwardCurvatureRadius(BaseConstraints):
160
208
  )
161
209
  )
162
210
  penalty_strong = self.penalty_scale * penalty * hard_boost
163
- loss = loss + (self.scaler[i][index] * penalty_strong).sum()
211
+ loss = loss + (self.integration_weights[i][index] * penalty_strong).sum()
164
212
 
165
213
  return loss
166
214
 
@@ -189,14 +237,29 @@ class OffsetSurfaceMinThickness(BaseConstraints):
189
237
  normal_min: float = CONSTANT.KERNEL.CODESIGN.NORMAL_TRANSITION_MIN,
190
238
  normal_max: float = CONSTANT.KERNEL.CODESIGN.NORMAL_TRANSITION_MAX,
191
239
  ) -> None:
192
- """
193
- Initialize the minimum thickness constraint for the offset surface.
240
+ """Initialize the minimum thickness constraint for the offset surface.
194
241
 
195
242
  Args:
196
- surface_start (int, optional): The starting index of surfaces to apply the constraint. Defaults to 1.
197
- surface_ids (list[int] | None, optional): The specific surface indices to apply the constraint. If None, applies to all surfaces starting from surface_start. Defaults to None.
198
- min_distance (float | None, optional): The required minimum distance.
199
- Defaults to twice the shell thickness.
243
+ surface_start (int): The starting index of surfaces to apply the constraint. Defaults to
244
+ 1.
245
+ surface_ids (list[int] | None): The specific surface indices to apply the constraint. If
246
+ None, applies to all surfaces starting from surface_start. Defaults to None.
247
+ min_distance (float | None): The required minimum distance. Defaults to twice the shell
248
+ thickness.
249
+ search_ratio (float): Distance-search radius relative to the configured geometric
250
+ spacing.
251
+ barrier_thre_ratio (float): Barrier activation threshold relative to the configured
252
+ geometric limit.
253
+ barrier_ratio (float): Activation threshold as a fraction of the barrier limit.
254
+ p (int): Polynomial penalty exponent.
255
+ penalty_scale (float): Scalar multiplying the constructed constraint contribution.
256
+ hard_violation_beta (float): Barrier-growth coefficient for strongly violated distance
257
+ constraints.
258
+ normal_sign (float): Orientation sign applied to the surface-normal comparison.
259
+ normal_opposition_thre (float): Normal-opposition threshold used to filter candidate
260
+ surface pairs.
261
+ normal_min (float): Lower bound on the normal-alignment criterion.
262
+ normal_max (float): Upper bound on the normal-alignment criterion.
200
263
  """
201
264
  super().__init__()
202
265
 
@@ -236,12 +299,28 @@ class OffsetSurfaceMinThickness(BaseConstraints):
236
299
  """Stores the neighbor mindist used by OffsetSurfaceMinThickness."""
237
300
 
238
301
  def _selected_surface_ids(self, n_surface: int) -> list[int]:
302
+ """Resolve the configured surface selection within the available boundary range.
303
+
304
+ Args:
305
+ n_surface (int): Number of boundary surfaces represented by the geometry configuration.
306
+
307
+ Returns:
308
+ list[int]: Valid zero-based surface indices in their configured order.
309
+ """
239
310
  if self.surface_ids is None:
240
311
  return [i for i in range(max(self.surface_start, 0), n_surface)]
241
312
  return [i for i in self.surface_ids if 0 <= i < n_surface]
242
313
 
243
314
  @staticmethod
244
315
  def _surface_normals(rdu_sf: torch.Tensor) -> torch.Tensor:
316
+ """Compute regularized unit normals using the surface parameter orientation.
317
+
318
+ Args:
319
+ rdu_sf (torch.Tensor): Surface first derivatives used to construct the offset geometry.
320
+
321
+ Returns:
322
+ torch.Tensor: Cartesian normals with shape (num_points, 3), oriented by cross(dv, du).
323
+ """
245
324
  normal0 = torch.cross(rdu_sf[:, :, 1], rdu_sf[:, :, 0], dim=1)
246
325
  normals = normal0 / (
247
326
  normal0.norm(dim=1, keepdim=True)
@@ -252,11 +331,29 @@ class OffsetSurfaceMinThickness(BaseConstraints):
252
331
  def _offset_points(
253
332
  self, r_sf: torch.Tensor, rdu_sf: torch.Tensor, thickness: float
254
333
  ) -> tuple[torch.Tensor, torch.Tensor]:
255
- """Offset surface points and the normals they were offset along."""
334
+ """Offset surface points and the normals they were offset along.
335
+
336
+ Args:
337
+ r_sf (torch.Tensor): Reference Cartesian samples of the surface being offset.
338
+ rdu_sf (torch.Tensor): Surface first derivatives used to construct the offset geometry.
339
+ thickness (float): Offset-layer thickness in model length units.
340
+
341
+ Returns:
342
+ tuple[torch.Tensor, torch.Tensor]: Offset surface points and the normals they were
343
+ offset along.
344
+ """
256
345
  normals = self._surface_normals(rdu_sf=rdu_sf)
257
346
  return r_sf + self.normal_sign * thickness * normals, normals
258
347
 
259
348
  def _min_distance(self, thickness: float) -> float:
349
+ """Resolve the explicit separation requirement or the shell-thickness default.
350
+
351
+ Args:
352
+ thickness (float): Offset-layer thickness in model length units.
353
+
354
+ Returns:
355
+ float: Positive required separation in model length units; defaults to twice thickness.
356
+ """
260
357
  dmin = (
261
358
  float(self.min_distance)
262
359
  if self.min_distance is not None
@@ -268,8 +365,15 @@ class OffsetSurfaceMinThickness(BaseConstraints):
268
365
  """Take the Part this constraint is evaluated for and pair its points.
269
366
 
270
367
  The geometry updater hands over the Part it evaluates; only a
271
- :class:`~morphopt.codesign.OffsetBoundaryPart` carries a
272
- shell, so anything else is rejected here.
368
+ :class:`~morphopt.codesign.OffsetBoundaryPart` carries a shell, so anything else is rejected
369
+ here.
370
+
371
+ Args:
372
+ r0: Initial cylinder radius, or reference sample positions for a surface objective.
373
+ rdu0: Reference first derivatives with one surface block of shape (num_points, 3, 2).
374
+ part_interface: Kernel Part interface selected as the geometry target.
375
+ *args: Additional positional arguments accepted by the shared interface.
376
+ **kwargs: Additional keyword arguments accepted by the shared interface.
273
377
  """
274
378
  super().initialize(r0=r0, rdu0=rdu0, *args, **kwargs)
275
379
  if not isinstance(part_interface, OffsetBoundaryPart):
@@ -320,6 +424,22 @@ class OffsetSurfaceMinThickness(BaseConstraints):
320
424
  *args,
321
425
  **kwargs,
322
426
  ) -> torch.Tensor:
427
+ """Evaluate OffsetSurfaceMinThickness for the supplied inputs.
428
+
429
+ Args:
430
+ r (list[torch.Tensor]): Current Cartesian surface samples; each surface block has shape
431
+ (num_points, 3).
432
+ rdu (list[torch.Tensor]): Current first surface derivatives; each block has shape
433
+ (num_points, 3, 2).
434
+ rdu2 (list[torch.Tensor]): Current second surface derivatives; each block has shape
435
+ (num_points, 3, 2, 2).
436
+ *args: Additional positional arguments accepted by the shared interface.
437
+ **kwargs: Additional keyword arguments accepted by the shared interface.
438
+
439
+ Returns:
440
+ torch.Tensor: One-element penalty for insufficient separation of the offset shell
441
+ boundaries.
442
+ """
323
443
  loss = torch.zeros(1, device=r[0].device, dtype=r[0].dtype)
324
444
 
325
445
  for sf_idx in self._selected_surface_ids(len(r)):
@@ -349,8 +469,8 @@ class OffsetSurfaceMinThickness(BaseConstraints):
349
469
  mindist_n = self._neighbor_mindist[sf_idx][mask_n].to(
350
470
  device=r[sf_idx].device, dtype=r[sf_idx].dtype
351
471
  )
352
- scaler_n0 = self.scaler[sf_idx][pairs_n[0]]
353
- scaler_n1 = self.scaler[sf_idx][pairs_n[1]]
472
+ weights_n0 = self.integration_weights[sf_idx][pairs_n[0]]
473
+ weights_n1 = self.integration_weights[sf_idx][pairs_n[1]]
354
474
 
355
475
  # Offset points and distance
356
476
  roff, _ = self._offset_points(
@@ -386,7 +506,7 @@ class OffsetSurfaceMinThickness(BaseConstraints):
386
506
 
387
507
  loss = (
388
508
  loss
389
- + (penalty_strong * scaler_n0[indexl] * scaler_n1[indexl]).sum()
509
+ + (penalty_strong * weights_n0[indexl] * weights_n1[indexl]).sum()
390
510
  )
391
511
 
392
512
  return loss
@@ -36,6 +36,13 @@ class OffsetBoundaryPart(BoundaryPart):
36
36
  num_layers: int = 1,
37
37
  **kwargs: object,
38
38
  ) -> None:
39
+ """Initialize OffsetBoundaryPart and its configuration state.
40
+
41
+ Args:
42
+ shell_thickness (float): Thickness of the generated shell region in model length units.
43
+ num_layers (int): Number of offset finite-element layers.
44
+ **kwargs: Additional keyword arguments accepted by the shared interface.
45
+ """
39
46
  super().__init__(**kwargs)
40
47
 
41
48
  self.shell_thickness: float = float(shell_thickness)
@@ -55,17 +62,39 @@ class OffsetBoundaryPart(BoundaryPart):
55
62
  # ------------------------------------------------------------- shell mesh
56
63
  @property
57
64
  def surface_set_names(self) -> tuple[str, ...]:
65
+ """Return surface set names.
66
+
67
+ Returns:
68
+ tuple[str, ...]: Surface set names.
69
+ """
58
70
  return (*super().surface_set_names, *self._offset_set_names())
59
71
 
60
72
  @property
61
73
  def node_set_names(self) -> tuple[str, ...]:
74
+ """Return node set names.
75
+
76
+ Returns:
77
+ tuple[str, ...]: Node set names.
78
+ """
62
79
  return (*super().node_set_names, *self._offset_set_names())
63
80
 
64
81
  def _offset_set_names(self) -> tuple[str, ...]:
82
+ """List the generated shell-offset selections for the inner boundaries.
83
+
84
+ Returns:
85
+ tuple[str, ...]: Names surface_N_offset for each cavity, beginning at surface index one.
86
+ """
65
87
  return tuple(f"surface_{index}_offset" for index in range(1, self.num_surface_interfaces))
66
88
 
67
89
  def _compute_normals(self, base_nodes: torch.Tensor) -> torch.Tensor:
68
- """Cavity-surface normals evaluated on the current control points."""
90
+ """Cavity-surface normals evaluated on the current control points.
91
+
92
+ Args:
93
+ base_nodes (torch.Tensor): Reference Cartesian nodes before applying the surface offset.
94
+
95
+ Returns:
96
+ torch.Tensor: Cavity-surface normals evaluated on the current control points.
97
+ """
69
98
  normals = []
70
99
  for index in range(1, self.num_surface_interfaces):
71
100
  surface = self.surfaceinterfaces[index]
@@ -80,16 +109,39 @@ class OffsetBoundaryPart(BoundaryPart):
80
109
  return torch.cat(normals, dim=0)
81
110
 
82
111
  def _compute_offset_targets(self, base_nodes: torch.Tensor) -> torch.Tensor:
83
- """Offset the base nodes by ``shell_thickness`` along the normals."""
112
+ """Offset the base nodes by ``shell_thickness`` along the normals.
113
+
114
+ Args:
115
+ base_nodes (torch.Tensor): Reference Cartesian nodes before applying the surface offset.
116
+
117
+ Returns:
118
+ torch.Tensor: Offset the base nodes by ``shell_thickness`` along the normals.
119
+ """
84
120
  direction = self._compute_normals(base_nodes)
85
121
  return base_nodes + float(self.shell_thickness) * direction
86
122
 
87
123
  def _postprocess_part(self, part: torchfea.Part) -> torchfea.Part:
88
- """Add the offset shell wedge elements to the meshed Part."""
124
+ """Add the offset shell wedge elements to the meshed Part.
125
+
126
+ Args:
127
+ part (torchfea.Part): Part whose geometry, mesh, or named sets are processed.
128
+
129
+ Returns:
130
+ torchfea.Part: Add the offset shell wedge elements to the meshed Part.
131
+ """
89
132
  return self._build_shell_c3d6(part)
90
133
 
91
134
  def build_part(self, path_result=None, pools=None) -> torchfea.Part:
92
- """Build and validate the offset wedges, including quadratic conversion."""
135
+ """Build and validate the offset wedges, including quadratic conversion.
136
+
137
+ Args:
138
+ path_result: Optimization result directory containing scripts and log subdirectories.
139
+ pools: Optional multiprocessing pool for geometry preparation or export.
140
+
141
+ Returns:
142
+ torchfea.Part: TorchFEA Part with geometry-derived selections and the requested element
143
+ order.
144
+ """
93
145
  part = super().build_part(path_result=path_result, pools=pools)
94
146
  shell = part.elems["C3D6"]
95
147
  shell.initialize(nodes=part.nodes)
@@ -100,6 +152,15 @@ class OffsetBoundaryPart(BoundaryPart):
100
152
 
101
153
  def _build_shell_c3d6(self, part: torchfea.Part) -> torchfea.Part:
102
154
  # Ensure surface elements exist so we can query triangle meshes.
155
+ """Build shell c3d6.
156
+
157
+ Args:
158
+ part (torchfea.Part): Part whose geometry, mesh, or named sets are processed.
159
+
160
+ Returns:
161
+ torchfea.Part: Offset shell discretized with six-node wedge elements and named boundary
162
+ selections.
163
+ """
103
164
  part.surfaces.initialize(part)
104
165
 
105
166
  tri_by_surface: dict[int, np.ndarray] = {}
@@ -236,7 +297,14 @@ class OffsetBoundaryPart(BoundaryPart):
236
297
  def modify_assembly(
237
298
  self, design_sensitivity_vars: torch.Tensor, assembly: torchfea.Assembly
238
299
  ) -> None:
239
- """Update the Part nodes and keep the offset layers consistent."""
300
+ """Update the Part nodes and keep the offset layers consistent.
301
+
302
+ Args:
303
+ design_sensitivity_vars (torch.Tensor): Differentiable design-variable tensor used to
304
+ modify the assembly.
305
+ assembly (torchfea.Assembly): TorchFEA assembly containing the registered Parts,
306
+ Instances, loads, and reference points.
307
+ """
240
308
  super().modify_assembly(design_sensitivity_vars, assembly)
241
309
 
242
310
  part = assembly.get_part(self.part_name)
@@ -266,7 +334,14 @@ class OffsetBoundaryPart(BoundaryPart):
266
334
 
267
335
  @staticmethod
268
336
  def _default_opacity(index: int) -> float:
269
- """The solid volume is hidden so the shell stays visible."""
337
+ """The solid volume is hidden so the shell stays visible.
338
+
339
+ Args:
340
+ index (int): Zero-based position within the relevant collection.
341
+
342
+ Returns:
343
+ float: The solid volume is hidden so the shell stays visible.
344
+ """
270
345
  return (
271
346
  0.0
272
347
  if index == 0