Skip to content

Commit 84a3a78

Browse files
committed
ParticleContainer Tests: w/ Runtime Attributes
1 parent 6bb6ef9 commit 84a3a78

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

tests/test_particleContainer.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ def particle_container(Npart, std_geometry, distmap, boxarr, std_real_box):
4040

4141
iseed = 1
4242
pc.InitRandom(Npart, iseed, myt, False, std_real_box)
43+
44+
# add runtime components: 1 real 2 int
45+
pc.add_real_comp(True)
46+
pc.add_int_comp(True)
47+
pc.add_int_comp(True)
48+
49+
# can be removed after
50+
# https://github.com/AMReX-Codes/amrex/pull/3615
51+
pc.resize_runtime_real_comp(1, True)
52+
pc.resize_runtime_int_comp(2, True)
53+
54+
# assign some values to runtime components
55+
for lvl in range(pc.finest_level + 1):
56+
for pti in pc.iterator(pc, level=lvl):
57+
soa = pti.soa()
58+
soa.GetRealData(2).assign(1.2345)
59+
soa.GetIntData(1).assign(42)
60+
soa.GetIntData(2).assign(33)
61+
4362
return pc
4463

4564

@@ -129,7 +148,7 @@ def test_pc_init():
129148
# lvl = 0
130149
for lvl in range(pc.finest_level + 1):
131150
print(f"at level {lvl}:")
132-
for pti in amr.ParIter_1_1_2_1_default(pc, level=lvl):
151+
for pti in pc.iterator(pc, level=lvl):
133152
print("...")
134153
assert pti.num_particles == 1
135154
assert pti.num_real_particles == 1
@@ -158,7 +177,7 @@ def test_pc_init():
158177

159178
# read-only
160179
for lvl in range(pc.finest_level + 1):
161-
for pti in amr.ParConstIter_1_1_2_1_default(pc, level=lvl):
180+
for pti in pc.const_iterator(pc, level=lvl):
162181
assert pti.num_particles == 1
163182
assert pti.num_real_particles == 1
164183
assert pti.num_neighbor_particles == 0

0 commit comments

Comments
 (0)