Migrate current callers to level-indexed refinement API
This commit is contained in:
1 parent
b4eacf7526
commit
55067652e4
38 files changed
+210
-199
No files matched your search
@@ -61,7 +61,7 @@ class ShiftedRemapGPU(unittest.TestCase):
|
||||
def check_finite(self,run):
|
||||
raw=run._download_raw()
|
||||
self.assertTrue(raw.shifted)
|
||||
for a,leaf in zip(raw.values,run._leaf):
|
||||
for a,leaf in zip(raw.values,run.leaf):
|
||||
self.assertTrue(np.isfinite(a[:,leaf]).all())
|
||||
self.assertTrue(np.isnan(a[:,~leaf]).all())
|
||||
self.assertTrue((1+a[:,leaf].sum(axis=0,dtype=np.float64)>0).all())
|
||||
@@ -71,7 +71,7 @@ class ShiftedRemapGPU(unittest.TestCase):
|
||||
old=owned.enter_context(make(ctx))
|
||||
old._initialize_raw(initial(old));old.step(2)
|
||||
before=old._download_raw()
|
||||
new=owned.enter_context(old.remap_child(A))
|
||||
new=owned.enter_context(old.remap_finest(A))
|
||||
self.check_reset(new,before.values)
|
||||
self.snapshot_equal(old._download_raw(),before,'old unchanged')
|
||||
self.snapshot_equal(new._download_raw(),before,'identity raw copy')
|
||||
@@ -85,11 +85,11 @@ class ShiftedRemapGPU(unittest.TestCase):
|
||||
old=owned.enter_context(make(ctx))
|
||||
old._initialize_raw(initial(old));old.step(2)
|
||||
before=old._download_raw();count=old.step_count
|
||||
old_mesh=RemapTopology.from_config(CFG,old.patch,A)
|
||||
new_mesh=RemapTopology.from_config(CFG,old.patch,B)
|
||||
old_mesh=RemapTopology.from_config(CFG,old.hierarchy.pairs[0],A)
|
||||
new_mesh=RemapTopology.from_config(CFG,old.hierarchy.pairs[0],B)
|
||||
expected=_remap_stored(old_mesh,new_mesh,before,shifted=True,
|
||||
base_count=count,level_steps=(count,2*count,4*count),phase='postcollision_g')
|
||||
new=owned.enter_context(old.remap_child(B))
|
||||
new=owned.enter_context(old.remap_finest(B))
|
||||
self.check_reset(new,expected.g)
|
||||
self.snapshot_equal(new._download_raw(),_StoredPopulations(expected.g,True),'host raw fill')
|
||||
for a,b,om,nm in zip(before.values,new._download_raw().values,old_mesh.leaf_masks,new_mesh.leaf_masks):
|
||||
@@ -103,7 +103,7 @@ class ShiftedRemapGPU(unittest.TestCase):
|
||||
with CudaContext(0) as ctx,make(ctx) as run:
|
||||
run._initialize_raw(initial(run));run.step(2)
|
||||
before=run._download_raw()
|
||||
with self.assertRaises(ValueError):run.remap_child([])
|
||||
with self.assertRaises(ValueError):run.remap_finest([])
|
||||
self.snapshot_equal(run._download_raw(),before,'rejection preserves source')
|
||||
self.assertEqual(run.step_count,2)
|
||||
run.step();self.check_finite(run)
|
||||
|
||||
Reference in new issue
Block a user