pyfemtet 0.9.5__py3-none-any.whl → 1.0.0b0__py3-none-any.whl

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.

Potentially problematic release.


This version of pyfemtet might be problematic. Click here for more details.

Files changed (272) hide show
  1. pyfemtet/__init__.py +6 -1
  2. pyfemtet/_i18n/1. make_pot_and_update_po.bat +8 -0
  3. pyfemtet/_i18n/2. build_mo.bat +5 -0
  4. pyfemtet/_i18n/__init__.py +4 -0
  5. pyfemtet/_i18n/babel.cfg +2 -0
  6. pyfemtet/_i18n/i18n.py +37 -0
  7. pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.mo +0 -0
  8. pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.po +1020 -0
  9. pyfemtet/_i18n/locales/messages.pot +987 -0
  10. pyfemtet/{_message → _i18n}/messages.py +128 -41
  11. pyfemtet/_util/closing.py +19 -0
  12. pyfemtet/_util/dask_util.py +89 -7
  13. pyfemtet/_util/df_util.py +29 -0
  14. pyfemtet/_util/excel_macro_util.py +8 -3
  15. pyfemtet/_util/excel_parse_util.py +43 -23
  16. pyfemtet/_util/femtet_access_inspection.py +120 -0
  17. pyfemtet/{_femtet_config_util/autosave.py → _util/femtet_autosave.py} +7 -0
  18. pyfemtet/_util/femtet_exit.py +105 -0
  19. pyfemtet/_util/femtet_version.py +20 -0
  20. pyfemtet/_util/helper.py +94 -0
  21. pyfemtet/_util/process_util.py +107 -0
  22. pyfemtet/_util/str_enum.py +44 -0
  23. pyfemtet/core.py +15 -47
  24. pyfemtet/dispatch_extensions/__init__.py +8 -11
  25. pyfemtet/dispatch_extensions/_impl.py +42 -198
  26. pyfemtet/logger/__init__.py +8 -1
  27. pyfemtet/logger/_impl.py +5 -6
  28. pyfemtet/opt/__init__.py +3 -17
  29. pyfemtet/opt/exceptions.py +45 -0
  30. pyfemtet/opt/femopt.py +608 -0
  31. pyfemtet/opt/history/__init__.py +11 -0
  32. pyfemtet/opt/history/_history.py +1404 -0
  33. pyfemtet/opt/history/_hypervolume.py +169 -0
  34. pyfemtet/opt/history/_optimality.py +79 -0
  35. pyfemtet/opt/interface/__init__.py +17 -24
  36. pyfemtet/opt/interface/_base_interface.py +222 -0
  37. pyfemtet/opt/interface/_excel_interface/__init__.py +3 -0
  38. pyfemtet/opt/interface/_excel_interface/debug-excel-interface.xlsm +0 -0
  39. pyfemtet/opt/interface/_excel_interface/excel_interface.py +999 -0
  40. pyfemtet/opt/interface/_femtet_interface/__init__.py +3 -0
  41. pyfemtet/opt/interface/{_femtet_parametric.py → _femtet_interface/_femtet_parametric.py} +20 -12
  42. pyfemtet/opt/interface/{_femtet.py → _femtet_interface/femtet_interface.py} +505 -349
  43. pyfemtet/opt/interface/_femtet_with_nx_interface/__init__.py +5 -0
  44. pyfemtet/opt/interface/_femtet_with_nx_interface/femtet_with_nx_interface.py +230 -0
  45. pyfemtet/opt/interface/_femtet_with_nx_interface/model1.prt +0 -0
  46. pyfemtet/opt/interface/_femtet_with_nx_interface/model1.x_t +98 -0
  47. pyfemtet/opt/interface/{_femtet_with_nx → _femtet_with_nx_interface}/update_model.py +1 -3
  48. pyfemtet/opt/interface/_femtet_with_solidworks/__init__.py +5 -0
  49. pyfemtet/opt/interface/_femtet_with_solidworks/femtet_with_solidworks_interface.py +122 -0
  50. pyfemtet/opt/interface/_solidworks_interface/__init__.py +5 -0
  51. pyfemtet/opt/interface/_solidworks_interface/solidworks_interface.py +206 -0
  52. pyfemtet/opt/interface/_surrogate_model_interface/__init__.py +8 -0
  53. pyfemtet/opt/interface/_surrogate_model_interface/base_surrogate_interface.py +150 -0
  54. pyfemtet/opt/interface/_surrogate_model_interface/botorch_interface.py +298 -0
  55. pyfemtet/opt/interface/_surrogate_model_interface/debug-pof-botorch.reccsv +18 -0
  56. pyfemtet/opt/interface/_with_excel_settings/__init__.py +61 -0
  57. pyfemtet/opt/interface/_with_excel_settings/with_excel_settings.py +134 -0
  58. pyfemtet/opt/meta_script/YAML_Generator.xlsm +0 -0
  59. pyfemtet/opt/meta_script/__main__.py +58 -36
  60. pyfemtet/opt/optimizer/__init__.py +7 -9
  61. pyfemtet/opt/optimizer/_base_optimizer.py +885 -0
  62. pyfemtet/opt/optimizer/optuna_optimizer/__init__.py +9 -0
  63. pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +73 -0
  64. pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py +678 -0
  65. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/__init__.py +7 -0
  66. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/debug-pof-botorch.reccsv +18 -0
  67. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/enable_nonlinear_constraint.py +244 -0
  68. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/pof_botorch_sampler.py +1249 -0
  69. pyfemtet/opt/optimizer/optuna_optimizer/wat_ex14_parametric_jp.femprj +0 -0
  70. pyfemtet/opt/optimizer/scipy_optimizer/__init__.py +1 -0
  71. pyfemtet/opt/optimizer/scipy_optimizer/_scipy_optimizer.py +364 -0
  72. pyfemtet/opt/prediction/__init__.py +7 -0
  73. pyfemtet/opt/prediction/_botorch_utils.py +133 -0
  74. pyfemtet/opt/prediction/_gpytorch_modules_extension.py +142 -0
  75. pyfemtet/opt/prediction/_helper.py +155 -0
  76. pyfemtet/opt/prediction/_model.py +118 -0
  77. pyfemtet/opt/problem/problem.py +304 -0
  78. pyfemtet/opt/problem/variable_manager/__init__.py +20 -0
  79. pyfemtet/opt/problem/variable_manager/_string_as_expression.py +115 -0
  80. pyfemtet/opt/problem/variable_manager/_variable_manager.py +295 -0
  81. pyfemtet/opt/visualization/history_viewer/__main__.py +5 -0
  82. pyfemtet/opt/visualization/{_base.py → history_viewer/_base_application.py} +18 -13
  83. pyfemtet/opt/visualization/history_viewer/_common_pages.py +150 -0
  84. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/alert_region.py +10 -5
  85. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/control_femtet.py +16 -13
  86. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/main_graph.py +117 -47
  87. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/pm_graph.py +159 -138
  88. pyfemtet/opt/visualization/history_viewer/_process_monitor/_application.py +173 -0
  89. pyfemtet/opt/visualization/history_viewer/_process_monitor/_pages.py +291 -0
  90. pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dbc.py +1 -1
  91. pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dcc.py +1 -1
  92. pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/html.py +1 -1
  93. pyfemtet/opt/visualization/history_viewer/result_viewer/__main__.py +5 -0
  94. pyfemtet/opt/visualization/{result_viewer/application.py → history_viewer/result_viewer/_application.py} +6 -6
  95. pyfemtet/opt/visualization/{result_viewer/pages.py → history_viewer/result_viewer/_pages.py} +106 -82
  96. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.csv +18 -0
  97. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.db +0 -0
  98. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.jpg +0 -0
  99. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.log +45 -0
  100. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.pdt +0 -0
  101. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.jpg +0 -0
  102. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.pdt +0 -0
  103. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.jpg +0 -0
  104. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.pdt +0 -0
  105. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.jpg +0 -0
  106. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.pdt +0 -0
  107. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.jpg +0 -0
  108. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.pdt +0 -0
  109. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.jpg +0 -0
  110. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.pdt +0 -0
  111. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.jpg +0 -0
  112. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.pdt +0 -0
  113. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.jpg +0 -0
  114. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.pdt +0 -0
  115. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.jpg +0 -0
  116. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.pdt +0 -0
  117. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.jpg +0 -0
  118. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.pdt +0 -0
  119. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.jpg +0 -0
  120. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.pdt +0 -0
  121. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.jpg +0 -0
  122. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.pdt +0 -0
  123. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.jpg +0 -0
  124. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.pdt +0 -0
  125. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.jpg +0 -0
  126. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.pdt +0 -0
  127. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.jpg +0 -0
  128. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.pdt +0 -0
  129. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bgr +0 -0
  130. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bnd +0 -0
  131. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.btr +0 -0
  132. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.jpg +0 -0
  133. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.mtl +0 -0
  134. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.pdt +0 -0
  135. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.prm +0 -0
  136. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.jpg +0 -0
  137. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.pdt +0 -0
  138. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.jpg +0 -0
  139. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.pdt +0 -0
  140. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.jpg +0 -0
  141. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.pdt +0 -0
  142. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.jpg +0 -0
  143. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.pdt +0 -0
  144. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.jpg +0 -0
  145. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.pdt +0 -0
  146. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.femprj +0 -0
  147. pyfemtet/opt/visualization/plotter/main_figure_creator.py +536 -0
  148. pyfemtet/opt/visualization/plotter/pm_graph_creator.py +359 -0
  149. pyfemtet/opt/worker_status.py +120 -0
  150. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/METADATA +23 -24
  151. pyfemtet-1.0.0b0.dist-info/RECORD +172 -0
  152. pyfemtet-1.0.0b0.dist-info/entry_points.txt +3 -0
  153. pyfemtet/_femtet_config_util/exit.py +0 -59
  154. pyfemtet/_message/1. make_pot.bat +0 -11
  155. pyfemtet/_message/2. make_mo.bat +0 -6
  156. pyfemtet/_message/__init__.py +0 -5
  157. pyfemtet/_message/babel.cfg +0 -2
  158. pyfemtet/_message/locales/ja/LC_MESSAGES/messages.mo +0 -0
  159. pyfemtet/_message/locales/ja/LC_MESSAGES/messages.po +0 -570
  160. pyfemtet/_message/locales/messages.pot +0 -551
  161. pyfemtet/_warning.py +0 -87
  162. pyfemtet/brep/_impl.py +0 -18
  163. pyfemtet/opt/_femopt.py +0 -1007
  164. pyfemtet/opt/_femopt_core.py +0 -1169
  165. pyfemtet/opt/_test_utils/control_femtet.py +0 -39
  166. pyfemtet/opt/_test_utils/hyper_sphere.py +0 -24
  167. pyfemtet/opt/_test_utils/record_history.py +0 -130
  168. pyfemtet/opt/advanced_samples/excel_ui/(ref) original_project.femprj +0 -0
  169. pyfemtet/opt/advanced_samples/excel_ui/femtet-macro.xlsm +0 -0
  170. pyfemtet/opt/advanced_samples/excel_ui/pyfemtet-core.py +0 -291
  171. pyfemtet/opt/advanced_samples/excel_ui/test-pyfemtet-core.cmd +0 -22
  172. pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric.femprj +0 -0
  173. pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart.py +0 -99
  174. pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart_jp.py +0 -102
  175. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data.py +0 -60
  176. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data_jp.py +0 -57
  177. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate.py +0 -100
  178. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate_jp.py +0 -90
  179. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_parametric.femprj +0 -0
  180. pyfemtet/opt/interface/_base.py +0 -101
  181. pyfemtet/opt/interface/_excel_interface.py +0 -984
  182. pyfemtet/opt/interface/_femtet_excel.py +0 -141
  183. pyfemtet/opt/interface/_femtet_with_nx/__init__.py +0 -3
  184. pyfemtet/opt/interface/_femtet_with_nx/_interface.py +0 -178
  185. pyfemtet/opt/interface/_femtet_with_sldworks.py +0 -298
  186. pyfemtet/opt/interface/_surrogate/__init__.py +0 -5
  187. pyfemtet/opt/interface/_surrogate/_base.py +0 -129
  188. pyfemtet/opt/interface/_surrogate/_chaospy.py +0 -71
  189. pyfemtet/opt/interface/_surrogate/_singletaskgp.py +0 -71
  190. pyfemtet/opt/interface/_surrogate_excel.py +0 -102
  191. pyfemtet/opt/optimizer/_base.py +0 -376
  192. pyfemtet/opt/optimizer/_optuna/_botorch_patch/enable_nonlinear_constraint.py +0 -220
  193. pyfemtet/opt/optimizer/_optuna/_optuna.py +0 -434
  194. pyfemtet/opt/optimizer/_optuna/_pof_botorch.py +0 -1914
  195. pyfemtet/opt/optimizer/_scipy.py +0 -159
  196. pyfemtet/opt/optimizer/_scipy_scalar.py +0 -127
  197. pyfemtet/opt/optimizer/parameter.py +0 -113
  198. pyfemtet/opt/prediction/_base.py +0 -61
  199. pyfemtet/opt/prediction/single_task_gp.py +0 -119
  200. pyfemtet/opt/samples/femprj_sample/ParametricIF.femprj +0 -0
  201. pyfemtet/opt/samples/femprj_sample/ParametricIF.py +0 -29
  202. pyfemtet/opt/samples/femprj_sample/ParametricIF_test_result.reccsv +0 -13
  203. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.femprj +0 -0
  204. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.prt +0 -0
  205. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.py +0 -135
  206. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX_test_result.reccsv +0 -23
  207. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.SLDPRT +0 -0
  208. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.femprj +0 -0
  209. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.py +0 -131
  210. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW_test_result.reccsv +0 -23
  211. pyfemtet/opt/samples/femprj_sample/constrained_pipe.femprj +0 -0
  212. pyfemtet/opt/samples/femprj_sample/constrained_pipe.py +0 -96
  213. pyfemtet/opt/samples/femprj_sample/constrained_pipe_test_result.reccsv +0 -13
  214. pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.femprj +0 -0
  215. pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.py +0 -74
  216. pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric_test_result.reccsv +0 -13
  217. pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.femprj +0 -0
  218. pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.py +0 -58
  219. pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric_test_result.reccsv +0 -23
  220. pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.femprj +0 -0
  221. pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.py +0 -52
  222. pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.femprj +0 -0
  223. pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.py +0 -138
  224. pyfemtet/opt/samples/femprj_sample/her_ex40_parametric_test_result.reccsv +0 -18
  225. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.femprj +0 -0
  226. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.py +0 -60
  227. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_parallel.py +0 -61
  228. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_test_result.reccsv +0 -18
  229. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.femprj +0 -0
  230. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.py +0 -58
  231. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_parallel.py +0 -58
  232. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_test_result.reccsv +0 -18
  233. pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.femprj +0 -0
  234. pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.py +0 -29
  235. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.femprj +0 -0
  236. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.py +0 -129
  237. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.femprj +0 -0
  238. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.py +0 -125
  239. pyfemtet/opt/samples/femprj_sample_jp/constrained_pipe_jp.py +0 -93
  240. pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.femprj +0 -0
  241. pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.py +0 -70
  242. pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.femprj +0 -0
  243. pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.py +0 -57
  244. pyfemtet/opt/samples/femprj_sample_jp/gau_ex12_parametric_jp.py +0 -52
  245. pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.femprj +0 -0
  246. pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.py +0 -138
  247. pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.femprj +0 -0
  248. pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.py +0 -58
  249. pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py +0 -59
  250. pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.py +0 -56
  251. pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py +0 -56
  252. pyfemtet/opt/visualization/_complex_components/main_figure_creator.py +0 -332
  253. pyfemtet/opt/visualization/_complex_components/pm_graph_creator.py +0 -201
  254. pyfemtet/opt/visualization/_process_monitor/application.py +0 -226
  255. pyfemtet/opt/visualization/_process_monitor/pages.py +0 -406
  256. pyfemtet/opt/visualization/_wrapped_components/__init__.py +0 -0
  257. pyfemtet/opt/visualization/result_viewer/__init__.py +0 -0
  258. pyfemtet-0.9.5.dist-info/RECORD +0 -158
  259. pyfemtet-0.9.5.dist-info/entry_points.txt +0 -3
  260. /pyfemtet/{_femtet_config_util → opt/problem}/__init__.py +0 -0
  261. /pyfemtet/{brep → opt/visualization/history_viewer}/__init__.py +0 -0
  262. /pyfemtet/opt/{_test_utils → visualization/history_viewer/_complex_components}/__init__.py +0 -0
  263. /pyfemtet/opt/{optimizer/_optuna → visualization/history_viewer/_process_monitor}/__init__.py +0 -0
  264. /pyfemtet/opt/{optimizer/_optuna/_botorch_patch → visualization/history_viewer/_wrapped_components}/__init__.py +0 -0
  265. /pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/str_enum.py +0 -0
  266. /pyfemtet/opt/visualization/{result_viewer → history_viewer/result_viewer}/.gitignore +0 -0
  267. /pyfemtet/opt/visualization/{_complex_components → history_viewer/result_viewer}/__init__.py +0 -0
  268. /pyfemtet/opt/visualization/{_process_monitor → plotter}/__init__.py +0 -0
  269. /pyfemtet/opt/{samples/femprj_sample_jp/wat_ex14_parametric_jp.femprj → wat_ex14_parametric_jp.femprj} +0 -0
  270. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/LICENSE +0 -0
  271. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/LICENSE_THIRD_PARTY.txt +0 -0
  272. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/WHEEL +0 -0
@@ -1,28 +1,27 @@
1
- from typing import Tuple
2
-
3
- import os
4
1
  from time import time, sleep
5
2
  from multiprocessing import current_process
6
3
 
7
4
  from tqdm import tqdm
8
- import psutil
9
- from dask.distributed import Lock
10
5
 
11
- import win32process
12
- import win32gui
13
- from win32com.client import Dispatch
6
+ from win32com.client import Dispatch, CDispatch
14
7
 
15
8
  from femtetutils import util
16
9
 
17
- from multiprocessing.context import BaseContext, SpawnProcess, _concrete_contexts
18
- from multiprocessing.process import _children, _cleanup
19
- from multiprocessing.managers import SyncManager
10
+ from pyfemtet._i18n import Msg
11
+ from pyfemtet._util.dask_util import *
12
+ from pyfemtet._util.process_util import *
13
+ from pyfemtet.logger import get_module_logger
20
14
 
21
- from pyfemtet._message import Msg
22
15
 
23
- from pyfemtet.logger import get_module_logger
16
+ __all__ = [
17
+ 'launch_and_dispatch_femtet',
18
+ 'dispatch_femtet',
19
+ 'dispatch_specific_femtet',
20
+ 'DispatchExtensionException',
21
+ ]
24
22
 
25
- logger = get_module_logger('dispatch', __name__)
23
+
24
+ logger = get_module_logger('dispatch', False)
26
25
 
27
26
 
28
27
  DISPATCH_TIMEOUT = 120
@@ -38,114 +37,16 @@ class FemtetNotFoundException(DispatchExtensionException):
38
37
 
39
38
  class FemtetConnectionTimeoutError(DispatchExtensionException):
40
39
  """Raises when connection trials is timed out."""
41
- pass
42
-
43
-
44
- class IFemtet:
45
- """IDispatch object to contact with Femtet.
46
-
47
- Usage:
48
- >>> from win32com.client import Dispatch
49
- >>> from femtetutils import const
50
- >>> Femtet = Dispatch(const.CFemtet)
51
- >>> print(Femtet.Version)
52
-
53
- or
54
-
55
- >>> from win32com.client import Dispatch
56
- >>> Femtet = Dispatch('FemtetMacro.Femtet')
57
- >>> print(Femtet.Version)
58
-
59
- This is just an dummy class for type hint.
60
- More detail usage, see Femtet Macro Help.
61
-
62
- """
63
- pass
64
-
65
-
66
- class _NestableSpawnProcess(SpawnProcess):
67
- _start_method = 'nestable_spawn'
68
-
69
- def start(self):
70
- """This method is modified version of multiprocess.process.BaseProcess.start().
71
-
72
- By using this class, it may become a zombie process.
73
-
74
- """
75
-
76
- #
77
- # multiprocessing/process.py
78
- #
79
- # Copyright (c) 2006-2008, R Oudkerk
80
- # Licensed to PSF under a Contributor Agreement.
81
- #
82
-
83
- self._check_closed()
84
- assert self._popen is None, 'cannot start a process twice'
85
- assert self._parent_pid == os.getpid(), \
86
- 'can only start a process object created by current process'
87
- # assert not _current_process._config.get('daemon'), \
88
- # 'daemonic processes are not allowed to have children'
89
- _cleanup()
90
- self._popen = self._Popen(self)
91
- self._sentinel = self._popen.sentinel
92
- # Avoid a refcycle if the target function holds an indirect
93
- # reference to the process object (see bpo-30775)
94
- del self._target, self._args, self._kwargs
95
- _children.add(self)
96
-
97
-
98
- class _NestableSpawnContext(BaseContext):
99
-
100
- #
101
- # multiprocessing/process.py
102
- #
103
- # Copyright (c) 2006-2008, R Oudkerk
104
- # Licensed to PSF under a Contributor Agreement.
105
- #
106
-
107
- _name = 'nestable_spawn'
108
- Process = _NestableSpawnProcess
109
-
110
-
111
- _concrete_contexts.update(
112
- dict(nestable_spawn=_NestableSpawnContext())
113
- )
114
-
115
-
116
- def _get_hwnds(pid):
117
- """Proces ID から window handle を取得します."""
118
- def callback(hwnd, _hwnds):
119
- if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd):
120
- _, found_pid = win32process.GetWindowThreadProcessId(hwnd)
121
- if found_pid == pid:
122
- _hwnds.append(hwnd)
123
- return True
124
- hwnds = []
125
- win32gui.EnumWindows(callback, hwnds)
126
- return hwnds
127
-
128
-
129
- def _get_pid(hwnd):
130
- """Window handle から process ID を取得します."""
131
- if hwnd > 0:
132
- _, pid = win32process.GetWindowThreadProcessId(hwnd)
133
- else:
134
- pid = 0
135
- return pid
136
-
137
-
138
- def _get_pids(process_name):
139
- """Process のイメージ名から実行中の process ID を取得します."""
140
- pids = [p.info["pid"] for p in psutil.process_iter(attrs=["pid", "name"]) if p.info["name"] == process_name]
141
- return pids
142
40
 
143
41
 
144
42
  def _get_subprocess_log_prefix():
145
43
  return f'({current_process().name}) '
146
44
 
147
45
 
148
- def launch_and_dispatch_femtet(timeout=DISPATCH_TIMEOUT, strictly_pid_specify=True) -> Tuple[IFemtet, int]:
46
+ def launch_and_dispatch_femtet(
47
+ timeout=DISPATCH_TIMEOUT,
48
+ strictly_pid_specify=True
49
+ ) -> tuple[CDispatch, int]:
149
50
  """Launch Femtet by new process and connect to it.
150
51
 
151
52
  The wrapper for Dispatch() but returns PID with IFemtet.
@@ -162,11 +63,12 @@ def launch_and_dispatch_femtet(timeout=DISPATCH_TIMEOUT, strictly_pid_specify=Tr
162
63
  tuple[IFemtet, int]: An object for controlling Femtet and the PID of the Femtet being controlled.
163
64
 
164
65
  """
66
+
165
67
  # launch femtet
166
68
  util.execute_femtet()
167
69
  pid = util.get_last_executed_femtet_process_id()
168
70
  logger.debug(f'Target pid is {pid}.')
169
- for _ in tqdm(range(5), 'wait for launch femtet...'):
71
+ for _ in tqdm(range(5), Msg.WAIT_FOR_LAUNCH_FEMTET):
170
72
  sleep(1)
171
73
 
172
74
  # dispatch femtet
@@ -174,18 +76,12 @@ def launch_and_dispatch_femtet(timeout=DISPATCH_TIMEOUT, strictly_pid_specify=Tr
174
76
  Femtet, pid = dispatch_specific_femtet(pid, timeout)
175
77
  else:
176
78
  # worker process なら排他処理する
177
- try:
178
- with Lock('simply-dispatch-femtet'):
179
- Femtet, pid = dispatch_femtet()
180
- except RuntimeError as e:
181
- if "distributed.lock.Lock" in str(e):
182
- Femtet, pid = dispatch_femtet()
183
- else:
184
- raise e
79
+ with Lock('simply-dispatch-femtet'):
80
+ Femtet, pid = dispatch_femtet()
185
81
  return Femtet, pid
186
82
 
187
83
 
188
- def dispatch_femtet(timeout=DISPATCH_TIMEOUT, subprocess_log_prefix='') -> Tuple[IFemtet, int]:
84
+ def dispatch_femtet(timeout=DISPATCH_TIMEOUT, subprocess_log_prefix='') -> tuple[CDispatch, int]:
189
85
  """Connect to existing Femtet process.
190
86
 
191
87
  The wrapper for Dispatch() but returns PID with IFemtet.
@@ -202,23 +98,11 @@ def dispatch_femtet(timeout=DISPATCH_TIMEOUT, subprocess_log_prefix='') -> Tuple
202
98
 
203
99
  """
204
100
 
205
- """
206
-
207
- Args:
208
- timeout (int or float, optional): Seconds to wait for connection. Defaults to DISPATCH_TIMEOUT.
209
- subprocess_log_prefix (str, optional): The prefix of log message.
210
-
211
- Raises:
212
- FemtetConnectionTimeoutError: Couldn't connect Femtet process for some reason (i.e. Femtet.exe is not launched).
213
-
214
- Returns:
215
- Tuple[IFemtet, int]:
216
- """
217
101
  # Dispatch
218
102
  if subprocess_log_prefix:
219
103
  logger.debug('%s'+'Try to connect Femtet.', subprocess_log_prefix)
220
104
  else:
221
- logger.info('Try to connect Femtet.')
105
+ logger.info(Msg.TRY_TO_CONNECT_FEMTET)
222
106
  Femtet = Dispatch('FemtetMacro.Femtet')
223
107
  logger.debug('%s'+'Dispatch finished.', subprocess_log_prefix)
224
108
 
@@ -229,10 +113,13 @@ def dispatch_femtet(timeout=DISPATCH_TIMEOUT, subprocess_log_prefix='') -> Tuple
229
113
 
230
114
  # 接続が確立
231
115
  if hwnd > 0:
232
- logger.debug('%s'+f'Dispatched hwnd is {hwnd} and its pid is {_get_pid(hwnd)}. Connection established.', subprocess_log_prefix)
116
+ logger.debug('%s'+f'Dispatched hwnd is {hwnd} and'
117
+ f'its pid is {_get_pid(hwnd)}.'
118
+ f'Connection established.', subprocess_log_prefix)
233
119
  break
234
120
  else:
235
- logger.debug('%s'+f'Dispatched hwnd is {hwnd}. Waiting for establishing connection.', subprocess_log_prefix)
121
+ logger.debug('%s'+f'Dispatched hwnd is {hwnd}.'
122
+ f'Waiting for establishing connection.', subprocess_log_prefix)
236
123
 
237
124
  # 接続がタイムアウト
238
125
  if time()-start > timeout:
@@ -245,7 +132,7 @@ def dispatch_femtet(timeout=DISPATCH_TIMEOUT, subprocess_log_prefix='') -> Tuple
245
132
  if subprocess_log_prefix:
246
133
  logger.debug('%s'+f'Successfully connected. The pid of Femtet is {pid}.', subprocess_log_prefix)
247
134
  else:
248
- logger.info(f'Successfully connected. The pid of Femtet is {pid}.')
135
+ logger.info(Msg.F_FEMTET_CONNECTED(pid))
249
136
 
250
137
  return Femtet, pid
251
138
 
@@ -328,56 +215,13 @@ def _block_other_femtets(
328
215
  sleep(1)
329
216
 
330
217
 
331
- def dispatch_specific_femtet(pid, timeout=DISPATCH_TIMEOUT) -> Tuple[IFemtet, int]:
332
- """Connect Existing Femtet whose process id is specified.
333
-
334
- Warnings:
335
- Once Femtet is connected a python process,
336
- the python process can only connect it during the process lifetime
337
- even if the process runs this function.
218
+ def dispatch_specific_femtet(pid, timeout=DISPATCH_TIMEOUT) -> tuple[CDispatch, int]:
338
219
 
339
- Example:
220
+ with Lock('dispatch-specific-femtet'):
221
+ return _dispatch_specific_femtet_core(pid, timeout)
340
222
 
341
- If you have 2 free Femtet processes (their pid is 1000 and 1001),
342
- you can only connect to first connected Femtet
343
- and cannot change the connection.
344
223
 
345
- >>> from pyfemtet.dispatch_extensions import dispatch_specific_femtet
346
- >>> Femtet1, pid1 = dispatch_specific_femtet(pid=1000)
347
- >>> print(pid1) # 1000
348
- >>> Femtet2, pid2 = dispatch_specific_femtet(pid=1001)
349
- >>> print(pid2) # not 1001, but 1000
350
-
351
- If you want to reconnect another process, please restart python script or interpreter.
352
-
353
- If you want to connect 2 more Femtet processes from single script or interprete,
354
- please consider parallel processing.
355
-
356
- Args:
357
- timeout (int, optional): Raises an error if the connection is not established within the specified timeout.
358
-
359
- Raises:
360
- FemtetConnectionTimeoutError: Couldn't connect Femtet process for some reason (i.e. Femtet.exe is not launched).
361
-
362
- Returns:
363
- tuple[IFemtet, int]: An object for controlling Femtet and the PID of the Femtet being controlled.
364
-
365
-
366
- """
367
- try:
368
- with Lock('dispatch-specific-femtet'):
369
- return _dispatch_specific_femtet_core(pid, timeout)
370
- except RuntimeError as e:
371
- if 'object not properly initialized' in str(e):
372
- pass
373
- else:
374
- raise e
375
- return _dispatch_specific_femtet_core(pid, timeout) # for logger, out of except.
376
-
377
-
378
- def _dispatch_specific_femtet_core(pid, timeout=DISPATCH_TIMEOUT) -> Tuple[IFemtet, int]:
379
-
380
- # TODO: 安定性を見て lock_main を復活させるか決める
224
+ def _dispatch_specific_femtet_core(pid, timeout=DISPATCH_TIMEOUT) -> tuple[CDispatch, int]:
381
225
 
382
226
  if timeout < 5:
383
227
  raise ValueError(f'Timeout to dispatch specific femtet should equal or be over 5.')
@@ -388,13 +232,10 @@ def _dispatch_specific_femtet_core(pid, timeout=DISPATCH_TIMEOUT) -> Tuple[IFemt
388
232
  if not (pid in pids):
389
233
  raise FemtetNotFoundException(f"Femtet (pid = {pid}) doesn't exist.")
390
234
 
391
- logger.info('Searching specific Femtet...')
235
+ logger.info(Msg.F_SEARCHING_FEMTET_WITH_SPECIFIC_PID(pid))
392
236
 
393
237
  # 子プロセスの準備
394
- # with Manager() as manager:
395
- m = SyncManager(ctx=_NestableSpawnContext()) # このへんが時間のかかる処理
396
- m.start()
397
- with m as manager:
238
+ with _NestableSyncManager() as manager:
398
239
  # フラグの準備
399
240
  connection_flags = manager.list()
400
241
  lock_inter_subproc = manager.Lock()
@@ -407,7 +248,6 @@ def _dispatch_specific_femtet_core(pid, timeout=DISPATCH_TIMEOUT) -> Tuple[IFemt
407
248
  processes = []
408
249
  for subprocess_id in tqdm(range(len(pids)), 'Specifying connection...'):
409
250
  p = _NestableSpawnProcess(
410
- # p = Process(
411
251
  target=_block_other_femtets,
412
252
  args=(
413
253
  pid,
@@ -435,7 +275,12 @@ def _dispatch_specific_femtet_core(pid, timeout=DISPATCH_TIMEOUT) -> Tuple[IFemt
435
275
  lock_inter_subproc.release()
436
276
  except RuntimeError:
437
277
  pass
438
- raise FemtetConnectionTimeoutError(f'Connect trial with specific Femtet (pid = {pid}) is timed out in {timeout} sec')
278
+ raise FemtetConnectionTimeoutError(
279
+ Msg.F_ERR_FEMTET_CONNECTION_TIMEOUT(
280
+ pid=pid,
281
+ timeout=timeout,
282
+ )
283
+ )
439
284
  sleep(1)
440
285
 
441
286
  # # subprocesses の Dispatch 終了後、target_pid の解放を待つ
@@ -459,8 +304,7 @@ def _dispatch_specific_femtet_core(pid, timeout=DISPATCH_TIMEOUT) -> Tuple[IFemt
459
304
  if my_pid != pid: # pid の結果が違う場合
460
305
  txt = f'Target pid is {pid}, but connected pid is {my_pid}. '
461
306
  txt += f'The common reason is that THIS python process once connected {pid}.'
462
- logger.warn(txt)
463
- # warnings.warn(txt)
307
+ logger.warning(txt)
464
308
 
465
309
  return Femtet, my_pid
466
310
 
@@ -1,5 +1,5 @@
1
1
  import logging
2
- from pyfemtet.logger._impl import (
2
+ from ._impl import (
3
3
  get_module_logger,
4
4
  add_file_output,
5
5
  set_stdout_output,
@@ -8,6 +8,13 @@ from pyfemtet.logger._impl import (
8
8
  remove_all_output,
9
9
  )
10
10
 
11
+ __all__ = [
12
+ 'get_module_logger',
13
+ 'get_dask_logger',
14
+ 'get_optuna_logger',
15
+ 'get_dash_logger',
16
+ ]
17
+
11
18
 
12
19
  def get_dask_logger():
13
20
  return logging.getLogger('distributed')
pyfemtet/logger/_impl.py CHANGED
@@ -4,7 +4,6 @@ import sys
4
4
  import datetime
5
5
  import locale
6
6
  from threading import Lock
7
- from pathlib import Path
8
7
  import platform
9
8
 
10
9
  from colorlog import ColoredFormatter
@@ -176,14 +175,14 @@ def setup_package_root_logger(package_name):
176
175
 
177
176
  # ===== module logger =====
178
177
 
179
- def get_module_logger(name: str, __module_name__: str, ) -> logging.Logger:
178
+ def get_module_logger(name: str, debug=False) -> logging.Logger:
180
179
  """Return the module-level logger.
181
180
 
182
181
  The format is defined in the package_root_logger.
183
182
 
184
183
  Args:
185
184
  name (str): The logger name to want.
186
- __module_name__ (str): __name__ of the module.
185
+ debug (bool, optional): Output DEBUG level message or not.
187
186
 
188
187
  Returns:
189
188
  logging.Logger:
@@ -206,7 +205,7 @@ def get_module_logger(name: str, __module_name__: str, ) -> logging.Logger:
206
205
  logger.propagate = True
207
206
 
208
207
  # If debug mode, set specific level.
209
- if __module_name__ == '__main__':
208
+ if debug:
210
209
  logger.setLevel(logging.DEBUG)
211
210
 
212
211
  return logger
@@ -215,8 +214,8 @@ def get_module_logger(name: str, __module_name__: str, ) -> logging.Logger:
215
214
  if __name__ == '__main__':
216
215
 
217
216
  root_logger = setup_package_root_logger('logger')
218
- optimizer_logger = get_module_logger('logger.optimizer', __name__); optimizer_logger.setLevel(logging.INFO)
219
- interface_logger = get_module_logger('logger.interface', __name__)
217
+ optimizer_logger = get_module_logger('logger.optimizer', False); optimizer_logger.setLevel(logging.INFO)
218
+ interface_logger = get_module_logger('logger.interface', False)
220
219
 
221
220
  root_logger.info("This is root logger's info.")
222
221
  optimizer_logger.info("This is optimizer logger's info.")
pyfemtet/opt/__init__.py CHANGED
@@ -1,27 +1,13 @@
1
- from pyfemtet.opt.interface import FEMInterface
2
- from pyfemtet.opt.interface import NoFEM
3
- from pyfemtet.opt.interface import FemtetInterface
4
- from pyfemtet.opt.interface import FemtetWithNXInterface
5
- from pyfemtet.opt.interface import FemtetWithSolidworksInterface
6
-
7
- from pyfemtet.opt.optimizer import OptunaOptimizer, ScipyOptimizer, ScipyScalarOptimizer
8
- from pyfemtet.opt.optimizer import AbstractOptimizer
9
-
10
- from pyfemtet.opt._femopt import FEMOpt
11
-
12
- from pyfemtet.opt._femopt_core import History
1
+ from .femopt import FEMOpt
2
+ from .interface import FemtetInterface, FemtetWithNXInterface, FemtetWithSolidworksInterface
3
+ from .optimizer import OptunaOptimizer, ScipyOptimizer
13
4
 
14
5
 
15
6
  __all__ = [
16
7
  'FEMOpt',
17
- 'FEMInterface',
18
- 'NoFEM',
19
8
  'FemtetInterface',
20
9
  'FemtetWithNXInterface',
21
10
  'FemtetWithSolidworksInterface',
22
- 'AbstractOptimizer',
23
11
  'OptunaOptimizer',
24
- 'ScipyScalarOptimizer',
25
12
  'ScipyOptimizer',
26
- 'History',
27
13
  ]
@@ -0,0 +1,45 @@
1
+ import warnings
2
+
3
+ __all__ = [
4
+ 'ExceptionDuringOptimization',
5
+ 'FEMError',
6
+ '_HiddenConstraintViolation',
7
+ 'ModelError',
8
+ 'MeshError',
9
+ 'SolveError',
10
+ 'PostProcessError',
11
+ 'HardConstraintViolation',
12
+ 'InterruptOptimization',
13
+ 'SkipSolve',
14
+ 'show_experimental_warning'
15
+ ]
16
+
17
+
18
+ class ExceptionDuringOptimization(Exception): ...
19
+ class FEMError(Exception): ...
20
+
21
+
22
+ class _HiddenConstraintViolation(ExceptionDuringOptimization):
23
+
24
+ __pyfemtet_subclasses__ = []
25
+
26
+ def __init_subclass__(cls, **kwargs):
27
+ super().__init_subclass__(**kwargs)
28
+ _HiddenConstraintViolation.__pyfemtet_subclasses__.append(cls)
29
+
30
+
31
+ class ModelError(FEMError, _HiddenConstraintViolation): ...
32
+ class MeshError(FEMError, _HiddenConstraintViolation): ...
33
+ class SolveError(FEMError, _HiddenConstraintViolation): ...
34
+ class PostProcessError(FEMError, _HiddenConstraintViolation): ...
35
+
36
+
37
+ class HardConstraintViolation(ExceptionDuringOptimization): ...
38
+ class InterruptOptimization(ExceptionDuringOptimization): ...
39
+ class SkipSolve(ExceptionDuringOptimization): ...
40
+
41
+
42
+ def show_experimental_warning(feature_name):
43
+ warnings.warn(f'{feature_name} は実験的機能です。将来 API 等が'
44
+ f'大きく変更されるか、機能自体が削除される'
45
+ f'可能性があります。')