From 2a3bc563c19d62f235c14c93b76fa54cb5d7e4a3 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Wed, 27 Dec 2023 13:48:15 +0900 Subject: [PATCH] Update __init__.py --- src/pvgmsh/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pvgmsh/__init__.py b/src/pvgmsh/__init__.py index 30f5b2d2..4f5fb094 100644 --- a/src/pvgmsh/__init__.py +++ b/src/pvgmsh/__init__.py @@ -47,6 +47,7 @@ def frontal_delaunay_2d( >>> import pyvista as pv >>> import pvgmsh as pg + >>> from pathlib import Path >>> geometry = pv.Polygon(n_sides=4, radius=8, fill=False) >>> geometry = geometry.rotate_z(45, inplace=False) @@ -154,12 +155,13 @@ def delaunay_3d() -> pv.UnstructuredGrid: >>> gmsh.model.geo.synchronize() >>> gmsh.model.mesh.generate(3) >>> # element_types, element_tags, node_tags = gmsh.model.mesh.getElements() - >>> fp = tempfile.NamedTemporaryFile(mode="w+", suffix=".msh") + >>> fp = tempfile.NamedTemporaryFile(mode="w+", suffix=".msh", delete=False) >>> gmsh.write(fp.name) + >>> fp.close() >>> mesh = pv.read(fp.name) - >>> fp.close() >>> mesh.clear_data() + >>> Path(fp.name).unlink() >>> mesh UnstructuredGrid (...) N Cells: 69