Test: map the q<.5 variant of a sparse cut link separately

The fixture listed (fluid_idx=13, dir=3) twice with different q, so the
existing repeated-link rejection fired before the sparse checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-10-16 03:14:55 +00:00
co-authored by Claude Opus 5.5
parent c397e08565
commit fa7fd9097a
+8 -5
View File
@@ -382,13 +382,16 @@ class SparseBlockLayoutTests(unittest.TestCase):
def test_cut_links_in_or_next_to_absent_blocks_are_rejected(self):
layout = BlockLayout2D.build(6, 12, 3, 4, periodic=(False, False), origins=L_ORIGINS)
ok = [link(1, 1, 3, .6), link(1, 1, 3, .3), link(1, 7, 2, .6), link(1, 4, 2, .3)]
ok = [link(1, 1, 3, .6), link(1, 7, 2, .6), link(1, 4, 2, .3)]
mapped = layout.map_cut_links(ok) # fully owned stencils, incl. across a seam
cells = int(np.prod(layout.local_shape))
np.testing.assert_array_equal(mapped.block, [0, 0, 1, 1])
np.testing.assert_array_equal(mapped.receiver, [layout.owner[1, 1]] * 2
+ [layout.owner[1, 7], layout.owner[1, 4]])
self.assertEqual(int(mapped.donor[1]), int(layout.owner[0, 1]))
np.testing.assert_array_equal(mapped.block, [0, 1, 1])
np.testing.assert_array_equal(mapped.receiver, [layout.owner[1, 1], layout.owner[1, 7],
layout.owner[1, 4]])
self.assertEqual(int(mapped.donor[2]), int(layout.owner[1, 5]))
# Same physical link with q<.5 is mapped separately (repeats are rejected).
donor = layout.map_cut_links([link(1, 1, 3, .3)]).donor
self.assertEqual(int(donor[0]), int(layout.owner[0, 1]))
self.assertTrue((mapped.write < np.uint64(layout.nblocks * NQ * cells)).all())
for bad in (link(4, 1, 1, .6), # receiver in an absent block
link(2, 1, 3, .6), # solid neighbor (3,1) absent