morphopt 4.0.5__tar.gz → 4.0.7__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.5 → morphopt-4.0.7}/PKG-INFO +31 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/README.md +29 -3
- {morphopt-4.0.5 → morphopt-4.0.7}/pyproject.toml +2 -1
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/__init__.py +2 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/codesign/offset_boundary_part.py +11 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/constants.py +4 -1
- morphopt-4.0.7/src/morphopt/opt_runner.py +164 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/__init__.py +1 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/controller.py +2 -1
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/__init__.py +6 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/geometry.py +1 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/parts/__init__.py +3 -1
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/parts/base_part.py +3 -15
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/parts/box_part.py +5 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/parts/cad_part.py +17 -12
- morphopt-4.0.7/src/morphopt/optcore/modelparams/parts/fixed_part.py +83 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/parts/inp_part.py +15 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/solver.py +26 -30
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/updaters.py +230 -76
- morphopt-4.0.7/src/morphopt/postprocess/__init__.py +56 -0
- morphopt-4.0.7/src/morphopt/postprocess/_runtime.py +33 -0
- morphopt-4.0.7/src/morphopt/postprocess/archive.py +225 -0
- morphopt-4.0.7/src/morphopt/postprocess/exports.py +440 -0
- morphopt-4.0.7/src/morphopt/postprocess/fields.py +508 -0
- morphopt-4.0.7/src/morphopt/postprocess/visualization.py +184 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/boundary_part.py +44 -5
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/objectivefuncs/__init__.py +1 -1
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +3 -1
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/objectivefuncs/shapederivative.py +74 -12
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/surfaces/base_surface.py +2 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/surfaces/brep_surface.py +3 -3
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/surfaces/bsp_surface.py +2 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/surfaces/cpgeo_surface.py +2 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/surfaces/mesh_surface.py +2 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/simp/objectivefuncs/__init__.py +1 -1
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/simp/objectivefuncs/basefuncs.py +4 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/simp/objectivefuncs/sensitivity.py +40 -6
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/simp/simpmaterial.py +12 -431
- morphopt-4.0.7/src/morphopt/simp/void_elements.py +430 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/__init__.py +4 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/app.py +15 -6
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/__init__.py +2 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/cad.py +20 -19
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/completion.py +56 -30
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/definitions.py +64 -14
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/devices.py +1 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/edit_history.py +19 -6
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/editing.py +194 -54
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/editor_routing.py +15 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/expressions.py +11 -3
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/fields.py +20 -7
- morphopt-4.0.7/src/morphopt/ui/application/finite_element.py +300 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/load_cases.py +127 -34
- morphopt-4.0.7/src/morphopt/ui/application/part_mesh.py +35 -0
- morphopt-4.0.7/src/morphopt/ui/application/part_sets.py +251 -0
- morphopt-4.0.7/src/morphopt/ui/application/quickstart.py +1077 -0
- morphopt-4.0.7/src/morphopt/ui/application/results.py +86 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/runs.py +57 -15
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/updaters.py +132 -39
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/validation.py +14 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application/values.py +13 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/codegen/assets.py +6 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/codegen/generator.py +68 -25
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/launcher.py +31 -26
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/locales/en-US.json +107 -14
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/locales/zh-CN.json +108 -15
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/mainwindow.py +96 -31
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/base_nodes.py +9 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/node_types/__init__.py +4 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/node_types/objectives.py +34 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/node_types/parts.py +5 -3
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/node_types/structural.py +42 -18
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/registry.py +4 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/observe_panel.py +176 -43
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/presentation/labels.py +39 -5
- morphopt-4.0.7/src/morphopt/ui/presentation/result_fields.py +42 -0
- morphopt-4.0.7/src/morphopt/ui/processes.py +32 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/schemes/base.py +41 -22
- morphopt-4.0.7/src/morphopt/ui/theme/fonts.py +284 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/theme/palette.py +18 -11
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/theme/styles/controls.qss +1 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/theme/styles/inputs.qss +8 -3
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/theme/stylesheet.py +1 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/theme/themes/dark.py +8 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/theme/themes/light.py +18 -5
- morphopt-4.0.7/src/morphopt/ui/theme/visualization.py +73 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/visualization/__init__.py +25 -24
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/visualization/assets.py +6 -3
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/visualization/geometry.py +46 -10
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/visualization/loads.py +1 -4
- morphopt-4.0.7/src/morphopt/ui/visualization/rendering.py +61 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/visualization/scene.py +16 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/asset_browser.py +59 -30
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/case_deletion.py +9 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/codeeditor.py +8 -3
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/custom_classes.py +3 -1
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/definition_actions.py +78 -29
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/definition_manager.py +32 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/edit_history.py +3 -3
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/editor.py +1 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/file_dialogs.py +1 -3
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/finite_element.py +48 -42
- morphopt-4.0.7/src/morphopt/ui/widgets/font_settings.py +215 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/helper_editor.py +7 -6
- morphopt-4.0.7/src/morphopt/ui/widgets/history_export.py +342 -0
- morphopt-4.0.5/src/morphopt/ui/widgets/result_path.py → morphopt-4.0.7/src/morphopt/ui/widgets/labels.py +45 -3
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/load_cases.py +79 -20
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/model_tree.py +67 -24
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/objective_editor.py +41 -18
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/observation_pages.py +59 -136
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/param_form.py +9 -1
- morphopt-4.0.7/src/morphopt/ui/widgets/part_set_list.py +61 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/preview_renderer.py +70 -8
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/quickstart.py +2 -4
- morphopt-4.0.7/src/morphopt/ui/widgets/solver_editor.py +370 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/template_insert_dialog.py +1 -1
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/updater_editor.py +9 -8
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/viewer.py +72 -29
- morphopt-4.0.7/src/morphopt/ui/widgets/viewport.py +159 -0
- morphopt-4.0.7/src/morphopt/ui/widgets/visualization_settings.py +149 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/workspace_objective.py +40 -10
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/workbench.py +28 -21
- morphopt-4.0.7/src/morphopt/ui/worker.py +92 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/utils/__init__.py +2 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/utils/gradient_check.py +7 -2
- morphopt-4.0.7/src/morphopt/utils/paths.py +15 -0
- {morphopt-4.0.5/src/morphopt/optcore → morphopt-4.0.7/src/morphopt/utils}/quadrature.py +5 -1
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt.egg-info/PKG-INFO +31 -4
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt.egg-info/SOURCES.txt +22 -17
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt.egg-info/requires.txt +1 -0
- morphopt-4.0.5/src/morphopt/opt_runner.py +0 -99
- morphopt-4.0.5/src/morphopt/postprocess/__init__.py +0 -9
- morphopt-4.0.5/src/morphopt/postprocess/exporters.py +0 -117
- morphopt-4.0.5/src/morphopt/postprocess/fields.py +0 -329
- morphopt-4.0.5/src/morphopt/postprocess/native.py +0 -81
- morphopt-4.0.5/src/morphopt/taskoptmization.py +0 -97
- morphopt-4.0.5/src/morphopt/ui/application/finite_element.py +0 -220
- morphopt-4.0.5/src/morphopt/ui/application/part_sets.py +0 -131
- morphopt-4.0.5/src/morphopt/ui/application/quickstart.py +0 -720
- morphopt-4.0.5/src/morphopt/ui/application/result_fields.py +0 -94
- morphopt-4.0.5/src/morphopt/ui/application/results.py +0 -171
- morphopt-4.0.5/src/morphopt/ui/application/surface_export.py +0 -105
- morphopt-4.0.5/src/morphopt/ui/cad_worker.py +0 -28
- morphopt-4.0.5/src/morphopt/ui/fea_worker.py +0 -67
- morphopt-4.0.5/src/morphopt/ui/surface_export_worker.py +0 -22
- morphopt-4.0.5/src/morphopt/ui/widgets/elided_label.py +0 -47
- morphopt-4.0.5/src/morphopt/ui/widgets/language_selector.py +0 -43
- morphopt-4.0.5/src/morphopt/ui/widgets/plot_style.py +0 -38
- morphopt-4.0.5/src/morphopt/ui/widgets/solver_editor.py +0 -207
- morphopt-4.0.5/src/morphopt/ui/widgets/surface_export.py +0 -163
- morphopt-4.0.5/src/morphopt/ui/widgets/theme_selector.py +0 -48
- morphopt-4.0.5/src/morphopt/ui/widgets/values.py +0 -31
- {morphopt-4.0.5 → morphopt-4.0.7}/setup.cfg +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/codesign/__init__.py +3 -3
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/codesign/constraints.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/codesign/update_offset_boundary_part.py +2 -2
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/history.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/base_model_component.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/baseparam.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/fea/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/fea/base_component.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/fea/body_force.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/fea/boundary_condition.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/fea/contact.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/fea/couple.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/fea/point_load.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/fea/pressure.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/fea/reference_point.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/fea/spring.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/feaparams.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/materials/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/materials/base_material.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/materials/homogeneous_material.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/materials/models.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/materialsparams.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/modelparams/params.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/objfunc.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/optcore/protocal.py +1 -1
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/objectivefuncs/boundarys.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/objectivefuncs/distancesurface.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/objectivefuncs/volumemaximization.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/surfaces/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/surfaces/base_constraints.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/surfaces/bsp_constraints.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/surfaces/cpgeo_constraints.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/surfaces/nurbs_face.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/shapeopt/update_boundary_part.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/simp/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/simp/objectivefuncs/boundarys.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/simp/objectivefuncs/densityfield.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/simp/objectivefuncs/volfrac.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/simp/update_simpmaterial.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/__main__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/application_icon.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/assets/morphopt.svg +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/codegen/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/codegen/custom_classes.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/codegen/workspace.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/i18n.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/chamberlayout.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/configuration.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/fields.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/loaders.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/material_models.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/node_types/cad.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/node_types/custom_code.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/node_types/loads.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/node_types/materials.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/node_types/penalties.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/node_types/surfaces.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/node_types/symmetry.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/model/problem.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/presentation/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/presentation/edit_history.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/presentation/history.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/presentation/navigation.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/refresh.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/schemes/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/schemes/snippets.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/theme/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/theme/manager.py +1 -1
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/theme/styles/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/theme/styles/base.qss +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/theme/themes/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/collection_controls.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/controller_editor.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/editor_pages.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/history_dialogs.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/run_dialogs.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/ui/widgets/source_view.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt/utils/history_read.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt.egg-info/dependency_links.txt +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/src/morphopt.egg-info/entry_points.txt +0 -0
- {morphopt-4.0.5 → morphopt-4.0.7}/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.7
|
|
4
4
|
Summary: A morphing optimization framework using PyTorch and torchfea.
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -16,6 +16,7 @@ Requires-Dist: gmsh>=4.15.0
|
|
|
16
16
|
Requires-Dist: cadquery-ocp>=8.0.1.1.0
|
|
17
17
|
Requires-Dist: tabulate>=0.9.0
|
|
18
18
|
Requires-Dist: imageio>=2.37.3
|
|
19
|
+
Requires-Dist: fonttools>=4.0
|
|
19
20
|
Requires-Dist: bspmap>=1.0.3
|
|
20
21
|
Requires-Dist: torchfea>=1.1.3
|
|
21
22
|
Requires-Dist: trimesh>=4.11.5
|
|
@@ -54,10 +55,10 @@ Requirements: Python ≥ 3.12; a PyTorch **float64** build is recommended.
|
|
|
54
55
|
|
|
55
56
|
```bash
|
|
56
57
|
# Shape optimization (pneumatic bending actuator)
|
|
57
|
-
python examples/
|
|
58
|
+
python examples/bending_actuator/bending_actuator.py
|
|
58
59
|
|
|
59
60
|
# SIMP topology optimization (compliant gripper)
|
|
60
|
-
python examples/
|
|
61
|
+
python examples/simp_gripper/simp_gripper.py
|
|
61
62
|
```
|
|
62
63
|
|
|
63
64
|
2. **Run a custom job** — copy an example as a starting point, configure the geometry, material, loads, updater, and objective, and launch it as a script:
|
|
@@ -79,6 +80,32 @@ The GUI opens directly into the full definition workbench with its standard sect
|
|
|
79
80
|
|
|
80
81
|
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.
|
|
81
82
|
|
|
83
|
+
### Run the UI in a virtual environment
|
|
84
|
+
|
|
85
|
+
Create and activate a Conda environment, then install and launch MorphOpt:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
conda create -n morphopt python=3.12
|
|
89
|
+
conda activate morphopt
|
|
90
|
+
python -m pip install morphopt
|
|
91
|
+
morphopt-ui
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
For an existing environment, activate it instead. To run the source checkout, install the project in editable mode from its root directory:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
conda activate morphopt
|
|
98
|
+
cd /path/to/morphopt
|
|
99
|
+
python -m pip install -e .
|
|
100
|
+
morphopt-ui
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Replace the environment name and project path as appropriate. Installation is required once per environment; subsequent launches require only environment activation and the launch command. The equivalent module entry point uses the active environment's Python interpreter:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
python -m morphopt.ui
|
|
107
|
+
```
|
|
108
|
+
|
|
82
109
|
### Numeric configuration
|
|
83
110
|
|
|
84
111
|
Shared UI defaults and tunable kernel parameters live in [`src/morphopt/constants.py`](src/morphopt/constants.py), grouped under `CONSTANT.UI` and `CONSTANT.KERNEL`. Code accesses them directly, for example `CONSTANT.UI.VIEWER.RENDER.LABEL_FONT_SIZE` or `CONSTANT.KERNEL.SOLVER.NUM_PROCESS`. Edit a value there to change its default; restart MorphOpt for the change to take effect. Coordinate indices, tensor dimensions, and coefficients that define mathematical formulas remain in code. UI translations remain in JSON files under `src/morphopt/ui/locales/`.
|
|
@@ -100,7 +127,7 @@ The [documentation index](docs/README.md) includes the reading order and automat
|
|
|
100
127
|
- `simp/` — SIMP topology optimization
|
|
101
128
|
- `codesign/` — Shell co-design (shape + material)
|
|
102
129
|
- `ui/` — PySide6 graphical UI (definition + observer in one window)
|
|
103
|
-
- `examples/` —
|
|
130
|
+
- [`examples/`](examples/README.md) — Runnable tasks, UI definitions, input geometry assets, and case notes
|
|
104
131
|
- `docs/` — Usage guides, API reference, theory papers
|
|
105
132
|
- `tests/` — Gradient checks, geometry tests, UI tests
|
|
106
133
|
- `ui_runs/` — runs launched from the UI and their results (`<label>_T<timestamp>/`)
|
|
@@ -27,10 +27,10 @@ Requirements: Python ≥ 3.12; a PyTorch **float64** build is recommended.
|
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
29
|
# Shape optimization (pneumatic bending actuator)
|
|
30
|
-
python examples/
|
|
30
|
+
python examples/bending_actuator/bending_actuator.py
|
|
31
31
|
|
|
32
32
|
# SIMP topology optimization (compliant gripper)
|
|
33
|
-
python examples/
|
|
33
|
+
python examples/simp_gripper/simp_gripper.py
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
2. **Run a custom job** — copy an example as a starting point, configure the geometry, material, loads, updater, and objective, and launch it as a script:
|
|
@@ -52,6 +52,32 @@ The GUI opens directly into the full definition workbench with its standard sect
|
|
|
52
52
|
|
|
53
53
|
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
54
|
|
|
55
|
+
### Run the UI in a virtual environment
|
|
56
|
+
|
|
57
|
+
Create and activate a Conda environment, then install and launch MorphOpt:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
conda create -n morphopt python=3.12
|
|
61
|
+
conda activate morphopt
|
|
62
|
+
python -m pip install morphopt
|
|
63
|
+
morphopt-ui
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
For an existing environment, activate it instead. To run the source checkout, install the project in editable mode from its root directory:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
conda activate morphopt
|
|
70
|
+
cd /path/to/morphopt
|
|
71
|
+
python -m pip install -e .
|
|
72
|
+
morphopt-ui
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Replace the environment name and project path as appropriate. Installation is required once per environment; subsequent launches require only environment activation and the launch command. The equivalent module entry point uses the active environment's Python interpreter:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
python -m morphopt.ui
|
|
79
|
+
```
|
|
80
|
+
|
|
55
81
|
### Numeric configuration
|
|
56
82
|
|
|
57
83
|
Shared UI defaults and tunable kernel parameters live in [`src/morphopt/constants.py`](src/morphopt/constants.py), grouped under `CONSTANT.UI` and `CONSTANT.KERNEL`. Code accesses them directly, for example `CONSTANT.UI.VIEWER.RENDER.LABEL_FONT_SIZE` or `CONSTANT.KERNEL.SOLVER.NUM_PROCESS`. Edit a value there to change its default; restart MorphOpt for the change to take effect. Coordinate indices, tensor dimensions, and coefficients that define mathematical formulas remain in code. UI translations remain in JSON files under `src/morphopt/ui/locales/`.
|
|
@@ -73,7 +99,7 @@ The [documentation index](docs/README.md) includes the reading order and automat
|
|
|
73
99
|
- `simp/` — SIMP topology optimization
|
|
74
100
|
- `codesign/` — Shell co-design (shape + material)
|
|
75
101
|
- `ui/` — PySide6 graphical UI (definition + observer in one window)
|
|
76
|
-
- `examples/` —
|
|
102
|
+
- [`examples/`](examples/README.md) — Runnable tasks, UI definitions, input geometry assets, and case notes
|
|
77
103
|
- `docs/` — Usage guides, API reference, theory papers
|
|
78
104
|
- `tests/` — Gradient checks, geometry tests, UI tests
|
|
79
105
|
- `ui_runs/` — runs launched from the UI and their results (`<label>_T<timestamp>/`)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "morphopt"
|
|
3
|
-
version = "4.0.
|
|
3
|
+
version = "4.0.7"
|
|
4
4
|
description = "A morphing optimization framework using PyTorch and torchfea."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -17,6 +17,7 @@ dependencies = [
|
|
|
17
17
|
"cadquery-ocp>=8.0.1.1.0",
|
|
18
18
|
"tabulate>=0.9.0",
|
|
19
19
|
"imageio>=2.37.3",
|
|
20
|
+
"fonttools>=4.0",
|
|
20
21
|
"bspmap>=1.0.3",
|
|
21
22
|
"torchfea>=1.1.3",
|
|
22
23
|
"trimesh>=4.11.5",
|
|
@@ -76,6 +76,7 @@ from .optcore.modelparams import (
|
|
|
76
76
|
BasePart,
|
|
77
77
|
BoxPart,
|
|
78
78
|
CADPart,
|
|
79
|
+
FixedPart,
|
|
79
80
|
FEAParams,
|
|
80
81
|
GeometryParams,
|
|
81
82
|
INPPart,
|
|
@@ -122,6 +123,7 @@ __all__ = [
|
|
|
122
123
|
"CPGEOSurfaceRelationConstraint",
|
|
123
124
|
"Controller",
|
|
124
125
|
"FEAParams",
|
|
126
|
+
"FixedPart",
|
|
125
127
|
"GeometryParams",
|
|
126
128
|
"History",
|
|
127
129
|
"HomogeneousMaterial",
|
|
@@ -53,6 +53,17 @@ class OffsetBoundaryPart(BoundaryPart):
|
|
|
53
53
|
raise ValueError("num_layers must be at least one.")
|
|
54
54
|
|
|
55
55
|
# ------------------------------------------------------------- shell mesh
|
|
56
|
+
@property
|
|
57
|
+
def surface_set_names(self) -> tuple[str, ...]:
|
|
58
|
+
return (*super().surface_set_names, *self._offset_set_names())
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def node_set_names(self) -> tuple[str, ...]:
|
|
62
|
+
return (*super().node_set_names, *self._offset_set_names())
|
|
63
|
+
|
|
64
|
+
def _offset_set_names(self) -> tuple[str, ...]:
|
|
65
|
+
return tuple(f"surface_{index}_offset" for index in range(1, self.num_surface_interfaces))
|
|
66
|
+
|
|
56
67
|
def _compute_normals(self, base_nodes: torch.Tensor) -> torch.Tensor:
|
|
57
68
|
"""Cavity-surface normals evaluated on the current control points."""
|
|
58
69
|
normals = []
|
|
@@ -1082,13 +1082,16 @@ class _Constants:
|
|
|
1082
1082
|
class CODESIGN_GEOMETRY:
|
|
1083
1083
|
DEFAULT_SHELL_THICKNESS = 1.0
|
|
1084
1084
|
|
|
1085
|
+
class UPDATER_OBJECTIVES:
|
|
1086
|
+
QUADRATIC_MEMORY_PAIRS = 10
|
|
1087
|
+
|
|
1085
1088
|
class OPTIMIZER:
|
|
1086
1089
|
LINE_SEARCH_C1 = 0.0001
|
|
1087
1090
|
LINE_SEARCH_BACKTRACK_RATIO = 0.2
|
|
1088
1091
|
LINE_SEARCH_MIN_STEP_TOLERANCE = 1e-14
|
|
1089
1092
|
LBFGS_MEMORY_PAIRS = 10
|
|
1090
1093
|
LBFGS_CONVERGENCE_TOLERANCE = 1e-10
|
|
1091
|
-
|
|
1094
|
+
BFGS_CURVATURE_TOLERANCE = 1e-8
|
|
1092
1095
|
LBFGS_SHAPE_MEMORY_PAIRS = 20
|
|
1093
1096
|
LBFGS_MATERIAL_MEMORY_PAIRS = 20
|
|
1094
1097
|
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"""Optimization entry points, worker execution and checkpoint restart loop."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import multiprocessing as mp
|
|
6
|
+
import os
|
|
7
|
+
from multiprocessing.queues import Queue
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _main_script(path_result: str | None) -> str:
|
|
11
|
+
"""Locate the initial task or the archived script of a resumed run."""
|
|
12
|
+
if path_result is None:
|
|
13
|
+
import __main__
|
|
14
|
+
|
|
15
|
+
return __main__.__file__
|
|
16
|
+
return os.path.join(path_result, "scripts", "MAIN_SCRIPT_FOR_RESTART.py")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def start_optimization(
|
|
20
|
+
device: str = "cpu",
|
|
21
|
+
restart_per_iteration: int = 20,
|
|
22
|
+
path_result: str | None = None,
|
|
23
|
+
target_iteration: int | None = None,
|
|
24
|
+
) -> None:
|
|
25
|
+
"""Run optimization in spawned processes and resume each completed segment.
|
|
26
|
+
|
|
27
|
+
``path_result`` selects an existing run; otherwise the task in ``__main__``
|
|
28
|
+
starts a new run. ``target_iteration=None`` resumes its latest checkpoint.
|
|
29
|
+
"""
|
|
30
|
+
mp.set_start_method("spawn", force=True)
|
|
31
|
+
process = mp.Process(
|
|
32
|
+
target=_run_task,
|
|
33
|
+
kwargs={
|
|
34
|
+
"path_result": path_result,
|
|
35
|
+
"main_filepath": _main_script(path_result),
|
|
36
|
+
"device": device,
|
|
37
|
+
"target_iteration": target_iteration,
|
|
38
|
+
"restart_per_iteration": restart_per_iteration,
|
|
39
|
+
},
|
|
40
|
+
)
|
|
41
|
+
process.start()
|
|
42
|
+
process.join()
|
|
43
|
+
exitcode = process.exitcode
|
|
44
|
+
process.close()
|
|
45
|
+
if exitcode != 0:
|
|
46
|
+
raise ChildProcessError(f"Optimization task failed with exit code {exitcode}.")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def debug_optimization(
|
|
50
|
+
device: str = "cpu",
|
|
51
|
+
restart_per_iteration: int = 20,
|
|
52
|
+
path_result: str | None = None,
|
|
53
|
+
target_iteration: int | None = None,
|
|
54
|
+
) -> None:
|
|
55
|
+
"""Run the task in the current process with serial, debugger-friendly FEA."""
|
|
56
|
+
mp.set_start_method("spawn", force=True)
|
|
57
|
+
_run_worker(
|
|
58
|
+
device=device,
|
|
59
|
+
path_result=path_result,
|
|
60
|
+
target_iteration=target_iteration,
|
|
61
|
+
restart_per_iteration=restart_per_iteration,
|
|
62
|
+
main_filepath=_main_script(path_result),
|
|
63
|
+
debug=True,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _run_task(
|
|
68
|
+
path_result: str | None,
|
|
69
|
+
main_filepath: str,
|
|
70
|
+
device: str = "cpu",
|
|
71
|
+
target_iteration: int | None = None,
|
|
72
|
+
restart_per_iteration: int = 20,
|
|
73
|
+
) -> None:
|
|
74
|
+
"""Continue worker segments from the latest completed checkpoint."""
|
|
75
|
+
import warnings
|
|
76
|
+
from queue import Empty
|
|
77
|
+
|
|
78
|
+
from .optcore.history import History
|
|
79
|
+
|
|
80
|
+
warnings.filterwarnings("ignore", category=UserWarning)
|
|
81
|
+
completed = 0
|
|
82
|
+
if path_result is not None:
|
|
83
|
+
history = History()
|
|
84
|
+
history.load(foldpath=path_result + "/log/", iteration=target_iteration)
|
|
85
|
+
completed = history.iteration
|
|
86
|
+
path_queue = mp.Queue()
|
|
87
|
+
try:
|
|
88
|
+
while True:
|
|
89
|
+
process = mp.Process(
|
|
90
|
+
target=_run_worker,
|
|
91
|
+
kwargs={
|
|
92
|
+
"device": device,
|
|
93
|
+
"target_iteration": target_iteration,
|
|
94
|
+
"path_result": path_result,
|
|
95
|
+
"restart_per_iteration": restart_per_iteration,
|
|
96
|
+
"main_filepath": main_filepath,
|
|
97
|
+
"pathqueue": path_queue,
|
|
98
|
+
},
|
|
99
|
+
)
|
|
100
|
+
process.start()
|
|
101
|
+
# Drain checkpoints while the worker is alive so its queue feeder
|
|
102
|
+
# cannot block shutdown while the supervisor waits for completion.
|
|
103
|
+
while True:
|
|
104
|
+
try:
|
|
105
|
+
progress = path_queue.get(timeout=0.1)
|
|
106
|
+
except Empty:
|
|
107
|
+
if process.is_alive():
|
|
108
|
+
continue
|
|
109
|
+
break
|
|
110
|
+
path_result = progress["path_result"]
|
|
111
|
+
completed = progress["iteration"]
|
|
112
|
+
process.join()
|
|
113
|
+
exitcode = process.exitcode
|
|
114
|
+
process.close()
|
|
115
|
+
if exitcode != 0:
|
|
116
|
+
if completed == 0:
|
|
117
|
+
raise ChildProcessError(
|
|
118
|
+
"Optimization failed before the first completed iteration "
|
|
119
|
+
f"(exit code {exitcode}). See the worker traceback."
|
|
120
|
+
)
|
|
121
|
+
print(f"Process failed with exit code {exitcode}, continuing...")
|
|
122
|
+
target_iteration = None
|
|
123
|
+
finally:
|
|
124
|
+
path_queue.close()
|
|
125
|
+
path_queue.join_thread()
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _run_worker(
|
|
129
|
+
main_filepath: str,
|
|
130
|
+
device: str = "cpu",
|
|
131
|
+
target_iteration: int | None = None,
|
|
132
|
+
path_result: str | None = None,
|
|
133
|
+
restart_per_iteration: int = 20,
|
|
134
|
+
pathqueue: Queue | None = None,
|
|
135
|
+
debug: bool = False,
|
|
136
|
+
) -> str:
|
|
137
|
+
"""Load one task and run a new or restored controller in this process."""
|
|
138
|
+
os.environ["KMP_DUPLICATE_LIB_OK"] = "True"
|
|
139
|
+
import sys
|
|
140
|
+
import warnings
|
|
141
|
+
|
|
142
|
+
import torch
|
|
143
|
+
|
|
144
|
+
import morphopt
|
|
145
|
+
|
|
146
|
+
warnings.filterwarnings("ignore", category=UserWarning)
|
|
147
|
+
torch.set_default_dtype(torch.float64)
|
|
148
|
+
torch.set_default_device(device)
|
|
149
|
+
filename = os.path.splitext(os.path.basename(main_filepath))[0]
|
|
150
|
+
os.chdir(os.path.dirname(main_filepath))
|
|
151
|
+
sys.path.append(os.getcwd())
|
|
152
|
+
controller_class = __import__(filename).ThisController
|
|
153
|
+
controller: morphopt.Controller = controller_class()
|
|
154
|
+
controller.restart_per_iteration = restart_per_iteration
|
|
155
|
+
controller.optdevice = device
|
|
156
|
+
controller.dataqueue = pathqueue
|
|
157
|
+
controller._debug_mode = debug
|
|
158
|
+
if target_iteration == 0 or path_result is None:
|
|
159
|
+
controller.start_optimization(main_filepath=main_filepath)
|
|
160
|
+
else:
|
|
161
|
+
controller.restart_optimization(
|
|
162
|
+
path_result=path_result, target_iteration=target_iteration
|
|
163
|
+
)
|
|
164
|
+
return controller.path_result
|
|
@@ -19,6 +19,7 @@ import torch
|
|
|
19
19
|
import morphopt
|
|
20
20
|
|
|
21
21
|
from ..constants import CONSTANT
|
|
22
|
+
from ..utils.paths import sanitize_name
|
|
22
23
|
from .history import History
|
|
23
24
|
|
|
24
25
|
logger = logging.getLogger(__name__)
|
|
@@ -164,7 +165,7 @@ class Controller:
|
|
|
164
165
|
self.path_result = (
|
|
165
166
|
self.path_result_folder
|
|
166
167
|
+ "/"
|
|
167
|
-
+ self.opt_label
|
|
168
|
+
+ sanitize_name(self.opt_label)
|
|
168
169
|
+ "_"
|
|
169
170
|
+ "T"
|
|
170
171
|
+ datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
@@ -8,6 +8,7 @@ from .materialsparams import MaterialsParams
|
|
|
8
8
|
from .params import Params
|
|
9
9
|
from .parts import (
|
|
10
10
|
BasePart,
|
|
11
|
+
FixedPart,
|
|
11
12
|
CADPart,
|
|
12
13
|
BoxPart,
|
|
13
14
|
INPPart,
|
|
@@ -16,12 +17,13 @@ from .parts import (
|
|
|
16
17
|
__all__ = [
|
|
17
18
|
"BaseModelComponent",
|
|
18
19
|
"BaseParams",
|
|
20
|
+
"BasePart",
|
|
21
|
+
"BoxPart",
|
|
22
|
+
"CADPart",
|
|
19
23
|
"FEAParams",
|
|
24
|
+
"FixedPart",
|
|
20
25
|
"GeometryParams",
|
|
26
|
+
"INPPart",
|
|
21
27
|
"MaterialsParams",
|
|
22
28
|
"Params",
|
|
23
|
-
"BasePart",
|
|
24
|
-
"CADPart",
|
|
25
|
-
"BoxPart",
|
|
26
|
-
"INPPart",
|
|
27
29
|
]
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"""Part definitions: one ``torchfea.Part`` and its Instances per definition."""
|
|
2
2
|
|
|
3
3
|
from .base_part import BasePart
|
|
4
|
+
from .fixed_part import FixedPart
|
|
4
5
|
from .cad_part import CADPart
|
|
5
6
|
from .inp_part import INPPart
|
|
6
7
|
from .box_part import BoxPart
|
|
7
8
|
|
|
8
9
|
__all__ = [
|
|
9
10
|
"BasePart",
|
|
10
|
-
"CADPart",
|
|
11
11
|
"BoxPart",
|
|
12
|
+
"CADPart",
|
|
13
|
+
"FixedPart",
|
|
12
14
|
"INPPart",
|
|
13
15
|
]
|
|
@@ -35,9 +35,6 @@ class BasePart(BaseModelComponent):
|
|
|
35
35
|
the Part class with :meth:`add_instance`.
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
|
-
cache_part: bool = False
|
|
39
|
-
"""Whether :meth:`build_part` may be called only once and cached."""
|
|
40
|
-
|
|
41
38
|
is_variable: bool = False
|
|
42
39
|
"""Whether optimization may change this Part's geometry or mesh.
|
|
43
40
|
|
|
@@ -63,14 +60,11 @@ class BasePart(BaseModelComponent):
|
|
|
63
60
|
self.exterior_surface: str | None = (
|
|
64
61
|
str(exterior_surface).strip() if exterior_surface else None
|
|
65
62
|
)
|
|
66
|
-
"""Surface set
|
|
63
|
+
"""Surface set drawn by default for Part mesh and deformation visualization."""
|
|
67
64
|
|
|
68
65
|
self._instance_definitions: list[tuple[str, str, list[float]]] = []
|
|
69
66
|
"""Declared ``(part_name, instance_name, pose)`` triples."""
|
|
70
67
|
|
|
71
|
-
self._part: torchfea.Part | None = None
|
|
72
|
-
"""Cached Part for fixed geometries."""
|
|
73
|
-
|
|
74
68
|
@property
|
|
75
69
|
def name(self) -> str:
|
|
76
70
|
"""Registration name inside the GeometryParams collection."""
|
|
@@ -90,7 +84,6 @@ class BasePart(BaseModelComponent):
|
|
|
90
84
|
@part_name.setter
|
|
91
85
|
def part_name(self, value: str | None) -> None:
|
|
92
86
|
self._part_name = str(value).strip() if value else ""
|
|
93
|
-
self._part = None
|
|
94
87
|
|
|
95
88
|
@property
|
|
96
89
|
def instance_names(self) -> list[str]:
|
|
@@ -152,13 +145,8 @@ class BasePart(BaseModelComponent):
|
|
|
152
145
|
def get_part(
|
|
153
146
|
self, path_result: str | None = None, pools: Pool | None = None
|
|
154
147
|
) -> torchfea.Part:
|
|
155
|
-
"""
|
|
156
|
-
|
|
157
|
-
return self._part
|
|
158
|
-
part = self.build_part(path_result=path_result, pools=pools)
|
|
159
|
-
if self.cache_part:
|
|
160
|
-
self._part = part
|
|
161
|
-
return part
|
|
148
|
+
"""Build the current geometry; FixedPart supplies mesh reuse separately."""
|
|
149
|
+
return self.build_part(path_result=path_result, pools=pools)
|
|
162
150
|
|
|
163
151
|
def add_to_assembly(
|
|
164
152
|
self,
|
|
@@ -9,7 +9,7 @@ import torch
|
|
|
9
9
|
import torchfea
|
|
10
10
|
|
|
11
11
|
from ....constants import CONSTANT
|
|
12
|
-
from .
|
|
12
|
+
from .fixed_part import FixedPart
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def _positive(**values: float) -> None:
|
|
@@ -18,11 +18,9 @@ def _positive(**values: float) -> None:
|
|
|
18
18
|
raise ValueError(f"{name} must be finite and positive.")
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
class BoxPart(
|
|
21
|
+
class BoxPart(FixedPart):
|
|
22
22
|
"""Structured hexahedral box with node and surface sets for each face."""
|
|
23
23
|
|
|
24
|
-
cache_part = True
|
|
25
|
-
|
|
26
24
|
def __init__(
|
|
27
25
|
self,
|
|
28
26
|
length: float = CONSTANT.UI.SCHEMA_FIELDS.PARTS.BOXPART.LENGTH.DEFAULT,
|
|
@@ -39,6 +37,9 @@ class BoxPart(BasePart):
|
|
|
39
37
|
self.length, self.height, self.depth = length, height, depth
|
|
40
38
|
self.mesh_size, self.mesh_order = mesh_size, mesh_order
|
|
41
39
|
|
|
40
|
+
def _mesh_cache_key(self) -> object:
|
|
41
|
+
return (self.length, self.height, self.depth, self.mesh_size, self.mesh_order, self.exterior_surface)
|
|
42
|
+
|
|
42
43
|
def build_part(self, path_result=None, pools=None) -> torchfea.Part:
|
|
43
44
|
dimensions = [self.length, self.height, self.depth]
|
|
44
45
|
axes = [
|
|
@@ -9,7 +9,7 @@ from copy import deepcopy
|
|
|
9
9
|
from dataclasses import dataclass
|
|
10
10
|
from functools import partial
|
|
11
11
|
from pathlib import Path
|
|
12
|
-
from typing import TYPE_CHECKING, Any, ClassVar
|
|
12
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Self
|
|
13
13
|
|
|
14
14
|
import gmsh
|
|
15
15
|
import torchfea
|
|
@@ -17,7 +17,7 @@ from torchfea import cad as torchfea_cad
|
|
|
17
17
|
from torchfea.cad.builder import OCCBuilder
|
|
18
18
|
|
|
19
19
|
from ....constants import CONSTANT
|
|
20
|
-
from .
|
|
20
|
+
from .fixed_part import FixedPart
|
|
21
21
|
|
|
22
22
|
if TYPE_CHECKING:
|
|
23
23
|
from multiprocessing.pool import Pool
|
|
@@ -25,8 +25,8 @@ if TYPE_CHECKING:
|
|
|
25
25
|
from ....shapeopt.boundary_part import BoundaryPart
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
class
|
|
29
|
-
"""
|
|
28
|
+
class CADMeshingMixin:
|
|
29
|
+
"""Shared CAD construction for fixed and boundary-described geometry.
|
|
30
30
|
|
|
31
31
|
Subclasses override :meth:`define_operations` and add native TorchFEA CAD
|
|
32
32
|
objects with :meth:`add_operation`::
|
|
@@ -53,8 +53,6 @@ class CADPart(BasePart):
|
|
|
53
53
|
``face_N`` and ``face_N_nodes`` after meshing.
|
|
54
54
|
"""
|
|
55
55
|
|
|
56
|
-
cache_part = True
|
|
57
|
-
|
|
58
56
|
@dataclass
|
|
59
57
|
class _Operation(torchfea_cad.CADOperation):
|
|
60
58
|
"""Bridge a Part method into TorchFEA's managed Gmsh execution session."""
|
|
@@ -86,7 +84,7 @@ class CADPart(BasePart):
|
|
|
86
84
|
def define_operations(self) -> None:
|
|
87
85
|
"""Override to declare CAD operations in their execution order."""
|
|
88
86
|
|
|
89
|
-
def add_operation(self, operation: torchfea_cad.CADOperation) ->
|
|
87
|
+
def add_operation(self, operation: torchfea_cad.CADOperation) -> Self:
|
|
90
88
|
"""Append one native TorchFEA CAD operation to the history."""
|
|
91
89
|
if not isinstance(operation, torchfea_cad.CADOperation):
|
|
92
90
|
raise TypeError("operation must be a TorchFEA CADOperation.")
|
|
@@ -262,7 +260,7 @@ class CADPart(BasePart):
|
|
|
262
260
|
shells: list[tuple[int, ...]],
|
|
263
261
|
) -> list[tuple[int, int]]:
|
|
264
262
|
"""Fill shell face indices in exterior-first order inside a CAD session."""
|
|
265
|
-
volume, faces =
|
|
263
|
+
volume, faces = CADMeshingMixin._single_solid(operations)
|
|
266
264
|
indices = {tag: index for index, tag in enumerate(faces)}
|
|
267
265
|
loops, shell_faces = context.occ.getSurfaceLoops(volume)
|
|
268
266
|
ordered = []
|
|
@@ -303,7 +301,7 @@ class CADPart(BasePart):
|
|
|
303
301
|
face_map: dict[str, list[float]],
|
|
304
302
|
) -> list[tuple[int, int]]:
|
|
305
303
|
"""Reconstruct one shell as a solid for standalone STEP export."""
|
|
306
|
-
volume, faces =
|
|
304
|
+
volume, faces = CADMeshingMixin._single_solid(operations)
|
|
307
305
|
context.occ.remove([(3, volume)], recursive=False)
|
|
308
306
|
selected = [faces[index] for index in face_indices]
|
|
309
307
|
loop = context.occ.addSurfaceLoop(selected)
|
|
@@ -314,7 +312,7 @@ class CADPart(BasePart):
|
|
|
314
312
|
context.occ.remove(unused, recursive=True)
|
|
315
313
|
context.occ.synchronize()
|
|
316
314
|
face_map.update({
|
|
317
|
-
f"face_{index}":
|
|
315
|
+
f"face_{index}": CADMeshingMixin.get_face_signature(tag)
|
|
318
316
|
for index, tag in zip(face_indices, selected)
|
|
319
317
|
})
|
|
320
318
|
return [(3, solid)]
|
|
@@ -329,10 +327,10 @@ class CADPart(BasePart):
|
|
|
329
327
|
path = Path(path)
|
|
330
328
|
face_map: dict[str, list[float]] = {}
|
|
331
329
|
action = partial(
|
|
332
|
-
|
|
330
|
+
CADMeshingMixin._build_shell, operations=operations,
|
|
333
331
|
face_indices=face_indices, face_map=face_map,
|
|
334
332
|
)
|
|
335
|
-
torchfea_cad.export_step([
|
|
333
|
+
torchfea_cad.export_step([CADMeshingMixin._Operation("shell", action)], str(path))
|
|
336
334
|
path.with_suffix(".brep.json").write_text(
|
|
337
335
|
json.dumps({"face_map": face_map}, indent=2), encoding="utf-8",
|
|
338
336
|
)
|
|
@@ -368,3 +366,10 @@ class CADPart(BasePart):
|
|
|
368
366
|
boundary.add_surface_interface(surface)
|
|
369
367
|
boundary.initialize()
|
|
370
368
|
return boundary
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
class CADPart(CADMeshingMixin, FixedPart):
|
|
372
|
+
"""A fixed CAD Part with shared CAD construction and cached FE mesh sets."""
|
|
373
|
+
|
|
374
|
+
def _mesh_cache_key(self) -> object:
|
|
375
|
+
return (self.mesh_size, self.mesh_order, self.exterior_surface, tuple(map(repr, self.operations)))
|