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

Function testTwoWayTransform

Tests/Particles/ParticleTransformations/main.cpp:284–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282
283template <typename PC>
284void 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
317template <typename PC, typename F>
318void filterParticles (PC& pc, F const& f)

Callers 1

testTransformationsFunction · 0.85

Calls 6

twoWayTransformParticlesFunction · 0.85
TwoWayTransformerClass · 0.85
GeomMethod · 0.80
ReduceMaxFunction · 0.50
idataMethod · 0.45

Tested by

no test coverage detected