| 282 | |
| 283 | template <typename PC> |
| 284 | void testTwoWayTransform (const PC& pc) |
| 285 | { |
| 286 | using PType = typename PC::SuperParticleType; |
| 287 | |
| 288 | PC pc1(pc.Geom(0), pc.ParticleDistributionMap(0), pc.ParticleBoxArray(0)); |
| 289 | pc1.copyParticles(pc); |
| 290 | |
| 291 | auto np_old = pc1.TotalNumberOfParticles(); |
| 292 | |
| 293 | PC pc2(pc.Geom(0), pc.ParticleDistributionMap(0), pc.ParticleBoxArray(0)); |
| 294 | PC pc3(pc.Geom(0), pc.ParticleDistributionMap(0), pc.ParticleBoxArray(0)); |
| 295 | |
| 296 | twoWayTransformParticles(pc2, pc3, pc1, TwoWayTransformer(2, 3)); |
| 297 | |
| 298 | auto mx1 = amrex::ReduceMax(pc1, [=] AMREX_GPU_HOST_DEVICE (const PType& p) -> int { return p.idata(NSI+1); }); |
| 299 | |
| 300 | auto mx2 = amrex::ReduceMax(pc2, [=] AMREX_GPU_HOST_DEVICE (const PType& p) -> int { return p.idata(NSI+1); }); |
| 301 | |
| 302 | AMREX_ALWAYS_ASSERT(2*mx1 == mx2); |
| 303 | |
| 304 | auto np_new = pc2.TotalNumberOfParticles(); |
| 305 | |
| 306 | AMREX_ALWAYS_ASSERT(np_old == np_new); |
| 307 | |
| 308 | auto mx3 = amrex::ReduceMax(pc3, [=] AMREX_GPU_HOST_DEVICE (const PType& p) -> int { return p.idata(NSI+1); }); |
| 309 | |
| 310 | AMREX_ALWAYS_ASSERT(mx3 == 3*mx1); |
| 311 | |
| 312 | np_new = pc3.TotalNumberOfParticles(); |
| 313 | |
| 314 | AMREX_ALWAYS_ASSERT(np_old == np_new); |
| 315 | } |
| 316 | |
| 317 | template <typename PC, typename F> |
| 318 | void filterParticles (PC& pc, F const& f) |
no test coverage detected