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.
- {morphopt-4.0.7 → morphopt-4.0.9}/PKG-INFO +12 -9
- {morphopt-4.0.7 → morphopt-4.0.9}/README.md +9 -6
- {morphopt-4.0.7 → morphopt-4.0.9}/pyproject.toml +3 -3
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/__init__.py +21 -17
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/codesign/constraints.py +148 -28
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/codesign/offset_boundary_part.py +81 -6
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/constants.py +67 -51
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/opt_runner.py +77 -11
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/__init__.py +4 -3
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/controller.py +118 -60
- morphopt-4.0.9/src/morphopt/optcore/history.py +117 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/baseparam.py +97 -22
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/fea/base_component.py +12 -5
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/fea/body_force.py +17 -2
- morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/boundary_condition.py +100 -0
- morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/contact.py +139 -0
- morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/couple.py +44 -0
- morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/point_load.py +140 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/fea/pressure.py +25 -10
- morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/reference_point.py +37 -0
- morphopt-4.0.9/src/morphopt/optcore/modelparams/fea/spring.py +305 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/feaparams.py +25 -11
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/geometry.py +31 -6
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/materials/base_material.py +51 -7
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/materials/homogeneous_material.py +5 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/materials/models.py +10 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/materialsparams.py +10 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/params.py +90 -56
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/base_part.py +115 -12
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/box_part.py +31 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/cad_part.py +260 -46
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/fixed_part.py +60 -6
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/inp_part.py +26 -6
- morphopt-4.0.9/src/morphopt/optcore/objfunc.py +350 -0
- morphopt-4.0.9/src/morphopt/optcore/protocal.py +234 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/solver.py +101 -77
- morphopt-4.0.9/src/morphopt/optcore/strategies.py +144 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/updaters.py +499 -120
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/postprocess/__init__.py +3 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/postprocess/_runtime.py +25 -3
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/postprocess/archive.py +158 -10
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/postprocess/exports.py +134 -10
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/postprocess/fields.py +174 -6
- morphopt-4.0.9/src/morphopt/postprocess/visualization.py +371 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/__init__.py +6 -4
- morphopt-4.0.9/src/morphopt/shapeopt/barriers.py +75 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/boundary_part.py +256 -107
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/objectivefuncs/__init__.py +1 -1
- morphopt-4.0.9/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +171 -0
- morphopt-4.0.9/src/morphopt/shapeopt/objectivefuncs/boundarys.py +137 -0
- morphopt-4.0.9/src/morphopt/shapeopt/objectivefuncs/distancesurface.py +172 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/objectivefuncs/shapederivative.py +82 -73
- morphopt-4.0.9/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +320 -0
- morphopt-4.0.9/src/morphopt/shapeopt/objectivefuncs/volumemaximization.py +63 -0
- morphopt-4.0.9/src/morphopt/shapeopt/strategies.py +448 -0
- morphopt-4.0.9/src/morphopt/shapeopt/surfaces/base_constraints.py +163 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/base_surface.py +331 -156
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/brep_surface.py +359 -36
- morphopt-4.0.9/src/morphopt/shapeopt/surfaces/bsp_constraints.py +349 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/bsp_surface.py +247 -240
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/cpgeo_constraints.py +79 -28
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/cpgeo_surface.py +129 -125
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/mesh_surface.py +53 -6
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/nurbs_face.py +181 -24
- morphopt-4.0.9/src/morphopt/shapeopt/update_boundary_part.py +376 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/objectivefuncs/basefuncs.py +15 -48
- morphopt-4.0.9/src/morphopt/simp/objectivefuncs/boundarys.py +104 -0
- morphopt-4.0.9/src/morphopt/simp/objectivefuncs/densityfield.py +53 -0
- morphopt-4.0.9/src/morphopt/simp/objectivefuncs/sensitivity.py +133 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/objectivefuncs/volfrac.py +29 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/simpmaterial.py +210 -32
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/update_simpmaterial.py +104 -138
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/void_elements.py +127 -2
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/__init__.py +6 -3
- morphopt-4.0.9/src/morphopt/ui/app.py +122 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/cad.py +103 -16
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/completion.py +58 -9
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/definitions.py +173 -19
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/devices.py +5 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/edit_history.py +140 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/editing.py +386 -35
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/editor_routing.py +26 -2
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/expressions.py +19 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/fields.py +147 -9
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/finite_element.py +76 -5
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/load_cases.py +109 -5
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/part_mesh.py +12 -2
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/part_sets.py +117 -2
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/quickstart.py +130 -65
- morphopt-4.0.9/src/morphopt/ui/application/results.py +199 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/runs.py +111 -4
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/updaters.py +136 -2
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/validation.py +221 -16
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/values.py +33 -6
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application_icon.py +15 -3
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/codegen/assets.py +15 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/codegen/custom_classes.py +95 -14
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/codegen/generator.py +326 -71
- {morphopt-4.0.7/src/morphopt/ui/schemes → morphopt-4.0.9/src/morphopt/ui/codegen}/snippets.py +21 -5
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/codegen/workspace.py +35 -5
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/i18n.py +66 -5
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/launcher.py +91 -17
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/locales/en-US.json +154 -57
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/locales/zh-CN.json +154 -57
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/mainwindow.py +123 -13
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/base_nodes.py +348 -36
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/chamberlayout.py +13 -0
- morphopt-4.0.9/src/morphopt/ui/model/configuration.py +229 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/fields.py +16 -0
- morphopt-4.0.9/src/morphopt/ui/model/loaders.py +328 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/__init__.py +10 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/custom_code.py +69 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/loads.py +93 -8
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/materials.py +4 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/objectives.py +4 -19
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/parts.py +94 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/penalties.py +6 -2
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/structural.py +380 -10
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/surfaces.py +6 -46
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/symmetry.py +72 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/problem.py +634 -116
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/registry.py +58 -1
- morphopt-4.0.9/src/morphopt/ui/model/strategies.py +83 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/observe_panel.py +281 -81
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/presentation/edit_history.py +9 -1
- morphopt-4.0.9/src/morphopt/ui/presentation/history.py +99 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/presentation/labels.py +210 -12
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/presentation/navigation.py +125 -9
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/presentation/result_fields.py +25 -3
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/processes.py +11 -2
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/refresh.py +42 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/__init__.py +7 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/fonts.py +116 -7
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/manager.py +63 -9
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/palette.py +23 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/styles/base.qss +1 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/styles/controls.qss +5 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/stylesheet.py +9 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/themes/dark.py +25 -0
- morphopt-4.0.9/src/morphopt/ui/theme/themes/light.py +117 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/visualization.py +16 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/assets.py +9 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/geometry.py +531 -39
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/loads.py +205 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/rendering.py +28 -3
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/scene.py +63 -2
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/asset_browser.py +65 -2
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/case_deletion.py +9 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/codeeditor.py +90 -7
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/collection_controls.py +52 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/controller_editor.py +29 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/custom_classes.py +57 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/definition_actions.py +309 -5
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/definition_manager.py +43 -8
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/edit_history.py +55 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/editor.py +106 -22
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/editor_pages.py +34 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/file_dialogs.py +72 -6
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/finite_element.py +69 -25
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/font_settings.py +6 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/helper_editor.py +31 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/history_dialogs.py +7 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/history_export.py +55 -65
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/labels.py +53 -0
- morphopt-4.0.9/src/morphopt/ui/widgets/load_cases.py +63 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/model_tree.py +118 -16
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/objective_editor.py +75 -44
- morphopt-4.0.9/src/morphopt/ui/widgets/observation_pages.py +611 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/param_form.py +56 -5
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/part_set_list.py +16 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/preview_renderer.py +88 -22
- morphopt-4.0.9/src/morphopt/ui/widgets/problems.py +119 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/quickstart.py +172 -48
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/run_dialogs.py +11 -0
- morphopt-4.0.9/src/morphopt/ui/widgets/sequence_input.py +165 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/solver_editor.py +26 -6
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/source_view.py +12 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/template_insert_dialog.py +36 -3
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/updater_editor.py +183 -26
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/viewer.py +74 -15
- morphopt-4.0.9/src/morphopt/ui/widgets/viewport.py +562 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/visualization_settings.py +11 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/workspace_objective.py +16 -2
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/workbench.py +113 -24
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/worker.py +9 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/utils/gradient_check.py +48 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/utils/history_read.py +5 -4
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/utils/paths.py +8 -1
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/utils/quadrature.py +17 -7
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt.egg-info/PKG-INFO +12 -9
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt.egg-info/SOURCES.txt +7 -3
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt.egg-info/requires.txt +2 -2
- morphopt-4.0.7/src/morphopt/optcore/history.py +0 -473
- morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/boundary_condition.py +0 -76
- morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/contact.py +0 -117
- morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/couple.py +0 -35
- morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/point_load.py +0 -79
- morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/reference_point.py +0 -29
- morphopt-4.0.7/src/morphopt/optcore/modelparams/fea/spring.py +0 -156
- morphopt-4.0.7/src/morphopt/optcore/objfunc.py +0 -240
- morphopt-4.0.7/src/morphopt/optcore/protocal.py +0 -130
- morphopt-4.0.7/src/morphopt/postprocess/visualization.py +0 -184
- morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +0 -141
- morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/boundarys.py +0 -105
- morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/distancesurface.py +0 -170
- morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +0 -42
- morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/volumemaximization.py +0 -41
- morphopt-4.0.7/src/morphopt/shapeopt/surfaces/base_constraints.py +0 -114
- morphopt-4.0.7/src/morphopt/shapeopt/surfaces/bsp_constraints.py +0 -89
- morphopt-4.0.7/src/morphopt/shapeopt/update_boundary_part.py +0 -445
- morphopt-4.0.7/src/morphopt/simp/objectivefuncs/boundarys.py +0 -76
- morphopt-4.0.7/src/morphopt/simp/objectivefuncs/densityfield.py +0 -29
- morphopt-4.0.7/src/morphopt/simp/objectivefuncs/sensitivity.py +0 -86
- morphopt-4.0.7/src/morphopt/ui/app.py +0 -68
- morphopt-4.0.7/src/morphopt/ui/application/results.py +0 -86
- morphopt-4.0.7/src/morphopt/ui/model/configuration.py +0 -112
- morphopt-4.0.7/src/morphopt/ui/model/loaders.py +0 -31
- morphopt-4.0.7/src/morphopt/ui/presentation/history.py +0 -83
- morphopt-4.0.7/src/morphopt/ui/schemes/__init__.py +0 -26
- morphopt-4.0.7/src/morphopt/ui/schemes/base.py +0 -407
- morphopt-4.0.7/src/morphopt/ui/theme/themes/light.py +0 -129
- morphopt-4.0.7/src/morphopt/ui/widgets/load_cases.py +0 -212
- morphopt-4.0.7/src/morphopt/ui/widgets/observation_pages.py +0 -325
- morphopt-4.0.7/src/morphopt/ui/widgets/viewport.py +0 -159
- {morphopt-4.0.7 → morphopt-4.0.9}/setup.cfg +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/codesign/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/codesign/update_offset_boundary_part.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/base_model_component.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/fea/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/materials/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/optcore/modelparams/parts/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/shapeopt/surfaces/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/simp/objectivefuncs/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/__main__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/application/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/assets/morphopt.svg +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/codegen/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/material_models.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/model/node_types/cad.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/presentation/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/styles/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/styles/inputs.qss +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/theme/themes/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/visualization/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/ui/widgets/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt/utils/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt.egg-info/dependency_links.txt +0 -0
- {morphopt-4.0.7 → morphopt-4.0.9}/src/morphopt.egg-info/entry_points.txt +0 -0
- {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.
|
|
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.
|
|
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.
|
|
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
|
|
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
|
-
-
|
|
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
|
|
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
|
|
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
|
|
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/` —
|
|
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
|
|
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
|
-
-
|
|
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
|
|
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
|
|
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
|
|
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/` —
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Examples
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
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
|
-
|
|
353
|
-
|
|
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 *
|
|
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
|