morphopt 4.0.5__tar.gz → 4.0.6__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.6}/PKG-INFO +5 -4
- {morphopt-4.0.5 → morphopt-4.0.6}/README.md +3 -3
- {morphopt-4.0.5 → morphopt-4.0.6}/pyproject.toml +2 -1
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/__init__.py +2 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/codesign/offset_boundary_part.py +11 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/opt_runner.py +4 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/__init__.py +1 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/controller.py +2 -1
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/__init__.py +6 -4
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/geometry.py +1 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/parts/__init__.py +3 -1
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/parts/base_part.py +3 -15
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/parts/box_part.py +5 -4
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/parts/cad_part.py +17 -12
- morphopt-4.0.6/src/morphopt/optcore/modelparams/parts/fixed_part.py +83 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/parts/inp_part.py +15 -4
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/solver.py +26 -30
- morphopt-4.0.6/src/morphopt/paths.py +15 -0
- morphopt-4.0.6/src/morphopt/postprocess/__init__.py +69 -0
- morphopt-4.0.6/src/morphopt/postprocess/archive.py +225 -0
- morphopt-4.0.6/src/morphopt/postprocess/context.py +33 -0
- morphopt-4.0.6/src/morphopt/postprocess/contours.py +112 -0
- morphopt-4.0.6/src/morphopt/postprocess/exporters.py +174 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/postprocess/fields.py +78 -46
- morphopt-4.0.6/src/morphopt/postprocess/history_gif.py +121 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/postprocess/native.py +49 -24
- morphopt-4.0.6/src/morphopt/postprocess/rendering.py +85 -0
- morphopt-4.0.6/src/morphopt/postprocess/surface_export.py +133 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/boundary_part.py +44 -5
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/surfaces/base_surface.py +2 -2
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/surfaces/brep_surface.py +3 -3
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/surfaces/bsp_surface.py +2 -2
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/surfaces/cpgeo_surface.py +2 -2
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/surfaces/mesh_surface.py +2 -2
- morphopt-4.0.6/src/morphopt/taskoptmization.py +116 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/__init__.py +1 -1
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/app.py +8 -2
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/__init__.py +2 -4
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/definitions.py +17 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/editing.py +53 -16
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/fields.py +7 -1
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/finite_element.py +8 -35
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/load_cases.py +3 -1
- morphopt-4.0.6/src/morphopt/ui/application/part_mesh.py +31 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/part_sets.py +76 -13
- morphopt-4.0.6/src/morphopt/ui/application/quickstart.py +1077 -0
- morphopt-4.0.6/src/morphopt/ui/application/results.py +84 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/runs.py +6 -4
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/validation.py +14 -4
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/codegen/assets.py +6 -2
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/codegen/generator.py +68 -25
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/fea_worker.py +20 -22
- morphopt-4.0.6/src/morphopt/ui/history_gif_worker.py +19 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/launcher.py +26 -26
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/locales/en-US.json +81 -13
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/locales/zh-CN.json +82 -14
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/mainwindow.py +67 -22
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/base_nodes.py +9 -4
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/node_types/parts.py +5 -3
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/node_types/structural.py +42 -18
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/observe_panel.py +168 -41
- morphopt-4.0.6/src/morphopt/ui/presentation/result_fields.py +42 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/schemes/base.py +41 -22
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/surface_export_worker.py +3 -6
- morphopt-4.0.6/src/morphopt/ui/theme/fonts.py +265 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/theme/styles/controls.qss +1 -2
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/theme/styles/inputs.qss +8 -3
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/visualization/geometry.py +26 -0
- morphopt-4.0.6/src/morphopt/ui/visualization/rendering.py +42 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/asset_browser.py +1 -1
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/codeeditor.py +8 -3
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/definition_actions.py +2 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/definition_manager.py +23 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/edit_history.py +3 -3
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/finite_element.py +29 -16
- morphopt-4.0.6/src/morphopt/ui/widgets/font_settings.py +212 -0
- morphopt-4.0.6/src/morphopt/ui/widgets/history_gif_export.py +241 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/model_tree.py +18 -5
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/observation_pages.py +68 -67
- morphopt-4.0.6/src/morphopt/ui/widgets/part_set_list.py +61 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/preview_renderer.py +44 -2
- morphopt-4.0.6/src/morphopt/ui/widgets/solver_editor.py +370 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/surface_export.py +3 -1
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/values.py +2 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/viewer.py +64 -4
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/workbench.py +14 -15
- morphopt-4.0.6/src/morphopt/ui/worker_environment.py +28 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt.egg-info/PKG-INFO +5 -4
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt.egg-info/SOURCES.txt +17 -3
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt.egg-info/requires.txt +1 -0
- 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/taskoptmization.py +0 -97
- 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/widgets/plot_style.py +0 -38
- morphopt-4.0.5/src/morphopt/ui/widgets/solver_editor.py +0 -207
- {morphopt-4.0.5 → morphopt-4.0.6}/setup.cfg +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/codesign/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/codesign/constraints.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/codesign/update_offset_boundary_part.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/constants.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/history.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/base_model_component.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/baseparam.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/fea/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/fea/base_component.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/fea/body_force.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/fea/boundary_condition.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/fea/contact.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/fea/couple.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/fea/point_load.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/fea/pressure.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/fea/reference_point.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/fea/spring.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/feaparams.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/materials/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/materials/base_material.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/materials/homogeneous_material.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/materials/models.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/materialsparams.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/modelparams/params.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/objfunc.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/protocal.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/quadrature.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/optcore/updaters.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/objectivefuncs/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/objectivefuncs/boundarys.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/objectivefuncs/distancesurface.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/objectivefuncs/shapederivative.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/objectivefuncs/volumemaximization.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/surfaces/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/surfaces/base_constraints.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/surfaces/bsp_constraints.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/surfaces/cpgeo_constraints.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/surfaces/nurbs_face.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/shapeopt/update_boundary_part.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/simp/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/simp/objectivefuncs/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/simp/objectivefuncs/basefuncs.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/simp/objectivefuncs/boundarys.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/simp/objectivefuncs/densityfield.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/simp/objectivefuncs/sensitivity.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/simp/objectivefuncs/volfrac.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/simp/simpmaterial.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/simp/update_simpmaterial.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/__main__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/cad.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/completion.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/devices.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/edit_history.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/editor_routing.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/expressions.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/updaters.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application/values.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/application_icon.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/assets/morphopt.svg +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/cad_worker.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/codegen/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/codegen/custom_classes.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/codegen/workspace.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/i18n.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/chamberlayout.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/configuration.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/fields.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/loaders.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/material_models.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/node_types/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/node_types/cad.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/node_types/custom_code.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/node_types/loads.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/node_types/materials.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/node_types/objectives.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/node_types/penalties.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/node_types/surfaces.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/node_types/symmetry.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/problem.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/model/registry.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/presentation/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/presentation/edit_history.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/presentation/history.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/presentation/labels.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/presentation/navigation.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/refresh.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/schemes/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/schemes/snippets.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/theme/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/theme/manager.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/theme/palette.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/theme/styles/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/theme/styles/base.qss +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/theme/stylesheet.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/theme/themes/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/theme/themes/dark.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/theme/themes/light.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/visualization/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/visualization/assets.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/visualization/loads.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/visualization/scene.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/case_deletion.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/collection_controls.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/controller_editor.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/custom_classes.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/editor.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/editor_pages.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/elided_label.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/file_dialogs.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/helper_editor.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/history_dialogs.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/language_selector.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/load_cases.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/objective_editor.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/param_form.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/quickstart.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/result_path.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/run_dialogs.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/source_view.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/template_insert_dialog.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/theme_selector.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/updater_editor.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/ui/widgets/workspace_objective.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/utils/__init__.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/utils/gradient_check.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt/utils/history_read.py +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt.egg-info/dependency_links.txt +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/src/morphopt.egg-info/entry_points.txt +0 -0
- {morphopt-4.0.5 → morphopt-4.0.6}/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.6
|
|
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:
|
|
@@ -100,7 +101,7 @@ The [documentation index](docs/README.md) includes the reading order and automat
|
|
|
100
101
|
- `simp/` — SIMP topology optimization
|
|
101
102
|
- `codesign/` — Shell co-design (shape + material)
|
|
102
103
|
- `ui/` — PySide6 graphical UI (definition + observer in one window)
|
|
103
|
-
- `examples/` —
|
|
104
|
+
- [`examples/`](examples/README.md) — Runnable tasks, UI definitions, input geometry assets, and case notes
|
|
104
105
|
- `docs/` — Usage guides, API reference, theory papers
|
|
105
106
|
- `tests/` — Gradient checks, geometry tests, UI tests
|
|
106
107
|
- `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:
|
|
@@ -73,7 +73,7 @@ The [documentation index](docs/README.md) includes the reading order and automat
|
|
|
73
73
|
- `simp/` — SIMP topology optimization
|
|
74
74
|
- `codesign/` — Shell co-design (shape + material)
|
|
75
75
|
- `ui/` — PySide6 graphical UI (definition + observer in one window)
|
|
76
|
-
- `examples/` —
|
|
76
|
+
- [`examples/`](examples/README.md) — Runnable tasks, UI definitions, input geometry assets, and case notes
|
|
77
77
|
- `docs/` — Usage guides, API reference, theory papers
|
|
78
78
|
- `tests/` — Gradient checks, geometry tests, UI tests
|
|
79
79
|
- `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.6"
|
|
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 = []
|
|
@@ -50,6 +50,10 @@ def start_optimization(
|
|
|
50
50
|
)
|
|
51
51
|
process_optimization.start()
|
|
52
52
|
process_optimization.join()
|
|
53
|
+
exitcode = process_optimization.exitcode
|
|
54
|
+
process_optimization.close()
|
|
55
|
+
if exitcode != 0:
|
|
56
|
+
raise ChildProcessError(f"Optimization task failed with exit code {exitcode}.")
|
|
53
57
|
|
|
54
58
|
|
|
55
59
|
def debug_optimization(
|
|
@@ -19,6 +19,7 @@ import torch
|
|
|
19
19
|
import morphopt
|
|
20
20
|
|
|
21
21
|
from ..constants import CONSTANT
|
|
22
|
+
from ..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)))
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""Fixed geometry owns one cached TorchFEA mesh and its named sets."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
import torchfea
|
|
9
|
+
|
|
10
|
+
from .base_part import BasePart
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from multiprocessing.pool import Pool
|
|
14
|
+
|
|
15
|
+
__all__ = ["FixedPart"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class FixedPart(BasePart):
|
|
19
|
+
"""Base for fixed mesh builders and importers.
|
|
20
|
+
|
|
21
|
+
Subclasses implement ``build_part()``. The cached TorchFEA Part owns all
|
|
22
|
+
set data; the properties below expose its containers without copying them.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def __init__(
|
|
26
|
+
self, part_name: str | None = None, exterior_surface: str | None = None,
|
|
27
|
+
) -> None:
|
|
28
|
+
super().__init__(part_name=part_name, exterior_surface=exterior_surface)
|
|
29
|
+
self._part: torchfea.Part | None = None
|
|
30
|
+
self._part_cache_key: object = None
|
|
31
|
+
|
|
32
|
+
@BasePart.part_name.setter
|
|
33
|
+
def part_name(self, value: str | None) -> None:
|
|
34
|
+
self._part_name = str(value).strip() if value else ""
|
|
35
|
+
self.clear_mesh_cache()
|
|
36
|
+
|
|
37
|
+
def clear_mesh_cache(self) -> None:
|
|
38
|
+
"""Discard the mesh before rebuilding changed inputs."""
|
|
39
|
+
self._part = None
|
|
40
|
+
self._part_cache_key = None
|
|
41
|
+
|
|
42
|
+
def initialize(self, *args: object, **kwargs: object) -> None:
|
|
43
|
+
"""Start initialization with a fresh mesh, including custom build inputs."""
|
|
44
|
+
self.clear_mesh_cache()
|
|
45
|
+
super().initialize(*args, **kwargs)
|
|
46
|
+
|
|
47
|
+
def _mesh_cache_key(self) -> object:
|
|
48
|
+
"""Identify inputs whose changes require a new mesh."""
|
|
49
|
+
return None
|
|
50
|
+
|
|
51
|
+
def get_part(
|
|
52
|
+
self, path_result: str | None = None, pools: Pool | None = None,
|
|
53
|
+
) -> torchfea.Part:
|
|
54
|
+
"""Reuse this geometry's mesh until its inputs change or it is cleared."""
|
|
55
|
+
key = self._mesh_cache_key()
|
|
56
|
+
if self._part is None or key != self._part_cache_key:
|
|
57
|
+
self.clear_mesh_cache()
|
|
58
|
+
self._part = self.build_part(path_result=path_result, pools=pools)
|
|
59
|
+
self._part_cache_key = key
|
|
60
|
+
return self._part
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def node_sets(self) -> dict[str, np.ndarray]:
|
|
64
|
+
"""Node sets owned by the cached mesh, built on first access."""
|
|
65
|
+
return self.get_part().set_nodes
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def surface_sets(self):
|
|
69
|
+
"""The cached mesh's surface container."""
|
|
70
|
+
return self.get_part().surfaces
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def element_sets(self) -> dict[str, np.ndarray]:
|
|
74
|
+
"""Named element sets owned by the cached mesh."""
|
|
75
|
+
return self.get_part().set_elements
|
|
76
|
+
|
|
77
|
+
@property
|
|
78
|
+
def surface_set_names(self) -> tuple[str, ...]:
|
|
79
|
+
return tuple(self.surface_sets.keys())
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def node_set_names(self) -> tuple[str, ...]:
|
|
83
|
+
return tuple(self.node_sets)
|
|
@@ -5,9 +5,10 @@ from __future__ import annotations
|
|
|
5
5
|
import os
|
|
6
6
|
from typing import TYPE_CHECKING
|
|
7
7
|
|
|
8
|
+
import numpy as np
|
|
8
9
|
import torchfea
|
|
9
10
|
|
|
10
|
-
from .
|
|
11
|
+
from .fixed_part import FixedPart
|
|
11
12
|
|
|
12
13
|
if TYPE_CHECKING:
|
|
13
14
|
from multiprocessing.pool import Pool
|
|
@@ -15,7 +16,7 @@ if TYPE_CHECKING:
|
|
|
15
16
|
__all__ = ["INPPart"]
|
|
16
17
|
|
|
17
18
|
|
|
18
|
-
class INPPart(
|
|
19
|
+
class INPPart(FixedPart):
|
|
19
20
|
"""One fixed Part read from an Abaqus ``.inp`` mesh.
|
|
20
21
|
|
|
21
22
|
Parameters
|
|
@@ -30,8 +31,6 @@ class INPPart(BasePart):
|
|
|
30
31
|
Part in the file.
|
|
31
32
|
"""
|
|
32
33
|
|
|
33
|
-
cache_part = True
|
|
34
|
-
|
|
35
34
|
def __init__(
|
|
36
35
|
self,
|
|
37
36
|
mesh_file: str,
|
|
@@ -52,6 +51,14 @@ class INPPart(BasePart):
|
|
|
52
51
|
raise FileNotFoundError(
|
|
53
52
|
f"Abaqus mesh file does not exist: {self.mesh_file}")
|
|
54
53
|
|
|
54
|
+
def _mesh_cache_key(self) -> object:
|
|
55
|
+
try:
|
|
56
|
+
stat = os.stat(self.mesh_file)
|
|
57
|
+
stamp = (stat.st_mtime_ns, stat.st_size)
|
|
58
|
+
except OSError:
|
|
59
|
+
stamp = None
|
|
60
|
+
return (os.path.abspath(self.mesh_file), stamp, self.inp_part_name, self.exterior_surface)
|
|
61
|
+
|
|
55
62
|
def build_part(self, path_result: str | None = None,
|
|
56
63
|
pools: Pool | None = None) -> torchfea.Part:
|
|
57
64
|
"""Read the ``.inp`` file and return the selected Part."""
|
|
@@ -68,5 +75,9 @@ class INPPart(BasePart):
|
|
|
68
75
|
"pass inp_part_name to select one.")
|
|
69
76
|
part_name = names[0]
|
|
70
77
|
part = imported.get_part(part_name)
|
|
78
|
+
part.set_elements.update({
|
|
79
|
+
name: np.asarray(sorted(indices), dtype=int)
|
|
80
|
+
for name, indices in inp.part[part_name].sets_elems.items()
|
|
81
|
+
})
|
|
71
82
|
part.exterior_surface = self.exterior_surface or part.exterior_surface
|
|
72
83
|
return part
|
|
@@ -13,15 +13,13 @@ from .protocal import ProtocalInitializable, ProtocalSavable
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class Solver(ProtocalInitializable, ProtocalSavable):
|
|
16
|
-
"""
|
|
17
|
-
This class is responsible for solving the FEA and get the displacement of the soft robot.
|
|
18
|
-
"""
|
|
16
|
+
"""Schedule ordered load-case groups across the FEA worker pool."""
|
|
19
17
|
|
|
20
18
|
def __init__(
|
|
21
19
|
self,
|
|
22
20
|
params: Params,
|
|
23
21
|
num_process: int = CONSTANT.KERNEL.SOLVER.NUM_PROCESS,
|
|
24
|
-
|
|
22
|
+
process_devices: list[str] | None = None,
|
|
25
23
|
task_step_list: list[list[str]] | None = None,
|
|
26
24
|
) -> None:
|
|
27
25
|
"""
|
|
@@ -31,8 +29,8 @@ class Solver(ProtocalInitializable, ProtocalSavable):
|
|
|
31
29
|
params (Params):
|
|
32
30
|
num_process (int): The number of processes to use for parallel computation.
|
|
33
31
|
Defaults to one process.
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
process_devices (list[str] | None): One device name for each process.
|
|
33
|
+
Defaults to CPU for every process.
|
|
36
34
|
"""
|
|
37
35
|
|
|
38
36
|
super().__init__()
|
|
@@ -47,11 +45,16 @@ class Solver(ProtocalInitializable, ProtocalSavable):
|
|
|
47
45
|
int: The number of processes to use for parallel computation.
|
|
48
46
|
"""
|
|
49
47
|
|
|
50
|
-
self.
|
|
48
|
+
self.process_devices = list(process_devices or [])
|
|
49
|
+
if len(self.process_devices) > num_process:
|
|
50
|
+
raise ValueError(
|
|
51
|
+
"process_devices cannot contain more entries than num_process"
|
|
52
|
+
)
|
|
53
|
+
self.process_devices.extend(["cpu"] * (num_process - len(self.process_devices)))
|
|
51
54
|
|
|
52
55
|
self.task_step_list = task_step_list
|
|
53
56
|
"""
|
|
54
|
-
list[list[str]]:
|
|
57
|
+
list[list[str]]: Ordered task groups; load cases run sequentially per group.
|
|
55
58
|
"""
|
|
56
59
|
|
|
57
60
|
def initialize(self) -> None:
|
|
@@ -62,6 +65,8 @@ class Solver(ProtocalInitializable, ProtocalSavable):
|
|
|
62
65
|
registered = [name for group in groups for name in group]
|
|
63
66
|
if len(set(registered)) != len(registered) or not set(registered) <= set(names):
|
|
64
67
|
raise ValueError("Solver task groups must reference existing load cases without duplicates.")
|
|
68
|
+
# Each nested list is one pool task; unassigned cases default to
|
|
69
|
+
# separate singleton tasks in load-case registration order.
|
|
65
70
|
self.task_step_list = [*groups, *[[name] for name in names if name not in registered]]
|
|
66
71
|
|
|
67
72
|
def reinitialize(self, iteration: int) -> None:
|
|
@@ -83,6 +88,12 @@ class Solver(ProtocalInitializable, ProtocalSavable):
|
|
|
83
88
|
if U_guess is None:
|
|
84
89
|
U_guess = self._previous_solution()
|
|
85
90
|
|
|
91
|
+
pool = morphopt.controller.pools
|
|
92
|
+
process_devices = {
|
|
93
|
+
worker.name: self.process_devices[index]
|
|
94
|
+
for index, worker in enumerate(pool._pool)
|
|
95
|
+
}
|
|
96
|
+
|
|
86
97
|
# multiprocess FEA
|
|
87
98
|
|
|
88
99
|
fe_cpu = copy.deepcopy(morphopt.controller.objfun.fe)
|
|
@@ -93,13 +104,12 @@ class Solver(ProtocalInitializable, ProtocalSavable):
|
|
|
93
104
|
fe=fe_cpu,
|
|
94
105
|
feamodel=self.params.feamodel,
|
|
95
106
|
step_names=self.task_step_list[0],
|
|
96
|
-
|
|
107
|
+
process_devices={mp.current_process().name: self.process_devices[0]},
|
|
97
108
|
U_guess=[U_guess[step] for step in self.task_step_list[0]]
|
|
98
109
|
if U_guess is not None else None,
|
|
99
110
|
path_result=morphopt.controller.path_result,
|
|
100
111
|
)
|
|
101
112
|
|
|
102
|
-
pools = morphopt.controller.pools
|
|
103
113
|
# pools.close()
|
|
104
114
|
# pools.join()
|
|
105
115
|
# pools = mp.Pool(processes=self.num_process)
|
|
@@ -107,13 +117,13 @@ class Solver(ProtocalInitializable, ProtocalSavable):
|
|
|
107
117
|
result = []
|
|
108
118
|
for i in range(len(self.task_step_list)):
|
|
109
119
|
result.append(
|
|
110
|
-
|
|
120
|
+
pool.apply_async(
|
|
111
121
|
self._solve_FEA,
|
|
112
122
|
kwds={
|
|
113
123
|
"fe": fe_cpu,
|
|
114
124
|
"feamodel": self.params.feamodel,
|
|
115
125
|
"step_names": self.task_step_list[i],
|
|
116
|
-
"
|
|
126
|
+
"process_devices": process_devices,
|
|
117
127
|
"U_guess": [U_guess[step] for step in self.task_step_list[i]]
|
|
118
128
|
if U_guess is not None
|
|
119
129
|
else None,
|
|
@@ -175,7 +185,7 @@ class Solver(ProtocalInitializable, ProtocalSavable):
|
|
|
175
185
|
fe: torchfea.FEAController,
|
|
176
186
|
feamodel: FEAParams,
|
|
177
187
|
step_names: list[str],
|
|
178
|
-
|
|
188
|
+
process_devices: dict[str, str],
|
|
179
189
|
U_guess: list[np.ndarray | None] | None = None,
|
|
180
190
|
path_result: str | None = None,
|
|
181
191
|
) -> list[torchfea.solver.StaticResult]:
|
|
@@ -195,23 +205,9 @@ class Solver(ProtocalInitializable, ProtocalSavable):
|
|
|
195
205
|
)
|
|
196
206
|
|
|
197
207
|
current_process_name = mp.current_process().name
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
pool_id = 0
|
|
202
|
-
|
|
203
|
-
if len(available_gpus) > 0:
|
|
204
|
-
cuda_now = (pool_id + 1) % len(available_gpus)
|
|
205
|
-
torch.set_default_device(available_gpus[cuda_now])
|
|
206
|
-
device_now = available_gpus[cuda_now]
|
|
207
|
-
print(
|
|
208
|
-
"Process %s use GPU: %s"
|
|
209
|
-
% (current_process_name, available_gpus[cuda_now])
|
|
210
|
-
)
|
|
211
|
-
else:
|
|
212
|
-
torch.set_default_device("cpu")
|
|
213
|
-
device_now = "cpu"
|
|
214
|
-
print("Process %s use CPU" % (current_process_name))
|
|
208
|
+
device_now = process_devices[current_process_name]
|
|
209
|
+
torch.set_default_device(device_now)
|
|
210
|
+
print(f"Process {current_process_name} uses device: {device_now}")
|
|
215
211
|
|
|
216
212
|
# torch.set_default_device(torch.device('cuda:0'))
|
|
217
213
|
torch.set_default_dtype(torch.float64)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Portable names shared by result creation and UI result discovery."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def sanitize_name(name: str) -> str:
|
|
7
|
+
"""Return a single filename component valid on Windows and Linux."""
|
|
8
|
+
name = re.sub(r'[<>:"/\\|?*\x00-\x1f]', "_", name).strip().rstrip(" .")
|
|
9
|
+
if not name:
|
|
10
|
+
return "problem"
|
|
11
|
+
reserved = {"CON", "PRN", "AUX", "NUL", "CONIN$", "CONOUT$",
|
|
12
|
+
*(f"{prefix}{index}" for prefix in ("COM", "LPT") for index in "123456789¹²³")}
|
|
13
|
+
if name.split(".")[0].rstrip(" ").upper() in reserved:
|
|
14
|
+
name = "_" + name
|
|
15
|
+
return name
|