/
AnalysisRMxprt.py
168 lines (139 loc) · 4.38 KB
/
AnalysisRMxprt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
from pyaedt.application.Analysis import Analysis
from pyaedt.generic.general_methods import pyaedt_function_handler
from pyaedt.generic.settings import settings
class FieldAnalysisRMxprt(Analysis):
"""Manages RMXprt field analysis setup. (To be implemented.)
This class is automatically initialized by an application call (like HFSS,
Q3D...). Refer to the application function for inputs definition.
Parameters
----------
Returns
-------
"""
def __init__(
self,
application,
projectname,
designname,
solution_type,
setup_name=None,
specified_version=None,
non_graphical=False,
new_desktop_session=False,
close_on_exit=False,
student_version=False,
machine="",
port=0,
aedt_process_id=None,
):
Analysis.__init__(
self,
application,
projectname,
designname,
solution_type,
setup_name,
specified_version,
non_graphical,
new_desktop_session,
close_on_exit,
student_version,
machine,
port,
aedt_process_id,
)
self._modeler = None
self._post = None
if not settings.lazy_load:
self._modeler = self.modeler
self._post = self.post
@property
def post(self):
"""Post Object.
Returns
-------
:class:`pyaedt.modules.PostProcessor.CircuitPostProcessor`
"""
if self._post is None: # pragma: no cover
self.logger.reset_timer()
from pyaedt.modules.PostProcessor import CircuitPostProcessor
self._post = CircuitPostProcessor(self)
self.logger.info_timer("Post class has been initialized!")
return self._post
@property
def modeler(self):
"""Modeler.
Returns
-------
:class:`pyaedt.modules.modeler2d.ModelerRMxprt`
"""
if self._modeler is None:
from pyaedt.modeler.modeler2d import ModelerRMxprt
self._modeler = ModelerRMxprt(self)
return self._modeler
@pyaedt_function_handler()
def disable_modelcreation(self, solution_type=None):
"""Enable the RMxprt solution.
Parameters
----------
solution_type :
Type of the solution. The default is ``None``.
Returns
-------
bool
``True`` when successful, ``False`` when failed.
"""
self._design_type = "RMxprtSolution"
self.solution_type = solution_type
return True
@pyaedt_function_handler()
def enable_modelcreation(self, solution_type=None):
"""Enable model creation for the Maxwell model wizard.
Parameters
----------
solution_type : str
Type of the solution. The default is ``None``.
Returns
-------
bool
``True`` when successful, ``False`` when failed.
"""
self._design_type = "ModelCreation"
self.solution_type = solution_type
return True
@pyaedt_function_handler()
def set_material_threshold(self, conductivity=100000, permeability=100):
"""Set material threshold.
Parameters
----------
conductivity : float, optional
Conductivity threshold.
The default value is 100000.
permeability : float, optional
Permeability threshold.
The default value is 100.
Returns
-------
bool
``True`` when successful, ``False`` when failed.
"""
try:
self.odesign.SetThreshold(conductivity, permeability)
return True
except Exception:
return False
@pyaedt_function_handler()
def _check_solution_consistency(self):
"""Check solution consistency."""
if self.design_solutions:
return self._odesign.GetSolutionType() == self.design_solutions._solution_type
else:
return True
@pyaedt_function_handler()
def _check_design_consistency(self):
"""Check design consistency."""
consistent = False
destype = self._odesign.GetDesignType()
if destype == "RMxprt":
consistent = self._check_solution_consistency()
return consistent