Skip to content

Commit 85eafcf

Browse files
rafacantonPProfizi
andauthored
Fix memory issues in mesh_to_pyvista (#920)
* Bug in the use of mesh_to_pyvista: nodes needs 3 dimensions * Try and fix 02-volume_averaged_stress.py for Docker * Fix 04-extrapolation_stress_3d.py for Docker * New Nodes api * Fix to memory issue with DpfVector in mesh_to_pyvista * definitive version of memory * Revert changes in examples * Also nodes_pv --------- Co-authored-by: paul.profizi <[email protected]>
1 parent 3620fff commit 85eafcf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ansys/dpf/core/vtk_helper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,14 @@ def dpf_mesh_to_vtk_op(mesh, nodes, as_linear):
155155
cells_pv = mesh_to_pyvista.outputs.cells()
156156
celltypes_pv = mesh_to_pyvista.outputs.cell_types()
157157
if VTK9:
158-
return pv.UnstructuredGrid(cells_pv, celltypes_pv, nodes_pv)
158+
grid = pv.UnstructuredGrid(cells_pv, celltypes_pv, nodes_pv)
159+
setattr(grid, "_dpf_cache_op", [cells_pv, celltypes_pv, nodes_pv])
160+
return grid
159161
else:
160162
offsets_pv = mesh_to_pyvista.outputs.offsets()
161-
return pv.UnstructuredGrid(offsets_pv, cells_pv, celltypes_pv, nodes_pv)
163+
grid = pv.UnstructuredGrid(offsets_pv, cells_pv, celltypes_pv, nodes_pv)
164+
setattr(grid, "_dpf_cache_op", [cells_pv, celltypes_pv, nodes_pv, offsets_pv])
165+
return grid
162166

163167

164168
def dpf_mesh_to_vtk_py(mesh, nodes, as_linear):

0 commit comments

Comments
 (0)