MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / testTransform

Function testTransform

Tests/Particles/ParticleTransformations/main.cpp:397–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395
396template <typename PC>
397void testTransform (const PC& pc)
398{
399 using PType = typename PC::SuperParticleType;
400
401 PC pc2(pc.Geom(0), pc.ParticleDistributionMap(0), pc.ParticleBoxArray(0));
402 pc2.copyParticles(pc);
403
404 auto np_old = pc2.TotalNumberOfParticles();
405
406 auto mx1 = amrex::ReduceMax(pc2, [=] AMREX_GPU_HOST_DEVICE (const PType& p) -> int { return p.idata(NSI+1); });
407
408 transformParticles(pc2, Transformer(2));
409
410 auto mx2 = amrex::ReduceMax(pc2, [=] AMREX_GPU_HOST_DEVICE (const PType& p) -> int { return p.idata(NSI+1); });
411
412 AMREX_ALWAYS_ASSERT(2*mx1 == mx2);
413
414 auto np_new = pc2.TotalNumberOfParticles();
415
416 AMREX_ALWAYS_ASSERT(np_old == np_new);
417
418 pc2.clearParticles();
419 pc2.copyParticles(pc);
420 transformParticles(pc2, Transformer(3));
421
422 auto mx3 = amrex::ReduceMax(pc2, [=] AMREX_GPU_HOST_DEVICE (const PType& p) -> int { return p.idata(NSI+1); });
423
424 AMREX_ALWAYS_ASSERT(mx3 == 3*mx1);
425}
426
427template <typename PC>
428void testFilter (const PC& pc)

Callers 1

testTransformationsFunction · 0.85

Calls 6

TransformerClass · 0.85
GeomMethod · 0.80
transformParticlesFunction · 0.70
ReduceMaxFunction · 0.50
idataMethod · 0.45

Tested by

no test coverage detected