Skip to content

Commit e425e2b

Browse files
committed
merge fixes
1 parent d87480c commit e425e2b

File tree

6 files changed

+9
-102
lines changed

6 files changed

+9
-102
lines changed

ansys/dpf/core/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
)
6262
from ansys.dpf.core import server
6363
from ansys.dpf.core import check_version
64-
from ansys.dpf.core import settings
6564
from ansys.dpf.core import path_utilities
6665
from ansys.dpf.core import settings
6766

ansys/dpf/core/data_sources.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ def add_file_path_for_specified_result(self, filepath, key="", result_key=""):
196196
def add_upstream(self, upstream_data_sources, result_key=""):
197197
"""Add upstream data sources.
198198
199+
This is used to add a set of path creating an upstream for
200+
recursive workflows.
201+
199202
Parameters
200203
----------
201204
upstream_data_sources : DataSources

ansys/dpf/core/examples/downloads.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def download_fluent_files() -> dict:
317317

318318
def download_extrapolation_3d_result() -> dict:
319319
"""Download example static results of reference and integrated points
320-
for extrapolation of 3d-element and return return the dictionnary of 2 download paths.
320+
for extrapolation of 3d-element and return return the dictionary of 2 download paths.
321321
322322
Examples files are downloaded to a persistent cache to avoid
323323
re-downloading the same file twice.
@@ -330,7 +330,7 @@ def download_extrapolation_3d_result() -> dict:
330330
331331
Examples
332332
--------
333-
Download 2 example result files and return the dictionnary containing 2 files
333+
Download 2 example result files and return the dictionary containing 2 files
334334
335335
>>> from ansys.dpf.core import examples
336336
>>> dict = examples.download_extrapolation_ref_result
@@ -351,7 +351,7 @@ def download_extrapolation_3d_result() -> dict:
351351

352352
def download_extrapolation_2d_result() -> dict:
353353
"""Download example static results of reference and integrated points
354-
for extrapolation of 2d-element and return the dictionnary of 2 download paths.
354+
for extrapolation of 2d-element and return the dictionary of 2 download paths.
355355
356356
Examples files are downloaded to a persistent cache to avoid
357357
re-downloading the same file twice.
@@ -364,7 +364,7 @@ def download_extrapolation_2d_result() -> dict:
364364
365365
Examples
366366
--------
367-
Download 2 example result files and return the dictionnary containing 2 files
367+
Download 2 example result files and return the dictionary containing 2 files
368368
369369
>>> from ansys.dpf.core import examples
370370
>>> dict = examples.download_extrapolation_ref_result

ansys/dpf/core/results.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,11 @@ class Results:
6060
6161
Examples
6262
--------
63-
Create a stress result from the model and choose its time and mesh scopings.
6463
6564
>>> from ansys.dpf import core as dpf
6665
>>> from ansys.dpf.core import examples
6766
>>> model = dpf.Model(examples.electric_therm)
6867
>>> v = model.results.electric_potential
69-
>>> rf = model.results.reaction_force
7068
>>> dissip = model.results.thermal_dissipation_energy
7169
7270
Examples

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def resolve_test_file(basename, additional_path="", is_in_examples=None):
5858
)
5959
if not os.path.isfile(filename):
6060
raise FileNotFoundError(f"Unable to locate {basename} at {test_files_path}")
61-
return filen
61+
return filename
6262

6363

6464
@pytest.fixture()

tests/test_field.py

Lines changed: 1 addition & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import numpy as np
22
import pytest
3-
43
from ansys import dpf
54
from ansys.dpf import core
65
from ansys.dpf.core import FieldDefinition
76
from ansys.dpf.core import operators as ops
87
from ansys.dpf.core.common import locations, shell_layers
8+
99
from conftest import local_server
1010

1111

@@ -1005,99 +1005,6 @@ def test_dot_operator_field():
10051005
assert np.allclose(out.data, -field.data)
10061006

10071007

1008-
def test_add_operator_server_field():
1009-
field = dpf.core.fields_factory.create_3d_vector_field(2, server=local_server)
1010-
field.data = [0., 1., 2., 3., 4., 5.]
1011-
field.scoping.ids = [1, 2]
1012-
1013-
# field+op
1014-
forward = ops.utility.forward_field(field, server=local_server)
1015-
add = field + forward
1016-
assert isinstance(add, ops.math.add)
1017-
out = add.outputs.field()
1018-
assert out.scoping.ids == [1, 2]
1019-
assert np.allclose(out.data, np.array(field.data) * 2.0)
1020-
1021-
# field + list
1022-
add = field + [0., 1., 2.]
1023-
assert isinstance(add, ops.math.add)
1024-
out = add.outputs.field()
1025-
assert len(out) == 6
1026-
assert out.scoping.ids == [1, 2]
1027-
assert np.allclose(out.data, field.data + np.array([[0., 1., 2.], [0., 1., 2.]]))
1028-
1029-
# field + float
1030-
add = field + 1.0
1031-
assert isinstance(add, ops.math.add)
1032-
out = add.outputs.field()
1033-
assert out.scoping.ids == [1, 2]
1034-
assert np.allclose(out.data, np.array([[1., 2., 3.], [4., 5., 6.]]))
1035-
1036-
1037-
def test_minus_operator_server_field():
1038-
field = dpf.core.fields_factory.create_3d_vector_field(2, server=local_server)
1039-
field.data = [0., 1., 2., 3., 4., 5.]
1040-
field.scoping.ids = [1, 2]
1041-
1042-
# field-op
1043-
forward = ops.utility.forward_field(field, server=local_server)
1044-
add = field - forward
1045-
assert isinstance(add, ops.math.minus)
1046-
out = add.outputs.field()
1047-
assert len(out) == 6
1048-
assert out.scoping.ids == [1, 2]
1049-
assert np.allclose(out.data, np.zeros((2, 3)))
1050-
1051-
# fc - list
1052-
add = field - [0., 1., 2.]
1053-
assert isinstance(add, ops.math.minus)
1054-
out = add.outputs.field()
1055-
assert out.scoping.ids == [1, 2]
1056-
assert np.allclose(out.data, np.array([[0., 0., 0.], [3., 3., 3.]]))
1057-
1058-
# operator - float
1059-
add = field - 1.0
1060-
assert isinstance(add, ops.math.minus)
1061-
out = add.outputs.field()
1062-
assert out.scoping.ids == [1, 2]
1063-
assert np.allclose(out.data, np.array([[-1., 0., 1.], [2., 3., 4.]]))
1064-
1065-
1066-
def test_dot_operator_server_field():
1067-
field = dpf.core.fields_factory.create_3d_vector_field(2, server=local_server)
1068-
field.data = [0., 1., 2., 3., 4., 5.]
1069-
field.scoping.ids = [1, 2]
1070-
1071-
# field * op
1072-
forward = ops.utility.forward_field(field, server=local_server)
1073-
add = field * forward
1074-
assert type(add) == ops.math.generalized_inner_product
1075-
out = add.outputs.field()
1076-
assert out.scoping.ids == [1, 2]
1077-
assert np.allclose(out.data, np.array([5., 50.]))
1078-
1079-
# field * field
1080-
add = field * field
1081-
assert isinstance(add, ops.math.generalized_inner_product)
1082-
out = add.outputs.field()
1083-
assert out.scoping.ids == [1, 2]
1084-
assert np.allclose(out.data, np.array([5., 50.]))
1085-
1086-
# field * list
1087-
add = field * [0., 1., 2.]
1088-
assert isinstance(add, ops.math.generalized_inner_product)
1089-
out = add.outputs.field()
1090-
assert out.scoping.ids == [1, 2]
1091-
assert np.allclose(out.data, np.array([5., 14.]))
1092-
1093-
# field * float
1094-
add = field * -1.0
1095-
assert isinstance(add, ops.math.generalized_inner_product)
1096-
out = add.outputs.field()
1097-
assert out.scoping.ids == [1, 2]
1098-
assert np.allclose(out.data, -field.data)
1099-
1100-
11011008
def test_add_operator_server_field():
11021009
field = dpf.core.fields_factory.create_3d_vector_field(2, server=local_server)
11031010
field.data = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]

0 commit comments

Comments
 (0)