From 87c09f5e3082ba9fb698536ed5808a0151ea03f0 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl <alexfikl@gmail.com> Date: Sat, 13 Jul 2024 15:27:57 +0300 Subject: [PATCH] use Mesh.copy instead of replace --- meshmode/mesh/processing.py | 3 +-- test/test_mesh.py | 3 +-- test/test_meshmode.py | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/meshmode/mesh/processing.py b/meshmode/mesh/processing.py index 1c23fbc..9e03f25 100644 --- a/meshmode/mesh/processing.py +++ b/meshmode/mesh/processing.py @@ -1646,8 +1646,7 @@ def remove_unused_vertices(mesh: Mesh) -> Mesh: new_vertex_indices = np.cumsum(used_flags, dtype=mesh.vertex_id_dtype) - 1 new_vertex_indices[~used_flags] = -1 - return replace( - mesh, + return mesh.copy( vertices=mesh.vertices[:, used_flags], groups=tuple( replace(grp, vertex_indices=new_vertex_indices[grp.vertex_indices]) diff --git a/test/test_mesh.py b/test/test_mesh.py index 6b0d4c8..c471e09 100644 --- a/test/test_mesh.py +++ b/test/test_mesh.py @@ -267,8 +267,7 @@ def test_remove_unused_vertices(): assert mesh.vertices is not None - mesh2 = replace( - mesh, + mesh2 = mesh.copy( vertices=np.concatenate([np.zeros((3, 1)), mesh.vertices], axis=1), groups=tuple( replace( diff --git a/test/test_meshmode.py b/test/test_meshmode.py index 526e7a2..f264b64 100644 --- a/test/test_meshmode.py +++ b/test/test_meshmode.py @@ -889,7 +889,7 @@ def test_mesh_without_vertices(actx_factory): groups = [ replace(grp, nodes=grp.nodes, vertex_indices=None) for grp in mesh.groups] - mesh = make_mesh(None, groups, is_conforming=False) + mesh = make_mesh(None, groups, is_conforming=None) # try refining it from meshmode.mesh.refinement import refine_uniformly -- GitLab