|
6 | 6 | from ansys.dpf.core import examples
|
7 | 7 | from ansys.dpf.core import fields_factory
|
8 | 8 | from ansys.dpf.core.common import locations
|
| 9 | +from ansys.dpf.core.check_version import meets_version, get_server_version |
9 | 10 |
|
| 11 | +SERVER_VERSION_HIGHER_THAN_3_0 = meets_version(get_server_version(dpf.core._global_server()), "3.0") |
10 | 12 |
|
11 | 13 | @pytest.fixture()
|
12 | 14 | def vel_acc_model(velocity_acceleration):
|
@@ -272,3 +274,27 @@ def test_deep_copy_time_freq_support_multi_stage():
|
272 | 274 |
|
273 | 275 | assert len(tf.get_harmonic_indices(0).data) == 6
|
274 | 276 | assert len(tf.get_harmonic_indices(1).data) == 6
|
| 277 | + |
| 278 | + |
| 279 | +@pytest.mark.skipif(not SERVER_VERSION_HIGHER_THAN_3_0, |
| 280 | + reason='Requires server version higher than 3.0') |
| 281 | +def test_operator_connect_get_output_time_freq_support(velocity_acceleration): |
| 282 | + model = Model(velocity_acceleration) |
| 283 | + tf = model.metadata.time_freq_support |
| 284 | + op = dpf.core.operators.utility.forward(tf) |
| 285 | + tfout = op.get_output(0, dpf.core.types.time_freq_support) |
| 286 | + assert np.allclose(tf.time_frequencies.data, tfout.time_frequencies.data) |
| 287 | + |
| 288 | + |
| 289 | +@pytest.mark.skipif(not SERVER_VERSION_HIGHER_THAN_3_0, |
| 290 | + reason='Requires server version higher than 3.0') |
| 291 | +def test_workflow_connect_get_output_time_freq_support(velocity_acceleration): |
| 292 | + model = Model(velocity_acceleration) |
| 293 | + tf = model.metadata.time_freq_support |
| 294 | + wf = dpf.core.Workflow() |
| 295 | + op = dpf.core.operators.utility.forward() |
| 296 | + wf.set_input_name("tf", op, 0) |
| 297 | + wf.set_output_name("tf", op, 0) |
| 298 | + wf.connect("tf", tf) |
| 299 | + tfout = wf.get_output("tf", dpf.core.types.time_freq_support) |
| 300 | + assert np.allclose(tf.time_frequencies.data, tfout.time_frequencies.data) |
0 commit comments