8
8
from ansys .dpf .core import Scoping
9
9
from ansys .dpf .core import errors as dpf_errors
10
10
from ansys .dpf .core .common import locations
11
-
11
+ from ansys . dpf . core . model import Model
12
12
13
13
def scoping_by_load_step (load_step , server = None ):
14
14
"""Create a specific ``ansys.dpf.core.Scoping`` for a given load step.
@@ -19,15 +19,15 @@ def scoping_by_load_step(load_step, server=None):
19
19
Parameters
20
20
----------
21
21
load_step : int
22
- Load step ID of the specific time frequency scoiping .
23
- server : ansys.dpf.core.server , optional
22
+ Load step ID of the specific time frequency scoping .
23
+ server : DpfServer , optional
24
24
Server with the channel connected to the remote or local instance.
25
25
The default is ``None``, in which case an attempt is made to use the
26
26
global server.
27
27
28
28
Returns
29
29
-------
30
- scoping : ansys.dpf.core. Scoping
30
+ scoping : Scoping
31
31
Scoping targeting one load step.
32
32
"""
33
33
scoping = Scoping (server = server , ids = [load_step ], location = locations .time_freq_step )
@@ -42,16 +42,16 @@ def scoping_by_load_steps(load_steps, server=None):
42
42
43
43
Parameters
44
44
----------
45
- load_steps : list of int
45
+ load_steps : list[ int]
46
46
List of load steps IDs of the specific time frequency scoping.
47
- server : ansys.dpf.core.server , optional
47
+ server : DpfServer , optional
48
48
Server with the channel connected to the remote or local instance.
49
49
The default is ``None``, in which case an attempt is made to use the
50
50
global server.
51
51
52
52
Returns
53
53
-------
54
- scoping : ansys.dpf.core. Scoping
54
+ scoping : Scoping
55
55
Scoping targeting several load_steps.
56
56
"""
57
57
if not isinstance (load_steps , list ):
@@ -70,14 +70,14 @@ def scoping_by_set(cumulative_set, server=None):
70
70
----------
71
71
cumulative_set : int
72
72
Cumulative index of the set.
73
- server : ansys.dpf.core.server , optional
73
+ server : DpfServer , optional
74
74
Server with the channel connected to the remote or local instance.
75
75
The default is ``None``, in which case an attempt is made to use the
76
76
global server.
77
77
78
78
Returns
79
79
-------
80
- scoping : ansys.dpf.core. Scoping
80
+ scoping : Scoping
81
81
Scoping targeting one set (referenced by cumulative index).
82
82
"""
83
83
scoping = Scoping (server = server , ids = [cumulative_set ], location = locations .time_freq )
@@ -92,16 +92,16 @@ def scoping_by_sets(cumulative_sets, server=None):
92
92
93
93
Parameters
94
94
----------
95
- cumulative_sets : list of int
95
+ cumulative_sets : list[ int]
96
96
List of cumulative indices of the sets.
97
- server : ansys.dpf.core.server , optional
97
+ server : DpfServer , optional
98
98
Server with the channel connected to the remote or local instance.
99
99
The default is ``None``, in which case an attempt is made to use the
100
100
global server.
101
101
102
102
Returns
103
103
-------
104
- scoping : ansys.dpf.core. Scoping
104
+ scoping : Scoping
105
105
Scoping targeting severals sets (referenced by cumulative indices).
106
106
"""
107
107
if not isinstance (cumulative_sets , list ):
@@ -111,7 +111,7 @@ def scoping_by_sets(cumulative_sets, server=None):
111
111
112
112
113
113
def scoping_by_step_and_substep (
114
- load_step_id , subset_id , time_freq_support , server = None
114
+ load_step_id , subset_id , time_freq_support
115
115
):
116
116
"""Create a specific :class:`ansys.dpf.core.Scoping` for a given step and subset.
117
117
@@ -124,19 +124,18 @@ def scoping_by_step_and_substep(
124
124
ID of the load step.
125
125
subset_id : int
126
126
ID of the subset.
127
- time_freq_support : ansys.dpf.core.TimeFreqSupport
128
- server : ansys.dpf.core.server, optional
129
- Server with the channel connected to the remote or local instance.
130
- The default is ``None``, in which case an attempt is made to use the
131
- global server.
127
+ time_freq_support : TimeFreqSupport
132
128
133
129
Returns
134
130
-------
135
- scoping : ansys.dpf.core. Scoping
131
+ scoping : Scoping
136
132
Scoping based on a given step and substep of a time frequency support.
137
133
"""
138
134
set_index = time_freq_support .get_cumulative_index (load_step_id - 1 , subset_id - 1 )
139
- scoping = Scoping (ids = [set_index + 1 ], location = locations .time_freq )
135
+ scoping = Scoping (
136
+ ids = [set_index + 1 ],
137
+ location = locations .time_freq ,
138
+ server = time_freq_support ._server )
140
139
return scoping
141
140
142
141
@@ -152,16 +151,37 @@ def scoping_by_step_and_substep_from_model(load_step_id, subset_id, model, serve
152
151
ID of the step.
153
152
subset_id : int
154
153
ID of the subset.
155
- time_freq_support : ansys.dpf.core.TimeFreqSupport()
156
- server : ansys.dpf.core.server , optional
154
+ model : Model
155
+ server : DpfServer , optional
157
156
Server with the channel connected to the remote or local instance.
158
157
The default is ``None``, in which case an attempt is made to use the
159
158
global server.
160
159
161
160
Returns
162
161
-------
163
- scoping : ansys.dpf.core. Scoping
162
+ scoping : Scoping
164
163
Scoping based on a given step/substep of a model's time_freq_support."""
165
164
return scoping_by_step_and_substep (
166
165
load_step_id , subset_id , model .metadata .time_freq_support
167
166
)
167
+
168
+
169
+ def scoping_on_all_time_freqs (tf_support_or_model ):
170
+ """Create a specific :class:`ansys.dpf.core.Scoping` with all time or
171
+ frequency sets of a :class:`ansys.dpf.core.TimeFreqSupport` or a class:`ansys.dpf.core.Model`
172
+
173
+ Parameters
174
+ ----------
175
+ tf_support_or_model : TimeFreqSupport, Model
176
+
177
+ Returns
178
+ -------
179
+ scoping : Scoping
180
+ Scoping with all time or frequency sets IDs.
181
+ """
182
+ if isinstance (tf_support_or_model , Model ):
183
+ tf_support_or_model = tf_support_or_model .metadata .time_freq_support
184
+ return Scoping (
185
+ ids = range (1 , len (tf_support_or_model .time_frequencies ) + 1 ),
186
+ location = locations .time_freq ,
187
+ server = tf_support_or_model ._server )
0 commit comments