diff --git a/src/ansys/dpf/post/dataframe.py b/src/ansys/dpf/post/dataframe.py index 6695ec91b..ba014ab3f 100644 --- a/src/ansys/dpf/post/dataframe.py +++ b/src/ansys/dpf/post/dataframe.py @@ -36,9 +36,7 @@ import ansys.dpf.core as dpf from ansys.dpf.core.dpf_array import DPFArray from ansys.dpf.core.plotter import DpfPlotter -from ansys.dpf.core.property_fields_container import ( - _MockPropertyFieldsContainer as PropertyFieldsContainer, -) +from ansys.dpf.core.property_fields_container import PropertyFieldsContainer import ansys.dpf.gate.errors import numpy as np @@ -345,7 +343,10 @@ def select(self, **kwargs) -> DataFrame: f"'{mesh_index_name}' is not yet supported" ) if isinstance(input_fc, PropertyFieldsContainer): - fc = input_fc.rescope(mesh_scoping) + rescope_fc = dpf.operators.scoping.rescope_property_field( + fields=input_fc, mesh_scoping=mesh_scoping, server=server + ) + fc = rescope_fc.outputs[0].get_data() else: rescope_fc = dpf.operators.scoping.rescope_fc( fields_container=input_fc, @@ -598,7 +599,10 @@ def _update_str(self, max_columns: int, max_rows: int): if label_name == ref_labels.set_ids: label_name = ref_labels.time label_space[label_name] = int(value) - fields = self._fc.get_fields(label_space=label_space) + if isinstance(self._fc, dpf.FieldsContainer): + fields = self._fc.get_fields(label_space=label_space) + else: + fields = self._fc.get_entries(label_space=label_space) # Start counting values found n_values = 0 @@ -832,7 +836,10 @@ def plot(self, shell_layer=shell_layers.top, **kwargs) -> Union[DpfPlotter, None fc = merge_stages_op.outputs.fields_container() label_space.pop("stage") - fields = fc.get_fields(label_space=label_space) + if isinstance(fc, dpf.FieldsContainer): + fields = fc.get_fields(label_space=label_space) + else: + fields = fc.get_entries(label_space=label_space) # for field in fields: if len(fields) > 1: # try: diff --git a/src/ansys/dpf/post/mesh.py b/src/ansys/dpf/post/mesh.py index 9d8c1ac8a..748508223 100644 --- a/src/ansys/dpf/post/mesh.py +++ b/src/ansys/dpf/post/mesh.py @@ -33,9 +33,7 @@ import ansys.dpf.core as dpf from ansys.dpf.core.faces import Face from ansys.dpf.core.nodes import Node -from ansys.dpf.core.property_fields_container import ( - _MockPropertyFieldsContainer as PropertyFieldsContainer, -) +from ansys.dpf.core.property_fields_container import PropertyFieldsContainer import ansys.dpf.post as post from ansys.dpf.post import index, locations @@ -266,7 +264,7 @@ def element_types(self) -> post.DataFrame: label = "elem_type_id" fields_container = PropertyFieldsContainer() field = self._meshed_region.elements.element_types_field - fields_container.add_field(label_space={}, field=field) + fields_container.add_entry(label_space={}, entry=field) return post.DataFrame( data=fields_container, @@ -305,7 +303,7 @@ def materials(self) -> post.DataFrame: label = "material_id" fields_container = PropertyFieldsContainer() field = self._meshed_region.elements.materials_field - fields_container.add_field(label_space={}, field=field) + fields_container.add_entry(label_space={}, entry=field) return post.DataFrame( data=fields_container, diff --git a/tests/conftest.py b/tests/conftest.py index 25950e1c5..8c512a114 100755 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -391,6 +391,10 @@ def license_context(): get_server_version(core._global_server()), "9.0" ) +SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_1 = meets_version( + get_server_version(core._global_server()), "8.1" +) + SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0 = meets_version( get_server_version(core._global_server()), "8.0" ) diff --git a/tests/test_mesh.py b/tests/test_mesh.py index d2baf3460..9332d91d9 100644 --- a/tests/test_mesh.py +++ b/tests/test_mesh.py @@ -28,7 +28,10 @@ from ansys.dpf.post import FluidSimulation, Mesh, StaticMechanicalSimulation from ansys.dpf.post.connectivity import ConnectivityListByIndex from ansys.dpf.post.faces import Face -from conftest import SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0 +from conftest import ( + SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0, + SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_1, +) @fixture @@ -166,6 +169,10 @@ def test_mesh_coordinates(mesh): assert str(coord) == ref +@pytest.mark.skipif( + not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_1, + reason="PropertyFieldsContainer supported for server versions greater than 8.1", +) def test_mesh_materials(mesh): materials = mesh.materials ref = """ @@ -189,6 +196,10 @@ def test_mesh_materials(mesh): assert str(materials_5) == ref +@pytest.mark.skipif( + not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_1, + reason="PropertyFieldsContainer supported for server versions greater than 8.1", +) def test_mesh_element_types(mesh): element_types = mesh.element_types # print(element_types)