pyfemtet 0.3.12__py3-none-any.whl → 0.4.1__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 (35) hide show
  1. pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.py +1 -1
  2. pyfemtet/FemtetPJTSample/Sldworks_ex01/Sldworks_ex01.py +1 -1
  3. pyfemtet/FemtetPJTSample/gau_ex08_parametric.py +1 -1
  4. pyfemtet/FemtetPJTSample/her_ex40_parametric.femprj +0 -0
  5. pyfemtet/FemtetPJTSample/her_ex40_parametric.py +1 -1
  6. pyfemtet/FemtetPJTSample/wat_ex14_parallel_parametric.py +1 -1
  7. pyfemtet/FemtetPJTSample/wat_ex14_parametric.femprj +0 -0
  8. pyfemtet/FemtetPJTSample/wat_ex14_parametric.py +1 -1
  9. pyfemtet/__init__.py +1 -1
  10. pyfemtet/core.py +14 -0
  11. pyfemtet/dispatch_extensions.py +5 -0
  12. pyfemtet/opt/__init__.py +22 -2
  13. pyfemtet/opt/_femopt.py +544 -0
  14. pyfemtet/opt/_femopt_core.py +730 -0
  15. pyfemtet/opt/interface/__init__.py +15 -0
  16. pyfemtet/opt/interface/_base.py +71 -0
  17. pyfemtet/opt/{interface.py → interface/_femtet.py} +120 -407
  18. pyfemtet/opt/interface/_femtet_with_nx/__init__.py +3 -0
  19. pyfemtet/opt/interface/_femtet_with_nx/_interface.py +128 -0
  20. pyfemtet/opt/interface/_femtet_with_sldworks.py +174 -0
  21. pyfemtet/opt/opt/__init__.py +8 -0
  22. pyfemtet/opt/opt/_base.py +202 -0
  23. pyfemtet/opt/opt/_optuna.py +240 -0
  24. pyfemtet/opt/visualization/__init__.py +7 -0
  25. pyfemtet/opt/visualization/_graphs.py +222 -0
  26. pyfemtet/opt/visualization/_monitor.py +1149 -0
  27. {pyfemtet-0.3.12.dist-info → pyfemtet-0.4.1.dist-info}/METADATA +4 -4
  28. pyfemtet-0.4.1.dist-info/RECORD +38 -0
  29. {pyfemtet-0.3.12.dist-info → pyfemtet-0.4.1.dist-info}/WHEEL +1 -1
  30. pyfemtet-0.4.1.dist-info/entry_points.txt +3 -0
  31. pyfemtet/opt/base.py +0 -1490
  32. pyfemtet/opt/monitor.py +0 -474
  33. pyfemtet-0.3.12.dist-info/RECORD +0 -26
  34. /pyfemtet/opt/{_FemtetWithNX → interface/_femtet_with_nx}/update_model.py +0 -0
  35. {pyfemtet-0.3.12.dist-info → pyfemtet-0.4.1.dist-info}/LICENSE +0 -0
@@ -0,0 +1,15 @@
1
+ from pyfemtet.opt.interface._base import FEMInterface, logger
2
+ from pyfemtet.opt.interface._base import NoFEM
3
+ from pyfemtet.opt.interface._femtet import FemtetInterface
4
+ from pyfemtet.opt.interface._femtet_with_sldworks import FemtetWithSolidworksInterface
5
+ from pyfemtet.opt.interface._femtet_with_nx import FemtetWithNXInterface
6
+
7
+
8
+ __all__ = [
9
+ 'FEMInterface',
10
+ 'NoFEM',
11
+ 'FemtetInterface',
12
+ 'FemtetWithNXInterface',
13
+ 'FemtetWithSolidworksInterface',
14
+ 'logger',
15
+ ]
@@ -0,0 +1,71 @@
1
+ from typing import Optional, List
2
+
3
+ import os
4
+ from abc import ABC, abstractmethod
5
+
6
+ import pandas as pd
7
+
8
+ import logging
9
+ from pyfemtet.logger import get_logger
10
+ logger = get_logger('FEM')
11
+ logger.setLevel(logging.INFO)
12
+
13
+
14
+ here, me = os.path.split(__file__)
15
+
16
+
17
+ class FEMInterface(ABC):
18
+ """Abstract base class for the interface with FEM software.
19
+
20
+ Stores information necessary to restore FEMInterface instance in a subprocess.
21
+
22
+ The concrete class should call super().__init__() with the desired arguments when restoring.
23
+
24
+ Args:
25
+ **kwargs: keyword arguments for FEMInterface (re)constructor.
26
+
27
+ """
28
+
29
+ def __init__(
30
+ self,
31
+ **kwargs
32
+ ):
33
+ # restore のための情報保管
34
+ self.kwargs = kwargs
35
+
36
+ @abstractmethod
37
+ def update(self, parameters: pd.DataFrame) -> None:
38
+ """Updates the FEM analysis based on the proposed parameters."""
39
+ raise NotImplementedError('update() must be implemented.')
40
+
41
+ def check_param_value(self, param_name) -> float or None:
42
+ """Checks the value of a parameter in the FEM model (if implemented in concrete class)."""
43
+ pass
44
+
45
+ def update_parameter(self, parameters: pd.DataFrame, with_warning=False) -> Optional[List[str]]:
46
+ """Updates only FEM variables (if implemented in concrete class)."""
47
+ pass
48
+
49
+ def _setup_before_parallel(self, client) -> None:
50
+ """Preprocessing before launching a dask worker (if implemented in concrete class).
51
+
52
+ Args:
53
+ client: dask client.
54
+ i.e. you can update associated files by
55
+ `client.upload_file(file_path)`
56
+ The file will be saved to dask-scratch-space directory
57
+ without any directory structure.
58
+
59
+ """
60
+ pass
61
+
62
+ def _setup_after_parallel(self):
63
+ """Preprocessing after launching a dask worker and before run optimization (if implemented in concrete class)."""
64
+ pass
65
+
66
+
67
+ class NoFEM(FEMInterface):
68
+ """Interface with no FEM for debug."""
69
+
70
+ def update(self, parameters: pd.DataFrame) -> None:
71
+ pass