morphopt 4.0.7__tar.gz → 4.0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {morphopt-4.0.7 → morphopt-4.0.8}/PKG-INFO +11 -8
- {morphopt-4.0.7 → morphopt-4.0.8}/README.md +9 -6
- {morphopt-4.0.7 → morphopt-4.0.8}/pyproject.toml +2 -2
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/__init__.py +2 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/codesign/constraints.py +4 -4
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/constants.py +34 -42
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/opt_runner.py +14 -5
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/controller.py +24 -10
- morphopt-4.0.8/src/morphopt/optcore/history.py +77 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/geometry.py +5 -3
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/params.py +24 -29
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/cad_part.py +56 -23
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/objfunc.py +3 -11
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/protocal.py +3 -3
- morphopt-4.0.8/src/morphopt/optcore/strategies.py +87 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/updaters.py +74 -20
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/postprocess/__init__.py +3 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/postprocess/archive.py +5 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/postprocess/visualization.py +120 -3
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/__init__.py +6 -4
- morphopt-4.0.8/src/morphopt/shapeopt/barriers.py +38 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/boundary_part.py +35 -74
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/objectivefuncs/__init__.py +1 -1
- morphopt-4.0.8/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +150 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/objectivefuncs/boundarys.py +30 -29
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/objectivefuncs/distancesurface.py +51 -67
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/objectivefuncs/shapederivative.py +5 -66
- morphopt-4.0.8/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +164 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/objectivefuncs/volumemaximization.py +2 -3
- morphopt-4.0.8/src/morphopt/shapeopt/strategies.py +360 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/base_constraints.py +10 -3
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/base_surface.py +10 -79
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/brep_surface.py +2 -2
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/bsp_surface.py +35 -196
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/cpgeo_constraints.py +0 -1
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/cpgeo_surface.py +10 -91
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/mesh_surface.py +0 -1
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/update_boundary_part.py +91 -205
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/sensitivity.py +4 -18
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/simp/update_simpmaterial.py +29 -112
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/app.py +48 -2
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/cad.py +32 -10
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/definitions.py +5 -3
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/editing.py +43 -14
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/editor_routing.py +6 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/fields.py +59 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/quickstart.py +31 -62
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/results.py +43 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/validation.py +70 -15
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/codegen/custom_classes.py +2 -10
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/codegen/generator.py +49 -27
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/locales/en-US.json +118 -40
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/locales/zh-CN.json +118 -40
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/mainwindow.py +10 -1
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/base_nodes.py +4 -10
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/configuration.py +36 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/fields.py +2 -0
- morphopt-4.0.8/src/morphopt/ui/model/loaders.py +245 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/__init__.py +2 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/loads.py +60 -8
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/materials.py +4 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/objectives.py +4 -19
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/penalties.py +6 -2
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/structural.py +60 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/surfaces.py +4 -46
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/symmetry.py +9 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/problem.py +38 -27
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/registry.py +11 -0
- morphopt-4.0.8/src/morphopt/ui/model/strategies.py +60 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/observe_panel.py +175 -70
- morphopt-4.0.8/src/morphopt/ui/presentation/history.py +71 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/presentation/labels.py +15 -3
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/presentation/navigation.py +7 -2
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/schemes/base.py +3 -3
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/palette.py +7 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/styles/base.qss +1 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/styles/controls.qss +5 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/themes/dark.py +1 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/themes/light.py +1 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/visualization/geometry.py +59 -23
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/definition_actions.py +61 -1
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/definition_manager.py +16 -3
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/editor.py +20 -18
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/finite_element.py +15 -17
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/history_export.py +21 -65
- morphopt-4.0.8/src/morphopt/ui/widgets/load_cases.py +46 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/model_tree.py +10 -1
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/objective_editor.py +22 -41
- morphopt-4.0.8/src/morphopt/ui/widgets/observation_pages.py +555 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/param_form.py +16 -2
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/quickstart.py +24 -13
- morphopt-4.0.8/src/morphopt/ui/widgets/sequence_input.py +146 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/solver_editor.py +7 -6
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/updater_editor.py +53 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/workspace_objective.py +4 -2
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/workbench.py +3 -2
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt.egg-info/PKG-INFO +11 -8
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt.egg-info/SOURCES.txt +5 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt.egg-info/requires.txt +1 -1
- morphopt-4.0.7/src/morphopt/optcore/history.py +0 -473
- morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +0 -141
- morphopt-4.0.7/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +0 -42
- 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/widgets/load_cases.py +0 -212
- morphopt-4.0.7/src/morphopt/ui/widgets/observation_pages.py +0 -325
- {morphopt-4.0.7 → morphopt-4.0.8}/setup.cfg +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/codesign/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/codesign/offset_boundary_part.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/codesign/update_offset_boundary_part.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/base_model_component.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/baseparam.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/base_component.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/body_force.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/boundary_condition.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/contact.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/couple.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/point_load.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/pressure.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/reference_point.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/fea/spring.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/feaparams.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/materials/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/materials/base_material.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/materials/homogeneous_material.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/materials/models.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/materialsparams.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/base_part.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/box_part.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/fixed_part.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/modelparams/parts/inp_part.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/optcore/solver.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/postprocess/_runtime.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/postprocess/exports.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/postprocess/fields.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/bsp_constraints.py +1 -1
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/shapeopt/surfaces/nurbs_face.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/simp/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/basefuncs.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/boundarys.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/densityfield.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/simp/objectivefuncs/volfrac.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/simp/simpmaterial.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/simp/void_elements.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/__main__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/completion.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/devices.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/edit_history.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/expressions.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/finite_element.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/load_cases.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/part_mesh.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/part_sets.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/runs.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/updaters.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application/values.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/application_icon.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/assets/morphopt.svg +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/codegen/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/codegen/assets.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/codegen/workspace.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/i18n.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/launcher.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/chamberlayout.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/material_models.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/cad.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/custom_code.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/model/node_types/parts.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/presentation/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/presentation/edit_history.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/presentation/result_fields.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/processes.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/refresh.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/schemes/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/schemes/snippets.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/fonts.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/manager.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/styles/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/styles/inputs.qss +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/stylesheet.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/themes/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/theme/visualization.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/visualization/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/visualization/assets.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/visualization/loads.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/visualization/rendering.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/visualization/scene.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/asset_browser.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/case_deletion.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/codeeditor.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/collection_controls.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/controller_editor.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/custom_classes.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/edit_history.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/editor_pages.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/file_dialogs.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/font_settings.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/helper_editor.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/history_dialogs.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/labels.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/part_set_list.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/preview_renderer.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/run_dialogs.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/source_view.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/template_insert_dialog.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/viewer.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/viewport.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/widgets/visualization_settings.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/ui/worker.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/utils/__init__.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/utils/gradient_check.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/utils/history_read.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/utils/paths.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt/utils/quadrature.py +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt.egg-info/dependency_links.txt +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt.egg-info/entry_points.txt +0 -0
- {morphopt-4.0.7 → morphopt-4.0.8}/src/morphopt.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: morphopt
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.8
|
|
4
4
|
Summary: A morphing optimization framework using PyTorch and torchfea.
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -18,7 +18,7 @@ Requires-Dist: tabulate>=0.9.0
|
|
|
18
18
|
Requires-Dist: imageio>=2.37.3
|
|
19
19
|
Requires-Dist: fonttools>=4.0
|
|
20
20
|
Requires-Dist: bspmap>=1.0.3
|
|
21
|
-
Requires-Dist: torchfea>=1.1.
|
|
21
|
+
Requires-Dist: torchfea>=1.1.5
|
|
22
22
|
Requires-Dist: trimesh>=4.11.5
|
|
23
23
|
Requires-Dist: networkx>=3.6.1
|
|
24
24
|
Requires-Dist: scipy>=1.17.1
|
|
@@ -30,13 +30,16 @@ Requires-Dist: pytest>=8.0; extra == "test"
|
|
|
30
30
|
|
|
31
31
|
**Developed by Zenan Song**
|
|
32
32
|
|
|
33
|
-
MorphOpt is a differentiable structural optimization framework that combines the adjoint method with automatic differentiation (AD). The sensitivity corresponds to the virtual work of residual force derivatives on the adjoint displacement field, computed via a single backpropagation through the residual graph. MorphOpt provides a unified interface for geometry, load, and material definition, calls torchfea for GPU-accelerated differentiable nonlinear FEA and adjoint-AD sensitivity, and
|
|
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.8"
|
|
4
4
|
description = "A morphing optimization framework using PyTorch and torchfea."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -19,7 +19,7 @@ dependencies = [
|
|
|
19
19
|
"imageio>=2.37.3",
|
|
20
20
|
"fonttools>=4.0",
|
|
21
21
|
"bspmap>=1.0.3",
|
|
22
|
-
"torchfea>=1.1.
|
|
22
|
+
"torchfea>=1.1.5",
|
|
23
23
|
"trimesh>=4.11.5",
|
|
24
24
|
"networkx>=3.6.1",
|
|
25
25
|
"scipy>=1.17.1",
|
|
@@ -92,6 +92,7 @@ from .optcore.protocal import (
|
|
|
92
92
|
ProtocalVisualizable,
|
|
93
93
|
)
|
|
94
94
|
from .optcore.solver import Solver
|
|
95
|
+
from .optcore import strategies
|
|
95
96
|
from .optcore.updaters import Updaters
|
|
96
97
|
from .shapeopt import (
|
|
97
98
|
BaseSurfaceConstraints,
|
|
@@ -150,4 +151,5 @@ __all__ = [
|
|
|
150
151
|
"shapeopt",
|
|
151
152
|
"simp",
|
|
152
153
|
"start_optimization",
|
|
154
|
+
"strategies",
|
|
153
155
|
]
|
|
@@ -160,7 +160,7 @@ class InwardCurvatureRadius(BaseConstraints):
|
|
|
160
160
|
)
|
|
161
161
|
)
|
|
162
162
|
penalty_strong = self.penalty_scale * penalty * hard_boost
|
|
163
|
-
loss = loss + (self.
|
|
163
|
+
loss = loss + (self.integration_weights[i][index] * penalty_strong).sum()
|
|
164
164
|
|
|
165
165
|
return loss
|
|
166
166
|
|
|
@@ -349,8 +349,8 @@ class OffsetSurfaceMinThickness(BaseConstraints):
|
|
|
349
349
|
mindist_n = self._neighbor_mindist[sf_idx][mask_n].to(
|
|
350
350
|
device=r[sf_idx].device, dtype=r[sf_idx].dtype
|
|
351
351
|
)
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
weights_n0 = self.integration_weights[sf_idx][pairs_n[0]]
|
|
353
|
+
weights_n1 = self.integration_weights[sf_idx][pairs_n[1]]
|
|
354
354
|
|
|
355
355
|
# Offset points and distance
|
|
356
356
|
roff, _ = self._offset_points(
|
|
@@ -386,7 +386,7 @@ class OffsetSurfaceMinThickness(BaseConstraints):
|
|
|
386
386
|
|
|
387
387
|
loss = (
|
|
388
388
|
loss
|
|
389
|
-
+ (penalty_strong *
|
|
389
|
+
+ (penalty_strong * weights_n0[indexl] * weights_n1[indexl]).sum()
|
|
390
390
|
)
|
|
391
391
|
|
|
392
392
|
return loss
|
|
@@ -21,6 +21,7 @@ class _Constants:
|
|
|
21
21
|
|
|
22
22
|
class OBSERVER:
|
|
23
23
|
OUTPUT_MAXIMUM_BLOCKS = 10000
|
|
24
|
+
LOG_READ_MAXIMUM_BYTES = 1024 * 1024
|
|
24
25
|
POLL_INTERVAL_MS = 1000
|
|
25
26
|
|
|
26
27
|
class UPDATER_EDITOR:
|
|
@@ -311,11 +312,8 @@ class _Constants:
|
|
|
311
312
|
DEFAULT = "auto"
|
|
312
313
|
CHOICES = (
|
|
313
314
|
"auto",
|
|
314
|
-
"instance",
|
|
315
315
|
"rp",
|
|
316
|
-
"
|
|
317
|
-
"constraint",
|
|
318
|
-
"boundary",
|
|
316
|
+
"instance",
|
|
319
317
|
)
|
|
320
318
|
|
|
321
319
|
class BOUNDARYCONDITION:
|
|
@@ -415,17 +413,8 @@ class _Constants:
|
|
|
415
413
|
class INIT_LOCATION:
|
|
416
414
|
DEFAULT = (0.0, 0.0, 0.0)
|
|
417
415
|
|
|
418
|
-
class MAXR:
|
|
419
|
-
DEFAULT = 0.2
|
|
420
|
-
MIN = 0.0
|
|
421
416
|
|
|
422
|
-
class MAXC:
|
|
423
|
-
DEFAULT = 1.0
|
|
424
|
-
MIN = 0.0
|
|
425
417
|
|
|
426
|
-
class MAXFF:
|
|
427
|
-
DEFAULT = 0.2
|
|
428
|
-
MIN = 0.0
|
|
429
418
|
|
|
430
419
|
class PERTURBATION_L:
|
|
431
420
|
DEFAULT = -1.0
|
|
@@ -454,9 +443,6 @@ class _Constants:
|
|
|
454
443
|
class INIT_LOCATION:
|
|
455
444
|
DEFAULT = (0.0, 0.0, 0.0)
|
|
456
445
|
|
|
457
|
-
class MAXC:
|
|
458
|
-
DEFAULT = 1.0
|
|
459
|
-
MIN = 0.0
|
|
460
446
|
|
|
461
447
|
class PERTURBATION_L:
|
|
462
448
|
DEFAULT = -1.0
|
|
@@ -473,9 +459,6 @@ class _Constants:
|
|
|
473
459
|
class INIT_LOCATION:
|
|
474
460
|
DEFAULT = (0.0, 0.0, 0.0)
|
|
475
461
|
|
|
476
|
-
class MAXC:
|
|
477
|
-
DEFAULT = 1.0
|
|
478
|
-
MIN = 0.0
|
|
479
462
|
|
|
480
463
|
class MESH_SURFACE:
|
|
481
464
|
class PATH_STL:
|
|
@@ -756,10 +739,6 @@ class _Constants:
|
|
|
756
739
|
DEFAULT = ""
|
|
757
740
|
|
|
758
741
|
class UPDATER_OBJECTIVES:
|
|
759
|
-
class SENSITIVITY:
|
|
760
|
-
class NORMALIZE_GRADIENT:
|
|
761
|
-
DEFAULT = False
|
|
762
|
-
|
|
763
742
|
class DENSITYFIELDMINIMIZE:
|
|
764
743
|
class SCALE:
|
|
765
744
|
DEFAULT = 1e-07
|
|
@@ -991,6 +970,9 @@ class _Constants:
|
|
|
991
970
|
)
|
|
992
971
|
DEFAULT_TARGET = 0.0
|
|
993
972
|
DEFAULT_WEIGHT = 1.0
|
|
973
|
+
DEFAULT_WORKSPACE_KIND = "workspace_plane"
|
|
974
|
+
DEFAULT_WORKSPACE_GAUSS_ORDER = 2
|
|
975
|
+
DEFAULT_WORKSPACE_NORMALIZATION = 1.0
|
|
994
976
|
TARGET_MINIMUM = -1000000.0
|
|
995
977
|
TARGET_MAXIMUM = 1000000.0
|
|
996
978
|
WEIGHT_MINIMUM = 0.0
|
|
@@ -1008,7 +990,7 @@ class _Constants:
|
|
|
1008
990
|
|
|
1009
991
|
class SOLVER:
|
|
1010
992
|
NUM_PROCESS = 1
|
|
1011
|
-
STATIC_TOLERANCE_ERROR = 1e-
|
|
993
|
+
STATIC_TOLERANCE_ERROR = 1e-04
|
|
1012
994
|
|
|
1013
995
|
class VISUALIZATION:
|
|
1014
996
|
WINDOW_SIZE = (1200, 1200)
|
|
@@ -1039,6 +1021,7 @@ class _Constants:
|
|
|
1039
1021
|
MAXIMUM_SIZE_RATIO = 1.0
|
|
1040
1022
|
MINIMUM_SIZE_RATIO = 0.5
|
|
1041
1023
|
DEFAULT_CAD_MESH_SIZE = 1.0
|
|
1024
|
+
BOUNDARY_SEED_SIZE_VARIATION = (0.9, 1.1)
|
|
1042
1025
|
DEFAULT_BOUNDARY_SEED_SIZE = 1.0
|
|
1043
1026
|
DEFAULT_ELEMENT_ORDER = 1
|
|
1044
1027
|
|
|
@@ -1057,14 +1040,23 @@ class _Constants:
|
|
|
1057
1040
|
DEFAULT_WEIGHT = 1.0
|
|
1058
1041
|
|
|
1059
1042
|
class SHAPE_CONSTRAINTS:
|
|
1043
|
+
class FAIRNESS:
|
|
1044
|
+
CURVATURE_LIMIT = 1.0
|
|
1045
|
+
METRIC_VARIATION_LIMIT = 0.1
|
|
1046
|
+
NONORTHOGONALITY_LIMIT = 0.1
|
|
1047
|
+
ACTIVATION_RATIO = 0.8
|
|
1048
|
+
BSP_EXPONENT = 3
|
|
1049
|
+
CPGEO_EXPONENT = 3
|
|
1050
|
+
REFERENCE_METRIC_RATIO = 0.2
|
|
1051
|
+
|
|
1060
1052
|
BARRIER_THRESHOLD = 0.05
|
|
1061
1053
|
BARRIER_RATIO = 0.0
|
|
1062
1054
|
MIN_RADIUS_EXPONENT = 3
|
|
1063
|
-
CYLINDER_EXPONENT =
|
|
1055
|
+
CYLINDER_EXPONENT = 3
|
|
1064
1056
|
DISTANCE_SEARCH_RATIO = 1.5
|
|
1065
1057
|
DISTANCE_PAIR_PRUNE_RATIO = 0.3
|
|
1066
1058
|
DISTANCE_BARRIER_THRESHOLD = 0.01
|
|
1067
|
-
DISTANCE_BARRIER_EXPONENT =
|
|
1059
|
+
DISTANCE_BARRIER_EXPONENT = 3
|
|
1068
1060
|
NORMAL_TRANSITION_MIN = -0.7
|
|
1069
1061
|
NORMAL_TRANSITION_MAX = 0.0
|
|
1070
1062
|
NORMALIZATION_TOLERANCE = 1e-08
|
|
@@ -1085,6 +1077,22 @@ class _Constants:
|
|
|
1085
1077
|
class UPDATER_OBJECTIVES:
|
|
1086
1078
|
QUADRATIC_MEMORY_PAIRS = 10
|
|
1087
1079
|
|
|
1080
|
+
class UPDATER_STRATEGIES:
|
|
1081
|
+
DEFAULT_CONSTRAINT_WEIGHT = 1.0
|
|
1082
|
+
|
|
1083
|
+
class ADAPTIVE_SHAPE_WEIGHTS:
|
|
1084
|
+
PROBE_FRACTION = 0.5
|
|
1085
|
+
SAFETY_FACTOR = 2.0
|
|
1086
|
+
BALANCE_RATIO = 0.25
|
|
1087
|
+
OBJECTIVE_TOLERANCE = 0.01
|
|
1088
|
+
TIGHTENING_INCREMENT = 0.001
|
|
1089
|
+
PENALTY_GROWTH_LIMIT = 2.0
|
|
1090
|
+
WEIGHT_INCREASE = 1.25
|
|
1091
|
+
SIGNIFICANT_PENALTY_RATIO = 0.001
|
|
1092
|
+
INITIAL_TOLERANCE = 0.05
|
|
1093
|
+
FINAL_TOLERANCE = 0.0
|
|
1094
|
+
DISTANCE_TRANSITION_RATIO = 0.05
|
|
1095
|
+
|
|
1088
1096
|
class OPTIMIZER:
|
|
1089
1097
|
LINE_SEARCH_C1 = 0.0001
|
|
1090
1098
|
LINE_SEARCH_BACKTRACK_RATIO = 0.2
|
|
@@ -1098,11 +1106,6 @@ class _Constants:
|
|
|
1098
1106
|
class SHAPE_UPDATE:
|
|
1099
1107
|
MAX_STEP_ITERATIONS = 100
|
|
1100
1108
|
MAX_STEP_LENGTH = 0.5
|
|
1101
|
-
INITIAL_STEP_LENGTH_RATIO = 0.5
|
|
1102
|
-
DIRECTION_CHANGE_THRESHOLD = -0.5
|
|
1103
|
-
MIN_STEP_LENGTH_RATIO = 0.1
|
|
1104
|
-
STEP_LENGTH_DECAY = 0.5
|
|
1105
|
-
STEP_LENGTH_INCREASE = 1.5
|
|
1106
1109
|
LOW_STEP_LENGTH_TOLERANCE = 1e-10
|
|
1107
1110
|
LOW_STEP_LENGTH_ITERATION_LIMIT = 10
|
|
1108
1111
|
STATUS_LOG_INTERVAL = 10
|
|
@@ -1112,10 +1115,6 @@ class _Constants:
|
|
|
1112
1115
|
class SIMP_UPDATE:
|
|
1113
1116
|
MAX_STEP_ITERATIONS = 50
|
|
1114
1117
|
MAX_STEP_LENGTH = 1.0
|
|
1115
|
-
INITIAL_STEP_LENGTH_RATIO = 0.5
|
|
1116
|
-
MIN_STEP_LENGTH_RATIO = 0.1
|
|
1117
|
-
STEP_LENGTH_DECAY = 0.5
|
|
1118
|
-
STEP_LENGTH_INCREASE = 1.5
|
|
1119
1118
|
LOW_STEP_LENGTH_TOLERANCE = 1e-10
|
|
1120
1119
|
LOW_STEP_LENGTH_ITERATION_LIMIT = 10
|
|
1121
1120
|
STATUS_LOG_INTERVAL = 10
|
|
@@ -1125,13 +1124,6 @@ class _Constants:
|
|
|
1125
1124
|
class SURFACE:
|
|
1126
1125
|
OBJ_VERTEX_MERGE_TOLERANCE = 1e-06
|
|
1127
1126
|
STEP_DISTANCE_ACCURACY_MM = 0.001
|
|
1128
|
-
DEFAULT_CURVATURE_LIMIT = 1.0
|
|
1129
|
-
DEFAULT_METRIC_VARIATION_LIMIT = 0.2
|
|
1130
|
-
DEFAULT_NONORTHOGONALITY_LIMIT = 0.2
|
|
1131
|
-
BSP_CLASS_NONORTHOGONALITY_LIMIT = 0.1
|
|
1132
|
-
FAIRNESS_ACTIVATION_RATIO = 0.8
|
|
1133
|
-
BSP_FAIRNESS_EXPONENT = 3
|
|
1134
|
-
CPGEO_FAIRNESS_EXPONENT = 5
|
|
1135
1127
|
CYLINDER_CIRCUMFERENTIAL_BASE_SEGMENTS = 12
|
|
1136
1128
|
CYLINDER_INITIAL_PERTURBATION_RATIO = 0.04
|
|
1137
1129
|
FIXED_END_CONTROL_POINT_ROWS = 5
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import logging
|
|
5
6
|
import multiprocessing as mp
|
|
6
7
|
import os
|
|
7
8
|
from multiprocessing.queues import Queue
|
|
8
9
|
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
9
12
|
|
|
10
13
|
def _main_script(path_result: str | None) -> str:
|
|
11
14
|
"""Locate the initial task or the archived script of a resumed run."""
|
|
@@ -155,10 +158,16 @@ def _run_worker(
|
|
|
155
158
|
controller.optdevice = device
|
|
156
159
|
controller.dataqueue = pathqueue
|
|
157
160
|
controller._debug_mode = debug
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
try:
|
|
162
|
+
if target_iteration == 0 or path_result is None:
|
|
163
|
+
controller.start_optimization(main_filepath=main_filepath)
|
|
164
|
+
else:
|
|
165
|
+
controller.restart_optimization(
|
|
166
|
+
path_result=path_result, target_iteration=target_iteration
|
|
167
|
+
)
|
|
168
|
+
except Exception:
|
|
169
|
+
logger.exception(
|
|
170
|
+
"Optimization worker failed; result folder: %s", controller.path_result
|
|
163
171
|
)
|
|
172
|
+
raise
|
|
164
173
|
return controller.path_result
|
|
@@ -317,7 +317,7 @@ class Controller:
|
|
|
317
317
|
"""
|
|
318
318
|
Perform a single optimization step.
|
|
319
319
|
Returns:
|
|
320
|
-
loss (torch.Tensor): The
|
|
320
|
+
loss (torch.Tensor): The high-fidelity objective at the evaluated design.
|
|
321
321
|
t0 (float): The start time of the optimization step.
|
|
322
322
|
t1 (float): The time after model generation.
|
|
323
323
|
t2 (float): The time after finite element analysis (FEA).
|
|
@@ -364,10 +364,9 @@ class Controller:
|
|
|
364
364
|
|
|
365
365
|
# Update the surfaces based on the FEA results
|
|
366
366
|
logger.info(f"Updating surfaces for iteration {self.history.iteration}...")
|
|
367
|
-
self.updater.update(gradients=gradients)
|
|
368
|
-
self.updater.update_variables()
|
|
369
|
-
|
|
370
367
|
loss = self.objfun.objective_function()
|
|
368
|
+
self.updater.update(gradients=gradients, objective_value=loss.detach().item())
|
|
369
|
+
self.updater.update_variables()
|
|
371
370
|
|
|
372
371
|
t4 = time.time()
|
|
373
372
|
|
|
@@ -379,9 +378,13 @@ class Controller:
|
|
|
379
378
|
"""
|
|
380
379
|
Record the history of the optimization process.
|
|
381
380
|
"""
|
|
382
|
-
self.
|
|
383
|
-
|
|
384
|
-
|
|
381
|
+
metrics = self.objfun.get_metrics()
|
|
382
|
+
if isinstance(metrics, (list, tuple)):
|
|
383
|
+
metrics = {str(index): value for index, value in enumerate(metrics)}
|
|
384
|
+
metrics = {
|
|
385
|
+
name: value.item() if isinstance(value, torch.Tensor) else value
|
|
386
|
+
for name, value in metrics.items()
|
|
387
|
+
}
|
|
385
388
|
# A model may hold any number of Parts and Instances (shape/codesign
|
|
386
389
|
# geometry interfaces, SIMP assemblies imported from torchfea-ui), so
|
|
387
390
|
# statistics are read from the actual Assembly instead of assuming a
|
|
@@ -396,15 +399,26 @@ class Controller:
|
|
|
396
399
|
instance.nodes.shape[0]
|
|
397
400
|
for instance in self.objfun.fe.assembly._instances.values()
|
|
398
401
|
)
|
|
399
|
-
self.history.append(
|
|
400
|
-
|
|
402
|
+
self.history.append(
|
|
403
|
+
iteration=self.history.iteration + 1,
|
|
404
|
+
objective=loss.item(),
|
|
405
|
+
metrics=metrics,
|
|
406
|
+
time={
|
|
407
|
+
"init": t1 - t0,
|
|
408
|
+
"fea": t2 - t1,
|
|
409
|
+
"sens": t3 - t2,
|
|
410
|
+
"update": t4 - t3,
|
|
411
|
+
},
|
|
412
|
+
num_elements=num_elements,
|
|
413
|
+
num_nodes=num_nodes,
|
|
414
|
+
)
|
|
401
415
|
|
|
402
416
|
def print_info(self, t0, t1, t2, t3, t4) -> None:
|
|
403
417
|
"""
|
|
404
418
|
Print the current information of the optimization process.
|
|
405
419
|
"""
|
|
406
420
|
logger.info(f"Iteration: {self.history.iteration}")
|
|
407
|
-
logger.info(f"Loss: {self.history.
|
|
421
|
+
logger.info(f"Loss: {self.history.records[-1]['objective']:.6f}")
|
|
408
422
|
logger.info("Time Breakdown:")
|
|
409
423
|
logger.info(f" Initialization Time: {t1 - t0:.2f} seconds")
|
|
410
424
|
logger.info(f" FEA Time: {t2 - t1:.2f} seconds")
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Iteration records with generic CSV persistence."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import csv
|
|
6
|
+
import json
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
import numpy as np
|
|
11
|
+
import torch
|
|
12
|
+
|
|
13
|
+
from .protocal import ProtocalInitializable, ProtocalSavable
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class History(ProtocalInitializable, ProtocalSavable):
|
|
17
|
+
"""Store one ordinary dictionary per iteration, without a field schema."""
|
|
18
|
+
|
|
19
|
+
def __init__(self) -> None:
|
|
20
|
+
self.records: list[dict[str, Any]] = []
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def iteration(self) -> int:
|
|
24
|
+
return len(self.records)
|
|
25
|
+
|
|
26
|
+
def initialize(self) -> None:
|
|
27
|
+
self.records.clear()
|
|
28
|
+
|
|
29
|
+
def append(self, **record: Any) -> None:
|
|
30
|
+
"""Append a complete iteration, copying tensors and arrays to plain values."""
|
|
31
|
+
if not record:
|
|
32
|
+
raise ValueError("A history record must contain at least one field.")
|
|
33
|
+
self.records.append(self._plain(record))
|
|
34
|
+
|
|
35
|
+
@staticmethod
|
|
36
|
+
def _plain(value: Any) -> Any:
|
|
37
|
+
if isinstance(value, torch.Tensor):
|
|
38
|
+
return value.detach().cpu().tolist()
|
|
39
|
+
if isinstance(value, np.ndarray):
|
|
40
|
+
return value.tolist()
|
|
41
|
+
if isinstance(value, np.generic):
|
|
42
|
+
return value.item()
|
|
43
|
+
if isinstance(value, dict):
|
|
44
|
+
return {key: History._plain(item) for key, item in value.items()}
|
|
45
|
+
if isinstance(value, (list, tuple)):
|
|
46
|
+
return [History._plain(item) for item in value]
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
def save(self, foldpath: str, iteration: int | None = None) -> None:
|
|
50
|
+
"""Write fields in registration order; JSON cells preserve nested values."""
|
|
51
|
+
records = self.records if iteration is None else self.records[:iteration]
|
|
52
|
+
fields = list(dict.fromkeys(key for record in records for key in record))
|
|
53
|
+
with (Path(foldpath) / "history_record.csv").open(
|
|
54
|
+
"w", encoding="utf-8", newline=""
|
|
55
|
+
) as stream:
|
|
56
|
+
writer = csv.writer(stream)
|
|
57
|
+
writer.writerow(fields)
|
|
58
|
+
for record in records:
|
|
59
|
+
writer.writerow([
|
|
60
|
+
json.dumps(record[key], ensure_ascii=False) if key in record else ""
|
|
61
|
+
for key in fields
|
|
62
|
+
])
|
|
63
|
+
|
|
64
|
+
def load(self, foldpath: str, iteration: int | None = None) -> None:
|
|
65
|
+
"""Read the same records, optionally keeping only a completed prefix."""
|
|
66
|
+
self.initialize()
|
|
67
|
+
path = Path(foldpath) / "history_record.csv"
|
|
68
|
+
if not path.is_file():
|
|
69
|
+
return
|
|
70
|
+
with path.open(encoding="utf-8", newline="") as stream:
|
|
71
|
+
self.records = [
|
|
72
|
+
{key: json.loads(value) for key, value in row.items()
|
|
73
|
+
if value != ""}
|
|
74
|
+
for row in csv.DictReader(stream)
|
|
75
|
+
]
|
|
76
|
+
if iteration is not None:
|
|
77
|
+
self.records = self.records[:iteration]
|
|
@@ -34,9 +34,9 @@ class GeometryParams(BaseParams):
|
|
|
34
34
|
|
|
35
35
|
from .parts import (
|
|
36
36
|
BasePart,
|
|
37
|
-
FixedPart,
|
|
38
|
-
CADPart,
|
|
39
37
|
BoxPart,
|
|
38
|
+
CADPart,
|
|
39
|
+
FixedPart,
|
|
40
40
|
INPPart,
|
|
41
41
|
)
|
|
42
42
|
|
|
@@ -53,7 +53,9 @@ class GeometryParams(BaseParams):
|
|
|
53
53
|
return ["geometry"]
|
|
54
54
|
|
|
55
55
|
# --------------------------------------------------------------- assembly
|
|
56
|
-
def generate(
|
|
56
|
+
def generate(
|
|
57
|
+
self, path_result: str, pools: Pool | None = None
|
|
58
|
+
) -> torchfea.Assembly:
|
|
57
59
|
"""Build the assembly holding every interface's Parts and Instances."""
|
|
58
60
|
assembly = torchfea.Assembly()
|
|
59
61
|
for interface in self.interfaces.values():
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from copy import deepcopy
|
|
2
2
|
import math
|
|
3
|
+
from pathlib import Path
|
|
3
4
|
import tempfile
|
|
4
5
|
|
|
5
6
|
import pyvista as pv
|
|
@@ -42,17 +43,13 @@ class Params(ProtocalInitializable, ProtocalSavable, ProtocalVisualizable):
|
|
|
42
43
|
"""
|
|
43
44
|
|
|
44
45
|
def pathlog_required(self) -> list[str]:
|
|
45
|
-
"""
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
paths += self.geometry.pathlog_required()
|
|
53
|
-
paths += self.feamodel.pathlog_required()
|
|
54
|
-
paths += self.materials.pathlog_required()
|
|
55
|
-
return paths + ["params"]
|
|
46
|
+
"""Declare this object's save directory before its child directories."""
|
|
47
|
+
return [
|
|
48
|
+
"params",
|
|
49
|
+
*self.geometry.pathlog_required(),
|
|
50
|
+
*self.feamodel.pathlog_required(),
|
|
51
|
+
*self.materials.pathlog_required(),
|
|
52
|
+
]
|
|
56
53
|
|
|
57
54
|
def reinitialize(self, iteration: int) -> None:
|
|
58
55
|
"""
|
|
@@ -136,6 +133,7 @@ class Params(ProtocalInitializable, ProtocalSavable, ProtocalVisualizable):
|
|
|
136
133
|
Args:
|
|
137
134
|
foldpath (str): The path to save the parameters.
|
|
138
135
|
"""
|
|
136
|
+
directory = Path(self.save_directory(foldpath))
|
|
139
137
|
self.geometry.save(foldpath=foldpath, iteration=iteration)
|
|
140
138
|
self.feamodel.save(foldpath=foldpath, iteration=iteration)
|
|
141
139
|
self.materials.save(foldpath=foldpath, iteration=iteration)
|
|
@@ -146,25 +144,22 @@ class Params(ProtocalInitializable, ProtocalSavable, ProtocalVisualizable):
|
|
|
146
144
|
off_screen=True,
|
|
147
145
|
window_size=list(CONSTANT.KERNEL.VISUALIZATION.WINDOW_SIZE),
|
|
148
146
|
)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
147
|
+
try:
|
|
148
|
+
plotter.set_background("white")
|
|
149
|
+
self.plot(plotter=plotter)
|
|
150
|
+
plotter.enable_parallel_projection()
|
|
151
|
+
azimuth = CONSTANT.KERNEL.VISUALIZATION.CAMERA_AZIMUTH_DEGREES
|
|
152
|
+
elevation = CONSTANT.KERNEL.VISUALIZATION.CAMERA_ELEVATION_DEGREES
|
|
153
|
+
plotter.view_vector(
|
|
154
|
+
(
|
|
155
|
+
math.cos(math.radians(azimuth)) * math.cos(math.radians(elevation)),
|
|
156
|
+
math.sin(math.radians(azimuth)) * math.cos(math.radians(elevation)),
|
|
157
|
+
math.sin(math.radians(elevation)),
|
|
158
|
+
)
|
|
161
159
|
)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
foldpath + self.pathlog_required()[-1] + "/%d.jpg" % iteration
|
|
166
|
-
)
|
|
167
|
-
plotter.close()
|
|
160
|
+
plotter.screenshot(str(directory / f"{iteration}.jpg"))
|
|
161
|
+
finally:
|
|
162
|
+
plotter.close()
|
|
168
163
|
|
|
169
164
|
def load(self, foldpath: str, iteration: int) -> None:
|
|
170
165
|
"""
|