pyfemtet 0.4.4__py3-none-any.whl → 0.4.6__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.

pyfemtet/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.4.4"
1
+ __version__ = "0.4.6"
pyfemtet/opt/_femopt.py CHANGED
@@ -381,9 +381,9 @@ class FEMOpt:
381
381
  )
382
382
  )
383
383
  # Femtet の parametric 設定を目的関数に用いるかどうか
384
- if self.fem.use_parametric_as_objective:
384
+ if self.fem.parametric_output_indexes_use_as_objective is not None:
385
385
  from pyfemtet.opt.interface._femtet_parametric import add_parametric_results_as_objectives
386
- add_parametric_results_as_objectives(self)
386
+ add_parametric_results_as_objectives(self, self.fem.parametric_output_indexes_use_as_objective)
387
387
 
388
388
  # actor の設定
389
389
  self.status = OptimizationStatus(self.client)
@@ -39,6 +39,9 @@ class FemtetInterface(FEMInterface):
39
39
  model_name (str or None, optional): The name of the analysis model. Defaults to None.
40
40
  connect_method (str, optional): The connection method to use. Can be 'new', 'existing', or 'auto'. Defaults to 'auto'.
41
41
  strictly_pid_specify (bool, optional): If True and connect_method=='new', search launched Femtet process strictly based on its process id.
42
+ allow_without_project (bool, optional): Allow to launch Femtet with no project file. Default to False.
43
+ open_result_with_gui (bool, optional): Open analysis result with Femtet GUI. Default to True.
44
+ parametric_output_indexes_use_as_objective (list of int, optional): Parametric output indexes which will be used as objective functions. Parametric output should be set on Femtet parametric analysis dialog. Note that output 'No.' in dialog is starts with 1, but this 'index' is starts with 0. Default to None.
42
45
 
43
46
  Warning:
44
47
  Even if you specify ``strictly_pid_specify=True`` on the constructor,
@@ -60,7 +63,7 @@ class FemtetInterface(FEMInterface):
60
63
  strictly_pid_specify=True,
61
64
  allow_without_project=False,
62
65
  open_result_with_gui=True,
63
- use_parametric_as_objective=False,
66
+ parametric_output_indexes_use_as_objective=None,
64
67
  **kwargs # 継承されたクラスからの引数
65
68
  ):
66
69
 
@@ -86,7 +89,7 @@ class FemtetInterface(FEMInterface):
86
89
  self.parameters = None
87
90
  self.max_api_retry = 3
88
91
  self.strictly_pid_specify = strictly_pid_specify
89
- self.use_parametric_as_objective = use_parametric_as_objective
92
+ self.parametric_output_indexes_use_as_objective = parametric_output_indexes_use_as_objective
90
93
 
91
94
  # dask サブプロセスのときは femprj を更新し connect_method を new にする
92
95
  try:
@@ -113,7 +116,7 @@ class FemtetInterface(FEMInterface):
113
116
  femprj_path=self.femprj_path,
114
117
  model_name=self.model_name,
115
118
  open_result_with_gui=self.open_result_with_gui,
116
- use_parametric_as_objective=self.use_parametric_as_objective,
119
+ parametric_output_indexes_use_as_objective=self.parametric_output_indexes_use_as_objective,
117
120
  **kwargs
118
121
  )
119
122
 
@@ -549,7 +552,7 @@ class FemtetInterface(FEMInterface):
549
552
  is_Gaudi_method=True,
550
553
  )
551
554
 
552
- if self.use_parametric_as_objective:
555
+ if self.parametric_output_indexes_use_as_objective is not None:
553
556
  from pyfemtet.opt.interface._femtet_parametric import solve_via_parametric_dll
554
557
  self._call_femtet_api(
555
558
  fun=solve_via_parametric_dll,
@@ -39,14 +39,30 @@ def _get_dll_with_set_femtet(Femtet):
39
39
  return dll
40
40
 
41
41
 
42
- def add_parametric_results_as_objectives(femopt) -> bool:
42
+ def _get_prm_result_names(Femtet):
43
+ out = []
44
+
45
+ # load dll and set target femtet
46
+ dll = _get_dll_with_set_femtet(Femtet)
47
+ n = dll.GetPrmnResult()
48
+ for i in range(n):
49
+ # objective name
50
+ dll.GetPrmResultName.restype = ctypes.c_char_p
51
+ result = dll.GetPrmResultName(i)
52
+ name = result.decode('mbcs')
53
+ # objective value function
54
+ out.append(name)
55
+ return out
56
+
57
+
58
+ def add_parametric_results_as_objectives(femopt, indexes) -> bool:
43
59
  # load dll and set target femtet
44
60
  dll = _get_dll_with_set_femtet(femopt.fem.Femtet)
45
61
 
46
62
  # get objective names
47
63
  dll.GetPrmnResult.restype = ctypes.c_int
48
64
  n = dll.GetPrmnResult()
49
- for i in range(n):
65
+ for i in indexes:
50
66
  # objective name
51
67
  dll.GetPrmResultName.restype = ctypes.c_char_p
52
68
  result = dll.GetPrmResultName(i)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyfemtet
3
- Version: 0.4.4
3
+ Version: 0.4.6
4
4
  Summary: Design parameter optimization using Femtet.
5
5
  Home-page: https://github.com/pyfemtet/pyfemtet
6
6
  License: BSD-3-Clause
@@ -12,12 +12,12 @@ pyfemtet/FemtetPJTSample/her_ex40_parametric.py,sha256=B5PQoh71Q3KN2CyLU1gP_Yh9g
12
12
  pyfemtet/FemtetPJTSample/wat_ex14_parallel_parametric.py,sha256=UfhJffuXyhzdIWNpOrpV6xLTK1fuVvgyhlyg4Rp-628,2148
13
13
  pyfemtet/FemtetPJTSample/wat_ex14_parametric.femprj,sha256=pxacKe0NPNUPAcxqo2cATFApsMKiVt2g2e_FOk4fpjA,172895
14
14
  pyfemtet/FemtetPJTSample/wat_ex14_parametric.py,sha256=LGbWxCek0Ad2YrDCKykiQkE3aIypM4g8P3mLd_2anEE,2052
15
- pyfemtet/__init__.py,sha256=xw_dYipbaGm6aV2OPgH234_ODRnMNhDWYLau1HFUaAQ,21
15
+ pyfemtet/__init__.py,sha256=kz_EtUK14aaAj9cTvW7Wp3hr3-OKQMeZoE6Yry0bGJo,21
16
16
  pyfemtet/core.py,sha256=3lqfBGJ5IuKz2Nqj5pRo7YQqKwx_0ZDL72u95Ur_1p0,1386
17
17
  pyfemtet/dispatch_extensions.py,sha256=MhWiUXVt2Cq8vDeajMK4SrajjiAmb4m2fK8gXwHLrWA,16177
18
18
  pyfemtet/logger.py,sha256=JYD0FvzijMS2NvZN7VT7vZA5hqtHEkvS93AHlIMDePw,2507
19
19
  pyfemtet/opt/__init__.py,sha256=_P8unESvqCRD5pmuo6-5yo7BbrPi7c0aE6UZpqUD-_I,596
20
- pyfemtet/opt/_femopt.py,sha256=LsgIF71hVY7LeAX-gKbJ__hr5FzLdrIW1xSqRg9gNOE,22287
20
+ pyfemtet/opt/_femopt.py,sha256=QiEaf7EToNQDufBzL82TALclTkQA3ufJHQovI0mC0DY,22367
21
21
  pyfemtet/opt/_femopt_core.py,sha256=n_m-GIW82uvKNAn_N1ypBZQ4sOjngfNly7-SEkOXfuU,24774
22
22
  pyfemtet/opt/femprj_sample/cad_ex01_NX.femprj,sha256=KC8JlHqHzqgyKriK911QSnQByQpRlw-SX5OSQ_GNe5M,149193
23
23
  pyfemtet/opt/femprj_sample/cad_ex01_NX.prt,sha256=3okHLeMdslrRA_wkhppZtxIe-2-ZPMfNqWCdQwUV31o,226626
@@ -53,8 +53,8 @@ pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_jp.femprj,sha256=dMwQMt6yok_Pb
53
53
  pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_jp.py,sha256=vnfI4WuCvyjQN1MhnzyB-jcAPtTwz3yNiwtTm2yQZHU,2311
54
54
  pyfemtet/opt/interface/__init__.py,sha256=qz5BszPuU3jZIoDnPjkPDAgvgHLlx1sYhuqh5ID798k,480
55
55
  pyfemtet/opt/interface/_base.py,sha256=lDjdvKYmBMxSc7SfoWSu91qVijGaQ2Ng-0C7z_f4eFM,2079
56
- pyfemtet/opt/interface/_femtet.py,sha256=oDKFGruKVRudSEt3x2NnvVsuCfb_3hF65ONpCrKrIJo,25565
57
- pyfemtet/opt/interface/_femtet_parametric.py,sha256=hGW7fKMVdHz0X1fVtGQIovxXtFWNFcEyPn9_tnMrny4,2399
56
+ pyfemtet/opt/interface/_femtet.py,sha256=oNgOB-Frtc0ffIHgC-Knf0iAXqicM3zRtVQA__QIQiU,26209
57
+ pyfemtet/opt/interface/_femtet_parametric.py,sha256=BmKeha6ivYIqNieA7iYSEoo-_xn8TSte-jzsmhlwy38,2822
58
58
  pyfemtet/opt/interface/_femtet_with_nx/__init__.py,sha256=-6W2g2FDEcKzGHmI5KAKQe-4U5jDpMj0CXuma-GZca0,83
59
59
  pyfemtet/opt/interface/_femtet_with_nx/_interface.py,sha256=kTEmfAyLMEZvYTYjGXgYnoyhi-wDzhKK7opyVp7rOcY,3931
60
60
  pyfemtet/opt/interface/_femtet_with_nx/update_model.py,sha256=t0AB7mKY7rmrI_9stP1-5qhzmugEQ19DnZ4CCrCdTSw,2856
@@ -65,8 +65,8 @@ pyfemtet/opt/opt/_optuna.py,sha256=TWtp9auU6GBWtEJVOuo8aWSvLcCHCUNUyOQRnqyln4I,9
65
65
  pyfemtet/opt/visualization/__init__.py,sha256=PUCHoZnuZrHjTd0QQQBgzWkCpKY2noBPTvi-lyvxQyw,193
66
66
  pyfemtet/opt/visualization/_graphs.py,sha256=G6HaoGD3GpuwXih1nuTeFQMD0zv4jrhogedP9hxaG1c,5306
67
67
  pyfemtet/opt/visualization/_monitor.py,sha256=X2KR6fd8qf1U58Qr_o0jn0FTm1w9ARMPhs4eMYgGipI,42100
68
- pyfemtet-0.4.4.dist-info/LICENSE,sha256=sVQBhyoglGJUu65-BP3iR6ujORI6YgEU2Qm-V4fGlOA,1485
69
- pyfemtet-0.4.4.dist-info/METADATA,sha256=eWMO2_okpoutM3fryBE_1Qo1t05ThIk7k3biMGP43wc,3332
70
- pyfemtet-0.4.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
71
- pyfemtet-0.4.4.dist-info/entry_points.txt,sha256=E_NUq8BEuKLM3z6Ou0sh6HyvaKE5O6NBDlmO-wgEGaQ,67
72
- pyfemtet-0.4.4.dist-info/RECORD,,
68
+ pyfemtet-0.4.6.dist-info/LICENSE,sha256=sVQBhyoglGJUu65-BP3iR6ujORI6YgEU2Qm-V4fGlOA,1485
69
+ pyfemtet-0.4.6.dist-info/METADATA,sha256=F71t5_WaaWazfhzMkfhw9_EC5NbFd8nMn-HsXSgoM3w,3332
70
+ pyfemtet-0.4.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
71
+ pyfemtet-0.4.6.dist-info/entry_points.txt,sha256=E_NUq8BEuKLM3z6Ou0sh6HyvaKE5O6NBDlmO-wgEGaQ,67
72
+ pyfemtet-0.4.6.dist-info/RECORD,,