Skip to content

Commit

Permalink
Extend interval test for optional return value
Browse files Browse the repository at this point in the history
  • Loading branch information
schnellerhase committed Aug 5, 2024
1 parent d346ac8 commit b34b090
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions python/test/unit/refinement/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,27 @@
[mesh.GhostMode.none, mesh.GhostMode.shared_vertex, mesh.GhostMode.shared_facet],
)
@pytest.mark.parametrize("redistribute", [True, False])
def test_refine_interval(n, ghost_mode, redistribute, ghost_mode_refined):
@pytest.mark.parametrize("option", [mesh.RefinementOption.none, mesh.RefinementOption.parent_cell])
def test_refine_interval(n, ghost_mode, redistribute, ghost_mode_refined, option):
msh = mesh.create_interval(MPI.COMM_WORLD, n, [0, 1], ghost_mode=ghost_mode)
msh_refined, edges, vertices = mesh.refine(
msh,
redistribute=redistribute,
ghost_mode=ghost_mode_refined,
option=mesh.RefinementOption.parent_cell,
option=option,
)

# vertex count
assert msh_refined.topology.index_map(0).size_global == 2 * n + 1

# edge count
edge_count = np.array([len(edges)], dtype=np.int64)
edge_count = MPI.COMM_WORLD.allreduce(edge_count)
if option is mesh.RefinementOption.parent_cell:
# edge count
edge_count = np.array([len(edges)], dtype=np.int64)
edge_count = MPI.COMM_WORLD.allreduce(edge_count)

assert edge_count == msh_refined.topology.index_map(1).size_global == 2 * n
assert edge_count == msh_refined.topology.index_map(1).size_global == 2 * n
else:
assert edges is None


@pytest.mark.parametrize("n", [50, 100])
Expand Down

0 comments on commit b34b090

Please sign in to comment.