From 6b839db8bed25e461a4a148d6fc4e8e3d54ddde3 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 21 Jun 2020 15:46:30 -0500 Subject: [PATCH] Test, fix that no-adjacency refiner produces a properly conformal mesh when it promises it will --- meshmode/mesh/generation.py | 2 +- meshmode/mesh/refinement/no_adjacency.py | 2 ++ test/test_refinement.py | 14 +++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/meshmode/mesh/generation.py b/meshmode/mesh/generation.py index ca5ddfb4..4fa520bc 100644 --- a/meshmode/mesh/generation.py +++ b/meshmode/mesh/generation.py @@ -446,7 +446,7 @@ def generate_icosphere(r, order, uniform_refinement_rounds=0): mesh = generate_icosahedron(r, order) if uniform_refinement_rounds: - # These come out conformal, so we're OK to use the faster refiner. + # These come out conforming, so we're OK to use the faster refiner. from meshmode.mesh.refinement import RefinerWithoutAdjacency refiner = RefinerWithoutAdjacency(mesh) for i in range(uniform_refinement_rounds): diff --git a/meshmode/mesh/refinement/no_adjacency.py b/meshmode/mesh/refinement/no_adjacency.py index f37f6621..87f843d3 100644 --- a/meshmode/mesh/refinement/no_adjacency.py +++ b/meshmode/mesh/refinement/no_adjacency.py @@ -238,6 +238,8 @@ class RefinerWithoutAdjacency(object): global_midpoint = inew_vertex additional_vertices.append( midpoints[old_iel][:, imidpoint]) + self.global_vertex_pair_to_midpoint[ + global_v1, global_v2] = global_midpoint inew_vertex += 1 refining_vertices[iref_midpoint] = global_midpoint diff --git a/test/test_refinement.py b/test/test_refinement.py index 5e10a946..2bc29e89 100644 --- a/test/test_refinement.py +++ b/test/test_refinement.py @@ -294,7 +294,7 @@ def test_refinement_connection( @pytest.mark.parametrize("with_adjacency", [True, False]) -def test_uniform_refinement(ctx_factory, with_adjacency): +def test_uniform_refinement(with_adjacency): make_mesh = partial(generate_box_mesh, ( np.linspace(0.0, 1.0, 2), np.linspace(0.0, 1.0, 3), @@ -305,6 +305,18 @@ def test_uniform_refinement(ctx_factory, with_adjacency): mesh = refine_uniformly(mesh, 1, with_adjacency=with_adjacency) +@pytest.mark.parametrize("refinement_rounds", [0, 1, 2]) +def test_conformity_of_uniform_mesh(refinement_rounds): + from meshmode.mesh.generation import generate_icosphere + mesh = generate_icosphere(r=1.0, order=4, + uniform_refinement_rounds=refinement_rounds) + + assert mesh.is_conforming + + from meshmode.mesh import is_boundary_tag_empty, BTAG_ALL + assert is_boundary_tag_empty(mesh, BTAG_ALL) + + if __name__ == "__main__": import sys if len(sys.argv) > 1: -- GitLab