From 7821c6ad71724db123c03b3249006aa1620ef67e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 01:35:04 +0000 Subject: [PATCH] P1 (2/n): runners and example use the level-list constructor run_refined_dfg, run_dfg_re20, time_window_dfg, time_refined_dfg, run_jet_circle_cv and examples/fixed_patch_circle pass refinements / level_blocks / level_objects / level_jets instead of bounds, base_block, fine_block, fine_objects and jets. One-to-one with _legacy_levels: same rectangle (FixedPatch2D frame), same blocks, bodies and Jets. Co-Authored-By: Claude Opus 5.5 --- examples/fixed_patch_circle.py | 4 ++-- tests/validation/run_dfg_re20.py | 4 ++-- tests/validation/run_jet_circle_cv.py | 9 ++++----- tests/validation/run_refined_dfg.py | 9 ++++----- tests/validation/time_refined_dfg.py | 5 +++-- tests/validation/time_window_dfg.py | 4 ++-- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/examples/fixed_patch_circle.py b/examples/fixed_patch_circle.py index de82436..6a5e3fb 100644 --- a/examples/fixed_patch_circle.py +++ b/examples/fixed_patch_circle.py @@ -90,8 +90,8 @@ def main(): # The caller owns the CUDA context; the stepper must be closed first (the # nested with-statement does that). with CudaContext(0) as context, FixedPatchStepper( - cfg, BOUNDS, context=context, coarse_boundary=args.mode, - fine_objects=[body], fine_block=fine_block) as run: + cfg, context=context, coarse_boundary=args.mode, refinements=[BOUNDS], + level_blocks=[None, fine_block], level_objects=[(), (body,)]) as run: p = run.patch # Rest equilibrium is already postcollision G, so no initial collision is # needed. Non-leaf entries (covered, ghost, solid) are discarded by initialize. diff --git a/tests/validation/run_dfg_re20.py b/tests/validation/run_dfg_re20.py index fdf43b3..ddbf24c 100644 --- a/tests/validation/run_dfg_re20.py +++ b/tests/validation/run_dfg_re20.py @@ -126,8 +126,8 @@ def run_case(a, h, case): cfg, pair, body, host = rr.host_geometry(a.source, h, a.collision) context = stack.enter_context(CudaContext(0)) backend = stack.enter_context(FixedPatchStepper( - cfg, rr.PLACEMENTS["wide"], context=context, coarse_boundary="channel", - base_block=rr.BASE_BLOCK, fine_block=rr.FINE_BLOCK, fine_objects=(body,), + cfg, context=context, coarse_boundary="channel", refinements=[rr.PLACEMENTS["wide"]], + level_blocks=[rr.BASE_BLOCK, rr.FINE_BLOCK], level_objects=[(), (body,)], observe_raw_exchange=True, observe_window_exchange=True)) from CelerisLab.lbm.channel import channel_masks from CelerisLab.lbm.refinement import ACTIVE diff --git a/tests/validation/run_jet_circle_cv.py b/tests/validation/run_jet_circle_cv.py index b6f46d0..1a5e65f 100644 --- a/tests/validation/run_jet_circle_cv.py +++ b/tests/validation/run_jet_circle_cv.py @@ -279,12 +279,11 @@ def run_case(c, ctx, output, provenance, continuation=False): PeriodicBlockStepper(fine_cfg, layout, context=ctx, objects=[fobj]) as uniform, FixedPatchStepper( cfg, - c["bounds"], context=ctx, - base_block=(8, 8), - fine_block=(8, 8), - fine_objects=[obj], - jets=jets, + refinements=[c["bounds"]], + level_blocks=[(8, 8), (8, 8)], + level_objects=[(), (obj,)], + level_jets=[(), tuple(jets)], observe_raw_exchange=True, ) as amr, ): diff --git a/tests/validation/run_refined_dfg.py b/tests/validation/run_refined_dfg.py index d4dea16..0123e9e 100644 --- a/tests/validation/run_refined_dfg.py +++ b/tests/validation/run_refined_dfg.py @@ -383,13 +383,12 @@ def run_case(a, h, periodic, case): backend = stack.enter_context( FixedPatchStepper( cfg, - PLACEMENTS[a.placement], context=context, coarse_boundary="channel", - base_block=BASE_BLOCK, - fine_block=FINE_BLOCK, - fine_objects=(body,), - jets=public_jets((80.5, 81.0), 20.0, a.jet_scenario), + refinements=[PLACEMENTS[a.placement]], + level_blocks=[BASE_BLOCK, FINE_BLOCK], + level_objects=[(), (body,)], + level_jets=[(), public_jets((80.5, 81.0), 20.0, a.jet_scenario)], observe_raw_exchange=True, **({"observe_window_exchange": True} if a.observation_mode == "window" else {}), ) diff --git a/tests/validation/time_refined_dfg.py b/tests/validation/time_refined_dfg.py index 5dd7a8a..0b52ffd 100644 --- a/tests/validation/time_refined_dfg.py +++ b/tests/validation/time_refined_dfg.py @@ -173,8 +173,9 @@ def time_refined(a, h, sched): cfg, pair, body, host = r.host_geometry(a.source, h, "MRT") context = stack.enter_context(CudaContext(0)) backend = stack.enter_context(FixedPatchStepper( - cfg, r.BOUNDS, context=context, coarse_boundary="channel", base_block=r.BASE_BLOCK, - fine_block=r.FINE_BLOCK, fine_objects=(body,), observe_raw_exchange=True)) + cfg, context=context, coarse_boundary="channel", refinements=[r.BOUNDS], + level_blocks=[r.BASE_BLOCK, r.FINE_BLOCK], level_objects=[(), (body,)], + observe_raw_exchange=True)) masks = [channel_masks(pair.coarse_shape)[0] & ~pair.covered, # as run_refined_dfg (pair.fine_kind == ACTIVE) & ((host.flags.reshape(pair.fine_shape) & SOLID) == 0)] fresh = (r.initial_state(pair.coarse_shape, (0.0, 0.0), 1.0, root=True), diff --git a/tests/validation/time_window_dfg.py b/tests/validation/time_window_dfg.py index 5f7bbe0..063b27d 100644 --- a/tests/validation/time_window_dfg.py +++ b/tests/validation/time_window_dfg.py @@ -130,8 +130,8 @@ def main(): cfg, pair, body, host = r.host_geometry(a.source, h, "MRT") context = stack.enter_context(CudaContext(0)) backend = stack.enter_context(FixedPatchStepper( - cfg, r.BOUNDS, context=context, coarse_boundary="channel", base_block=r.BASE_BLOCK, - fine_block=r.FINE_BLOCK, fine_objects=(body,), observe_raw_exchange=True, + cfg, context=context, coarse_boundary="channel", refinements=[r.BOUNDS], + level_blocks=[r.BASE_BLOCK, r.FINE_BLOCK], level_objects=[(), (body,)], observe_raw_exchange=True, observe_window_exchange=True)) masks = [channel_masks(pair.coarse_shape)[0] & ~pair.covered, (pair.fine_kind == ACTIVE) & ((host.flags.reshape(pair.fine_shape) & SOLID) == 0)]