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

Method hostPartitionTile

Src/Particle/AMReX_ParticleContainerI.H:1351–1434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1349template <typename ParticleType, int NArrayReal, int NArrayInt,
1350 template<class> class Allocator, class CellAssignor>
1351AMREX_FORCE_INLINE
1352int
1353ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>
1354::hostPartitionTile (ParticleTileType& src_tile,
1355 int lev, int gid, int tid,
1356 int lev_min, int lev_max, int nGrow, int local,
1357 bool remove_negative, int myproc,
1358 Gpu::DeviceVector<int>& boxes,
1359 Gpu::DeviceVector<int>& levels,
1360 Gpu::DeviceVector<int>& tiles,
1361 Gpu::DeviceVector<int>& src_indices,
1362 Gpu::DeviceVector<IntVect>& periodic_shift)
1363{
1364 ParticleLocData pld;
1365 auto ptd = src_tile.getParticleTileData();
1366 int num_move = 0;
1367
1368 Long last = src_tile.numParticles() - 1;
1369 Long pindex = 0;
1370 int who = -1;
1371 while (pindex <= last) {
1372 decltype(auto) p = ptd[pindex];
1373
1374 // remove invalid if needed
1375 if (!ptd.id(pindex).is_valid()) {
1376 if (remove_negative) {
1377 copyParticle(ptd, ptd, last, pindex);
1378 correctCellVectors(last, pindex, gid, p);
1379 --last;
1380 } else {
1381 ++pindex;
1382 }
1383 continue;
1384 }
1385
1386 // Fast path: if on the finest level, try the last good location first
1387 // If not on finest level, we need to do the full locate because even if
1388 // the last assignment works, the particle might belong on a finer level.
1389 if (lev == lev_max && pld.m_tile == tid && pld.m_grid == gid && pld.m_lev == lev && who == myproc) {
1390 const auto iv = Index(p, lev);
1391 if (pld.m_tilebox.contains(iv)) {
1392 ++pindex;
1393 continue; // don't need correctCellVectors or particlePostLocate if it stays where it is
1394 }
1395 }
1396
1397 // full locate
1398 locateParticle(p, pld, lev_min, lev_max, nGrow, local ? gid : -1);
1399 particlePostLocate(p, pld, lev);
1400
1401 // particle may have been invalidated, so check if we need to remove again.
1402 if (!ptd.id(pindex).is_valid()) {
1403 copyParticle(ptd, ptd, last, pindex);
1404 correctCellVectors(last, pindex, gid, p);
1405 --last;
1406 continue;
1407 }
1408

Callers

nothing calls this directly

Calls 7

procIDMethod · 0.80
getParticleTileDataMethod · 0.45
numParticlesMethod · 0.45
is_validMethod · 0.45
idMethod · 0.45
containsMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected