Skip to content

Commit

Permalink
apply pre-commit patch
Browse files Browse the repository at this point in the history
  • Loading branch information
roosre committed Sep 22, 2023
1 parent fe3c22e commit 4994770
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/ansys/dpf/composites/_composite_model_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ def material_names(self) -> Dict[str, int]:
Can be used to filter analysis plies or element layers.
"""
helper_op = dpf.Operator("composite::materials_container_helper")
try:
helper_op = dpf.Operator("composite::materials_container_helper")
except:
raise RuntimeError(
"Operator composite::materials_container_helper does not exist in the registry "
" of 2024 R1-pre0. Please use the latest preview or the unified installer."
)

helper_op.inputs.materials_container(self._material_operators.material_provider.outputs)
string_field = helper_op.outputs.material_names()
material_ids = string_field.scoping.ids
Expand All @@ -162,7 +169,6 @@ def material_names(self) -> Dict[str, int]:

return names


@_deprecated_composite_definition_label
def get_mesh(self, composite_definition_label: Optional[str] = None) -> MeshedRegion:
"""Get the underlying DPF meshed region.
Expand Down
8 changes: 4 additions & 4 deletions tests/composite_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ def test_basic_functionality_of_composite_model(dpf_server, data_files, distribu
assert [ply["id"] for ply in sampling_point.analysis_plies] == analysis_ply_ids

ref_material_names = {
'Epoxy Carbon UD (230 GPa) Prepreg': 3,
'Epoxy Carbon Woven (230 GPa) Wet': 2,
'Honeycomb': 4,
'Structural Steel': 1
"Epoxy Carbon UD (230 GPa) Prepreg": 3,
"Epoxy Carbon Woven (230 GPa) Wet": 2,
"Honeycomb": 4,
"Structural Steel": 1,
}
mat_names = composite_model.material_names
assert len(mat_names) == len(ref_material_names)
Expand Down

0 comments on commit 4994770

Please sign in to comment.