Skip to content
Closed
382 changes: 191 additions & 191 deletions doc/source/_static/dpf_operators.html

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/ansys/dpf/core/any.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def _type_to_new_from_get_as_method(self, obj):
from ansys.dpf.core import (
collection,
custom_type_field,
data_sources,
data_tree,
dpf_operator,
field,
Expand Down Expand Up @@ -205,6 +206,11 @@ def _type_to_new_from_get_as_method(self, obj):
self._api.any_new_from_operator,
self._api.any_get_as_operator,
)
elif issubclass(obj, data_sources.DataSources):
return (
self._api.any_new_from_data_sources,
self._api.any_get_as_data_sources,
)
elif issubclass(obj, Any):
return (
lambda x: x,
Expand Down
10 changes: 10 additions & 0 deletions src/ansys/dpf/gate/any_grpcapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def _type_to_message_type():
field,
fields_container,
property_field,
data_sources,
generic_data_container,
string_field,
scoping,
Expand All @@ -62,6 +63,7 @@ def _type_to_message_type():
(collection_base.CollectionBase, base_pb2.Type.COLLECTION, base_pb2.Type.ANY),
(dpf_vector.DPFVectorInt, base_pb2.Type.COLLECTION, base_pb2.Type.INT),
(dpf_operator.Operator, base_pb2.Type.OPERATOR),
(data_sources.DataSources, base_pb2.Type.DATA_SOURCES),
]

@staticmethod
Expand Down Expand Up @@ -137,6 +139,10 @@ def any_get_as_generic_data_container(any):
def any_get_as_scoping(any):
return AnyGRPCAPI._get_as(any).scoping

@staticmethod
def any_get_as_data_sources(any):
return AnyGRPCAPI._get_as(any).data_sources

@staticmethod
def any_get_as_data_tree(any):
return AnyGRPCAPI._get_as(any).data_tree
Expand Down Expand Up @@ -239,6 +245,10 @@ def any_new_from_generic_data_container(any):
def any_new_from_scoping(any):
return AnyGRPCAPI._new_from(any, any._server)

@staticmethod
def any_new_from_data_sources(any):
return AnyGRPCAPI._new_from(any, any._server)

@staticmethod
def any_new_from_data_tree(any):
return AnyGRPCAPI._new_from(any, any._server)
Expand Down
Binary file modified src/ansys/dpf/gatebin/Ans.Dpf.GrpcClient.dll
Binary file not shown.
Binary file modified src/ansys/dpf/gatebin/DPFClientAPI.dll
Binary file not shown.
Binary file modified src/ansys/dpf/gatebin/libAns.Dpf.GrpcClient.so
Binary file not shown.
Binary file modified src/ansys/dpf/gatebin/libDPFClientAPI.so
Binary file not shown.
10 changes: 10 additions & 0 deletions tests/test_any.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ def test_cast_scoping_any(server_type):
assert entity.location == new_entity.location


@conftest.raises_for_servers_version_under("8.2")
def test_cast_data_sources_any(server_type):
# Not available through grpc yet
entity = dpf.DataSources(server=server_type, result_path="test.pth")
any_dpf = dpf.Any.new_from(entity)
new_entity = any_dpf.cast()

assert entity.result_files[0] == new_entity.result_files[0]


@pytest.mark.skipif(
not conftest.SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0,
reason="for_each not implemented below 8.0. Failing for gRPC CLayer below 10.0 for any.whl",
Expand Down
Loading