Skip to content

Commit a615396

Browse files
authored
Merge branch 'main' into AnsMelanie/op-doc/update-template-j2
2 parents 2de010f + 1ce2bc7 commit a615396

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

.ci/generate_operators_doc.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,20 @@ def initialize_server(ansys_path=None, include_composites=False, include_sound=F
2020
if include_composites:
2121
print("Loading Composites Plugin")
2222
load_library(
23-
Path(server.ansys_path)
23+
filename=Path(server.ansys_path)
2424
/ "dpf"
2525
/ "plugins"
2626
/ "dpf_composites"
27-
/ "composite_operators.dll"
27+
/ "composite_operators.dll",
28+
name="composites",
2829
)
2930
if include_sound:
3031
print("Loading Acoustics Plugin")
31-
load_library(Path(server.ansys_path) / "Acoustics" / "SAS" / "ads" / "dpf_sound.dll")
32+
load_library(
33+
filename=Path(server.ansys_path) / "Acoustics" / "SAS" / "ads" / "dpf_sound.dll",
34+
name="sound",
35+
)
36+
print(f"Loaded plugins: {list(server.plugins.keys())}")
3237
return server
3338

3439

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ requires = ["setuptools>=61.0.0", "wheel"]
55
[project]
66
# Check https://setuptools.pypa.io/en/stable/userguide/quickstart.html for all available sections
77
name = "ansys-dpf-core"
8-
version = "0.13.9.dev0"
8+
version = "0.14.2.dev0"
99
description = "Data Processing Framework - Python Core "
1010
readme = "README.md"
1111
requires-python = ">=3.9, <4"

src/ansys/dpf/core/vtk_helper.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,22 @@ def dpf_mesh_to_vtk_op(mesh, nodes=None, as_linear=True):
185185
celltypes_pv = mesh_to_pyvista.outputs.cell_types()
186186
if VTK9:
187187
grid = pv.UnstructuredGrid(cells_pv, celltypes_pv, nodes_pv)
188-
# setattr(grid, "_dpf_cache_op", [cells_pv, celltypes_pv, nodes_pv])
189-
pv.set_new_attribute(
190-
obj=grid, name="_dpf_cache_op", value=[cells_pv, celltypes_pv, nodes_pv]
191-
)
188+
if hasattr(pv, "set_new_attribute"): # For pyvista >=0.46.0
189+
pv.set_new_attribute(
190+
obj=grid, name="_dpf_cache_op", value=[cells_pv, celltypes_pv, nodes_pv]
191+
)
192+
else: # For pyvista <0.46.0 # pragma: nocover
193+
setattr(grid, "_dpf_cache_op", [cells_pv, celltypes_pv, nodes_pv])
192194
return grid
193195
else:
194196
offsets_pv = mesh_to_pyvista.outputs.offsets()
195197
grid = pv.UnstructuredGrid(offsets_pv, cells_pv, celltypes_pv, nodes_pv)
196-
# setattr(grid, "_dpf_cache_op", [cells_pv, celltypes_pv, nodes_pv, offsets_pv])
197-
pv.set_new_attribute(
198-
obj=grid, name="_dpf_cache_op", value=[cells_pv, celltypes_pv, nodes_pv, offsets_pv]
199-
)
198+
if hasattr(pv, "set_new_attribute"): # For pyvista >=0.46.0
199+
pv.set_new_attribute(
200+
obj=grid, name="_dpf_cache_op", value=[cells_pv, celltypes_pv, nodes_pv, offsets_pv]
201+
)
202+
else: # For pyvista <0.46.0 # pragma: nocover
203+
setattr(grid, "_dpf_cache_op", [cells_pv, celltypes_pv, nodes_pv, offsets_pv])
200204
return grid
201205

202206

@@ -356,11 +360,12 @@ def compute_offset():
356360

357361
# Quick fix required to hold onto the data as PyVista does not make a copy.
358362
# All of those now return DPFArrays
359-
# setattr(grid, "_dpf_cache", [node_coordinates, coordinates_field])
360-
pv.set_new_attribute(
361-
obj=grid, name="_dpf_cache", value=[node_coordinates, coordinates_field]
362-
)
363-
363+
if hasattr(pv, "set_new_attribute"): # For pyvista >=0.46.0
364+
pv.set_new_attribute(
365+
obj=grid, name="_dpf_cache_op", value=[node_coordinates, coordinates_field]
366+
)
367+
else: # For pyvista <0.46.0 # pragma: nocover
368+
setattr(grid, "_dpf_cache_op", [node_coordinates, coordinates_field])
364369
return grid
365370

366371
# might be computed when checking for VTK quadratic bug

0 commit comments

Comments
 (0)