morphopt 4.0.9__tar.gz → 4.0.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {morphopt-4.0.9 → morphopt-4.0.11}/PKG-INFO +10 -8
- {morphopt-4.0.9 → morphopt-4.0.11}/README.md +7 -5
- {morphopt-4.0.9 → morphopt-4.0.11}/pyproject.toml +3 -3
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/constants.py +30 -14
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/controller.py +46 -37
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/baseparam.py +0 -8
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/__init__.py +1 -0
- morphopt-4.0.11/src/morphopt/optcore/modelparams/fea/joint.py +75 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/feaparams.py +2 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/geometry.py +0 -9
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/params.py +1 -9
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/objfunc.py +10 -62
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/protocal.py +12 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/strategies.py +34 -57
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/updaters.py +100 -66
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/postprocess/__init__.py +4 -6
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/postprocess/archive.py +106 -55
- morphopt-4.0.11/src/morphopt/postprocess/exports/__init__.py +34 -0
- morphopt-4.0.11/src/morphopt/postprocess/exports/animation.py +100 -0
- morphopt-4.0.11/src/morphopt/postprocess/exports/components.py +63 -0
- morphopt-4.0.11/src/morphopt/postprocess/exports/finite_element.py +168 -0
- morphopt-4.0.11/src/morphopt/postprocess/exports/tables.py +197 -0
- morphopt-4.0.11/src/morphopt/postprocess/snapshots.py +229 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/postprocess/visualization.py +138 -145
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/barriers.py +22 -15
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/boundary_part.py +14 -10
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +131 -71
- morphopt-4.0.11/src/morphopt/shapeopt/strategies.py +455 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/base_surface.py +36 -18
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/brep_surface.py +394 -153
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/bsp_surface.py +26 -59
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/cpgeo_surface.py +36 -56
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/mesh_surface.py +18 -53
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/update_boundary_part.py +31 -103
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/simp/simpmaterial.py +86 -21
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/simp/update_simpmaterial.py +45 -142
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/__init__.py +1 -1
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/app.py +18 -2
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/definitions.py +26 -23
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/devices.py +7 -4
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/editing.py +1 -1
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/expressions.py +23 -3
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/fields.py +12 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/finite_element.py +10 -5
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/load_cases.py +1 -1
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/part_sets.py +15 -4
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/results.py +16 -25
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/runs.py +14 -39
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/validation.py +22 -11
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/codegen/assets.py +41 -11
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/codegen/custom_classes.py +12 -10
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/codegen/generator.py +13 -14
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/i18n.py +9 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/locales/en-US.json +83 -42
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/locales/zh-CN.json +83 -42
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/mainwindow.py +88 -29
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/base_nodes.py +5 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/configuration.py +4 -6
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/loaders.py +13 -14
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/__init__.py +4 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/loads.py +46 -20
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/registry.py +4 -0
- morphopt-4.0.11/src/morphopt/ui/model/strategies.py +60 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/observe_panel.py +56 -172
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/presentation/history.py +4 -3
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/presentation/labels.py +16 -1
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/presentation/result_fields.py +3 -12
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/refresh.py +6 -1
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/palette.py +1 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/styles/base.qss +1 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/styles/controls.qss +2 -2
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/styles/inputs.qss +1 -1
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/themes/dark.py +1 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/themes/light.py +10 -9
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/visualization/geometry.py +36 -6
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/visualization/loads.py +27 -12
- morphopt-4.0.11/src/morphopt/ui/visualization/rendering.py +166 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/controller_editor.py +2 -2
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/finite_element.py +1 -1
- morphopt-4.0.11/src/morphopt/ui/widgets/history_export.py +753 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/model_tree.py +5 -1
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/observation_pages.py +122 -68
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/solver_editor.py +1 -2
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/source_view.py +21 -2
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/updater_editor.py +13 -14
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/viewer.py +4 -2
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/viewport.py +7 -3
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/workbench.py +1 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/worker.py +7 -3
- morphopt-4.0.11/src/morphopt/utils/paths.py +74 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt.egg-info/PKG-INFO +10 -8
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt.egg-info/SOURCES.txt +7 -1
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt.egg-info/requires.txt +2 -2
- morphopt-4.0.9/src/morphopt/postprocess/exports.py +0 -564
- morphopt-4.0.9/src/morphopt/shapeopt/strategies.py +0 -448
- morphopt-4.0.9/src/morphopt/ui/model/strategies.py +0 -83
- morphopt-4.0.9/src/morphopt/ui/visualization/rendering.py +0 -86
- morphopt-4.0.9/src/morphopt/ui/widgets/history_export.py +0 -332
- morphopt-4.0.9/src/morphopt/utils/paths.py +0 -22
- {morphopt-4.0.9 → morphopt-4.0.11}/setup.cfg +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/codesign/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/codesign/constraints.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/codesign/offset_boundary_part.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/codesign/update_offset_boundary_part.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/opt_runner.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/history.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/base_model_component.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/base_component.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/body_force.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/boundary_condition.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/contact.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/couple.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/point_load.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/pressure.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/reference_point.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/fea/spring.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/materials/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/materials/base_material.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/materials/homogeneous_material.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/materials/models.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/materialsparams.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/base_part.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/box_part.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/cad_part.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/fixed_part.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/modelparams/parts/inp_part.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/optcore/solver.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/postprocess/_runtime.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/postprocess/fields.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/boundarys.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/distancesurface.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/shapederivative.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/objectivefuncs/volumemaximization.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/base_constraints.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/bsp_constraints.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/cpgeo_constraints.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/shapeopt/surfaces/nurbs_face.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/simp/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/basefuncs.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/boundarys.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/densityfield.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/sensitivity.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/simp/objectivefuncs/volfrac.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/simp/void_elements.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/__main__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/cad.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/completion.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/edit_history.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/editor_routing.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/part_mesh.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/quickstart.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/updaters.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application/values.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/application_icon.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/assets/morphopt.svg +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/codegen/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/codegen/snippets.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/codegen/workspace.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/launcher.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/chamberlayout.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/fields.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/material_models.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/cad.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/custom_code.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/materials.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/objectives.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/parts.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/penalties.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/structural.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/surfaces.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/node_types/symmetry.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/model/problem.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/presentation/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/presentation/edit_history.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/presentation/navigation.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/processes.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/fonts.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/manager.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/styles/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/stylesheet.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/themes/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/theme/visualization.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/visualization/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/visualization/assets.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/visualization/scene.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/asset_browser.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/case_deletion.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/codeeditor.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/collection_controls.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/custom_classes.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/definition_actions.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/definition_manager.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/edit_history.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/editor.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/editor_pages.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/file_dialogs.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/font_settings.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/helper_editor.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/history_dialogs.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/labels.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/load_cases.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/objective_editor.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/param_form.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/part_set_list.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/preview_renderer.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/problems.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/quickstart.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/run_dialogs.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/sequence_input.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/template_insert_dialog.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/visualization_settings.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/ui/widgets/workspace_objective.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/utils/__init__.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/utils/gradient_check.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/utils/history_read.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt/utils/quadrature.py +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt.egg-info/dependency_links.txt +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt.egg-info/entry_points.txt +0 -0
- {morphopt-4.0.9 → morphopt-4.0.11}/src/morphopt.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: morphopt
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.11
|
|
4
4
|
Summary: A morphing optimization framework using PyTorch and torchfea.
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -18,11 +18,11 @@ Requires-Dist: tabulate>=0.9.0
|
|
|
18
18
|
Requires-Dist: imageio>=2.37.3
|
|
19
19
|
Requires-Dist: fonttools>=4.0
|
|
20
20
|
Requires-Dist: bspmap>=1.0.3
|
|
21
|
-
Requires-Dist: torchfea>=1.1.
|
|
21
|
+
Requires-Dist: torchfea>=1.1.7
|
|
22
22
|
Requires-Dist: trimesh>=4.11.5
|
|
23
23
|
Requires-Dist: networkx>=3.6.1
|
|
24
24
|
Requires-Dist: scipy>=1.17.1
|
|
25
|
-
Requires-Dist: cpgeo>=1.0.
|
|
25
|
+
Requires-Dist: cpgeo>=1.0.15
|
|
26
26
|
Provides-Extra: test
|
|
27
27
|
Requires-Dist: pytest>=8.0; extra == "test"
|
|
28
28
|
|
|
@@ -39,7 +39,7 @@ MorphOpt is a differentiable structural optimization framework that combines the
|
|
|
39
39
|
- First-order and history-based quadratic FEA surrogates with L-BFGS subproblem solves and explicit step limits
|
|
40
40
|
- Surface-integrated geometric penalties with fixed, sensitivity-based, or adaptive weights; native FEA sensitivities remain unscaled
|
|
41
41
|
- Named load cases, ordered solve groups, and per-worker CPU/GPU assignment (one CPU worker by default)
|
|
42
|
-
- UI definition, asset preview, saved-log browsing, per-surface/control-net views, and
|
|
42
|
+
- UI definition, asset preview, saved-log browsing, per-surface/control-net views, and component-specific history export (STEP/STL for boundary surfaces), previewable GIF animations, and Abaqus INP files
|
|
43
43
|
- Component customization through framework class inheritance
|
|
44
44
|
|
|
45
45
|
## Quick Start
|
|
@@ -81,7 +81,7 @@ Requirements: Python ≥ 3.12; a PyTorch **float64** build is recommended.
|
|
|
81
81
|
|
|
82
82
|
The GUI opens directly into the full definition workbench with its standard sections present and no problem setup prefilled. Definitions can be created directly in the workbench or generated through **Quickstart**. Quickstart provides shape and topology optimization settings, geometry definitions, and weighted objective terms with associated load conditions. Workspace terms select their driving pressure channels and use boundary integration. Generated problems stay editable and can be saved or exported as runnable folders. Load cases use named interface cards with individually labelled scalar parameters. Workspace objectives automatically register their boundary Gauss-point cases.
|
|
83
83
|
|
|
84
|
-
The [UI quick start](docs/
|
|
84
|
+
The [UI quick start](docs/en-US/ui-quickstart.md) covers the complete example from model definition to optimization and result inspection. The [script quick start](docs/en-US/script-quickstart.md) provides the equivalent runnable Python task.
|
|
85
85
|
|
|
86
86
|
### Run the UI in a virtual environment
|
|
87
87
|
|
|
@@ -115,12 +115,14 @@ Shared UI defaults and tunable kernel parameters live in [`src/morphopt/constant
|
|
|
115
115
|
|
|
116
116
|
### Documentation
|
|
117
117
|
|
|
118
|
+
[English documentation](docs/en-US/README.md) · [简体中文文档](docs/zh-CN/README.md)
|
|
119
|
+
|
|
118
120
|
| Workflow | Quick start | Module and interface reference |
|
|
119
121
|
|---|---|---|
|
|
120
|
-
| Python script | [Start an optimization](docs/
|
|
121
|
-
| Graphical UI | [Create and run the example](docs/
|
|
122
|
+
| Python script | [Start an optimization](docs/en-US/script-quickstart.md) | [Define and extend each module](docs/en-US/script-reference.md) |
|
|
123
|
+
| Graphical UI | [Create and run the example](docs/en-US/ui-quickstart.md) | [Modules, parameters and interface definitions](docs/en-US/ui-reference.md) |
|
|
122
124
|
|
|
123
|
-
The [documentation index](docs/README.md) includes the reading order and automatic section numbering commands. Theory and code architecture are documented separately under `docs/theory/` and `docs/codestructure/`.
|
|
125
|
+
The [documentation index](docs/en-US/README.md) includes the reading order and automatic section numbering commands. Theory and code architecture are documented separately under `docs/en-US/theory/` and `docs/en-US/codestructure/`.
|
|
124
126
|
|
|
125
127
|
## Directory Overview
|
|
126
128
|
|
|
@@ -11,7 +11,7 @@ MorphOpt is a differentiable structural optimization framework that combines the
|
|
|
11
11
|
- First-order and history-based quadratic FEA surrogates with L-BFGS subproblem solves and explicit step limits
|
|
12
12
|
- Surface-integrated geometric penalties with fixed, sensitivity-based, or adaptive weights; native FEA sensitivities remain unscaled
|
|
13
13
|
- Named load cases, ordered solve groups, and per-worker CPU/GPU assignment (one CPU worker by default)
|
|
14
|
-
- UI definition, asset preview, saved-log browsing, per-surface/control-net views, and
|
|
14
|
+
- UI definition, asset preview, saved-log browsing, per-surface/control-net views, and component-specific history export (STEP/STL for boundary surfaces), previewable GIF animations, and Abaqus INP files
|
|
15
15
|
- Component customization through framework class inheritance
|
|
16
16
|
|
|
17
17
|
## Quick Start
|
|
@@ -53,7 +53,7 @@ Requirements: Python ≥ 3.12; a PyTorch **float64** build is recommended.
|
|
|
53
53
|
|
|
54
54
|
The GUI opens directly into the full definition workbench with its standard sections present and no problem setup prefilled. Definitions can be created directly in the workbench or generated through **Quickstart**. Quickstart provides shape and topology optimization settings, geometry definitions, and weighted objective terms with associated load conditions. Workspace terms select their driving pressure channels and use boundary integration. Generated problems stay editable and can be saved or exported as runnable folders. Load cases use named interface cards with individually labelled scalar parameters. Workspace objectives automatically register their boundary Gauss-point cases.
|
|
55
55
|
|
|
56
|
-
The [UI quick start](docs/
|
|
56
|
+
The [UI quick start](docs/en-US/ui-quickstart.md) covers the complete example from model definition to optimization and result inspection. The [script quick start](docs/en-US/script-quickstart.md) provides the equivalent runnable Python task.
|
|
57
57
|
|
|
58
58
|
### Run the UI in a virtual environment
|
|
59
59
|
|
|
@@ -87,12 +87,14 @@ Shared UI defaults and tunable kernel parameters live in [`src/morphopt/constant
|
|
|
87
87
|
|
|
88
88
|
### Documentation
|
|
89
89
|
|
|
90
|
+
[English documentation](docs/en-US/README.md) · [简体中文文档](docs/zh-CN/README.md)
|
|
91
|
+
|
|
90
92
|
| Workflow | Quick start | Module and interface reference |
|
|
91
93
|
|---|---|---|
|
|
92
|
-
| Python script | [Start an optimization](docs/
|
|
93
|
-
| Graphical UI | [Create and run the example](docs/
|
|
94
|
+
| Python script | [Start an optimization](docs/en-US/script-quickstart.md) | [Define and extend each module](docs/en-US/script-reference.md) |
|
|
95
|
+
| Graphical UI | [Create and run the example](docs/en-US/ui-quickstart.md) | [Modules, parameters and interface definitions](docs/en-US/ui-reference.md) |
|
|
94
96
|
|
|
95
|
-
The [documentation index](docs/README.md) includes the reading order and automatic section numbering commands. Theory and code architecture are documented separately under `docs/theory/` and `docs/codestructure/`.
|
|
97
|
+
The [documentation index](docs/en-US/README.md) includes the reading order and automatic section numbering commands. Theory and code architecture are documented separately under `docs/en-US/theory/` and `docs/en-US/codestructure/`.
|
|
96
98
|
|
|
97
99
|
## Directory Overview
|
|
98
100
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "morphopt"
|
|
3
|
-
version = "4.0.
|
|
3
|
+
version = "4.0.11"
|
|
4
4
|
description = "A morphing optimization framework using PyTorch and torchfea."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -19,11 +19,11 @@ dependencies = [
|
|
|
19
19
|
"imageio>=2.37.3",
|
|
20
20
|
"fonttools>=4.0",
|
|
21
21
|
"bspmap>=1.0.3",
|
|
22
|
-
"torchfea>=1.1.
|
|
22
|
+
"torchfea>=1.1.7",
|
|
23
23
|
"trimesh>=4.11.5",
|
|
24
24
|
"networkx>=3.6.1",
|
|
25
25
|
"scipy>=1.17.1",
|
|
26
|
-
"cpgeo>=1.0.
|
|
26
|
+
"cpgeo>=1.0.15",
|
|
27
27
|
]
|
|
28
28
|
|
|
29
29
|
[project.scripts]
|
|
@@ -21,10 +21,14 @@ class _Constants:
|
|
|
21
21
|
|
|
22
22
|
class OBSERVER:
|
|
23
23
|
OUTPUT_MAXIMUM_BLOCKS = 10000
|
|
24
|
+
PREVIEW_CACHE_BYTES = (
|
|
25
|
+
5 * 1024**3
|
|
26
|
+
) # Shared mesh-data budget for history previews.
|
|
24
27
|
LOG_READ_MAXIMUM_BYTES = 1024 * 1024
|
|
25
28
|
POLL_INTERVAL_MS = 1000
|
|
26
29
|
|
|
27
30
|
class CAMERA:
|
|
31
|
+
FIT_VIEW_FRACTION = 0.96
|
|
28
32
|
FRAME_INTERVAL_MS = 16
|
|
29
33
|
MOVEMENT_SPEED_RATIO = 0.3
|
|
30
34
|
FAST_MULTIPLIER = 4.0
|
|
@@ -422,9 +426,6 @@ class _Constants:
|
|
|
422
426
|
class INIT_LOCATION:
|
|
423
427
|
DEFAULT = (0.0, 0.0, 0.0)
|
|
424
428
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
429
|
class PERTURBATION_L:
|
|
429
430
|
DEFAULT = -1.0
|
|
430
431
|
|
|
@@ -452,7 +453,6 @@ class _Constants:
|
|
|
452
453
|
class INIT_LOCATION:
|
|
453
454
|
DEFAULT = (0.0, 0.0, 0.0)
|
|
454
455
|
|
|
455
|
-
|
|
456
456
|
class PERTURBATION_L:
|
|
457
457
|
DEFAULT = -1.0
|
|
458
458
|
|
|
@@ -468,7 +468,6 @@ class _Constants:
|
|
|
468
468
|
class INIT_LOCATION:
|
|
469
469
|
DEFAULT = (0.0, 0.0, 0.0)
|
|
470
470
|
|
|
471
|
-
|
|
472
471
|
class MESH_SURFACE:
|
|
473
472
|
class PATH_STL:
|
|
474
473
|
DEFAULT = ""
|
|
@@ -1012,6 +1011,8 @@ class _Constants:
|
|
|
1012
1011
|
|
|
1013
1012
|
class VISUALIZATION:
|
|
1014
1013
|
WINDOW_SIZE = (1200, 1200)
|
|
1014
|
+
SNAPSHOT_LZMA_LEVEL = 1
|
|
1015
|
+
SNAPSHOT_BLOCK_BYTES = 256 * 1024
|
|
1015
1016
|
CAMERA_AZIMUTH_DEGREES = 210
|
|
1016
1017
|
CAMERA_ELEVATION_DEGREES = 20
|
|
1017
1018
|
INSTANCE_COLORS = ("#2878b5", "#edb120", "#af52cd", "#f15854", "#779548")
|
|
@@ -1035,7 +1036,9 @@ class _Constants:
|
|
|
1035
1036
|
|
|
1036
1037
|
class MESH:
|
|
1037
1038
|
QUADRATIC_ELEMENT_TYPES = {
|
|
1038
|
-
"C3D4": "C3D10",
|
|
1039
|
+
"C3D4": "C3D10",
|
|
1040
|
+
"C3D6": "C3D15",
|
|
1041
|
+
"C3D8": "C3D20",
|
|
1039
1042
|
}
|
|
1040
1043
|
SURFACE_ELEMENT_LINE_CHUNK_SIZE = 16
|
|
1041
1044
|
SURFACE_NODE_LINE_CHUNK_SIZE = 16
|
|
@@ -1047,6 +1050,16 @@ class _Constants:
|
|
|
1047
1050
|
DEFAULT_ELEMENT_ORDER = 1
|
|
1048
1051
|
|
|
1049
1052
|
class FEA:
|
|
1053
|
+
SPHERICAL_JOINT_VALUES = (1.0, 0.0, 0.0, 0.0)
|
|
1054
|
+
SINGLE_DOF_JOINT_VALUES = (
|
|
1055
|
+
*SPHERICAL_JOINT_VALUES,
|
|
1056
|
+
0.0,
|
|
1057
|
+
0.0,
|
|
1058
|
+
0.0,
|
|
1059
|
+
0.0,
|
|
1060
|
+
0.0,
|
|
1061
|
+
1.0,
|
|
1062
|
+
)
|
|
1050
1063
|
DEFAULT_TRANSLATION_DOFS = (0, 1, 2)
|
|
1051
1064
|
CONTACT_PENALTY_THRESHOLD = 3.0
|
|
1052
1065
|
|
|
@@ -1062,13 +1075,13 @@ class _Constants:
|
|
|
1062
1075
|
|
|
1063
1076
|
class SHAPE_CONSTRAINTS:
|
|
1064
1077
|
class FAIRNESS:
|
|
1065
|
-
CURVATURE_LIMIT =
|
|
1066
|
-
METRIC_VARIATION_LIMIT = 0
|
|
1067
|
-
NONORTHOGONALITY_LIMIT = 0.
|
|
1078
|
+
CURVATURE_LIMIT = 1.0
|
|
1079
|
+
METRIC_VARIATION_LIMIT = 1.0
|
|
1080
|
+
NONORTHOGONALITY_LIMIT = 0.2
|
|
1068
1081
|
ACTIVATION_RATIO = 0.8
|
|
1069
1082
|
BSP_EXPONENT = 3
|
|
1070
1083
|
CPGEO_EXPONENT = 3
|
|
1071
|
-
|
|
1084
|
+
CPGEO_STRETCH_RATIO_LIMIT = 2.5
|
|
1072
1085
|
|
|
1073
1086
|
BARRIER_THRESHOLD = 0.05
|
|
1074
1087
|
BARRIER_RATIO = 0.0
|
|
@@ -1102,19 +1115,19 @@ class _Constants:
|
|
|
1102
1115
|
class UPDATER_STRATEGIES:
|
|
1103
1116
|
DEFAULT_CONSTRAINT_WEIGHT = 1.0
|
|
1104
1117
|
|
|
1105
|
-
class
|
|
1118
|
+
class ADAPTIVE_SHAPE_UPDATE:
|
|
1119
|
+
MAX_SOLVES = 3
|
|
1106
1120
|
PROBE_FRACTION = 0.5
|
|
1107
1121
|
SAFETY_FACTOR = 2.0
|
|
1108
1122
|
BALANCE_RATIO = 0.25
|
|
1109
1123
|
TIGHTENING_INCREMENT = 0.0002
|
|
1110
1124
|
VIOLATION_TOLERANCE = 0.1
|
|
1111
1125
|
VIOLATION_BAND_RATIO = 2.0
|
|
1112
|
-
VIOLATION_WEIGHT_POWER = 2.0
|
|
1113
1126
|
WEIGHT_CHANGE_LIMIT = 10.0
|
|
1114
|
-
WEIGHT_UPDATE_FRACTION = 0.1
|
|
1115
1127
|
INITIAL_TOLERANCE = 0.05
|
|
1116
1128
|
FINAL_TOLERANCE = 0.0
|
|
1117
1129
|
DISTANCE_TRANSITION_RATIO = 0.05
|
|
1130
|
+
RETRY_WEIGHT_INCREASE = 4.0
|
|
1118
1131
|
|
|
1119
1132
|
class OPTIMIZER:
|
|
1120
1133
|
LINE_SEARCH_C1 = 0.0001
|
|
@@ -1128,7 +1141,7 @@ class _Constants:
|
|
|
1128
1141
|
LBFGS_MATERIAL_MEMORY_PAIRS = 20
|
|
1129
1142
|
|
|
1130
1143
|
class SHAPE_UPDATE:
|
|
1131
|
-
MAX_STEP_ITERATIONS =
|
|
1144
|
+
MAX_STEP_ITERATIONS = 50
|
|
1132
1145
|
MAX_STEP_LENGTH = 0.5
|
|
1133
1146
|
LOW_STEP_LENGTH_TOLERANCE = 1e-10
|
|
1134
1147
|
LOW_STEP_LENGTH_ITERATION_LIMIT = 10
|
|
@@ -1171,6 +1184,9 @@ class _Constants:
|
|
|
1171
1184
|
PROJECTION_PARAMETER_MAX = 1.0
|
|
1172
1185
|
|
|
1173
1186
|
class SIMP:
|
|
1187
|
+
EXPORT_VOXEL_SIZE = 1.0
|
|
1188
|
+
EXPORT_DENSITY_THRESHOLD = 0.5
|
|
1189
|
+
EXPORT_SAMPLE_BATCH_SIZE = 8192
|
|
1174
1190
|
DEFAULT_INITIAL_RATIO = 0.5
|
|
1175
1191
|
DEFAULT_VOID_PENALTY_FACTOR = 0.01
|
|
1176
1192
|
DEFAULT_MATERIAL_PENALTY = 8
|
|
@@ -3,6 +3,8 @@ from __future__ import annotations
|
|
|
3
3
|
from typing import TYPE_CHECKING
|
|
4
4
|
|
|
5
5
|
if TYPE_CHECKING:
|
|
6
|
+
from pyvista import MultiBlock
|
|
7
|
+
|
|
6
8
|
from .. import ObjectiveFunction, Params, Solver, Updaters
|
|
7
9
|
import datetime
|
|
8
10
|
import gc
|
|
@@ -13,13 +15,14 @@ import os
|
|
|
13
15
|
import shutil
|
|
14
16
|
import time
|
|
15
17
|
from multiprocessing import get_context
|
|
18
|
+
from pathlib import Path
|
|
16
19
|
|
|
17
20
|
import torch
|
|
18
21
|
|
|
19
22
|
import morphopt
|
|
20
23
|
|
|
21
24
|
from ..constants import CONSTANT
|
|
22
|
-
from ..utils.paths import sanitize_name
|
|
25
|
+
from ..utils.paths import sanitize_name, write_result_launcher
|
|
23
26
|
from .history import History
|
|
24
27
|
|
|
25
28
|
logger = logging.getLogger(__name__)
|
|
@@ -33,21 +36,18 @@ class Controller:
|
|
|
33
36
|
task. The controller owns the outer iteration, result directory, persistence, and history
|
|
34
37
|
collection; numerical responsibilities remain in the composed components.
|
|
35
38
|
"""
|
|
39
|
+
|
|
36
40
|
class Params:
|
|
37
41
|
"""Declare the model-parameter implementation used by the task controller."""
|
|
38
|
-
pass
|
|
39
42
|
|
|
40
43
|
class Solver:
|
|
41
44
|
"""Declare the finite-element solver implementation used by the task controller."""
|
|
42
|
-
pass
|
|
43
45
|
|
|
44
46
|
class Updater:
|
|
45
47
|
"""Declare the updater collection used by the task controller."""
|
|
46
|
-
pass
|
|
47
48
|
|
|
48
49
|
class ObjectiveFunction:
|
|
49
50
|
"""Declare the physical objective and named metrics used by the task controller."""
|
|
50
|
-
pass
|
|
51
51
|
|
|
52
52
|
def __init__(
|
|
53
53
|
self, path_result_folder: str, opt_label: str = "DefaultLabel"
|
|
@@ -104,7 +104,9 @@ class Controller:
|
|
|
104
104
|
History: An instance of the History class from the History module to record the optimization history.
|
|
105
105
|
"""
|
|
106
106
|
|
|
107
|
-
self.restart_per_iteration: int =
|
|
107
|
+
self.restart_per_iteration: int = (
|
|
108
|
+
CONSTANT.KERNEL.CONTROLLER.RESTART_PER_ITERATION
|
|
109
|
+
)
|
|
108
110
|
"""
|
|
109
111
|
The frequency of restarting the optimization process.
|
|
110
112
|
"""
|
|
@@ -209,9 +211,10 @@ class Controller:
|
|
|
209
211
|
|
|
210
212
|
main_filepath = __main__.__file__
|
|
211
213
|
scripts_directory = self.path_result + "/scripts/"
|
|
212
|
-
shutil.copy(
|
|
213
|
-
|
|
214
|
-
)
|
|
214
|
+
shutil.copy(main_filepath, scripts_directory + "MAIN_SCRIPT_FOR_RESTART.py")
|
|
215
|
+
definition = Path(main_filepath).with_suffix(".morph")
|
|
216
|
+
if definition.is_file():
|
|
217
|
+
shutil.copyfile(definition, Path(scripts_directory) / "MAIN_SCRIPT_FOR_RESTART.morph")
|
|
215
218
|
asset_directory = os.path.join(
|
|
216
219
|
os.path.dirname(os.path.abspath(main_filepath)), "morphopt_assets"
|
|
217
220
|
)
|
|
@@ -224,6 +227,7 @@ class Controller:
|
|
|
224
227
|
vendor_package("torchfea", target_dir=self.path_result + "/scripts/")
|
|
225
228
|
vendor_package("cpgeo", target_dir=self.path_result + "/scripts/")
|
|
226
229
|
vendor_package("morphopt", target_dir=self.path_result + "/scripts/")
|
|
230
|
+
write_result_launcher(Path(self.path_result))
|
|
227
231
|
|
|
228
232
|
def initialize(self) -> None:
|
|
229
233
|
"""
|
|
@@ -247,7 +251,6 @@ class Controller:
|
|
|
247
251
|
self.pools = get_context("spawn").Pool(processes=self.solver.num_process)
|
|
248
252
|
|
|
249
253
|
def start_optimization(self, main_filepath: str = None) -> None:
|
|
250
|
-
|
|
251
254
|
"""Initialize a new task and run the outer optimization loop.
|
|
252
255
|
|
|
253
256
|
Create the result directory and log layout, initialize the composed model and numerical
|
|
@@ -292,7 +295,6 @@ class Controller:
|
|
|
292
295
|
def restart_optimization(
|
|
293
296
|
self, path_result: str, target_iteration: int = None
|
|
294
297
|
) -> None:
|
|
295
|
-
|
|
296
298
|
"""Restore an archived task at a completed checkpoint and continue optimization.
|
|
297
299
|
|
|
298
300
|
Args:
|
|
@@ -323,7 +325,7 @@ class Controller:
|
|
|
323
325
|
# Explicitly release large objects to ensure they are collected
|
|
324
326
|
self.clear_cache()
|
|
325
327
|
|
|
326
|
-
_, t0, t1, t2, t3, t4 = self.step()
|
|
328
|
+
_, t0, t1, t2, t3, t4, design_snapshot = self.step()
|
|
327
329
|
|
|
328
330
|
# Record the history of the optimization process
|
|
329
331
|
self.record_history(t0, t1, t2, t3, t4)
|
|
@@ -332,7 +334,8 @@ class Controller:
|
|
|
332
334
|
self.print_info(t0, t1, t2, t3, t4)
|
|
333
335
|
|
|
334
336
|
# Save the current parameters and plot the figures
|
|
335
|
-
self.save()
|
|
337
|
+
self.save(design_snapshot)
|
|
338
|
+
del design_snapshot # Release the meshes before building the next FE model.
|
|
336
339
|
|
|
337
340
|
# if dataqueue is not None, send the data to the queue
|
|
338
341
|
if self.dataqueue is not None:
|
|
@@ -356,13 +359,12 @@ class Controller:
|
|
|
356
359
|
self.pools.join()
|
|
357
360
|
return
|
|
358
361
|
|
|
359
|
-
def step(self):
|
|
362
|
+
def step(self) -> tuple[torch.Tensor, float, float, float, float, float, MultiBlock]:
|
|
360
363
|
"""Execute one complete outer iteration: build, solve, differentiate, and update.
|
|
361
364
|
|
|
362
365
|
Returns:
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
and design update.
|
|
366
|
+
The physical objective, timestamps t0 through t4, and the design meshes
|
|
367
|
+
used for this solve, captured before the design update.
|
|
366
368
|
"""
|
|
367
369
|
t0 = time.time()
|
|
368
370
|
|
|
@@ -379,12 +381,21 @@ class Controller:
|
|
|
379
381
|
self.updater.reinitialize(iteration=self.history.iteration)
|
|
380
382
|
self.objfun.reinitialize(iteration=self.history.iteration)
|
|
381
383
|
|
|
384
|
+
if self.history.iteration == 0:
|
|
385
|
+
self.params.geometry.save(
|
|
386
|
+
foldpath=os.path.join(self.path_result, "log"), iteration=0
|
|
387
|
+
)
|
|
388
|
+
|
|
382
389
|
# Perform the optimization step
|
|
383
390
|
logger.info(f"Creating FEA model for iteration {self.history.iteration}...")
|
|
384
391
|
self.objfun.fe = self.params.create_feamodel(
|
|
385
392
|
path_result=self.path_result + "/cache/", pools=self.pools
|
|
386
393
|
)
|
|
387
394
|
|
|
395
|
+
from ..postprocess.snapshots import capture_design
|
|
396
|
+
|
|
397
|
+
with torch.no_grad():
|
|
398
|
+
design_snapshot = capture_design(self.params)
|
|
388
399
|
t1 = time.time()
|
|
389
400
|
|
|
390
401
|
# Perform finite element analysis (FEA)
|
|
@@ -409,7 +420,7 @@ class Controller:
|
|
|
409
420
|
|
|
410
421
|
t4 = time.time()
|
|
411
422
|
|
|
412
|
-
return loss, t0, t1, t2, t3, t4
|
|
423
|
+
return loss, t0, t1, t2, t3, t4, design_snapshot
|
|
413
424
|
|
|
414
425
|
def record_history(
|
|
415
426
|
self, t0: float, t1: float, t2: float, t3: float, t4: float
|
|
@@ -457,26 +468,24 @@ class Controller:
|
|
|
457
468
|
logger.info(f" Total Time: {t4 - t0:.2f} seconds")
|
|
458
469
|
logger.info("-" * 50)
|
|
459
470
|
|
|
460
|
-
def save(self) -> None:
|
|
461
|
-
"""
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
self.
|
|
471
|
-
|
|
472
|
-
)
|
|
473
|
-
self.objfun.save(
|
|
474
|
-
|
|
475
|
-
|
|
471
|
+
def save(self, design_snapshot: MultiBlock) -> None:
|
|
472
|
+
"""Archive the completed solve and its updated design parameters.
|
|
473
|
+
|
|
474
|
+
Args:
|
|
475
|
+
design_snapshot: Design meshes captured for the finite-element solve.
|
|
476
|
+
"""
|
|
477
|
+
from ..postprocess.snapshots import save_snapshot
|
|
478
|
+
|
|
479
|
+
log_folder = self.path_result + "/log/"
|
|
480
|
+
iteration = self.history.iteration
|
|
481
|
+
self.params.save(foldpath=log_folder, iteration=iteration)
|
|
482
|
+
self.solver.save(foldpath=log_folder, iteration=iteration)
|
|
483
|
+
self.updater.save(foldpath=log_folder, iteration=iteration)
|
|
484
|
+
self.objfun.save(foldpath=log_folder, iteration=iteration)
|
|
485
|
+
with torch.no_grad():
|
|
486
|
+
save_snapshot(log_folder, iteration, design_snapshot, self.objfun)
|
|
476
487
|
# Publish a completed iteration only after its model and results exist.
|
|
477
|
-
self.history.save(
|
|
478
|
-
foldpath=self.path_result + "/log/", iteration=self.history.iteration
|
|
479
|
-
)
|
|
488
|
+
self.history.save(foldpath=log_folder, iteration=iteration)
|
|
480
489
|
|
|
481
490
|
def clear_cache(self) -> None:
|
|
482
491
|
"""
|
|
@@ -200,14 +200,6 @@ class BaseParams(
|
|
|
200
200
|
f"{list(self.interfaces)}."
|
|
201
201
|
) from None
|
|
202
202
|
|
|
203
|
-
def export_data(self, foldpath: str):
|
|
204
|
-
"""
|
|
205
|
-
Export the data of parameters to file(s).
|
|
206
|
-
|
|
207
|
-
Args:
|
|
208
|
-
foldpath (str): The path to export the data.
|
|
209
|
-
"""
|
|
210
|
-
|
|
211
203
|
def save(self, foldpath: str, iteration: int) -> None:
|
|
212
204
|
"""Save the state of every registered interface.
|
|
213
205
|
|
|
@@ -2,6 +2,7 @@ from .base_component import BaseFEAComponent
|
|
|
2
2
|
from .pressure import Pressure
|
|
3
3
|
from .contact import Contact, SelfContact
|
|
4
4
|
from .point_load import ConcentratedForce, ConcentratedMoment
|
|
5
|
+
from .joint import SingleDoFJoint, SphericalJoint
|
|
5
6
|
from .spring import SpringToGround, SpringBetweenRPs, PenaltyDoF
|
|
6
7
|
from .couple import Couple
|
|
7
8
|
from .boundary_condition import BoundaryCondition, ReferencePointBoundaryCondition
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""TorchFEA penalty joints connecting two six-DoF reference points."""
|
|
2
|
+
|
|
3
|
+
from torchfea import FEAController
|
|
4
|
+
from torchfea.model import loads
|
|
5
|
+
|
|
6
|
+
from ....constants import CONSTANT
|
|
7
|
+
from .base_component import BaseFEAComponent
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class _ReferencePointJoint(BaseFEAComponent):
|
|
11
|
+
"""Register the two endpoints and apply the common per-case joint parameters."""
|
|
12
|
+
|
|
13
|
+
default_values = CONSTANT.KERNEL.FEA.SPHERICAL_JOINT_VALUES
|
|
14
|
+
|
|
15
|
+
def __init__(self, rp_name1: str, rp_name2: str) -> None:
|
|
16
|
+
"""Connect two distinct reference points.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
rp_name1: Reference point carrying the joint's local frame.
|
|
20
|
+
rp_name2: Reference point whose relative motion is constrained.
|
|
21
|
+
"""
|
|
22
|
+
super().__init__()
|
|
23
|
+
self.rp_name1 = rp_name1
|
|
24
|
+
self.rp_name2 = rp_name2
|
|
25
|
+
self._values = list(self.default_values)
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def num_values(self) -> int:
|
|
29
|
+
"""Number of scalar joint parameters in a load case."""
|
|
30
|
+
return len(self.default_values)
|
|
31
|
+
|
|
32
|
+
def apply_fea_value(self, fe: FEAController, name: str) -> None:
|
|
33
|
+
"""Apply the penalty stiffness and initial global connection point."""
|
|
34
|
+
joint = fe.assembly.get_load(name)
|
|
35
|
+
joint.k = self._values[0]
|
|
36
|
+
joint.connection_point = self._values[1:4]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class SphericalJoint(_ReferencePointJoint):
|
|
40
|
+
"""Constrain relative translation at a point and allow all relative rotations.
|
|
41
|
+
|
|
42
|
+
Load-case values are [k, x, y, z], with positive penalty stiffness k.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
def modify_fea(self, fe: FEAController, name: str) -> None:
|
|
46
|
+
"""Register the spherical joint with the assembly before case selection."""
|
|
47
|
+
joint = loads.SphericalJoint(
|
|
48
|
+
self.rp_name1, self.rp_name2,
|
|
49
|
+
connection_point=self._values[1:4], k=self._values[0],
|
|
50
|
+
)
|
|
51
|
+
fe.assembly.add_load(joint, name)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class SingleDoFJoint(_ReferencePointJoint):
|
|
55
|
+
"""Allow one relative motion in RP 1's frame and penalize the other five.
|
|
56
|
+
|
|
57
|
+
Load-case values are [k, x, y, z, tx, ty, tz, rx, ry, rz]. The final
|
|
58
|
+
six entries specify a nonzero free direction, initially in global axes.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
default_values = CONSTANT.KERNEL.FEA.SINGLE_DOF_JOINT_VALUES
|
|
62
|
+
|
|
63
|
+
def modify_fea(self, fe: FEAController, name: str) -> None:
|
|
64
|
+
"""Register the single-DoF joint with the assembly before case selection."""
|
|
65
|
+
joint = loads.SingleDoFJoint(
|
|
66
|
+
self.rp_name1, self.rp_name2,
|
|
67
|
+
connection_point=self._values[1:4], free_direction=self._values[4:],
|
|
68
|
+
k=self._values[0],
|
|
69
|
+
)
|
|
70
|
+
fe.assembly.add_load(joint, name)
|
|
71
|
+
|
|
72
|
+
def apply_fea_value(self, fe: FEAController, name: str) -> None:
|
|
73
|
+
"""Apply the common joint parameters and the case's free direction."""
|
|
74
|
+
super().apply_fea_value(fe, name)
|
|
75
|
+
fe.assembly.get_load(name).free_direction = self._values[4:]
|
|
@@ -80,12 +80,3 @@ class GeometryParams(BaseParams):
|
|
|
80
80
|
for interface in self.interfaces.values():
|
|
81
81
|
interface.add_to_assembly(assembly, path_result=path_result, pools=pools)
|
|
82
82
|
return assembly
|
|
83
|
-
|
|
84
|
-
def export_data(self, foldpath: str) -> None:
|
|
85
|
-
"""Export the geometry description of every interface.
|
|
86
|
-
|
|
87
|
-
Args:
|
|
88
|
-
foldpath (str): Root log directory containing this component's namespaced state files.
|
|
89
|
-
"""
|
|
90
|
-
for interface in self.interfaces.values():
|
|
91
|
-
interface.export_data(interface.workdir(foldpath))
|
|
@@ -202,17 +202,9 @@ class Params(
|
|
|
202
202
|
iteration (int): Iteration index associated with the saved or current model state.
|
|
203
203
|
"""
|
|
204
204
|
self.geometry.load(foldpath=foldpath, iteration=iteration)
|
|
205
|
+
self.feamodel.load(foldpath=foldpath, iteration=iteration)
|
|
205
206
|
self.materials.load(foldpath=foldpath, iteration=iteration)
|
|
206
207
|
|
|
207
|
-
def export_data(self, filepath: str) -> None:
|
|
208
|
-
"""
|
|
209
|
-
Export the data of parameters to file(s).
|
|
210
|
-
|
|
211
|
-
Args:
|
|
212
|
-
filepath (str): The path to export the data.
|
|
213
|
-
"""
|
|
214
|
-
self.geometry.export_data(foldpath=filepath)
|
|
215
|
-
|
|
216
208
|
def plot(
|
|
217
209
|
self, plotter: pv.Plotter | None = None, meshes: list[pv.DataSet] | None = None
|
|
218
210
|
) -> pv.Plotter:
|