From 9b909992ee84cda4ec4f9661ae84a14d108db14a Mon Sep 17 00:00:00 2001 From: atmyers Date: Thu, 4 Apr 2024 00:38:56 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20main=20from=20@=20AMReX-Codes/?= =?UTF-8?q?amrex@771c439170bf46f63ad7df891f49297902a028ef=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../amrex.pdf | Bin 8636055 -> 8636055 bytes .../AMReX__NeighborParticles_8H_source.html | 4 +- .../AMReX__ParticleContainerI_8H_source.html | 254 +++-- .../AMReX__ParticleContainer_8H_source.html | 921 +++++++++--------- ...AMReX__ParticleDataAdaptorI_8H_source.html | 2 +- .../doxygen/AMReX__ParticleIO_8H_source.html | 84 +- .../AMReX__ParticleInit_8H_source.html | 28 +- ...ssamrex_1_1AmrParticleContainer__impl.html | 2 + ...ssamrex_1_1AmrTracerParticleContainer.html | 2 + ...assamrex_1_1NeighborParticleContainer.html | 2 + ...classamrex_1_1ParticleContainer__impl.html | 6 + ...classamrex_1_1TracerParticleContainer.html | 2 + .../doxygen/AMReX__ParticleContainerI_8H.xml | 244 ++--- .../doxygen/AMReX__ParticleContainer_8H.xml | 813 ++++++++-------- .../docs_xml/doxygen/AMReX__ParticleIO_8H.xml | 82 +- .../doxygen/AMReX__ParticleInit_8H.xml | 28 +- .../classamrex_1_1ParticleContainer__impl.xml | 258 ++--- amrex/docs_xml/doxygen/namespaceamrex.xml | 2 +- 18 files changed, 1371 insertions(+), 1363 deletions(-) diff --git a/amrex/docs_html/_downloads/008eb6dbfab802633dff40122ece848c/amrex.pdf b/amrex/docs_html/_downloads/008eb6dbfab802633dff40122ece848c/amrex.pdf index 890c0fc8b289035ab7467867fe3ecf589516a298..2a43e77311dd36827982565ec30f01f2a5cdef70 100644 GIT binary patch delta 680 zcmajawN66;0EOY;Q1s$Xf#P=>14Xm)i4h;^}q7LR!J?!HE zhd9D9PH>7doa4eHsIG6PK@~;CEJ=fTx{{XFX>DR_MxU#d$)c=^zxgXY%AIQ@#BQ~z nCX-ZZGi$2dAWOOP)F*$dwAfiL{v zj{pQB2pR+<1fd8+I3ge*5>bdo3}O+7cqAYZNk~QtQjrEN(vg8o=#YhMZ{m5qcRi>60Jk{12LJ#7 diff --git a/amrex/docs_html/doxygen/AMReX__NeighborParticles_8H_source.html b/amrex/docs_html/doxygen/AMReX__NeighborParticles_8H_source.html index 4397054847..85ec8c6f7e 100644 --- a/amrex/docs_html/doxygen/AMReX__NeighborParticles_8H_source.html +++ b/amrex/docs_html/doxygen/AMReX__NeighborParticles_8H_source.html @@ -658,8 +658,8 @@
Particle< NStructReal+NArrayReal, NStructInt+NArrayInt > SuperParticleType
The type of the "SuperParticle" which stored all components in AoS form.
Definition: AMReX_ParticleContainer.H:169
typename ParticleTileType::AoS AoS
Definition: AMReX_ParticleContainer.H:186
typename AoS::ParticleVector ParticleVector
Definition: AMReX_ParticleContainer.H:191
-
void AddIntComp(T communicate=true)
Definition: AMReX_ParticleContainer.H:1264
-
void AddRealComp(T communicate=true)
Definition: AMReX_ParticleContainer.H:1241
+
void AddIntComp(T communicate=true)
Definition: AMReX_ParticleContainer.H:1275
+
void AddRealComp(T communicate=true)
Definition: AMReX_ParticleContainer.H:1252
typename SoA::IntVector IntVector
Definition: AMReX_ParticleContainer.H:190
void Redistribute(int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
Redistribute puts all the particles back in the right places (for some value of right)
Definition: AMReX_ParticleContainerI.H:1066
T_ParticleType ParticleType
Definition: AMReX_ParticleContainer.H:146
diff --git a/amrex/docs_html/doxygen/AMReX__ParticleContainerI_8H_source.html b/amrex/docs_html/doxygen/AMReX__ParticleContainerI_8H_source.html index a4d8e031d7..c2ed694ca6 100644 --- a/amrex/docs_html/doxygen/AMReX__ParticleContainerI_8H_source.html +++ b/amrex/docs_html/doxygen/AMReX__ParticleContainerI_8H_source.html @@ -470,11 +470,11 @@
369 
370  LayoutData<Long> np_per_grid_local(ParticleBoxArray(lev),
371  ParticleDistributionMap(lev));
-
372 
-
373  for (ParConstIterType pti(*this, lev); pti.isValid(); ++pti)
+
372 
+
373  for (ParConstIterType pti(*this, lev); pti.isValid(); ++pti)
374  {
375  int gid = pti.index();
-
376  if (only_valid)
+
376  if (only_valid)
377  {
378  const auto& ptile = ParticlesAt(lev, pti);
379  const int np = ptile.numParticles();
@@ -482,7 +482,7 @@
381 
382  ReduceOps<ReduceOpSum> reduce_op;
383  ReduceData<int> reduce_data(reduce_op);
-
384  using ReduceTuple = typename decltype(reduce_data)::Type;
+
384  using ReduceTuple = typename decltype(reduce_data)::Type;
385 
386  reduce_op.eval(np, reduce_data,
387  [=] AMREX_GPU_DEVICE (int i) -> ReduceTuple
@@ -498,7 +498,7 @@
397  }
398  }
399 
-
400  Vector<Long> nparticles(np_per_grid_local.size(), 0);
+
400  Vector<Long> nparticles(np_per_grid_local.size(), 0);
401  if (only_local)
402  {
403  for (ParConstIterType pti(*this, lev); pti.isValid(); ++pti)
@@ -550,9 +550,9 @@
449  }
450  }
451 
-
452  if (!only_local) {
+
452  if (!only_local) {
-
454  }
+
454  }
455 
456  return nparticles;
457 }
@@ -561,11 +561,11 @@
460 // This includes both valid and invalid particles since invalid particles still take up space.
461 //
462 
-
463 template <typename ParticleType, int NArrayReal, int NArrayInt,
-
464  template<class> class Allocator, class CellAssignor>
-
465 std::array<Long, 3>
-
466 ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>
-
467 ::ByteSpread () const
+
463 template <typename ParticleType, int NArrayReal, int NArrayInt,
+
464  template<class> class Allocator, class CellAssignor>
+
465 std::array<Long, 3>
+ +
467 ::ByteSpread () const
468 {
469  Long cnt = 0;
470 
@@ -590,7 +590,7 @@
490 
491  amrex::Print() << "ParticleContainer spread across MPI nodes - bytes (num particles): [Min: "
-
492  << mn*sz
+
492  << mn*sz
493  << " (" << mn << ")"
494  << ", Max: "
495  << mx*sz
@@ -601,7 +601,7 @@
500 #ifdef AMREX_LAZY
501  });
502 #endif
-
503 
+
503 
504  return {mn*sz, mx*sz, cnt*sz};
505 }
506 
@@ -622,23 +622,23 @@
521  }
522 
523  Long mn = cnt, mx = mn;
-
524 
+
524 
525  const int IOProc = ParallelContext::IOProcessorNumberSub();
526 
527 #ifdef AMREX_LAZY
528  Lazy::QueueReduction( [=] () mutable {
-
529 #endif
+
529 #endif
533 
534  amrex::Print() << "ParticleContainer spread across MPI nodes - bytes: [Min: "
-
535  << mn
+
535  << mn
536  << ", Max: "
-
537  << mx
+
537  << mx
538  << ", Total: "
539  << cnt
-
540  << "]\n";
+
540  << "]\n";
541 #ifdef AMREX_LAZY
542  });
543 #endif
@@ -646,22 +646,22 @@
545  return {mn, mx, cnt};
546 }
547 
-
548 template <typename ParticleType, int NArrayReal, int NArrayInt,
-
549  template<class> class Allocator, class CellAssignor>
+
548 template <typename ParticleType, int NArrayReal, int NArrayInt,
+
549  template<class> class Allocator, class CellAssignor>
550 void
- +
552 {
-
553  for (unsigned lev = 0; lev < m_particles.size(); lev++) {
+
553  for (unsigned lev = 0; lev < m_particles.size(); lev++) {
554  auto& pmap = m_particles[lev];
-
555  for (auto& kv : pmap) {
+
555  for (auto& kv : pmap) {
556  auto& ptile = kv.second;
557  ptile.shrink_to_fit();
558  }
559  }
-
560 }
+
560 }
561 
568 template <typename ParticleType, int NArrayReal, int NArrayInt,
-
569  template<class> class Allocator, class CellAssignor>
+
569  template<class> class Allocator, class CellAssignor>
570 void
572 {
@@ -670,9 +670,9 @@
575  AMREX_ASSERT(OK());
576  if (m_particles.empty()) { return; }
577  AMREX_ASSERT(lev >= 0 && lev < int(m_particles.size()));
-
578  AMREX_ASSERT(numParticlesOutOfRange(*this, 0) == 0);
-
579 
-
580  const auto& geom = Geom(lev);
+ +
579 
+
580  const auto& geom = Geom(lev);
581  const auto plo = geom.ProbLoArray();
582  const auto dxi = geom.InvCellSizeArray();
583  const auto domain = geom.Domain();
@@ -681,9 +681,9 @@
586  amrex::Array4<amrex::Real> const& count)
587  {
588  const auto& p = make_particle<ConstParticleType>{}(ptd, ip);
-
589  CellAssignor assignor;
-
590  IntVect iv = assignor(p, plo, dxi, domain);
-
591  amrex::Gpu::Atomic::AddNoRet(&count(iv), 1.0_rt);
+
589  CellAssignor assignor;
+
590  IntVect iv = assignor(p, plo, dxi, domain);
+
591  amrex::Gpu::Atomic::AddNoRet(&count(iv), 1.0_rt);
592  }, false);
593 }
594 
@@ -692,9 +692,9 @@
597 Long
599 {
-
600  BL_PROFILE("ParticleContainer::IncrementWithTotal(lev)");
+
600  BL_PROFILE("ParticleContainer::IncrementWithTotal(lev)");
601  Increment(mf, lev);
-
602  return TotalNumberOfParticles(true, local);
+
602  return TotalNumberOfParticles(true, local);
603 }
604 
605 template <typename ParticleType, int NArrayReal, int NArrayInt,
@@ -703,11 +703,11 @@
609 {
610  BL_PROFILE("ParticleContainer::RemoveParticlesAtLevel()");
-
611  if (level >= int(this->m_particles.size())) { return; }
+
611  if (level >= int(this->m_particles.size())) { return; }
612 
613  if (!this->m_particles[level].empty())
614  {
-
615  ParticleLevel().swap(this->m_particles[level]);
+
615  ParticleLevel().swap(this->m_particles[level]);
616  }
617 }
618 
@@ -720,7 +720,7 @@
625  AMREX_ASSERT(this->finestLevel()+1 == int(this->m_particles.size()));
626 
627  Long cnt = 0;
-
628 
+
628 
629  for (unsigned lev = 0; lev < m_particles.size() - 1; ++lev) {
630  auto& pmap = m_particles[lev];
631  if (!pmap.empty()) {
@@ -731,7 +731,7 @@
636  ParticleLevel().swap(pmap);
637  }
638  }
-
639 
+
639 
640  //
641  // Print how many particles removed on each processor if any were removed.
642  //
@@ -745,7 +745,7 @@
650 {
651 
- +
653  GpuArray<Real, AMREX_SPACEDIM> m_plo, m_dxi;
654  Box m_domain;
655 
656  FilterVirt (const amrex::AssignGrid<amrex::DenseBinIteratorFactory<amrex::Box>>& assign_buffer_grid, const GpuArray<Real, AMREX_SPACEDIM>& plo,
@@ -756,7 +756,7 @@
661  template <typename SrcData>
663  int operator() (const SrcData& src, int src_i) const noexcept
-
664  {
+
664  {
665  auto iv = getParticleCell(src.m_aos[src_i], m_plo, m_dxi, m_domain);
666  return (m_assign_buffer_grid(iv)!=-1);
667  }
@@ -1271,7 +1271,7 @@
1180  {
1181  const Geometry& geom = Geom(lev);
1182  const auto dxi = geom.InvCellSizeArray();
-
1183  const auto plo = geom.ProbLoArray();
+
1183  const auto plo = geom.ProbLoArray();
1184  const auto domain = geom.Domain();
1185 
1186  for(MFIter mfi = MakeMFIter(lev); mfi.isValid(); ++mfi)
@@ -1282,11 +1282,11 @@
1191  const Box& box = mfi.validbox();
1192 
1193  int ntiles = numTilesInBox(box, true, bin_size);
-
1194 
+
1195  m_bins.build(np, ptile.getParticleTileData(), ntiles,
1196  GetParticleBin{plo, dxi, domain, bin_size, box});
1197  ReorderParticles(lev, mfi, m_bins.permutationPtr());
-
1198  }
+
1198  }
1199  }
1200 }
1201 
@@ -1297,7 +1297,7 @@
1206 ::SortParticlesForDeposition (IntVect idx_type)
1207 {
1208  BL_PROFILE("ParticleContainer::SortParticlesForDeposition()");
-
1209 
+
1210  for (int lev = 0; lev < numLevels(); ++lev)
1211  {
1212  const Geometry& geom = Geom(lev);
@@ -1319,21 +1319,21 @@
1228 
1229 //
1230 // The GPU implementation of Redistribute
-
1231 //
-
1232 template <typename ParticleType, int NArrayReal, int NArrayInt,
-
1233  template<class> class Allocator, class CellAssignor>
-
1234 void
- -
1236 ::RedistributeGPU (int lev_min, int lev_max, int nGrow, int local, bool remove_negative)
+
1231 //
+
1232 template <typename ParticleType, int NArrayReal, int NArrayInt,
+
1233  template<class> class Allocator, class CellAssignor>
+
1234 void
+
1235 ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>
+
1236 ::RedistributeGPU (int lev_min, int lev_max, int nGrow, int local, bool remove_negative)
1237 {
1238 #ifdef AMREX_USE_GPU
1239 
1240  if (local) { AMREX_ASSERT(numParticlesOutOfRange(*this, lev_min, lev_max, local) == 0); }
1241 
-
1242  // sanity check
+
1242  // sanity check
1243  AMREX_ALWAYS_ASSERT(do_tiling == false);
1244 
-
1245  BL_PROFILE("ParticleContainer::RedistributeGPU()");
+
1245  BL_PROFILE("ParticleContainer::RedistributeGPU()");
1246  BL_PROFILE_VAR_NS("Redistribute_partition", blp_partition);
1247 
1248  int theEffectiveFinestLevel = m_gdb->finestLevel();
@@ -1367,10 +1367,10 @@
1276  auto assign_grid = m_particle_locator.getGridAssignor();
1277 
1278  BL_PROFILE_VAR_START(blp_partition);
-
1279  ParticleCopyOp op;
+
1279  ParticleCopyOp op;
1280  int num_levels = finest_lev_particles + 1;
-
1281  op.setNumLevels(num_levels);
-
1282  Vector<std::map<int, int> > new_sizes(num_levels);
+
1281  op.setNumLevels(num_levels);
+
1282  Vector<std::map<int, int> > new_sizes(num_levels);
1283  const auto plo = Geom(0).ProbLoArray();
1284  const auto phi = Geom(0).ProbHiArray();
1285  const auto rlo = Geom(0).ProbLoArrayInParticleReal();
@@ -1384,25 +1384,25 @@
1293  int gid = kv.first.first;
1294  int tid = kv.first.second;
1295  auto index = std::make_pair(gid, tid);
- +
1296 
1297  auto& src_tile = plev[index];
1298  const size_t np = src_tile.numParticles();
1299 
1300  int num_stay = partitionParticlesByDest(src_tile, assign_grid,
-
1301  std::forward<CellAssignor>(CellAssignor{}),
+
1301  std::forward<CellAssignor>(CellAssignor{}),
1302  BufferMap(),
-
1303  plo, phi, rlo, rhi, is_per, lev, gid, tid,
+
1303  plo, phi, rlo, rhi, is_per, lev, gid, tid,
1304  lev_min, lev_max, nGrow, remove_negative);
1305 
1306  int num_move = np - num_stay;
-
1307  new_sizes[lev][gid] = num_stay;
-
1308  op.resize(gid, lev, num_move);
+
1307  new_sizes[lev][gid] = num_stay;
+
1308  op.resize(gid, lev, num_move);
1309 
-
1310  auto p_boxes = op.m_boxes[lev][gid].dataPtr();
-
1311  auto p_levs = op.m_levels[lev][gid].dataPtr();
-
1312  auto p_src_indices = op.m_src_indices[lev][gid].dataPtr();
-
1313  auto p_periodic_shift = op.m_periodic_shift[lev][gid].dataPtr();
-
1314  auto ptd = src_tile.getParticleTileData();
+
1310  auto p_boxes = op.m_boxes[lev][gid].dataPtr();
+
1311  auto p_levs = op.m_levels[lev][gid].dataPtr();
+
1312  auto p_src_indices = op.m_src_indices[lev][gid].dataPtr();
+
1313  auto p_periodic_shift = op.m_periodic_shift[lev][gid].dataPtr();
+
1314  auto ptd = src_tile.getParticleTileData();
1315 
1316  AMREX_FOR_1D ( num_move, i,
1317  {
@@ -1416,11 +1416,11 @@
1325  else
1326  {
1327  const auto tup = assign_grid(p, lev_min, lev_max, nGrow,
-
1328  std::forward<CellAssignor>(CellAssignor{}));
+
1328  std::forward<CellAssignor>(CellAssignor{}));
1329  p_boxes[i] = amrex::get<0>(tup);
1330  p_levs[i] = amrex::get<1>(tup);
1331  }
-
1332  p_periodic_shift[i] = IntVect(AMREX_D_DECL(0,0,0));
+
1332  p_periodic_shift[i] = IntVect(AMREX_D_DECL(0,0,0));
1333  p_src_indices[i] = i+num_stay;
1334  });
1335  }
@@ -1488,36 +1488,36 @@
1397  } else {
1398  pinned_snd_buffer.resize(snd_buffer.size());
1399  Gpu::dtoh_memcpy_async(pinned_snd_buffer.dataPtr(), snd_buffer.dataPtr(), snd_buffer.size());
-
1400  plan.buildMPIFinish(BufferMap());
+
1400  plan.buildMPIFinish(BufferMap());
1402  communicateParticlesStart(*this, plan, pinned_snd_buffer, pinned_rcv_buffer);
1403  }
1404 
1405  rcv_buffer.resize(pinned_rcv_buffer.size());
-
1406  unpackBuffer(*this, plan, snd_buffer, RedistributeUnpackPolicy());
+
1406  unpackBuffer(*this, plan, snd_buffer, RedistributeUnpackPolicy());
1408  Gpu::htod_memcpy_async(rcv_buffer.dataPtr(), pinned_rcv_buffer.dataPtr(), pinned_rcv_buffer.size());
-
1409  unpackRemotes(*this, plan, rcv_buffer, RedistributeUnpackPolicy());
+
1409  unpackRemotes(*this, plan, rcv_buffer, RedistributeUnpackPolicy());
1410  }
- +
1413  AMREX_ASSERT(numParticlesOutOfRange(*this, lev_min, lev_max, nGrow) == 0);
1414 #else
1415  amrex::ignore_unused(lev_min,lev_max,nGrow,local,remove_negative);
1416 #endif
1417 }
- +
1418 
1419 //
1420 // The CPU implementation of Redistribute
1421 //
-
1422 template <typename ParticleType, int NArrayReal, int NArrayInt,
+
1422 template <typename ParticleType, int NArrayReal, int NArrayInt,
1423  template<class> class Allocator, class CellAssignor>
1424 void
1426 ::RedistributeCPU (int lev_min, int lev_max, int nGrow, int local, bool remove_negative)
1427 {
1428  BL_PROFILE("ParticleContainer::RedistributeCPU()");
-
1429 
+
1430  const int MyProc = ParallelContext::MyProcSub();
1431  auto strttime = amrex::second();
1432 
@@ -1563,15 +1563,15 @@
1472 
1473  // these are temporary buffers for each thread
1474  std::map<int, Vector<Vector<char> > > tmp_remote;
- - +
1475  Vector<std::map<std::pair<int, int>, Vector<ParticleVector> > > tmp_local;
+
1476  Vector<std::map<std::pair<int, int>, Vector<StructOfArrays<NArrayReal, NArrayInt, Allocator> > > > soa_local;
1477  tmp_local.resize(theEffectiveFinestLevel+1);
1478  soa_local.resize(theEffectiveFinestLevel+1);
1479 
1480  // we resize these buffers outside the parallel region
1481  for (int lev = lev_min; lev <= lev_max; lev++) {
-
1482  for (MFIter mfi(*m_dummy_mf[lev], this->do_tiling ? this->tile_size : IntVect::TheZeroVector());
-
1483  mfi.isValid(); ++mfi) {
+
1482  for (MFIter mfi(*m_dummy_mf[lev], this->do_tiling ? this->tile_size : IntVect::TheZeroVector());
+
1483  mfi.isValid(); ++mfi) {
1484  auto index = std::make_pair(mfi.index(), mfi.LocalTileIndex());
1485  tmp_local[lev][index].resize(num_threads);
1486  soa_local[lev][index].resize(num_threads);
@@ -1595,8 +1595,8 @@
1504  for (int lev = lev_min; lev <= finest_lev_particles; lev++) {
1505  auto& pmap = m_particles[lev];
1506 
-
1507  Vector<std::pair<int, int> > grid_tile_ids;
-
1508  Vector<ParticleTileType*> ptile_ptrs;
+
1507  Vector<std::pair<int, int> > grid_tile_ids;
+
1508  Vector<ParticleTileType*> ptile_ptrs;
1509  for (auto& kv : pmap)
1510  {
1511  grid_tile_ids.push_back(kv.first);
@@ -1606,7 +1606,7 @@
1515 #ifdef AMREX_USE_OMP
1516 #pragma omp parallel for
1517 #endif
-
1518  for (int pmap_it = 0; pmap_it < static_cast<int>(ptile_ptrs.size()); ++pmap_it)
+
1518  for (int pmap_it = 0; pmap_it < static_cast<int>(ptile_ptrs.size()); ++pmap_it)
1519  {
1520  int thread_num = OpenMP::get_thread_num();
1521  int grid = grid_tile_ids[pmap_it].first;
@@ -1619,7 +1619,7 @@
1528  // "The AoS and SoA data on this tile are different sizes - "
1529  // "perhaps particles have not been initialized correctly?");
1530  unsigned npart = ptile_ptrs[pmap_it]->numParticles();
-
1531  ParticleLocData pld;
+
1531  ParticleLocData pld;
1532 
1533  if constexpr (!ParticleType::is_soa_particle){
1534 
@@ -1627,7 +1627,7 @@
1536  Long last = npart - 1;
1537  Long pindex = 0;
1538  while (pindex <= last) {
-
1539  ParticleType& p = aos[pindex];
+
1539  ParticleType& p = aos[pindex];
1540 
1541  if ((remove_negative == false) && (p.id() < 0)) {
1542  ++pindex;
@@ -1666,19 +1666,19 @@
1575  continue;
1576  }
1577 
-
1578  const int who = ParallelContext::global_to_local_rank(ParticleDistributionMap(pld.m_lev)[pld.m_grid]);
+
1578  const int who = ParallelContext::global_to_local_rank(ParticleDistributionMap(pld.m_lev)[pld.m_grid]);
1579  if (who == MyProc) {
-
1580  if (pld.m_lev != lev || pld.m_grid != grid || pld.m_tile != tile) {
+
1580  if (pld.m_lev != lev || pld.m_grid != grid || pld.m_tile != tile) {
1581  // We own it but must shift it to another place.
-
1582  auto index = std::make_pair(pld.m_grid, pld.m_tile);
-
1583  AMREX_ASSERT(tmp_local[pld.m_lev][index].size() == num_threads);
-
1584  tmp_local[pld.m_lev][index][thread_num].push_back(p);
+
1582  auto index = std::make_pair(pld.m_grid, pld.m_tile);
+
1583  AMREX_ASSERT(tmp_local[pld.m_lev][index].size() == num_threads);
+
1584  tmp_local[pld.m_lev][index][thread_num].push_back(p);
1585  for (int comp = 0; comp < NumRealComps(); ++comp) {
-
1586  RealVector& arr = soa_local[pld.m_lev][index][thread_num].GetRealData(comp);
+
1586  RealVector& arr = soa_local[pld.m_lev][index][thread_num].GetRealData(comp);
1587  arr.push_back(soa.GetRealData(comp)[pindex]);
1588  }
1589  for (int comp = 0; comp < NumIntComps(); ++comp) {
-
1590  IntVector& arr = soa_local[pld.m_lev][index][thread_num].GetIntData(comp);
+
1590  IntVector& arr = soa_local[pld.m_lev][index][thread_num].GetIntData(comp);
1591  arr.push_back(soa.GetIntData(comp)[pindex]);
1592  }
1593 
@@ -1687,7 +1687,7 @@
1596  }
1597  else {
1598  auto& particles_to_send = tmp_remote[who][thread_num];
-
1599  auto old_size = particles_to_send.size();
+
1599  auto old_size = particles_to_send.size();
1600  auto new_size = old_size + superparticle_size;
1601  particles_to_send.resize(new_size);
1602  std::memcpy(&particles_to_send[old_size], &p, particle_size);
@@ -1729,11 +1729,11 @@
1638 
1639  aos().erase(aos().begin() + last + 1, aos().begin() + npart);
1640  for (int comp = 0; comp < NumRealComps(); comp++) {
-
1641  RealVector& rdata = soa.GetRealData(comp);
+
1641  RealVector& rdata = soa.GetRealData(comp);
1642  rdata.erase(rdata.begin() + last + 1, rdata.begin() + npart);
1643  }
1644  for (int comp = 0; comp < NumIntComps(); comp++) {
-
1645  IntVector& idata = soa.GetIntData(comp);
+
1645  IntVector& idata = soa.GetIntData(comp);
1646  idata.erase(idata.begin() + last + 1, idata.begin() + npart);
1647  }
1648  }
@@ -1746,7 +1746,7 @@
1655  Long pindex = 0;
1656  auto ptd = particle_tile->getParticleTileData();
1657  while (pindex <= last) {
-
1658  ParticleType p(ptd,pindex);
+
1658  ParticleType p(ptd,pindex);
1659 
1660  if ((remove_negative == false) && (p.id() < 0)) {
1661  ++pindex;
@@ -1783,22 +1783,22 @@
1692  continue;
1693  }
1694 
-
1695  const int who = ParallelContext::global_to_local_rank(ParticleDistributionMap(pld.m_lev)[pld.m_grid]);
+
1695  const int who = ParallelContext::global_to_local_rank(ParticleDistributionMap(pld.m_lev)[pld.m_grid]);
1696  if (who == MyProc) {
-
1697  if (pld.m_lev != lev || pld.m_grid != grid || pld.m_tile != tile) {
+
1697  if (pld.m_lev != lev || pld.m_grid != grid || pld.m_tile != tile) {
1698  // We own it but must shift it to another place.
-
1699  auto index = std::make_pair(pld.m_grid, pld.m_tile);
-
1700  AMREX_ASSERT(soa_local[pld.m_lev][index].size() == num_threads);
+
1699  auto index = std::make_pair(pld.m_grid, pld.m_tile);
+
1700  AMREX_ASSERT(soa_local[pld.m_lev][index].size() == num_threads);
1701  {
-
1702  auto& arr = soa_local[pld.m_lev][index][thread_num].GetIdCPUData();
+
1702  auto& arr = soa_local[pld.m_lev][index][thread_num].GetIdCPUData();
1703  arr.push_back(soa.GetIdCPUData()[pindex]);
1704  }
1705  for (int comp = 0; comp < NumRealComps(); ++comp) {
-
1706  RealVector& arr = soa_local[pld.m_lev][index][thread_num].GetRealData(comp);
+
1706  RealVector& arr = soa_local[pld.m_lev][index][thread_num].GetRealData(comp);
1707  arr.push_back(soa.GetRealData(comp)[pindex]);
1708  }
1709  for (int comp = 0; comp < NumIntComps(); ++comp) {
-
1710  IntVector& arr = soa_local[pld.m_lev][index][thread_num].GetIntData(comp);
+
1710  IntVector& arr = soa_local[pld.m_lev][index][thread_num].GetIntData(comp);
1711  arr.push_back(soa.GetIntData(comp)[pindex]);
1712  }
1713 
@@ -1807,7 +1807,7 @@
1716  }
1717  else {
1718  auto& particles_to_send = tmp_remote[who][thread_num];
-
1719  auto old_size = particles_to_send.size();
+
1719  auto old_size = particles_to_send.size();
1720  auto new_size = old_size + superparticle_size;
1721  particles_to_send.resize(new_size);
1722 
@@ -1854,11 +1854,11 @@
1763  iddata.erase(iddata.begin() + last + 1, iddata.begin() + npart);
1764  }
1765  for (int comp = 0; comp < NumRealComps(); comp++) {
-
1766  RealVector& rdata = soa.GetRealData(comp);
+
1766  RealVector& rdata = soa.GetRealData(comp);
1767  rdata.erase(rdata.begin() + last + 1, rdata.begin() + npart);
1768  }
1769  for (int comp = 0; comp < NumIntComps(); comp++) {
-
1770  IntVector& idata = soa.GetIntData(comp);
+
1770  IntVector& idata = soa.GetIntData(comp);
1771  idata.erase(idata.begin() + last + 1, idata.begin() + npart);
1772  }
1773  }
@@ -1872,11 +1872,11 @@
1781 
1782  // Second pass - for each tile in parallel, collect the particles we are owed from all thread's buffers.
1783  for (int lev = lev_min; lev <= lev_max; lev++) {
-
1784  typename std::map<std::pair<int, int>, Vector<ParticleVector > >::iterator pmap_it;
+
1784  typename std::map<std::pair<int, int>, Vector<ParticleVector > >::iterator pmap_it;
1785 
1786  if constexpr(!ParticleType::is_soa_particle) {
-
1787  Vector<std::pair<int, int> > grid_tile_ids;
-
1788  Vector<Vector<ParticleVector>* > pvec_ptrs;
+
1787  Vector<std::pair<int, int> > grid_tile_ids;
+
1788  Vector<Vector<ParticleVector>* > pvec_ptrs;
1789 
1790  // we need to create any missing map entries in serial here
1791  for (pmap_it=tmp_local[lev].begin(); pmap_it != tmp_local[lev].end(); pmap_it++)
@@ -1889,7 +1889,7 @@
1798 #ifdef AMREX_USE_OMP
1799 #pragma omp parallel for
1800 #endif
-
1801  for (int pit = 0; pit < static_cast<int>(pvec_ptrs.size()); ++pit)
+
1801  for (int pit = 0; pit < static_cast<int>(pvec_ptrs.size()); ++pit)
1802  {
1803  auto index = grid_tile_ids[pit];
1804  auto& ptile = DefineAndReturnParticleTile(lev, index.first, index.second);
@@ -1901,21 +1901,21 @@
1810  aos.insert(aos.end(), aos_tmp[i].begin(), aos_tmp[i].end());
1811  aos_tmp[i].erase(aos_tmp[i].begin(), aos_tmp[i].end());
1812  for (int comp = 0; comp < NumRealComps(); ++comp) {
-
1813  RealVector& arr = soa.GetRealData(comp);
-
1814  RealVector& tmp = soa_tmp[i].GetRealData(comp);
+
1813  RealVector& arr = soa.GetRealData(comp);
+
1814  RealVector& tmp = soa_tmp[i].GetRealData(comp);
1815  arr.insert(arr.end(), tmp.begin(), tmp.end());
1816  tmp.erase(tmp.begin(), tmp.end());
1817  }
1818  for (int comp = 0; comp < NumIntComps(); ++comp) {
-
1819  IntVector& arr = soa.GetIntData(comp);
-
1820  IntVector& tmp = soa_tmp[i].GetIntData(comp);
+
1819  IntVector& arr = soa.GetIntData(comp);
+
1820  IntVector& tmp = soa_tmp[i].GetIntData(comp);
1821  arr.insert(arr.end(), tmp.begin(), tmp.end());
1822  tmp.erase(tmp.begin(), tmp.end());
1823  }
1824  }
1825  }
1826  } else { // soa particle
-
1827  Vector<std::pair<int, int> > grid_tile_ids;
+
1827  Vector<std::pair<int, int> > grid_tile_ids;
1828 
1829  // we need to create any missing map entries in serial here
1830  for (auto soa_map_it=soa_local[lev].begin(); soa_map_it != soa_local[lev].end(); soa_map_it++)
@@ -1927,7 +1927,7 @@
1836 #ifdef AMREX_USE_OMP
1837 #pragma omp parallel for
1838 #endif
-
1839  for (int pit = 0; pit < static_cast<int>(grid_tile_ids.size()); ++pit) // NOLINT(modernize-loop-convert)
+
1839  for (int pit = 0; pit < static_cast<int>(grid_tile_ids.size()); ++pit) // NOLINT(modernize-loop-convert)
1840  {
1841  auto index = grid_tile_ids[pit];
1842  auto& ptile = DefineAndReturnParticleTile(lev, index.first, index.second);
@@ -1941,14 +1941,14 @@
1850  tmp.erase(tmp.begin(), tmp.end());
1851  }
1852  for (int comp = 0; comp < NumRealComps(); ++comp) {
-
1853  RealVector& arr = soa.GetRealData(comp);
-
1854  RealVector& tmp = soa_tmp[i].GetRealData(comp);
+
1853  RealVector& arr = soa.GetRealData(comp);
+
1854  RealVector& tmp = soa_tmp[i].GetRealData(comp);
1855  arr.insert(arr.end(), tmp.begin(), tmp.end());
1856  tmp.erase(tmp.begin(), tmp.end());
1857  }
1858  for (int comp = 0; comp < NumIntComps(); ++comp) {
-
1859  IntVector& arr = soa.GetIntData(comp);
-
1860  IntVector& tmp = soa_tmp[i].GetIntData(comp);
+
1859  IntVector& arr = soa.GetIntData(comp);
+
1860  IntVector& tmp = soa_tmp[i].GetIntData(comp);
1861  arr.insert(arr.end(), tmp.begin(), tmp.end());
1862  tmp.erase(tmp.begin(), tmp.end());
1863  }
@@ -1962,8 +1962,8 @@
1871  not_ours[who];
1872  }
1873 
-
1874  Vector<int> dest_proc_ids;
-
1875  Vector<Vector<Vector<char> >* > pbuff_ptrs;
+
1874  Vector<int> dest_proc_ids;
+
1875  Vector<Vector<Vector<char> >* > pbuff_ptrs;
1876  for (auto& kv : tmp_remote)
1877  {
1878  dest_proc_ids.push_back(kv.first);
@@ -1973,10 +1973,10 @@
1882 #ifdef AMREX_USE_OMP
1883 #pragma omp parallel for
1884 #endif
-
1885  for (int pmap_it = 0; pmap_it < static_cast<int>(pbuff_ptrs.size()); ++pmap_it)
+
1885  for (int pmap_it = 0; pmap_it < static_cast<int>(pbuff_ptrs.size()); ++pmap_it)
1886  {
1887  int who = dest_proc_ids[pmap_it];
-
1888  Vector<Vector<char> >& tmp = *(pbuff_ptrs[pmap_it]);
+
1888  Vector<Vector<char> >& tmp = *(pbuff_ptrs[pmap_it]);
1889  for (int i = 0; i < num_threads; ++i) {
1890  not_ours[who].insert(not_ours[who].end(), tmp[i].begin(), tmp[i].end());
1891  tmp[i].erase(tmp[i].begin(), tmp[i].end());
@@ -2801,15 +2801,8 @@
Definition: AMReX_ParticleUtil.H:395
Definition: AMReX_DenseBins.H:32
Definition: AMReX_ParticleUtil.H:341
- +
Definition: AMReX_Array.H:33
uint64_t m_idcpu
Definition: AMReX_Particle.H:252
-
Definition: AMReX_ParticleCommunication.H:58
-
void setNumLevels(int num_levels)
Definition: AMReX_ParticleCommunication.cpp:14
-
Vector< std::map< int, Gpu::DeviceVector< IntVect > > > m_periodic_shift
Definition: AMReX_ParticleCommunication.H:62
-
Vector< std::map< int, Gpu::DeviceVector< int > > > m_boxes
Definition: AMReX_ParticleCommunication.H:59
-
Vector< std::map< int, Gpu::DeviceVector< int > > > m_levels
Definition: AMReX_ParticleCommunication.H:60
-
void resize(int gid, int lev, int size)
Definition: AMReX_ParticleCommunication.cpp:22
-
Vector< std::map< int, Gpu::DeviceVector< int > > > m_src_indices
Definition: AMReX_ParticleCommunication.H:61
A struct used for storing a particle's position in the AMR hierarchy.
Definition: AMReX_ParticleContainer.H:90
Box m_grown_gridbox
Definition: AMReX_ParticleContainer.H:97
IntVect m_cell
Definition: AMReX_ParticleContainer.H:94
@@ -2831,7 +2824,6 @@
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RealType & rdata(int index) &
Definition: AMReX_Particle.H:356
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int & idata(int index) &
Definition: AMReX_Particle.H:427
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleCPUWrapper cpu() &
Definition: AMReX_Particle.H:312
-
Definition: AMReX_ParticleCommunication.H:34
Definition: AMReX_MakeParticle.H:16
diff --git a/amrex/docs_html/doxygen/AMReX__ParticleContainer_8H_source.html b/amrex/docs_html/doxygen/AMReX__ParticleContainer_8H_source.html index 488b40e9fb..29859ad377 100644 --- a/amrex/docs_html/doxygen/AMReX__ParticleContainer_8H_source.html +++ b/amrex/docs_html/doxygen/AMReX__ParticleContainer_8H_source.html @@ -361,431 +361,432 @@
369  return (lev < m_particles.size()) ? m_particles[lev].size() : 0;
370  }
371 
-
372  void reserveData () override;
-
373  void resizeData () override;
-
374 
-
375  void InitFromAsciiFile (const std::string& file, int extradata,
-
376  const IntVect* Nrep = nullptr);
+
376  void reserveData () override;
377 
-
378  void InitFromBinaryFile (const std::string& file, int extradata);
-
379 
-
380  void InitFromBinaryMetaFile (const std::string& file, int extradata);
-
381 
-
398  void InitRandom (Long icount, ULong iseed,
-
399  const ParticleInitData& pdata,
-
400  bool serialize = false, RealBox bx = RealBox());
-
401 
-
402 
-
418  void InitRandomPerBox (Long icount, ULong iseed, const ParticleInitData& pdata);
-
419 
-
420 
-
435  void InitOnePerCell (Real x_off, Real y_off, Real z_off,
-
436  const ParticleInitData& pdata);
-
437 
-
438 
-
450  void InitNRandomPerCell (int n_per_cell, const ParticleInitData& pdata);
-
451 
-
452  void Increment (MultiFab& mf, int level);
-
453 
-
454  Long IncrementWithTotal (MultiFab& mf, int level, bool local = false);
-
455 
-
492  void Redistribute (int lev_min = 0, int lev_max = -1, int nGrow = 0, int local=0,
-
493  bool remove_negative=true);
-
494 
-
495 
-
507  template <class index_type>
-
508  void ReorderParticles (int lev, const MFIter& mfi, const index_type* permutations);
-
509 
-
524  void SortParticlesForDeposition (IntVect idx_type);
-
525 
-
529  void SortParticlesByCell ();
-
530 
-
537  void SortParticlesByBin (IntVect bin_size);
-
538 
-
549  bool OK (int lev_min = 0, int lev_max = -1, int nGrow = 0) const;
-
550 
-
551  std::array<Long, 3> ByteSpread () const;
-
552 
-
553  std::array<Long, 3> PrintCapacity () const;
-
554 
-
555  void ShrinkToFit ();
-
556 
-
567  Long NumberOfParticlesAtLevel (int level, bool only_valid = true, bool only_local = false) const;
-
568 
-
569  Vector<Long> NumberOfParticlesInGrid (int level, bool only_valid = true, bool only_local = false) const;
-
570 
-
579  Long TotalNumberOfParticles (bool only_valid=true, bool only_local=false) const;
-
580 
+
384  void resizeData () override;
+
385 
+
386  void InitFromAsciiFile (const std::string& file, int extradata,
+
387  const IntVect* Nrep = nullptr);
+
388 
+
389  void InitFromBinaryFile (const std::string& file, int extradata);
+
390 
+
391  void InitFromBinaryMetaFile (const std::string& file, int extradata);
+
392 
+
409  void InitRandom (Long icount, ULong iseed,
+
410  const ParticleInitData& pdata,
+
411  bool serialize = false, RealBox bx = RealBox());
+
412 
+
413 
+
429  void InitRandomPerBox (Long icount, ULong iseed, const ParticleInitData& pdata);
+
430 
+
431 
+
446  void InitOnePerCell (Real x_off, Real y_off, Real z_off,
+
447  const ParticleInitData& pdata);
+
448 
+
449 
+
461  void InitNRandomPerCell (int n_per_cell, const ParticleInitData& pdata);
+
462 
+
463  void Increment (MultiFab& mf, int level);
+
464 
+
465  Long IncrementWithTotal (MultiFab& mf, int level, bool local = false);
+
466 
+
503  void Redistribute (int lev_min = 0, int lev_max = -1, int nGrow = 0, int local=0,
+
504  bool remove_negative=true);
+
505 
+
506 
+
518  template <class index_type>
+
519  void ReorderParticles (int lev, const MFIter& mfi, const index_type* permutations);
+
520 
+
535  void SortParticlesForDeposition (IntVect idx_type);
+
536 
+
540  void SortParticlesByCell ();
+
541 
+
548  void SortParticlesByBin (IntVect bin_size);
+
549 
+
560  bool OK (int lev_min = 0, int lev_max = -1, int nGrow = 0) const;
+
561 
+
562  std::array<Long, 3> ByteSpread () const;
+
563 
+
564  std::array<Long, 3> PrintCapacity () const;
+
565 
+
566  void ShrinkToFit ();
+
567 
+
578  Long NumberOfParticlesAtLevel (int level, bool only_valid = true, bool only_local = false) const;
+
579 
+
580  Vector<Long> NumberOfParticlesInGrid (int level, bool only_valid = true, bool only_local = false) const;
581 
-
589  void RemoveParticlesAtLevel (int level);
-
590 
- +
590  Long TotalNumberOfParticles (bool only_valid=true, bool only_local=false) const;
+
591 
592 
-
600  void CreateVirtualParticles (int level, AoS& virts) const;
+
600  void RemoveParticlesAtLevel (int level);
601 
-
610  void CreateGhostParticles (int level, int ngrow, AoS& ghosts) const;
-
611 
-
619  void AddParticlesAtLevel (AoS& particles, int level, int nGrow=0);
-
620 
-
628  void CreateVirtualParticles (int level, ParticleTileType& virts) const;
-
629 
-
638  void CreateGhostParticles (int level, int ngrow, ParticleTileType& ghosts) const;
-
639 
-
647  void AddParticlesAtLevel (ParticleTileType& particles, int level, int nGrow=0);
-
648 
-
649 
-
653  void clearParticles ();
-
654 
-
655 
-
664  template <class PCType,
-
665  std::enable_if_t<IsParticleContainer<PCType>::value, int> foo = 0>
-
666  void copyParticles (const PCType& other, bool local=false);
-
667 
+ +
603 
+
611  void CreateVirtualParticles (int level, AoS& virts) const;
+
612 
+
621  void CreateGhostParticles (int level, int ngrow, AoS& ghosts) const;
+
622 
+
630  void AddParticlesAtLevel (AoS& particles, int level, int nGrow=0);
+
631 
+
639  void CreateVirtualParticles (int level, ParticleTileType& virts) const;
+
640 
+
649  void CreateGhostParticles (int level, int ngrow, ParticleTileType& ghosts) const;
+
650 
+
658  void AddParticlesAtLevel (ParticleTileType& particles, int level, int nGrow=0);
+
659 
+
660 
+
664  void clearParticles ();
+
665 
+
666 
675  template <class PCType,
676  std::enable_if_t<IsParticleContainer<PCType>::value, int> foo = 0>
-
677  void addParticles (const PCType& other, bool local=false);
+
677  void copyParticles (const PCType& other, bool local=false);
678 
-
693  template <class F, class PCType,
-
694  std::enable_if_t<IsParticleContainer<PCType>::value, int> foo = 0,
-
695  std::enable_if_t<! std::is_integral_v<F>, int> bar = 0>
-
696  void copyParticles (const PCType& other, F&&f, bool local=false);
-
697 
-
711  template <class F, class PCType,
-
712  std::enable_if_t<IsParticleContainer<PCType>::value, int> foo = 0,
-
713  std::enable_if_t<! std::is_integral_v<F>, int> bar = 0>
-
714  void addParticles (const PCType& other, F const& f, bool local=false);
-
715 
-
723  void WriteParticleRealData (void* data, size_t size, std::ostream& os) const;
-
724 
-
733  void ReadParticleRealData (void* data, size_t size, std::istream& is);
-
734 
-
743  void Checkpoint (const std::string& dir, const std::string& name,
-
744  const Vector<std::string>& real_comp_names = Vector<std::string>(),
-
745  const Vector<std::string>& int_comp_names = Vector<std::string>()) const
-
746  {
-
747  Checkpoint(dir, name, true, real_comp_names, int_comp_names);
-
748  }
-
749 
-
755  void Checkpoint (const std::string& dir, const std::string& name, bool is_checkpoint,
-
756  const Vector<std::string>& real_comp_names = Vector<std::string>(),
-
757  const Vector<std::string>& int_comp_names = Vector<std::string>()) const;
-
758 
-
773  template <class F>
-
774  void WriteBinaryParticleData (const std::string& dir,
-
775  const std::string& name,
-
776  const Vector<int>& write_real_comp,
-
777  const Vector<int>& write_int_comp,
-
778  const Vector<std::string>& real_comp_names,
-
779  const Vector<std::string>& int_comp_names,
-
780  F&& f, bool is_checkpoint=false) const;
-
781 
-
782  void CheckpointPre ();
-
783 
-
784  void CheckpointPost ();
-
785 
-
792  void Restart (const std::string& dir, const std::string& file);
-
793 
-
801  void Restart (const std::string& dir, const std::string& file, bool is_checkpoint);
-
802 
-
809  void WritePlotFile (const std::string& dir, const std::string& name) const;
-
810 
-
822  template <class F, std::enable_if_t<!std::is_same_v<F, Vector<std::string>&>>* = nullptr>
-
823  void WritePlotFile (const std::string& dir, const std::string& name, F&& f) const;
-
824 
-
833  void WritePlotFile (const std::string& dir, const std::string& name,
-
834  const Vector<std::string>& real_comp_names,
-
835  const Vector<std::string>& int_comp_names) const;
-
836 
-
850  template <class F>
-
851  void WritePlotFile (const std::string& dir, const std::string& name,
-
852  const Vector<std::string>& real_comp_names,
-
853  const Vector<std::string>& int_comp_names, F&& f) const;
-
854 
-
863  void WritePlotFile (const std::string& dir, const std::string& name,
-
864  const Vector<std::string>& real_comp_names) const;
+
686  template <class PCType,
+
687  std::enable_if_t<IsParticleContainer<PCType>::value, int> foo = 0>
+
688  void addParticles (const PCType& other, bool local=false);
+
689 
+
704  template <class F, class PCType,
+
705  std::enable_if_t<IsParticleContainer<PCType>::value, int> foo = 0,
+
706  std::enable_if_t<! std::is_integral_v<F>, int> bar = 0>
+
707  void copyParticles (const PCType& other, F&&f, bool local=false);
+
708 
+
722  template <class F, class PCType,
+
723  std::enable_if_t<IsParticleContainer<PCType>::value, int> foo = 0,
+
724  std::enable_if_t<! std::is_integral_v<F>, int> bar = 0>
+
725  void addParticles (const PCType& other, F const& f, bool local=false);
+
726 
+
734  void WriteParticleRealData (void* data, size_t size, std::ostream& os) const;
+
735 
+
744  void ReadParticleRealData (void* data, size_t size, std::istream& is);
+
745 
+
754  void Checkpoint (const std::string& dir, const std::string& name,
+
755  const Vector<std::string>& real_comp_names = Vector<std::string>(),
+
756  const Vector<std::string>& int_comp_names = Vector<std::string>()) const
+
757  {
+
758  Checkpoint(dir, name, true, real_comp_names, int_comp_names);
+
759  }
+
760 
+
766  void Checkpoint (const std::string& dir, const std::string& name, bool is_checkpoint,
+
767  const Vector<std::string>& real_comp_names = Vector<std::string>(),
+
768  const Vector<std::string>& int_comp_names = Vector<std::string>()) const;
+
769 
+
784  template <class F>
+
785  void WriteBinaryParticleData (const std::string& dir,
+
786  const std::string& name,
+
787  const Vector<int>& write_real_comp,
+
788  const Vector<int>& write_int_comp,
+
789  const Vector<std::string>& real_comp_names,
+
790  const Vector<std::string>& int_comp_names,
+
791  F&& f, bool is_checkpoint=false) const;
+
792 
+
793  void CheckpointPre ();
+
794 
+
795  void CheckpointPost ();
+
796 
+
803  void Restart (const std::string& dir, const std::string& file);
+
804 
+
812  void Restart (const std::string& dir, const std::string& file, bool is_checkpoint);
+
813 
+
820  void WritePlotFile (const std::string& dir, const std::string& name) const;
+
821 
+
833  template <class F, std::enable_if_t<!std::is_same_v<F, Vector<std::string>&>>* = nullptr>
+
834  void WritePlotFile (const std::string& dir, const std::string& name, F&& f) const;
+
835 
+
844  void WritePlotFile (const std::string& dir, const std::string& name,
+
845  const Vector<std::string>& real_comp_names,
+
846  const Vector<std::string>& int_comp_names) const;
+
847 
+
861  template <class F>
+
862  void WritePlotFile (const std::string& dir, const std::string& name,
+
863  const Vector<std::string>& real_comp_names,
+
864  const Vector<std::string>& int_comp_names, F&& f) const;
865 
-
879  template <class F, std::enable_if_t<!std::is_same_v<F, Vector<std::string>>>* = nullptr>
-
880  void WritePlotFile (const std::string& dir, const std::string& name,
-
881  const Vector<std::string>& real_comp_names, F&& f) const;
-
882 
-
892  void WritePlotFile (const std::string& dir,
-
893  const std::string& name,
-
894  const Vector<int>& write_real_comp,
-
895  const Vector<int>& write_int_comp) const;
-
896 
-
911  template <class F>
-
912  void WritePlotFile (const std::string& dir,
-
913  const std::string& name,
-
914  const Vector<int>& write_real_comp,
-
915  const Vector<int>& write_int_comp, F&& f) const;
-
916 
-
930  void WritePlotFile (const std::string& dir,
-
931  const std::string& name,
-
932  const Vector<int>& write_real_comp,
-
933  const Vector<int>& write_int_comp,
-
934  const Vector<std::string>& real_comp_names,
-
935  const Vector<std::string>& int_comp_names) const;
-
936 
-
955  template <class F>
-
956  void WritePlotFile (const std::string& dir,
-
957  const std::string& name,
-
958  const Vector<int>& write_real_comp,
-
959  const Vector<int>& write_int_comp,
-
960  const Vector<std::string>& real_comp_names,
-
961  const Vector<std::string>& int_comp_names,
-
962  F&& f) const;
-
963 
-
964  void WritePlotFilePre ();
-
965 
-
966  void WritePlotFilePost ();
-
967 
-
968  void WriteAsciiFile (const std::string& file);
-
969 
-
974  const Vector<ParticleLevel>& GetParticles () const { return m_particles; }
-
975 
- -
981 
-
995  const ParticleLevel& GetParticles (int lev) const { return m_particles[lev]; }
-
996 
-
1010  ParticleLevel & GetParticles (int lev) { return m_particles[lev]; }
-
1011 
-
1034  const ParticleTileType& ParticlesAt (int lev, int grid, int tile) const
-
1035  { return m_particles[lev].at(std::make_pair(grid, tile)); }
-
1036 
-
1059  ParticleTileType& ParticlesAt (int lev, int grid, int tile)
-
1060  { return m_particles[lev].at(std::make_pair(grid, tile)); }
-
1061 
-
1083  template <class Iterator>
-
1084  const ParticleTileType& ParticlesAt (int lev, const Iterator& iter) const
-
1085  { return ParticlesAt(lev, iter.index(), iter.LocalTileIndex()); }
-
1086 
-
1108  template <class Iterator>
-
1109  ParticleTileType& ParticlesAt (int lev, const Iterator& iter)
-
1110  { return ParticlesAt(lev, iter.index(), iter.LocalTileIndex()); }
-
1111 
-
1134  ParticleTileType& DefineAndReturnParticleTile (int lev, int grid, int tile)
-
1135  {
-
1136  m_particles[lev][std::make_pair(grid, tile)].define(NumRuntimeRealComps(), NumRuntimeIntComps());
-
1137  return ParticlesAt(lev, grid, tile);
-
1138  }
-
1139 
-
1161  template <class Iterator>
-
1162  ParticleTileType& DefineAndReturnParticleTile (int lev, const Iterator& iter)
-
1163  {
-
1164  auto index = std::make_pair(iter.index(), iter.LocalTileIndex());
-
1165  m_particles[lev][index].define(NumRuntimeRealComps(), NumRuntimeIntComps());
-
1166  return ParticlesAt(lev, iter);
-
1167  }
-
1168 
-
1179  void AssignDensity (int rho_index,
-
1180  Vector<std::unique_ptr<MultiFab> >& mf_to_be_filled,
-
1181  int lev_min, int ncomp, int finest_level, int ngrow=2) const;
-
1182 
-
1183  void AssignCellDensitySingleLevel (int rho_index, MultiFab& mf, int level,
-
1184  int ncomp=1, int particle_lvl_offset = 0) const;
-
1185 
-
1186  template <typename P, typename Assignor=CellAssignor>
-
1187  IntVect Index (const P& p, int lev) const;
-
1188 
-
1198  ParticleLocData Reset (ParticleType& prt, bool update, bool verbose=true,
-
1199  ParticleLocData pld = ParticleLocData()) const;
-
1200 
-
1206  template <typename P>
-
1207  bool PeriodicShift (P& p) const;
-
1208 
- -
1210 
- -
1212 
-
1213  void SetUsePrePost (bool tf) const {
-
1214  usePrePost = tf;
-
1215  }
-
1216  bool GetUsePrePost () const {
-
1217  return usePrePost;
-
1218  }
+
874  void WritePlotFile (const std::string& dir, const std::string& name,
+
875  const Vector<std::string>& real_comp_names) const;
+
876 
+
890  template <class F, std::enable_if_t<!std::is_same_v<F, Vector<std::string>>>* = nullptr>
+
891  void WritePlotFile (const std::string& dir, const std::string& name,
+
892  const Vector<std::string>& real_comp_names, F&& f) const;
+
893 
+
903  void WritePlotFile (const std::string& dir,
+
904  const std::string& name,
+
905  const Vector<int>& write_real_comp,
+
906  const Vector<int>& write_int_comp) const;
+
907 
+
922  template <class F>
+
923  void WritePlotFile (const std::string& dir,
+
924  const std::string& name,
+
925  const Vector<int>& write_real_comp,
+
926  const Vector<int>& write_int_comp, F&& f) const;
+
927 
+
941  void WritePlotFile (const std::string& dir,
+
942  const std::string& name,
+
943  const Vector<int>& write_real_comp,
+
944  const Vector<int>& write_int_comp,
+
945  const Vector<std::string>& real_comp_names,
+
946  const Vector<std::string>& int_comp_names) const;
+
947 
+
966  template <class F>
+
967  void WritePlotFile (const std::string& dir,
+
968  const std::string& name,
+
969  const Vector<int>& write_real_comp,
+
970  const Vector<int>& write_int_comp,
+
971  const Vector<std::string>& real_comp_names,
+
972  const Vector<std::string>& int_comp_names,
+
973  F&& f) const;
+
974 
+
975  void WritePlotFilePre ();
+
976 
+
977  void WritePlotFilePost ();
+
978 
+
979  void WriteAsciiFile (const std::string& file);
+
980 
+
985  const Vector<ParticleLevel>& GetParticles () const { return m_particles; }
+
986 
+ +
992 
+
1006  const ParticleLevel& GetParticles (int lev) const { return m_particles[lev]; }
+
1007 
+
1021  ParticleLevel & GetParticles (int lev) { return m_particles[lev]; }
+
1022 
+
1045  const ParticleTileType& ParticlesAt (int lev, int grid, int tile) const
+
1046  { return m_particles[lev].at(std::make_pair(grid, tile)); }
+
1047 
+
1070  ParticleTileType& ParticlesAt (int lev, int grid, int tile)
+
1071  { return m_particles[lev].at(std::make_pair(grid, tile)); }
+
1072 
+
1094  template <class Iterator>
+
1095  const ParticleTileType& ParticlesAt (int lev, const Iterator& iter) const
+
1096  { return ParticlesAt(lev, iter.index(), iter.LocalTileIndex()); }
+
1097 
+
1119  template <class Iterator>
+
1120  ParticleTileType& ParticlesAt (int lev, const Iterator& iter)
+
1121  { return ParticlesAt(lev, iter.index(), iter.LocalTileIndex()); }
+
1122 
+
1145  ParticleTileType& DefineAndReturnParticleTile (int lev, int grid, int tile)
+
1146  {
+
1147  m_particles[lev][std::make_pair(grid, tile)].define(NumRuntimeRealComps(), NumRuntimeIntComps());
+
1148  return ParticlesAt(lev, grid, tile);
+
1149  }
+
1150 
+
1172  template <class Iterator>
+
1173  ParticleTileType& DefineAndReturnParticleTile (int lev, const Iterator& iter)
+
1174  {
+
1175  auto index = std::make_pair(iter.index(), iter.LocalTileIndex());
+
1176  m_particles[lev][index].define(NumRuntimeRealComps(), NumRuntimeIntComps());
+
1177  return ParticlesAt(lev, iter);
+
1178  }
+
1179 
+
1190  void AssignDensity (int rho_index,
+
1191  Vector<std::unique_ptr<MultiFab> >& mf_to_be_filled,
+
1192  int lev_min, int ncomp, int finest_level, int ngrow=2) const;
+
1193 
+
1194  void AssignCellDensitySingleLevel (int rho_index, MultiFab& mf, int level,
+
1195  int ncomp=1, int particle_lvl_offset = 0) const;
+
1196 
+
1197  template <typename P, typename Assignor=CellAssignor>
+
1198  IntVect Index (const P& p, int lev) const;
+
1199 
+
1209  ParticleLocData Reset (ParticleType& prt, bool update, bool verbose=true,
+
1210  ParticleLocData pld = ParticleLocData()) const;
+
1211 
+
1217  template <typename P>
+
1218  bool PeriodicShift (P& p) const;
1219 
-
1220  int GetMaxNextIDPrePost () const { return maxnextidPrePost; }
-
1221  Long GetNParticlesPrePost () const { return nparticlesPrePost; }
-
1222 
-
1223  void SetUseUnlink (bool tf) const {
-
1224  doUnlink = tf;
-
1225  }
-
1226 
-
1227  bool GetUseUnlink () const {
-
1228  return doUnlink;
+ +
1221 
+ +
1223 
+
1224  void SetUsePrePost (bool tf) const {
+
1225  usePrePost = tf;
+
1226  }
+
1227  bool GetUsePrePost () const {
+
1228  return usePrePost;
1229  }
1230 
-
1231  void RedistributeCPU (int lev_min = 0, int lev_max = -1, int nGrow = 0, int local=0,
-
1232  bool remove_negative=true);
+
1231  int GetMaxNextIDPrePost () const { return maxnextidPrePost; }
+
1232  Long GetNParticlesPrePost () const { return nparticlesPrePost; }
1233 
-
1234  void RedistributeGPU (int lev_min = 0, int lev_max = -1, int nGrow = 0, int local=0,
-
1235  bool remove_negative=true);
-
1236 
-
1237  Long superParticleSize() const { return superparticle_size; }
-
1238 
-
1239  template <typename T,
-
1240  std::enable_if_t<std::is_same_v<T,bool>,int> = 0>
-
1241  void AddRealComp (T communicate=true)
-
1242  {
-
1243  m_runtime_comps_defined = true;
- -
1245  h_redistribute_real_comp.push_back(communicate);
-
1246  SetParticleSize();
-
1247  this->resizeData();
-
1248 
-
1249  // resize runtime SoA
-
1250  for (int lev = 0; lev < numLevels(); ++lev) {
-
1251  for (ParIterType pti(*this,lev); pti.isValid(); ++pti) {
-
1252  auto& tile = DefineAndReturnParticleTile(lev, pti);
-
1253  auto np = tile.numParticles();
-
1254  if (np > 0) {
-
1255  auto& soa = tile.GetStructOfArrays();
-
1256  soa.resize(np);
-
1257  }
-
1258  }
-
1259  }
-
1260  }
-
1261 
-
1262  template <typename T,
-
1263  std::enable_if_t<std::is_same_v<T,bool>,int> = 0>
-
1264  void AddIntComp (T communicate=true)
-
1265  {
-
1266  m_runtime_comps_defined = true;
- -
1268  h_redistribute_int_comp.push_back(communicate);
-
1269  SetParticleSize();
-
1270  this->resizeData();
-
1271 
-
1272  // resize runtime SoA
-
1273  for (int lev = 0; lev < numLevels(); ++lev) {
-
1274  for (ParIterType pti(*this,lev); pti.isValid(); ++pti) {
-
1275  auto& tile = DefineAndReturnParticleTile(lev, pti);
-
1276  auto np = tile.numParticles();
-
1277  if (np > 0) {
-
1278  auto& soa = tile.GetStructOfArrays();
-
1279  soa.resize(np);
-
1280  }
-
1281  }
-
1282  }
-
1283  }
-
1284 
-
1285  int NumRuntimeRealComps () const { return m_num_runtime_real; }
-
1286  int NumRuntimeIntComps () const { return m_num_runtime_int; }
-
1287 
-
1288  int NumRealComps () const { return NArrayReal + NumRuntimeRealComps(); }
-
1289  int NumIntComps () const { return NArrayInt + NumRuntimeIntComps() ; }
-
1290 
-
1296  void ResizeRuntimeRealComp (int new_size, bool communicate);
-
1297 
-
1303  void ResizeRuntimeIntComp (int new_size, bool communicate);
-
1304 
-
1306  template <template<class> class NewAllocator=amrex::DefaultAllocator>
- +
1234  void SetUseUnlink (bool tf) const {
+
1235  doUnlink = tf;
+
1236  }
+
1237 
+
1238  bool GetUseUnlink () const {
+
1239  return doUnlink;
+
1240  }
+
1241 
+
1242  void RedistributeCPU (int lev_min = 0, int lev_max = -1, int nGrow = 0, int local=0,
+
1243  bool remove_negative=true);
+
1244 
+
1245  void RedistributeGPU (int lev_min = 0, int lev_max = -1, int nGrow = 0, int local=0,
+
1246  bool remove_negative=true);
+
1247 
+
1248  Long superParticleSize() const { return superparticle_size; }
+
1249 
+
1250  template <typename T,
+
1251  std::enable_if_t<std::is_same_v<T,bool>,int> = 0>
+
1252  void AddRealComp (T communicate=true)
+
1253  {
+
1254  m_runtime_comps_defined = true;
+ +
1256  h_redistribute_real_comp.push_back(communicate);
+
1257  SetParticleSize();
+
1258  this->resizeData();
+
1259 
+
1260  // resize runtime SoA
+
1261  for (int lev = 0; lev < numLevels(); ++lev) {
+
1262  for (ParIterType pti(*this,lev); pti.isValid(); ++pti) {
+
1263  auto& tile = DefineAndReturnParticleTile(lev, pti);
+
1264  auto np = tile.numParticles();
+
1265  if (np > 0) {
+
1266  auto& soa = tile.GetStructOfArrays();
+
1267  soa.resize(np);
+
1268  }
+
1269  }
+
1270  }
+
1271  }
+
1272 
+
1273  template <typename T,
+
1274  std::enable_if_t<std::is_same_v<T,bool>,int> = 0>
+
1275  void AddIntComp (T communicate=true)
+
1276  {
+
1277  m_runtime_comps_defined = true;
+ +
1279  h_redistribute_int_comp.push_back(communicate);
+
1280  SetParticleSize();
+
1281  this->resizeData();
+
1282 
+
1283  // resize runtime SoA
+
1284  for (int lev = 0; lev < numLevels(); ++lev) {
+
1285  for (ParIterType pti(*this,lev); pti.isValid(); ++pti) {
+
1286  auto& tile = DefineAndReturnParticleTile(lev, pti);
+
1287  auto np = tile.numParticles();
+
1288  if (np > 0) {
+
1289  auto& soa = tile.GetStructOfArrays();
+
1290  soa.resize(np);
+
1291  }
+
1292  }
+
1293  }
+
1294  }
+
1295 
+
1296  int NumRuntimeRealComps () const { return m_num_runtime_real; }
+
1297  int NumRuntimeIntComps () const { return m_num_runtime_int; }
+
1298 
+
1299  int NumRealComps () const { return NArrayReal + NumRuntimeRealComps(); }
+
1300  int NumIntComps () const { return NArrayInt + NumRuntimeIntComps() ; }
+
1301 
+
1307  void ResizeRuntimeRealComp (int new_size, bool communicate);
1308 
-
1319  template <template<class> class NewAllocator=amrex::DefaultAllocator>
- -
1321  make_alike () const
-
1322  {
- -
1324 
-
1325  // add runtime real comps to tmp
-
1326  for (int ic = 0; ic < this->NumRuntimeRealComps(); ++ic) { tmp.AddRealComp(false); }
-
1327 
-
1328  // add runtime int comps to tmp
-
1329  for (int ic = 0; ic < this->NumRuntimeIntComps(); ++ic) { tmp.AddIntComp(false); }
-
1330 
-
1331  return tmp;
-
1332  }
-
1333 
- - -
1336 
- -
1339  mutable bool usePrePost;
-
1340  mutable bool doUnlink;
- -
1342  mutable int nOutFilesPrePost;
- - - - - -
1348  mutable std::string HdrFileNamePrePost;
- -
1350 
-
1351 protected:
-
1352 
-
1366  template <typename P>
-
1367  bool Where (const P& prt, ParticleLocData& pld,
-
1368  int lev_min = 0, int lev_max = -1, int nGrow=0, int local_grid=-1) const;
-
1369 
-
1370 
-
1381  template <typename P>
- -
1383  int lev_min = 0, int lev_max = -1, int local_grid=-1) const;
-
1384 
-
1385 public:
-
1386  void
-
1387  WriteParticles (int level, std::ofstream& ofs, int fnum,
-
1388  Vector<int>& which, Vector<int>& count, Vector<Long>& where,
-
1389  const Vector<int>& write_real_comp, const Vector<int>& write_int_comp,
-
1390  const Vector<std::map<std::pair<int, int>,IntVector>>& particle_io_flags, bool is_checkpoint) const;
-
1391 #ifdef AMREX_USE_HDF5
-
1392 #include "AMReX_ParticlesHDF5.H"
-
1393 #endif
-
1394 
-
1395 protected:
-
1396 
-
1397  template <class RTYPE>
-
1398  void ReadParticles (int cnt, int grd, int lev, std::ifstream& ifs, int finest_level_in_file, bool convert_ids);
-
1399 
-
1400  void SetParticleSize ();
-
1401 
- -
1403 
-
1404 private:
-
1405  virtual void particlePostLocate (ParticleType& /*p*/, const ParticleLocData& /*pld*/,
-
1406  const int /*lev*/) {}
+
1314  void ResizeRuntimeIntComp (int new_size, bool communicate);
+
1315 
+
1317  template <template<class> class NewAllocator=amrex::DefaultAllocator>
+ +
1319 
+
1330  template <template<class> class NewAllocator=amrex::DefaultAllocator>
+ +
1332  make_alike () const
+
1333  {
+ +
1335 
+
1336  // add runtime real comps to tmp
+
1337  for (int ic = 0; ic < this->NumRuntimeRealComps(); ++ic) { tmp.AddRealComp(false); }
+
1338 
+
1339  // add runtime int comps to tmp
+
1340  for (int ic = 0; ic < this->NumRuntimeIntComps(); ++ic) { tmp.AddIntComp(false); }
+
1341 
+
1342  return tmp;
+
1343  }
+
1344 
+ + +
1347 
+ +
1350  mutable bool usePrePost;
+
1351  mutable bool doUnlink;
+ +
1353  mutable int nOutFilesPrePost;
+ + + + + +
1359  mutable std::string HdrFileNamePrePost;
+ +
1361 
+
1362 protected:
+
1363 
+
1377  template <typename P>
+
1378  bool Where (const P& prt, ParticleLocData& pld,
+
1379  int lev_min = 0, int lev_max = -1, int nGrow=0, int local_grid=-1) const;
+
1380 
+
1381 
+
1392  template <typename P>
+ +
1394  int lev_min = 0, int lev_max = -1, int local_grid=-1) const;
+
1395 
+
1396 public:
+
1397  void
+
1398  WriteParticles (int level, std::ofstream& ofs, int fnum,
+
1399  Vector<int>& which, Vector<int>& count, Vector<Long>& where,
+
1400  const Vector<int>& write_real_comp, const Vector<int>& write_int_comp,
+
1401  const Vector<std::map<std::pair<int, int>,IntVector>>& particle_io_flags, bool is_checkpoint) const;
+
1402 #ifdef AMREX_USE_HDF5
+
1403 #include "AMReX_ParticlesHDF5.H"
+
1404 #endif
+
1405 
+
1406 protected:
1407 
-
1408  virtual void correctCellVectors (int /*old_index*/, int /*new_index*/,
-
1409  int /*grid*/, const ParticleType& /*p*/) {}
+
1408  template <class RTYPE>
+
1409  void ReadParticles (int cnt, int grd, int lev, std::ifstream& ifs, int finest_level_in_file, bool convert_ids);
1410 
-
1411  void RedistributeMPI (std::map<int, Vector<char> >& not_ours,
-
1412  int lev_min = 0, int lev_max = 0, int nGrow = 0, int local=0);
-
1413 
-
1414  template <typename P>
- -
1416  int lev_min, int lev_max, int nGrow, int local_grid=-1) const;
-
1417 
-
1418  void Initialize ();
-
1419 
- - - -
1423 
- - - -
1427 };
+
1411  void SetParticleSize ();
+
1412 
+ +
1414 
+
1415 private:
+
1416  virtual void particlePostLocate (ParticleType& /*p*/, const ParticleLocData& /*pld*/,
+
1417  const int /*lev*/) {}
+
1418 
+
1419  virtual void correctCellVectors (int /*old_index*/, int /*new_index*/,
+
1420  int /*grid*/, const ParticleType& /*p*/) {}
+
1421 
+
1422  void RedistributeMPI (std::map<int, Vector<char> >& not_ours,
+
1423  int lev_min = 0, int lev_max = 0, int nGrow = 0, int local=0);
+
1424 
+
1425  template <typename P>
+ +
1427  int lev_min, int lev_max, int nGrow, int local_grid=-1) const;
1428 
-
1429 template <int T_NStructReal, int T_NStructInt, int T_NArrayReal, int T_NArrayInt, template<class> class Allocator, class CellAssignor>
-
1430 using ParticleContainer = ParticleContainer_impl<Particle<T_NStructReal, T_NStructInt>, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor>;
-
1431 
-
1432 template <int T_NArrayReal, int T_NArrayInt, template<class> class Allocator=DefaultAllocator, class CellAssignor=DefaultAssignor>
-
1433 using ParticleContainerPureSoA = ParticleContainer_impl<SoAParticle<T_NArrayReal, T_NArrayInt>, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor>;
+
1429  void Initialize ();
+
1430 
+ + +
1434 
-
1435 
-
1436 #include "AMReX_ParticleInit.H"
-
1437 #include "AMReX_ParticleContainerI.H"
-
1438 #include "AMReX_ParticleIO.H"
+ + + +
1438 };
1439 
-
1440 #ifdef AMREX_USE_HDF5
-
1441 #include "AMReX_ParticleHDF5.H"
-
1442 #endif
-
1443 
-
1444 }
+
1440 template <int T_NStructReal, int T_NStructInt, int T_NArrayReal, int T_NArrayInt, template<class> class Allocator, class CellAssignor>
+
1441 using ParticleContainer = ParticleContainer_impl<Particle<T_NStructReal, T_NStructInt>, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor>;
+
1442 
+
1443 template <int T_NArrayReal, int T_NArrayInt, template<class> class Allocator=DefaultAllocator, class CellAssignor=DefaultAssignor>
+
1444 using ParticleContainerPureSoA = ParticleContainer_impl<SoAParticle<T_NArrayReal, T_NArrayInt>, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor>;
1445 
-
1446 #endif /*_PARTICLES_H_*/
+
1446 
+
1447 #include "AMReX_ParticleInit.H"
+
1448 #include "AMReX_ParticleContainerI.H"
+
1449 #include "AMReX_ParticleIO.H"
+
1450 
+
1451 #ifdef AMREX_USE_HDF5
+
1452 #include "AMReX_ParticleHDF5.H"
+
1453 #endif
+
1454 
+
1455 }
+
1456 
+
1457 #endif /*_PARTICLES_H_*/
@@ -851,42 +852,42 @@
int numLevels() const
the number of defined levels in the ParticleContainer
Definition: AMReX_ParticleContainerBase.H:222
A distributed container for Particles sorted onto the levels, grids, and tiles of a block-structured ...
Definition: AMReX_ParticleContainer.H:144
void AssignDensity(int rho_index, Vector< std::unique_ptr< MultiFab > > &mf_to_be_filled, int lev_min, int ncomp, int finest_level, int ngrow=2) const
Functions depending the layout of the data. Use with caution.
Definition: AMReX_AmrParticles.H:17
-
void SetUseUnlink(bool tf) const
Definition: AMReX_ParticleContainer.H:1223
-
Vector< ParticleLevel > m_particles
Definition: AMReX_ParticleContainer.H:1426
-
Vector< Long > nParticlesAtLevelPrePost
Definition: AMReX_ParticleContainer.H:1344
+
void SetUseUnlink(bool tf) const
Definition: AMReX_ParticleContainer.H:1234
+
Vector< ParticleLevel > m_particles
Definition: AMReX_ParticleContainer.H:1437
+
Vector< Long > nParticlesAtLevelPrePost
Definition: AMReX_ParticleContainer.H:1355
void WriteBinaryParticleData(const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, F &&f, bool is_checkpoint=false) const
Writes particle data to disk in the AMReX native format.
void InitFromBinaryFile(const std::string &file, int extradata)
Definition: AMReX_ParticleInit.H:483
-
bool GetLevelDirectoriesCreated() const
Definition: AMReX_ParticleContainer.H:1211
-
size_t superparticle_size
Definition: AMReX_ParticleContainer.H:1424
+
bool GetLevelDirectoriesCreated() const
Definition: AMReX_ParticleContainer.H:1222
+
size_t superparticle_size
Definition: AMReX_ParticleContainer.H:1435
std::array< Long, 3 > ByteSpread() const
Definition: AMReX_ParticleContainerI.H:467
void clearParticles()
Clear all the particles in this container. This does not free memory.
Definition: AMReX_ParticleContainerI.H:976
void copyParticles(const PCType &other, bool local=false)
Copy particles from other to this ParticleContainer. Will clear all the particles from this container...
-
bool doUnlink
Definition: AMReX_ParticleContainer.H:1340
-
Vector< Vector< int > > whichPrePost
Definition: AMReX_ParticleContainer.H:1345
+
bool doUnlink
Definition: AMReX_ParticleContainer.H:1351
+
Vector< Vector< int > > whichPrePost
Definition: AMReX_ParticleContainer.H:1356
void WriteParticleRealData(void *data, size_t size, std::ostream &os) const
Write a contiguous chunk of real particle data to an ostream.
Definition: AMReX_ParticleIO.H:11
-
const ParticleTileType & ParticlesAt(int lev, const Iterator &iter) const
Return the ParticleTile for level "lev" and Iterator "iter". Const version.
Definition: AMReX_ParticleContainer.H:1084
+
const ParticleTileType & ParticlesAt(int lev, const Iterator &iter) const
Return the ParticleTile for level "lev" and Iterator "iter". Const version.
Definition: AMReX_ParticleContainer.H:1095
ParticleContainer_impl(const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< IntVect > &rr)
Same as the above, but accepts different refinement ratios in each direction.
Definition: AMReX_ParticleContainer.H:276
-
std::string HdrFileNamePrePost
Definition: AMReX_ParticleContainer.H:1348
-
Vector< Vector< Long > > wherePrePost
Definition: AMReX_ParticleContainer.H:1347
+
std::string HdrFileNamePrePost
Definition: AMReX_ParticleContainer.H:1359
+
Vector< Vector< Long > > wherePrePost
Definition: AMReX_ParticleContainer.H:1358
void WritePlotFile(const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, F &&f) const
This version of WritePlotFile writes all components and allows the user to specify the names of the c...
RealDescriptor ParticleRealDescriptor
Definition: AMReX_ParticleContainer.H:176
-
ParticleTileType & DefineAndReturnParticleTile(int lev, int grid, int tile)
Define and return the ParticleTile for level "lev", grid "grid" and tile "tile.".
Definition: AMReX_ParticleContainer.H:1134
-
int nOutFilesPrePost
Definition: AMReX_ParticleContainer.H:1342
-
int maxnextidPrePost
Definition: AMReX_ParticleContainer.H:1341
+
ParticleTileType & DefineAndReturnParticleTile(int lev, int grid, int tile)
Define and return the ParticleTile for level "lev", grid "grid" and tile "tile.".
Definition: AMReX_ParticleContainer.H:1145
+
int nOutFilesPrePost
Definition: AMReX_ParticleContainer.H:1353
+
int maxnextidPrePost
Definition: AMReX_ParticleContainer.H:1352
void WritePlotFile(const std::string &dir, const std::string &name, F &&f) const
This version of WritePlotFile writes all components and assigns component names.
ParticleContainer_impl(ParticleContainer_impl &&) noexcept=default
-
void Checkpoint(const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names=Vector< std::string >(), const Vector< std::string > &int_comp_names=Vector< std::string >()) const
Writes a particle checkpoint to file, suitable for restarting.
Definition: AMReX_ParticleContainer.H:743
+
void Checkpoint(const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names=Vector< std::string >(), const Vector< std::string > &int_comp_names=Vector< std::string >()) const
Writes a particle checkpoint to file, suitable for restarting.
Definition: AMReX_ParticleContainer.H:754
void addParticles(const PCType &other, bool local=false)
Add particles from other to this ParticleContainer. local controls whether or not to call Redistribut...
std::map< std::pair< int, int >, ParticleTileType > ParticleLevel
Definition: AMReX_ParticleContainer.H:185
-
bool levelDirectoriesCreated
Variables for i/o optimization saved for pre and post checkpoint.
Definition: AMReX_ParticleContainer.H:1338
-
ContainerLike< NewAllocator > make_alike() const
Definition: AMReX_ParticleContainer.H:1321
+
bool levelDirectoriesCreated
Variables for i/o optimization saved for pre and post checkpoint.
Definition: AMReX_ParticleContainer.H:1349
+
ContainerLike< NewAllocator > make_alike() const
Definition: AMReX_ParticleContainer.H:1332
void WriteAsciiFile(const std::string &file)
Definition: AMReX_ParticleIO.H:1134
static constexpr int NArrayInt
Number of extra integer components stored in struct-of-array form.
Definition: AMReX_ParticleContainer.H:157
void Initialize()
Definition: AMReX_ParticleContainerI.H:33
static constexpr int NArrayReal
Number of extra Real components stored in struct-of-array form.
Definition: AMReX_ParticleContainer.H:155
-
int GetMaxNextIDPrePost() const
Definition: AMReX_ParticleContainer.H:1220
+
int GetMaxNextIDPrePost() const
Definition: AMReX_ParticleContainer.H:1231
std::array< Long, 3 > PrintCapacity() const
Definition: AMReX_ParticleContainerI.H:511
-
bool GetUsePrePost() const
Definition: AMReX_ParticleContainer.H:1216
+
bool GetUsePrePost() const
Definition: AMReX_ParticleContainer.H:1227
ParticleContainer_impl & operator=(const ParticleContainer_impl &)=delete
bool PeriodicShift(P &p) const
Returns true if the particle was shifted.
typename ParticleTileType::AoS AoS
Definition: AMReX_ParticleContainer.H:186
@@ -899,108 +900,108 @@
Long NumberOfParticlesAtLevel(int level, bool only_valid=true, bool only_local=false) const
Returns # of particles at specified the level.
Definition: AMReX_ParticleContainerI.H:421
void AssignCellDensitySingleLevel(int rho_index, MultiFab &mf, int level, int ncomp=1, int particle_lvl_offset=0) const
Definition: AMReX_ParticleContainerI.H:2348
void Increment(MultiFab &mf, int level)
Definition: AMReX_ParticleContainerI.H:571
-
void SetLevelDirectoriesCreated(bool tf)
Definition: AMReX_ParticleContainer.H:1209
+
void SetLevelDirectoriesCreated(bool tf)
Definition: AMReX_ParticleContainer.H:1220
void ReorderParticles(int lev, const MFIter &mfi, const index_type *permutations)
Reorder particles on the tile given by lev and mfi using a the permutations array.
typename AoS::ParticleVector ParticleVector
Definition: AMReX_ParticleContainer.H:191
-
const ParticleLevel & GetParticles(int lev) const
Return the ParticleLevel for level "lev". Const version.
Definition: AMReX_ParticleContainer.H:995
+
const ParticleLevel & GetParticles(int lev) const
Return the ParticleLevel for level "lev". Const version.
Definition: AMReX_ParticleContainer.H:1006
void Define(const Geometry &geom, const DistributionMapping &dmap, const BoxArray &ba)
Define a default-constructed ParticleContainer using a ParGDB object. Single-level version.
Definition: AMReX_ParticleContainer.H:320
static constexpr int NStructInt
Number of extra integer components in the particle struct.
Definition: AMReX_ParticleContainer.H:153
ParticleContainer_impl()
Default constructor - construct an empty particle container that has no concept of a level hierarchy....
Definition: AMReX_ParticleContainer.H:198
-
void SetUsePrePost(bool tf) const
Definition: AMReX_ParticleContainer.H:1213
-
int NumRealComps() const
Definition: AMReX_ParticleContainer.H:1288
+
void SetUsePrePost(bool tf) const
Definition: AMReX_ParticleContainer.H:1224
+
int NumRealComps() const
Definition: AMReX_ParticleContainer.H:1299
void WritePlotFilePre()
Definition: AMReX_ParticleIO.H:560
bool EnforcePeriodicWhere(P &prt, ParticleLocData &pld, int lev_min=0, int lev_max=-1, int local_grid=-1) const
Checks whether the particle has crossed a periodic boundary in such a way that it is on levels lev_mi...
void RemoveParticlesAtLevel(int level)
The Following methods are for managing Virtual and Ghost Particles.
Definition: AMReX_ParticleContainerI.H:608
void InitFromAsciiFile(const std::string &file, int extradata, const IntVect *Nrep=nullptr)
Definition: AMReX_ParticleInit.H:37
-
ParticleTileType & DefineAndReturnParticleTile(int lev, const Iterator &iter)
Define and return the ParticleTile for level "lev", and Iterator "iter".
Definition: AMReX_ParticleContainer.H:1162
+
ParticleTileType & DefineAndReturnParticleTile(int lev, const Iterator &iter)
Define and return the ParticleTile for level "lev", and Iterator "iter".
Definition: AMReX_ParticleContainer.H:1173
Long TotalNumberOfParticles(bool only_valid=true, bool only_local=false) const
Returns # of particles at all levels.
Definition: AMReX_ParticleContainerI.H:351
-
Vector< int > h_redistribute_int_comp
Definition: AMReX_ParticleContainer.H:1335
+
Vector< int > h_redistribute_int_comp
Definition: AMReX_ParticleContainer.H:1346
typename ParticleTileType::SoA SoA
Definition: AMReX_ParticleContainer.H:187
-
virtual void correctCellVectors(int, int, int, const ParticleType &)
Definition: AMReX_ParticleContainer.H:1408
+
virtual void correctCellVectors(int, int, int, const ParticleType &)
Definition: AMReX_ParticleContainer.H:1419
void WritePlotFile(const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, F &&f) const
This version of WritePlotFile writes all components and allows the user to specify the names of the c...
bool OK(int lev_min=0, int lev_max=-1, int nGrow=0) const
OK checks that all particles are in the right places (for some value of right)
Definition: AMReX_ParticleContainerI.H:2287
void locateParticle(P &p, ParticleLocData &pld, int lev_min, int lev_max, int nGrow, int local_grid=-1) const
-
int NumRuntimeIntComps() const
Definition: AMReX_ParticleContainer.H:1286
-
Long GetNParticlesPrePost() const
Definition: AMReX_ParticleContainer.H:1221
+
int NumRuntimeIntComps() const
Definition: AMReX_ParticleContainer.H:1297
+
Long GetNParticlesPrePost() const
Definition: AMReX_ParticleContainer.H:1232
void InitRandom(Long icount, ULong iseed, const ParticleInitData &pdata, bool serialize=false, RealBox bx=RealBox())
This initializes the particle container with icount randomly distributed particles....
Definition: AMReX_ParticleInit.H:968
void ResizeRuntimeRealComp(int new_size, bool communicate)
Definition: AMReX_ParticleContainerI.H:2488
T_CellAssignor CellAssignor
Definition: AMReX_ParticleContainer.H:148
void RemoveParticlesNotAtFinestLevel()
Definition: AMReX_ParticleContainerI.H:622
-
DenseBins< typename ParticleTileType::ParticleTileDataType > m_bins
Definition: AMReX_ParticleContainer.H:1402
+
DenseBins< typename ParticleTileType::ParticleTileDataType > m_bins
Definition: AMReX_ParticleContainer.H:1413
void ReadParticleRealData(void *data, size_t size, std::istream &is)
Read a contiguous chunk of real particle data from an istream.
Definition: AMReX_ParticleIO.H:25
void RedistributeCPU(int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
Definition: AMReX_ParticleContainerI.H:1426
-
int m_num_runtime_int
Definition: AMReX_ParticleContainer.H:1422
+
int m_num_runtime_int
Definition: AMReX_ParticleContainer.H:1433
ParticleContainer_impl(ParGDBBase *gdb)
Construct a particle container using a ParGDB object. The container will track changes in the grid st...
Definition: AMReX_ParticleContainer.H:214
void Restart(const std::string &dir, const std::string &file)
Restart from checkpoint.
Definition: AMReX_ParticleIO.H:644
void WritePlotFilePost()
Definition: AMReX_ParticleIO.H:570
void Define(const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< IntVect > &rr)
Define a default-constructed ParticleContainer using a ParGDB object. Multi-level version.
Definition: AMReX_ParticleContainer.H:357
void ReadParticles(int cnt, int grd, int lev, std::ifstream &ifs, int finest_level_in_file, bool convert_ids)
void CreateVirtualParticles(int level, AoS &virts) const
Creates virtual particles for a given level that represent in some capacity all particles at finer le...
Definition: AMReX_ParticleContainerI.H:689
-
int NumRuntimeRealComps() const
Definition: AMReX_ParticleContainer.H:1285
+
int NumRuntimeRealComps() const
Definition: AMReX_ParticleContainer.H:1296
void Checkpoint(const std::string &dir, const std::string &name, bool is_checkpoint, const Vector< std::string > &real_comp_names=Vector< std::string >(), const Vector< std::string > &int_comp_names=Vector< std::string >()) const
Writes a particle checkpoint to file, suitable for restarting. This version allows the particle compo...
-
Long nparticlesPrePost
Definition: AMReX_ParticleContainer.H:1343
+
Long nparticlesPrePost
Definition: AMReX_ParticleContainer.H:1354
void InitNRandomPerCell(int n_per_cell, const ParticleInitData &pdata)
This initializes the particle container with n_per_cell randomly distributed particles per cell,...
Definition: AMReX_ParticleInit.H:1547
void WritePlotFile(const std::string &dir, const std::string &name) const
This version of WritePlotFile writes all components and assigns component names.
Definition: AMReX_ParticleIO.H:97
void WritePlotFile(const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, F &&f) const
This version of WritePlotFile assigns component names, but allows the user to pass in a vector of int...
-
int m_num_runtime_real
Definition: AMReX_ParticleContainer.H:1421
+
int m_num_runtime_real
Definition: AMReX_ParticleContainer.H:1432
void copyParticles(const PCType &other, F &&f, bool local=false)
Copy particles from other to this ParticleContainer. Will clear all the particles from this container...
void CheckpointPre()
Definition: AMReX_ParticleIO.H:447
ParticleLocData Reset(ParticleType &prt, bool update, bool verbose=true, ParticleLocData pld=ParticleLocData()) const
Updates a particle's location (Where), tries to periodic shift any particles that have left the domai...
Definition: AMReX_ParticleContainerI.H:262
-
Vector< std::string > filePrefixPrePost
Definition: AMReX_ParticleContainer.H:1349
+
Vector< std::string > filePrefixPrePost
Definition: AMReX_ParticleContainer.H:1360
void RedistributeGPU(int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
Definition: AMReX_ParticleContainerI.H:1236
int numLocalTilesAtLevel(int lev) const
The total number of tiles on this rank on this level.
Definition: AMReX_ParticleContainer.H:368
-
void reserveData() override
Definition: AMReX_ParticleContainerI.H:296
+
void reserveData() override
This reserves data in the vector of dummy MultiFabs used by the ParticleContainer for the maximum num...
Definition: AMReX_ParticleContainerI.H:296
void WritePlotFile(const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, F &&f) const
This is the most general version of WritePlotFile, which takes component names and flags for whether ...
static constexpr int NStructReal
Number of extra Real components in the particle struct.
Definition: AMReX_ParticleContainer.H:151
-
Vector< int > h_redistribute_real_comp
Definition: AMReX_ParticleContainer.H:1334
+
Vector< int > h_redistribute_real_comp
Definition: AMReX_ParticleContainer.H:1345
typename Particle< NStructReal, NStructInt >::RealType RealType
The type of the Real data.
Definition: AMReX_ParticleContainer.H:171
-
bool GetUseUnlink() const
Definition: AMReX_ParticleContainer.H:1227
+
bool GetUseUnlink() const
Definition: AMReX_ParticleContainer.H:1238
Vector< Long > NumberOfParticlesInGrid(int level, bool only_valid=true, bool only_local=false) const
Definition: AMReX_ParticleContainerI.H:366
-
int NumIntComps() const
Definition: AMReX_ParticleContainer.H:1289
+
int NumIntComps() const
Definition: AMReX_ParticleContainer.H:1300
Allocator< T > AllocatorType
The memory allocator in use.
Definition: AMReX_ParticleContainer.H:167
void RedistributeMPI(std::map< int, Vector< char > > &not_ours, int lev_min=0, int lev_max=0, int nGrow=0, int local=0)
Definition: AMReX_ParticleContainerI.H:1940
-
void AddIntComp(T communicate=true)
Definition: AMReX_ParticleContainer.H:1264
-
ParticleLevel & GetParticles(int lev)
Return the ParticleLevel for level "lev". Non-const version.
Definition: AMReX_ParticleContainer.H:1010
+
void AddIntComp(T communicate=true)
Definition: AMReX_ParticleContainer.H:1275
+
ParticleLevel & GetParticles(int lev)
Return the ParticleLevel for level "lev". Non-const version.
Definition: AMReX_ParticleContainer.H:1021
void CreateGhostParticles(int level, int ngrow, ParticleTileType &ghosts) const
Create ghost particles for a given level that are copies of particles near coarse->fine boundaries in...
void AddParticlesAtLevel(ParticleTileType &particles, int level, int nGrow=0)
Add particles from a pbox to the grid at this level.
void ShrinkToFit()
Definition: AMReX_ParticleContainerI.H:551
void addParticles(const PCType &other, F const &f, bool local=false)
Add particles from other to this ParticleContainer. local controls whether or not to call Redistribut...
-
Vector< ParticleLevel > & GetParticles()
Return the underlying Vector (over AMR levels) of ParticleLevels. Non-const version.
Definition: AMReX_ParticleContainer.H:980
+
Vector< ParticleLevel > & GetParticles()
Return the underlying Vector (over AMR levels) of ParticleLevels. Non-const version.
Definition: AMReX_ParticleContainer.H:991
bool Where(const P &prt, ParticleLocData &pld, int lev_min=0, int lev_max=-1, int nGrow=0, int local_grid=-1) const
Checks a particle's location on levels lev_min and higher. Returns false if the particle does not exi...
void Restart(const std::string &dir, const std::string &file, bool is_checkpoint)
Older version, for backwards compatibility.
-
void AddRealComp(T communicate=true)
Definition: AMReX_ParticleContainer.H:1241
+
void AddRealComp(T communicate=true)
Definition: AMReX_ParticleContainer.H:1252
void Define(ParGDBBase *gdb)
Define a default-constructed ParticleContainer using a ParGDB object. The container will track change...
Definition: AMReX_ParticleContainer.H:306
ParticleContainer_impl(const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< int > &rr)
Construct a particle container using a given Geometry, DistributionMapping, BoxArray and Vector of re...
Definition: AMReX_ParticleContainer.H:254
-
Long superParticleSize() const
Definition: AMReX_ParticleContainer.H:1237
+
Long superParticleSize() const
Definition: AMReX_ParticleContainer.H:1248
typename SoA::IntVector IntVector
Definition: AMReX_ParticleContainer.H:190
-
int num_int_comm_comps
Definition: AMReX_ParticleContainer.H:1425
-
size_t particle_size
Definition: AMReX_ParticleContainer.H:1424
+
int num_int_comm_comps
Definition: AMReX_ParticleContainer.H:1436
+
size_t particle_size
Definition: AMReX_ParticleContainer.H:1435
void SortParticlesByBin(IntVect bin_size)
Sort the particles on each tile by groups of cells, given an IntVect bin_size.
Definition: AMReX_ParticleContainerI.H:1173
-
virtual void particlePostLocate(ParticleType &, const ParticleLocData &, const int)
Definition: AMReX_ParticleContainer.H:1405
+
virtual void particlePostLocate(ParticleType &, const ParticleLocData &, const int)
Definition: AMReX_ParticleContainer.H:1416
void CreateGhostParticles(int level, int ngrow, AoS &ghosts) const
Create ghost particles for a given level that are copies of particles near coarse->fine boundaries in...
void Define(const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< int > &rr)
Define a default-constructed ParticleContainer using a ParGDB object. Multi-level version.
Definition: AMReX_ParticleContainer.H:338
void AddParticlesAtLevel(AoS &particles, int level, int nGrow=0)
Add particles from a pbox to the grid at this level.
void SortParticlesByCell()
Sort the particles on each tile by cell, using Fortran ordering.
Definition: AMReX_ParticleContainerI.H:1164
-
ParticleTileType & ParticlesAt(int lev, int grid, int tile)
Return the ParticleTile for level "lev", grid "grid" and tile "tile." Non-const version.
Definition: AMReX_ParticleContainer.H:1059
+
ParticleTileType & ParticlesAt(int lev, int grid, int tile)
Return the ParticleTile for level "lev", grid "grid" and tile "tile." Non-const version.
Definition: AMReX_ParticleContainer.H:1070
void ResizeRuntimeIntComp(int new_size, bool communicate)
Definition: AMReX_ParticleContainerI.H:2514
void InitFromBinaryMetaFile(const std::string &file, int extradata)
Definition: AMReX_ParticleInit.H:929
-
void resizeData() override
Definition: AMReX_ParticleContainerI.H:305
-
int num_real_comm_comps
Definition: AMReX_ParticleContainer.H:1425
-
ParticleTileType & ParticlesAt(int lev, const Iterator &iter)
Return the ParticleTile for level "lev" and Iterator "iter". Non-const version.
Definition: AMReX_ParticleContainer.H:1109
+
void resizeData() override
This resizes the vector of dummy MultiFabs used by the ParticleContainer for the current number of le...
Definition: AMReX_ParticleContainerI.H:305
+
int num_real_comm_comps
Definition: AMReX_ParticleContainer.H:1436
+
ParticleTileType & ParticlesAt(int lev, const Iterator &iter)
Return the ParticleTile for level "lev" and Iterator "iter". Non-const version.
Definition: AMReX_ParticleContainer.H:1120
IntVect Index(const P &p, int lev) const
void Redistribute(int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
Redistribute puts all the particles back in the right places (for some value of right)
Definition: AMReX_ParticleContainerI.H:1066
Long IncrementWithTotal(MultiFab &mf, int level, bool local=false)
Definition: AMReX_ParticleContainerI.H:598
-
const Vector< ParticleLevel > & GetParticles() const
Return the underlying Vector (over AMR levels) of ParticleLevels. Const version.
Definition: AMReX_ParticleContainer.H:974
+
const Vector< ParticleLevel > & GetParticles() const
Return the underlying Vector (over AMR levels) of ParticleLevels. Const version.
Definition: AMReX_ParticleContainer.H:985
void InitOnePerCell(Real x_off, Real y_off, Real z_off, const ParticleInitData &pdata)
This initializes the particle container with one particle per cell, where the other particle data and...
Definition: AMReX_ParticleInit.H:1463
-
const ParticleTileType & ParticlesAt(int lev, int grid, int tile) const
Return the ParticleTile for level "lev", grid "grid" and tile "tile." Const version.
Definition: AMReX_ParticleContainer.H:1034
+
const ParticleTileType & ParticlesAt(int lev, int grid, int tile) const
Return the ParticleTile for level "lev", grid "grid" and tile "tile." Const version.
Definition: AMReX_ParticleContainer.H:1045
void SortParticlesForDeposition(IntVect idx_type)
Sort particles on each tile such that particles adjacent in memory are likely to map to adjacent cell...
Definition: AMReX_ParticleContainerI.H:1206
~ParticleContainer_impl() override=default
void CheckpointPost()
Definition: AMReX_ParticleIO.H:504
T_ParticleType ParticleType
Definition: AMReX_ParticleContainer.H:146
-
bool m_runtime_comps_defined
Definition: AMReX_ParticleContainer.H:1420
-
Vector< Vector< int > > countPrePost
Definition: AMReX_ParticleContainer.H:1346
+
bool m_runtime_comps_defined
Definition: AMReX_ParticleContainer.H:1431
+
Vector< Vector< int > > countPrePost
Definition: AMReX_ParticleContainer.H:1357
void InitRandomPerBox(Long icount, ULong iseed, const ParticleInitData &pdata)
This initializes the container with icount randomly distributed particles per box,...
Definition: AMReX_ParticleInit.H:1362
-
bool usePrePost
Definition: AMReX_ParticleContainer.H:1339
+
bool usePrePost
Definition: AMReX_ParticleContainer.H:1350
void SetParticleSize()
Definition: AMReX_ParticleContainerI.H:7
A Box with real dimensions. A RealBox is OK iff volume >= 0.
Definition: AMReX_RealBox.H:21
A Descriptor of the Real Type.
Definition: AMReX_FabConv.H:105
diff --git a/amrex/docs_html/doxygen/AMReX__ParticleDataAdaptorI_8H_source.html b/amrex/docs_html/doxygen/AMReX__ParticleDataAdaptorI_8H_source.html index 88708d8e05..814d935d32 100644 --- a/amrex/docs_html/doxygen/AMReX__ParticleDataAdaptorI_8H_source.html +++ b/amrex/docs_html/doxygen/AMReX__ParticleDataAdaptorI_8H_source.html @@ -1245,7 +1245,7 @@
if(!(yy_init))
Definition: amrex_iparser.lex.nolint.H:924
A distributed container for Particles sorted onto the levels, grids, and tiles of a block-structured ...
Definition: AMReX_ParticleContainer.H:144
-
const Vector< ParticleLevel > & GetParticles() const
Return the underlying Vector (over AMR levels) of ParticleLevels. Const version.
Definition: AMReX_ParticleContainer.H:974
+
const Vector< ParticleLevel > & GetParticles() const
Return the underlying Vector (over AMR levels) of ParticleLevels. Const version.
Definition: AMReX_ParticleContainer.H:985
@ max
Definition: AMReX_ParallelReduce.H:17
Definition: AMReX_Amr.cpp:49
Definition: AMReX_MakeParticle.H:16
diff --git a/amrex/docs_html/doxygen/AMReX__ParticleIO_8H_source.html b/amrex/docs_html/doxygen/AMReX__ParticleIO_8H_source.html index 0a23d69b1b..6f0690ce94 100644 --- a/amrex/docs_html/doxygen/AMReX__ParticleIO_8H_source.html +++ b/amrex/docs_html/doxygen/AMReX__ParticleIO_8H_source.html @@ -821,7 +821,7 @@
720  int nrc = ParticleType::is_soa_particle ? NStructReal + NumRealComps() - AMREX_SPACEDIM : NStructReal + NumRealComps();
721  if (nr != nrc) {
722  amrex::Abort("ParticleContainer::Restart(): nr not the expected value");
-
723  }
+
723  }
724 
725  std::string comp_name;
726  for (int i = 0; i < nr; ++i) {
@@ -831,8 +831,8 @@
730  int ni;
731  HdrFile >> ni;
732  if (ni != NStructInt + NumIntComps()) {
-
733  amrex::Abort("ParticleContainer::Restart(): ni != NStructInt");
-
734  }
+
733  amrex::Abort("ParticleContainer::Restart(): ni != NStructInt");
+
734  }
735 
736  for (int i = 0; i < ni; ++i) {
737  HdrFile >> comp_name;
@@ -842,7 +842,7 @@
741  HdrFile >> checkpoint;
742 
743  Long nparticles;
-
744  HdrFile >> nparticles;
+
744  HdrFile >> nparticles;
745  AMREX_ASSERT(nparticles >= 0);
746 
747  Long maxnextid;
@@ -855,9 +855,9 @@
754  AMREX_ASSERT(finest_level_in_file >= 0);
755 
756  // Determine whether this is a dual-grid restart or not.
-
757  Vector<DistributionMapping> old_dms(finest_level_in_file + 1);
-
758  Vector<BoxArray> old_bas(finest_level_in_file + 1);
-
759  Vector<BoxArray> particle_box_arrays(finest_level_in_file + 1);
+
757  Vector<DistributionMapping> old_dms(finest_level_in_file + 1);
+
758  Vector<BoxArray> old_bas(finest_level_in_file + 1);
+
759  Vector<BoxArray> particle_box_arrays(finest_level_in_file + 1);
760  bool dual_grid = false;
761 
762  bool have_pheaders = false;
@@ -880,20 +880,20 @@
779  {
780  old_dms[lev] = ParticleDistributionMap(lev);
781  old_bas[lev] = ParticleBoxArray(lev);
-
782  std::string phdr_name = fullname;
+
782  std::string phdr_name = fullname;
783  phdr_name += "/Level_";
-
784  phdr_name = amrex::Concatenate(phdr_name, lev, 1);
+
784  phdr_name = amrex::Concatenate(phdr_name, lev, 1);
785  phdr_name += "/Particle_H";
786 
787  if (! amrex::FileExists(phdr_name)) { continue; }
788 
-
789  Vector<char> phdr_chars;
+
789  Vector<char> phdr_chars;
790  ParallelDescriptor::ReadAndBcastFile(phdr_name, phdr_chars);
-
791  std::string phdr_string(phdr_chars.dataPtr());
-
792  std::istringstream phdr_file(phdr_string, std::istringstream::in);
-
793 
+
791  std::string phdr_string(phdr_chars.dataPtr());
+
792  std::istringstream phdr_file(phdr_string, std::istringstream::in);
+
793 
794  if (lev > finestLevel())
-
795  {
+
795  {
796  dual_grid = true;
797  break;
798  }
@@ -901,24 +901,24 @@
800  particle_box_arrays[lev].readFrom(phdr_file);
801  if (! particle_box_arrays[lev].CellEqual(ParticleBoxArray(lev))) { dual_grid = true; }
802  }
-
803  } else // if no particle box array information exists in the file, we assume a single grid restart
+
803  } else // if no particle box array information exists in the file, we assume a single grid restart
804  {
805  dual_grid = false;
806  }
807 
808  if (dual_grid) {
-
809  for (int lev = 0; lev <= finestLevel(); lev++) {
+
809  for (int lev = 0; lev <= finestLevel(); lev++) {
810  // this can happen if there are no particles at a given level in the checkpoint
811  if (particle_box_arrays[lev].empty()) {
-
812  particle_box_arrays[lev] = BoxArray(Geom(lev).Domain());
+
812  particle_box_arrays[lev] = BoxArray(Geom(lev).Domain());
813  }
814  SetParticleBoxArray(lev, particle_box_arrays[lev]);
-
815  DistributionMapping pdm(particle_box_arrays[lev]);
+
815  DistributionMapping pdm(particle_box_arrays[lev]);
816  SetParticleDistributionMap(lev, pdm);
817  }
818  }
819 
-
820  Vector<int> ngrids(finest_level_in_file+1);
+
820  Vector<int> ngrids(finest_level_in_file+1);
821  for (int lev = 0; lev <= finest_level_in_file; lev++) {
822  HdrFile >> ngrids[lev];
823  AMREX_ASSERT(ngrids[lev] > 0);
@@ -931,18 +931,18 @@
830  }
831 
832  for (int lev = 0; lev <= finest_level_in_file; lev++) {
-
833  Vector<int> which(ngrids[lev]);
-
834  Vector<int> count(ngrids[lev]);
-
835  Vector<Long> where(ngrids[lev]);
+
833  Vector<int> which(ngrids[lev]);
+
834  Vector<int> count(ngrids[lev]);
+
835  Vector<Long> where(ngrids[lev]);
836  for (int i = 0; i < ngrids[lev]; i++) {
837  HdrFile >> which[i] >> count[i] >> where[i];
838  }
839 
-
840  Vector<int> grids_to_read;
+
840  Vector<int> grids_to_read;
841  if (lev <= finestLevel()) {
-
842  for (MFIter mfi(*m_dummy_mf[lev]); mfi.isValid(); ++mfi) {
+
842  for (MFIter mfi(*m_dummy_mf[lev]); mfi.isValid(); ++mfi) {
843  grids_to_read.push_back(mfi.index());
-
844  }
+
844  }
845  } else {
846 
847  // we lost a level on restart. we still need to read in particles
@@ -961,7 +961,7 @@
860  hi = lo + Navg + 1;
861  }
862  else {
-
863  lo = rank * Navg + Nleft;
+
863  lo = rank * Navg + Nleft;
864  hi = lo + Navg;
865  }
866 
@@ -972,7 +972,7 @@
871 
872  for(int grid : grids_to_read) {
873  if (count[grid] <= 0) { continue; }
-
874 
+
874 
875  // The file names in the header file are relative.
876  std::string name = fullname;
877 
@@ -990,7 +990,7 @@
889 
890  ParticleFile.open(name.c_str(), std::ios::in | std::ios::binary);
891 
-
892  if (!ParticleFile.good()) {
+
892  if (!ParticleFile.good()) {
893  amrex::FileOpenFailed(name);
894  }
895 
@@ -1001,7 +1001,7 @@
900  // underlying copy calls
901  if (how == "single") {
902  if constexpr (std::is_same_v<ParticleReal, float>) {
-
903  ReadParticles<float>(count[grid], grid, lev, ParticleFile, finest_level_in_file, convert_ids);
+
903  ReadParticles<float>(count[grid], grid, lev, ParticleFile, finest_level_in_file, convert_ids);
904  } else {
905  amrex::Error("File contains single-precision data, while AMReX is compiled with ParticleReal==double");
906  }
@@ -1028,7 +1028,7 @@
927  }
928 
929  if (dual_grid) {
-
930  for (int lev = 0; lev <= finest_level_in_file; lev++) {
+
930  for (int lev = 0; lev <= finest_level_in_file; lev++) {
931  SetParticleBoxArray(lev, old_bas[lev]);
932  SetParticleDistributionMap(lev, old_dms[lev]);
933  }
@@ -1039,7 +1039,7 @@
938  AMREX_ASSERT(OK());
939 
940  if (m_verbose > 1) {
-
941  auto stoptime = amrex::second() - strttime;
+
941  auto stoptime = amrex::second() - strttime;
943  amrex::Print() << "ParticleContainer::Restart() time: " << stoptime << '\n';
944  }
@@ -1062,22 +1062,22 @@
961  // the m_lev and m_grid data on disk. We can easily recreate
962  // that given the structure of the checkpoint file.
963  const int iChunkSize = 2 + NStructInt + NumIntComps();
-
964  Vector<int> istuff(std::size_t(cnt)*iChunkSize);
-
965  readIntData(istuff.dataPtr(), istuff.size(), ifs, FPC::NativeIntDescriptor());
-
966 
+
964  Vector<int> istuff(std::size_t(cnt)*iChunkSize);
+
965  readIntData(istuff.dataPtr(), istuff.size(), ifs, FPC::NativeIntDescriptor());
+
966 
967  // Then the real data in binary.
-
968  const int rChunkSize = ParticleType::is_soa_particle ? NStructReal + NumRealComps() : AMREX_SPACEDIM + NStructReal + NumRealComps();
+
968  const int rChunkSize = ParticleType::is_soa_particle ? NStructReal + NumRealComps() : AMREX_SPACEDIM + NStructReal + NumRealComps();
969  Vector<RTYPE> rstuff(std::size_t(cnt)*rChunkSize);
-
970  ReadParticleRealData(rstuff.dataPtr(), rstuff.size(), ifs);
+
970  ReadParticleRealData(rstuff.dataPtr(), rstuff.size(), ifs);
971 
972  // Now reassemble the particles.
-
973  int* iptr = istuff.dataPtr();
-
974  RTYPE* rptr = rstuff.dataPtr();
-
975 
+
973  int* iptr = istuff.dataPtr();
+
974  RTYPE* rptr = rstuff.dataPtr();
+
975 
-
977  ParticleLocData pld;
+
978 
- +
980  host_particles.reserve(15);
981  host_particles.resize(finest_level_in_file+1);
982 
@@ -1400,8 +1400,6 @@
void WriteBinaryParticleDataAsync(PC const &pc, const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, bool is_checkpoint)
Definition: AMReX_WriteBinaryParticleData.H:684
void WriteBinaryParticleDataSync(PC const &pc, const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, F const &f, bool is_checkpoint)
Definition: AMReX_WriteBinaryParticleData.H:392
-
A collection of Boxes stored in an Array.
Definition: AMReX_BoxArray.H:529
-
Calculates the distribution of FABs to MPI processes.
Definition: AMReX_DistributionMapping.H:41
Definition: AMReX_MFIter.H:57
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition: AMReX_MFIter.H:141
A collection (stored as an array) of FArrayBox objects.
Definition: AMReX_MultiFab.H:38
diff --git a/amrex/docs_html/doxygen/AMReX__ParticleInit_8H_source.html b/amrex/docs_html/doxygen/AMReX__ParticleInit_8H_source.html index f9a99b231b..0ef126a7c4 100644 --- a/amrex/docs_html/doxygen/AMReX__ParticleInit_8H_source.html +++ b/amrex/docs_html/doxygen/AMReX__ParticleInit_8H_source.html @@ -473,30 +473,30 @@
372  if (which == MyProc)
373  {
374  while (!nparticles.empty())
-
375  {
+
375  {
376  ParticleType& p = nparticles.back();
377  Where(p, pld);
-
378 
+
378 
379  host_particles[pld.m_lev][std::make_pair(pld.m_grid, pld.m_tile)].push_back(p);
-
380  if((host_real_attribs[pld.m_lev][std::make_pair(pld.m_grid, pld.m_tile)]).size() > (long unsigned int) (extradata - NStructReal)) {
+
380  if((host_real_attribs[pld.m_lev][std::make_pair(pld.m_grid, pld.m_tile)]).size() > (long unsigned int) (extradata - NStructReal)) {
381  for (int n = NStructReal; n < extradata; n++)
382  {
383  Real rdata = nreals[n-NStructReal].back();
384  host_real_attribs[pld.m_lev][std::make_pair(pld.m_grid, pld.m_tile)][n-NStructReal].push_back(rdata);
385  }
-
386  }
+
386  }
387 
388  nparticles.pop_back();
-
389 
+
389 
390  if (nreals.size() > extradata - NStructReal) {
-
391  for (int n = NStructReal; n < extradata; n++)
+
391  for (int n = NStructReal; n < extradata; n++)
392  {
393  nreals[n-NStructReal].pop_back();
394  }
395  }
396  }
397  }
-
398 
+
398 
399  for (int lev = 0; lev < static_cast<int>(host_particles.size()); ++lev)
400  {
401  for (auto& kv : host_particles[lev])
@@ -507,7 +507,7 @@
406 
407  auto& dst_tile = GetParticles(lev)[std::make_pair(grid,tile)];
408  auto old_size = dst_tile.GetArrayOfStructs().size();
-
409  auto new_size = old_size + src_tile.size();
+
409  auto new_size = old_size + src_tile.size();
410  dst_tile.resize(new_size);
411 
412  Gpu::copyAsync(Gpu::hostToDevice, src_tile.begin(), src_tile.end(),
@@ -516,7 +516,7 @@
415  for (int i = 0; i < NArrayReal; ++i) {
417  host_real_attribs[lev][std::make_pair(grid,tile)][i].begin(),
-
418  host_real_attribs[lev][std::make_pair(grid,tile)][i].end(),
+
418  host_real_attribs[lev][std::make_pair(grid,tile)][i].end(),
419  dst_tile.GetStructOfArrays().GetRealData(i).begin() + old_size);
420  }
421  }
@@ -527,13 +527,13 @@
426 
427  }
428 
-
429  if (m_verbose > 0)
+
429  if (m_verbose > 0)
430  {
431  const int IOProcNumber = ParallelDescriptor::IOProcessorNumber();
432 
433  Long num_particles = how_many;
434 
-
435  ParallelDescriptor::ReduceLongSum(num_particles, IOProcNumber);
+
435  ParallelDescriptor::ReduceLongSum(num_particles, IOProcNumber);
436 
437  if (AMREX_D_TERM(lNrep[0] == 1, && lNrep[1] == 1, && lNrep[2] == 1))
438  {
@@ -544,11 +544,11 @@
443  Long num_particles_read = how_many_read;
444 
445  ParallelDescriptor::ReduceLongSum(num_particles_read, IOProcNumber);
-
446 
+
446 
447  amrex::Print() << "Replication the domain with vector "
448  << AMREX_D_TERM(lNrep[0] << " ", << lNrep[1] << " ", << lNrep[2]) << "\n"
449  << "Total number of particles read in : " << num_particles_read << '\n'
-
450  << "Total number of particles after replication: " << num_particles << '\n';
+
450  << "Total number of particles after replication: " << num_particles << '\n';
451  }
452  }
453 
@@ -559,7 +559,7 @@
458  ByteSpread();
459 
460  auto runtime = amrex::second() - strttime;
-
461 
+
461 
463 
464  amrex::Print() << "InitFromAsciiFile() time: " << runtime << '\n';
diff --git a/amrex/docs_html/doxygen/classamrex_1_1AmrParticleContainer__impl.html b/amrex/docs_html/doxygen/classamrex_1_1AmrParticleContainer__impl.html index 76217ca23a..67809ff0e1 100644 --- a/amrex/docs_html/doxygen/classamrex_1_1AmrParticleContainer__impl.html +++ b/amrex/docs_html/doxygen/classamrex_1_1AmrParticleContainer__impl.html @@ -223,8 +223,10 @@  The total number of tiles on this rank on this level. More...
  void reserveData () override + This reserves data in the vector of dummy MultiFabs used by the ParticleContainer for the maximum number of levels possible. More...
  void resizeData () override + This resizes the vector of dummy MultiFabs used by the ParticleContainer for the current number of levels and calls RedefineDummyMF on each level. Note that this must be done prior to using ParticleIterator. More...
  void InitFromAsciiFile (const std::string &file, int extradata, const IntVect *Nrep=nullptr)   diff --git a/amrex/docs_html/doxygen/classamrex_1_1AmrTracerParticleContainer.html b/amrex/docs_html/doxygen/classamrex_1_1AmrTracerParticleContainer.html index 80154dbfc1..52ff240833 100644 --- a/amrex/docs_html/doxygen/classamrex_1_1AmrTracerParticleContainer.html +++ b/amrex/docs_html/doxygen/classamrex_1_1AmrTracerParticleContainer.html @@ -195,8 +195,10 @@  The total number of tiles on this rank on this level. More...
  void reserveData () override + This reserves data in the vector of dummy MultiFabs used by the ParticleContainer for the maximum number of levels possible. More...
  void resizeData () override + This resizes the vector of dummy MultiFabs used by the ParticleContainer for the current number of levels and calls RedefineDummyMF on each level. Note that this must be done prior to using ParticleIterator. More...
  void InitFromAsciiFile (const std::string &file, int extradata, const IntVect *Nrep=nullptr)   diff --git a/amrex/docs_html/doxygen/classamrex_1_1NeighborParticleContainer.html b/amrex/docs_html/doxygen/classamrex_1_1NeighborParticleContainer.html index 0e0af8cd35..35f334c64d 100644 --- a/amrex/docs_html/doxygen/classamrex_1_1NeighborParticleContainer.html +++ b/amrex/docs_html/doxygen/classamrex_1_1NeighborParticleContainer.html @@ -337,8 +337,10 @@  The total number of tiles on this rank on this level. More...
  void reserveData () override + This reserves data in the vector of dummy MultiFabs used by the ParticleContainer for the maximum number of levels possible. More...
  void resizeData () override + This resizes the vector of dummy MultiFabs used by the ParticleContainer for the current number of levels and calls RedefineDummyMF on each level. Note that this must be done prior to using ParticleIterator. More...
  void InitFromAsciiFile (const std::string &file, int extradata, const IntVect *Nrep=nullptr)   diff --git a/amrex/docs_html/doxygen/classamrex_1_1ParticleContainer__impl.html b/amrex/docs_html/doxygen/classamrex_1_1ParticleContainer__impl.html index a630c339a7..ed6b1e1e9c 100644 --- a/amrex/docs_html/doxygen/classamrex_1_1ParticleContainer__impl.html +++ b/amrex/docs_html/doxygen/classamrex_1_1ParticleContainer__impl.html @@ -217,8 +217,10 @@  The total number of tiles on this rank on this level. More...
  void reserveData () override + This reserves data in the vector of dummy MultiFabs used by the ParticleContainer for the maximum number of levels possible. More...
  void resizeData () override + This resizes the vector of dummy MultiFabs used by the ParticleContainer for the current number of levels and calls RedefineDummyMF on each level. Note that this must be done prior to using ParticleIterator. More...
  void InitFromAsciiFile (const std::string &file, int extradata, const IntVect *Nrep=nullptr)   @@ -4991,6 +4993,8 @@

+

This reserves data in the vector of dummy MultiFabs used by the ParticleContainer for the maximum number of levels possible.

+

Reimplemented from amrex::ParticleContainerBase.

@@ -5073,6 +5077,8 @@

+

This resizes the vector of dummy MultiFabs used by the ParticleContainer for the current number of levels and calls RedefineDummyMF on each level. Note that this must be done prior to using ParticleIterator.

+

Reimplemented from amrex::ParticleContainerBase.

diff --git a/amrex/docs_html/doxygen/classamrex_1_1TracerParticleContainer.html b/amrex/docs_html/doxygen/classamrex_1_1TracerParticleContainer.html index db9a366f69..664a780c9e 100644 --- a/amrex/docs_html/doxygen/classamrex_1_1TracerParticleContainer.html +++ b/amrex/docs_html/doxygen/classamrex_1_1TracerParticleContainer.html @@ -182,8 +182,10 @@  The total number of tiles on this rank on this level. More...
  void reserveData () override + This reserves data in the vector of dummy MultiFabs used by the ParticleContainer for the maximum number of levels possible. More...
  void resizeData () override + This resizes the vector of dummy MultiFabs used by the ParticleContainer for the current number of levels and calls RedefineDummyMF on each level. Note that this must be done prior to using ParticleIterator. More...
  void InitFromAsciiFile (const std::string &file, int extradata, const IntVect *Nrep=nullptr)   diff --git a/amrex/docs_xml/doxygen/AMReX__ParticleContainerI_8H.xml b/amrex/docs_xml/doxygen/AMReX__ParticleContainerI_8H.xml index 90e70607d8..999a0bb1bc 100644 --- a/amrex/docs_xml/doxygen/AMReX__ParticleContainerI_8H.xml +++ b/amrex/docs_xml/doxygen/AMReX__ParticleContainerI_8H.xml @@ -464,11 +464,11 @@ LayoutData<Long>np_per_grid_local(ParticleBoxArray(lev), ParticleDistributionMap(lev)); - -for(ParConstIterTypepti(*this,lev);pti.isValid();++pti) + +for(ParConstIterTypepti(*this,lev);pti.isValid();++pti) { intgid=pti.index(); -if(only_valid) +if(only_valid) { constauto&ptile=ParticlesAt(lev,pti); constintnp=ptile.numParticles(); @@ -476,7 +476,7 @@ ReduceOps<ReduceOpSum>reduce_op; ReduceData<int>reduce_data(reduce_op); -usingReduceTuple=typenamedecltype(reduce_data)::Type; +usingReduceTuple=typenamedecltype(reduce_data)::Type; reduce_op.eval(np,reduce_data, [=]AMREX_GPU_DEVICE(inti)->ReduceTuple @@ -492,7 +492,7 @@ } } -Vector<Long>nparticles(np_per_grid_local.size(),0); +Vector<Long>nparticles(np_per_grid_local.size(),0); if(only_local) { for(ParConstIterTypepti(*this,lev);pti.isValid();++pti) @@ -544,9 +544,9 @@ } } -if(!only_local){ +if(!only_local){ ParallelAllReduce::Sum(nparticles,ParallelContext::CommunicatorSub()); -} +} returnnparticles; } @@ -555,11 +555,11 @@ //Thisincludesbothvalidandinvalidparticlessinceinvalidparticlesstilltakeupspace. // -template<typenameParticleType,intNArrayReal,intNArrayInt, -template<class>classAllocator,classCellAssignor> -std::array<Long,3> -ParticleContainer_impl<ParticleType,NArrayReal,NArrayInt,Allocator,CellAssignor> -::ByteSpread()const +template<typenameParticleType,intNArrayReal,intNArrayInt, +template<class>classAllocator,classCellAssignor> +std::array<Long,3> +ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor> +::ByteSpread()const { Longcnt=0; @@ -584,7 +584,7 @@ ParallelReduce::Sum(cnt,IOProc,ParallelContext::CommunicatorSub()); amrex::Print()<<"ParticleContainerspreadacrossMPInodes-bytes(numparticles):[Min:" -<<mn*sz +<<mn*sz <<"("<<mn<<")" <<",Max:" <<mx*sz @@ -595,7 +595,7 @@ #ifdefAMREX_LAZY }); #endif - + return{mn*sz,mx*sz,cnt*sz}; } @@ -616,23 +616,23 @@ } Longmn=cnt,mx=mn; - + constintIOProc=ParallelContext::IOProcessorNumberSub(); #ifdefAMREX_LAZY Lazy::QueueReduction([=]()mutable{ -#endif +#endif ParallelReduce::Min(mn,IOProc,ParallelContext::CommunicatorSub()); ParallelReduce::Max(mx,IOProc,ParallelContext::CommunicatorSub()); ParallelReduce::Sum(cnt,IOProc,ParallelContext::CommunicatorSub()); amrex::Print()<<"ParticleContainerspreadacrossMPInodes-bytes:[Min:" -<<mn +<<mn <<",Max:" -<<mx +<<mx <<",Total:" <<cnt -<<"]\n"; +<<"]\n"; #ifdefAMREX_LAZY }); #endif @@ -640,22 +640,22 @@ return{mn,mx,cnt}; } -template<typenameParticleType,intNArrayReal,intNArrayInt, -template<class>classAllocator,classCellAssignor> +template<typenameParticleType,intNArrayReal,intNArrayInt, +template<class>classAllocator,classCellAssignor> void -ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>::ShrinkToFit() +ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>::ShrinkToFit() { -for(unsignedlev=0;lev<m_particles.size();lev++){ +for(unsignedlev=0;lev<m_particles.size();lev++){ auto&pmap=m_particles[lev]; -for(auto&kv:pmap){ +for(auto&kv:pmap){ auto&ptile=kv.second; ptile.shrink_to_fit(); } } -} +} template<typenameParticleType,intNArrayReal,intNArrayInt, -template<class>classAllocator,classCellAssignor> +template<class>classAllocator,classCellAssignor> void ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>::Increment(MultiFab&mf,intlev) { @@ -664,9 +664,9 @@ AMREX_ASSERT(OK()); if(m_particles.empty()){return;} AMREX_ASSERT(lev>=0&&lev<int(m_particles.size())); -AMREX_ASSERT(numParticlesOutOfRange(*this,0)==0); - -constauto&geom=Geom(lev); +AMREX_ASSERT(numParticlesOutOfRange(*this,0)==0); + +constauto&geom=Geom(lev); constautoplo=geom.ProbLoArray(); constautodxi=geom.InvCellSizeArray(); constautodomain=geom.Domain(); @@ -675,9 +675,9 @@ amrex::Array4<amrex::Real>const&count) { constauto&p=make_particle<ConstParticleType>{}(ptd,ip); -CellAssignorassignor; -IntVectiv=assignor(p,plo,dxi,domain); -amrex::Gpu::Atomic::AddNoRet(&count(iv),1.0_rt); +CellAssignorassignor; +IntVectiv=assignor(p,plo,dxi,domain); +amrex::Gpu::Atomic::AddNoRet(&count(iv),1.0_rt); },false); } @@ -686,9 +686,9 @@ Long ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>::IncrementWithTotal(MultiFab&mf,intlev,boollocal) { -BL_PROFILE("ParticleContainer::IncrementWithTotal(lev)"); +BL_PROFILE("ParticleContainer::IncrementWithTotal(lev)"); Increment(mf,lev); -returnTotalNumberOfParticles(true,local); +returnTotalNumberOfParticles(true,local); } template<typenameParticleType,intNArrayReal,intNArrayInt, @@ -697,11 +697,11 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>::RemoveParticlesAtLevel(intlevel) { BL_PROFILE("ParticleContainer::RemoveParticlesAtLevel()"); -if(level>=int(this->m_particles.size())){return;} +if(level>=int(this->m_particles.size())){return;} if(!this->m_particles[level].empty()) { -ParticleLevel().swap(this->m_particles[level]); +ParticleLevel().swap(this->m_particles[level]); } } @@ -714,7 +714,7 @@ AMREX_ASSERT(this->finestLevel()+1==int(this->m_particles.size())); Longcnt=0; - + for(unsignedlev=0;lev<m_particles.size()-1;++lev){ auto&pmap=m_particles[lev]; if(!pmap.empty()){ @@ -725,7 +725,7 @@ ParticleLevel().swap(pmap); } } - + // //Printhowmanyparticlesremovedoneachprocessorifanywereremoved. // @@ -739,7 +739,7 @@ { amrex::AssignGrid<amrex::DenseBinIteratorFactory<amrex::Box>>m_assign_buffer_grid; -GpuArray<Real, AMREX_SPACEDIM>m_plo,m_dxi; +GpuArray<Real,AMREX_SPACEDIM>m_plo,m_dxi; Boxm_domain; FilterVirt(constamrex::AssignGrid<amrex::DenseBinIteratorFactory<amrex::Box>>&assign_buffer_grid,constGpuArray<Real,AMREX_SPACEDIM>&plo, @@ -750,7 +750,7 @@ template<typenameSrcData> AMREX_GPU_HOST_DEVICE intoperator() (constSrcData&src,intsrc_i)constnoexcept -{ +{ autoiv=getParticleCell(src.m_aos[src_i],m_plo,m_dxi,m_domain); return(m_assign_buffer_grid(iv)!=-1); } @@ -1265,7 +1265,7 @@ { constGeometry&geom=Geom(lev); constautodxi=geom.InvCellSizeArray(); -constautoplo=geom.ProbLoArray(); +constautoplo=geom.ProbLoArray(); constautodomain=geom.Domain(); for(MFItermfi=MakeMFIter(lev);mfi.isValid();++mfi) @@ -1276,11 +1276,11 @@ constBox&box=mfi.validbox(); intntiles=numTilesInBox(box,true,bin_size); - + m_bins.build(np,ptile.getParticleTileData(),ntiles, GetParticleBin{plo,dxi,domain,bin_size,box}); ReorderParticles(lev,mfi,m_bins.permutationPtr()); -} +} } } @@ -1291,7 +1291,7 @@ ::SortParticlesForDeposition(IntVectidx_type) { BL_PROFILE("ParticleContainer::SortParticlesForDeposition()"); - + for(intlev=0;lev<numLevels();++lev) { constGeometry&geom=Geom(lev); @@ -1313,21 +1313,21 @@ // //TheGPUimplementationofRedistribute -// -template<typenameParticleType,intNArrayReal,intNArrayInt, -template<class>classAllocator,classCellAssignor> -void -ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor> -::RedistributeGPU(intlev_min,intlev_max,intnGrow,intlocal,boolremove_negative) +// +template<typenameParticleType,intNArrayReal,intNArrayInt, +template<class>classAllocator,classCellAssignor> +void +ParticleContainer_impl<ParticleType,NArrayReal,NArrayInt,Allocator,CellAssignor> +::RedistributeGPU(intlev_min,intlev_max,intnGrow,intlocal,boolremove_negative) { #ifdefAMREX_USE_GPU if(local){AMREX_ASSERT(numParticlesOutOfRange(*this,lev_min,lev_max,local)==0);} -//sanitycheck +//sanitycheck AMREX_ALWAYS_ASSERT(do_tiling==false); -BL_PROFILE("ParticleContainer::RedistributeGPU()"); +BL_PROFILE("ParticleContainer::RedistributeGPU()"); BL_PROFILE_VAR_NS("Redistribute_partition",blp_partition); inttheEffectiveFinestLevel=m_gdb->finestLevel(); @@ -1361,10 +1361,10 @@ autoassign_grid=m_particle_locator.getGridAssignor(); BL_PROFILE_VAR_START(blp_partition); -ParticleCopyOpop; +ParticleCopyOpop; intnum_levels=finest_lev_particles+1; -op.setNumLevels(num_levels); -Vector<std::map<int, int>>new_sizes(num_levels); +op.setNumLevels(num_levels); +Vector<std::map<int,int>>new_sizes(num_levels); constautoplo=Geom(0).ProbLoArray(); constautophi=Geom(0).ProbHiArray(); constautorlo=Geom(0).ProbLoArrayInParticleReal(); @@ -1378,25 +1378,25 @@ intgid=kv.first.first; inttid=kv.first.second; autoindex=std::make_pair(gid,tid); - + auto&src_tile=plev[index]; constsize_tnp=src_tile.numParticles(); intnum_stay=partitionParticlesByDest(src_tile,assign_grid, -std::forward<CellAssignor>(CellAssignor{}), +std::forward<CellAssignor>(CellAssignor{}), BufferMap(), -plo,phi,rlo,rhi,is_per,lev,gid,tid, +plo,phi,rlo,rhi,is_per,lev,gid,tid, lev_min,lev_max,nGrow,remove_negative); intnum_move=np-num_stay; -new_sizes[lev][gid]=num_stay; -op.resize(gid,lev,num_move); +new_sizes[lev][gid]=num_stay; +op.resize(gid,lev,num_move); -autop_boxes=op.m_boxes[lev][gid].dataPtr(); -autop_levs=op.m_levels[lev][gid].dataPtr(); -autop_src_indices=op.m_src_indices[lev][gid].dataPtr(); -autop_periodic_shift=op.m_periodic_shift[lev][gid].dataPtr(); -autoptd=src_tile.getParticleTileData(); +autop_boxes=op.m_boxes[lev][gid].dataPtr(); +autop_levs=op.m_levels[lev][gid].dataPtr(); +autop_src_indices=op.m_src_indices[lev][gid].dataPtr(); +autop_periodic_shift=op.m_periodic_shift[lev][gid].dataPtr(); +autoptd=src_tile.getParticleTileData(); AMREX_FOR_1D(num_move,i, { @@ -1410,11 +1410,11 @@ else { constautotup=assign_grid(p,lev_min,lev_max,nGrow, -std::forward<CellAssignor>(CellAssignor{})); +std::forward<CellAssignor>(CellAssignor{})); p_boxes[i]=amrex::get<0>(tup); p_levs[i]=amrex::get<1>(tup); } -p_periodic_shift[i]=IntVect(AMREX_D_DECL(0,0,0)); +p_periodic_shift[i]=IntVect(AMREX_D_DECL(0,0,0)); p_src_indices[i]=i+num_stay; }); } @@ -1482,36 +1482,36 @@ }else{ pinned_snd_buffer.resize(snd_buffer.size()); Gpu::dtoh_memcpy_async(pinned_snd_buffer.dataPtr(),snd_buffer.dataPtr(),snd_buffer.size()); -plan.buildMPIFinish(BufferMap()); +plan.buildMPIFinish(BufferMap()); Gpu::Device::streamSynchronize(); communicateParticlesStart(*this,plan,pinned_snd_buffer,pinned_rcv_buffer); } rcv_buffer.resize(pinned_rcv_buffer.size()); -unpackBuffer(*this,plan,snd_buffer,RedistributeUnpackPolicy()); +unpackBuffer(*this,plan,snd_buffer,RedistributeUnpackPolicy()); communicateParticlesFinish(plan); Gpu::htod_memcpy_async(rcv_buffer.dataPtr(),pinned_rcv_buffer.dataPtr(),pinned_rcv_buffer.size()); -unpackRemotes(*this,plan,rcv_buffer,RedistributeUnpackPolicy()); +unpackRemotes(*this,plan,rcv_buffer,RedistributeUnpackPolicy()); } - + Gpu::Device::streamSynchronize(); AMREX_ASSERT(numParticlesOutOfRange(*this,lev_min,lev_max,nGrow)==0); #else amrex::ignore_unused(lev_min,lev_max,nGrow,local,remove_negative); #endif } - + // //TheCPUimplementationofRedistribute // -template<typenameParticleType,intNArrayReal,intNArrayInt, +template<typenameParticleType,intNArrayReal,intNArrayInt, template<class>classAllocator,classCellAssignor> void ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor> ::RedistributeCPU(intlev_min,intlev_max,intnGrow,intlocal,boolremove_negative) { BL_PROFILE("ParticleContainer::RedistributeCPU()"); - + constintMyProc=ParallelContext::MyProcSub(); autostrttime=amrex::second(); @@ -1557,15 +1557,15 @@ //thesearetemporarybuffersforeachthread std::map<int,Vector<Vector<char>>>tmp_remote; -Vector<std::map<std::pair<int, int>,Vector<ParticleVector>>>tmp_local; -Vector<std::map<std::pair<int, int>,Vector<StructOfArrays<NArrayReal, NArrayInt, Allocator>>>>soa_local; +Vector<std::map<std::pair<int,int>,Vector<ParticleVector>>>tmp_local; +Vector<std::map<std::pair<int,int>,Vector<StructOfArrays<NArrayReal,NArrayInt,Allocator>>>>soa_local; tmp_local.resize(theEffectiveFinestLevel+1); soa_local.resize(theEffectiveFinestLevel+1); //weresizethesebuffersoutsidetheparallelregion for(intlev=lev_min;lev<=lev_max;lev++){ -for(MFItermfi(*m_dummy_mf[lev],this->do_tiling?this->tile_size:IntVect::TheZeroVector()); -mfi.isValid();++mfi){ +for(MFItermfi(*m_dummy_mf[lev],this->do_tiling?this->tile_size:IntVect::TheZeroVector()); +mfi.isValid();++mfi){ autoindex=std::make_pair(mfi.index(),mfi.LocalTileIndex()); tmp_local[lev][index].resize(num_threads); soa_local[lev][index].resize(num_threads); @@ -1589,8 +1589,8 @@ for(intlev=lev_min;lev<=finest_lev_particles;lev++){ auto&pmap=m_particles[lev]; -Vector<std::pair<int, int>>grid_tile_ids; -Vector<ParticleTileType*>ptile_ptrs; +Vector<std::pair<int,int>>grid_tile_ids; +Vector<ParticleTileType*>ptile_ptrs; for(auto&kv:pmap) { grid_tile_ids.push_back(kv.first); @@ -1600,7 +1600,7 @@ #ifdefAMREX_USE_OMP #pragmaompparallelfor #endif -for(intpmap_it=0;pmap_it<static_cast<int>(ptile_ptrs.size());++pmap_it) +for(intpmap_it=0;pmap_it<static_cast<int>(ptile_ptrs.size());++pmap_it) { intthread_num=OpenMP::get_thread_num(); intgrid=grid_tile_ids[pmap_it].first; @@ -1613,7 +1613,7 @@ //"TheAoSandSoAdataonthistilearedifferentsizes-" //"perhapsparticleshavenotbeeninitializedcorrectly?"); unsignednpart=ptile_ptrs[pmap_it]->numParticles(); -ParticleLocDatapld; +ParticleLocDatapld; ifconstexpr(!ParticleType::is_soa_particle){ @@ -1621,7 +1621,7 @@ Longlast=npart-1; Longpindex=0; while(pindex<=last){ -ParticleType&p=aos[pindex]; +ParticleType&p=aos[pindex]; if((remove_negative==false)&&(p.id()<0)){ ++pindex; @@ -1660,19 +1660,19 @@ continue; } -constintwho=ParallelContext::global_to_local_rank(ParticleDistributionMap(pld.m_lev)[pld.m_grid]); +constintwho=ParallelContext::global_to_local_rank(ParticleDistributionMap(pld.m_lev)[pld.m_grid]); if(who==MyProc){ -if(pld.m_lev!=lev||pld.m_grid!=grid||pld.m_tile!=tile){ +if(pld.m_lev!=lev||pld.m_grid!=grid||pld.m_tile!=tile){ //Weownitbutmustshiftittoanotherplace. -autoindex=std::make_pair(pld.m_grid,pld.m_tile); -AMREX_ASSERT(tmp_local[pld.m_lev][index].size()==num_threads); -tmp_local[pld.m_lev][index][thread_num].push_back(p); +autoindex=std::make_pair(pld.m_grid,pld.m_tile); +AMREX_ASSERT(tmp_local[pld.m_lev][index].size()==num_threads); +tmp_local[pld.m_lev][index][thread_num].push_back(p); for(intcomp=0;comp<NumRealComps();++comp){ -RealVector&arr=soa_local[pld.m_lev][index][thread_num].GetRealData(comp); +RealVector&arr=soa_local[pld.m_lev][index][thread_num].GetRealData(comp); arr.push_back(soa.GetRealData(comp)[pindex]); } for(intcomp=0;comp<NumIntComps();++comp){ -IntVector&arr=soa_local[pld.m_lev][index][thread_num].GetIntData(comp); +IntVector&arr=soa_local[pld.m_lev][index][thread_num].GetIntData(comp); arr.push_back(soa.GetIntData(comp)[pindex]); } @@ -1681,7 +1681,7 @@ } else{ auto&particles_to_send=tmp_remote[who][thread_num]; -autoold_size=particles_to_send.size(); +autoold_size=particles_to_send.size(); autonew_size=old_size+superparticle_size; particles_to_send.resize(new_size); std::memcpy(&particles_to_send[old_size],&p,particle_size); @@ -1723,11 +1723,11 @@ aos().erase(aos().begin()+last+1,aos().begin()+npart); for(intcomp=0;comp<NumRealComps();comp++){ -RealVector&rdata=soa.GetRealData(comp); +RealVector&rdata=soa.GetRealData(comp); rdata.erase(rdata.begin()+last+1,rdata.begin()+npart); } for(intcomp=0;comp<NumIntComps();comp++){ -IntVector&idata=soa.GetIntData(comp); +IntVector&idata=soa.GetIntData(comp); idata.erase(idata.begin()+last+1,idata.begin()+npart); } } @@ -1740,7 +1740,7 @@ Longpindex=0; autoptd=particle_tile->getParticleTileData(); while(pindex<=last){ -ParticleTypep(ptd,pindex); +ParticleTypep(ptd,pindex); if((remove_negative==false)&&(p.id()<0)){ ++pindex; @@ -1777,22 +1777,22 @@ continue; } -constintwho=ParallelContext::global_to_local_rank(ParticleDistributionMap(pld.m_lev)[pld.m_grid]); +constintwho=ParallelContext::global_to_local_rank(ParticleDistributionMap(pld.m_lev)[pld.m_grid]); if(who==MyProc){ -if(pld.m_lev!=lev||pld.m_grid!=grid||pld.m_tile!=tile){ +if(pld.m_lev!=lev||pld.m_grid!=grid||pld.m_tile!=tile){ //Weownitbutmustshiftittoanotherplace. -autoindex=std::make_pair(pld.m_grid,pld.m_tile); -AMREX_ASSERT(soa_local[pld.m_lev][index].size()==num_threads); +autoindex=std::make_pair(pld.m_grid,pld.m_tile); +AMREX_ASSERT(soa_local[pld.m_lev][index].size()==num_threads); { -auto&arr=soa_local[pld.m_lev][index][thread_num].GetIdCPUData(); +auto&arr=soa_local[pld.m_lev][index][thread_num].GetIdCPUData(); arr.push_back(soa.GetIdCPUData()[pindex]); } for(intcomp=0;comp<NumRealComps();++comp){ -RealVector&arr=soa_local[pld.m_lev][index][thread_num].GetRealData(comp); +RealVector&arr=soa_local[pld.m_lev][index][thread_num].GetRealData(comp); arr.push_back(soa.GetRealData(comp)[pindex]); } for(intcomp=0;comp<NumIntComps();++comp){ -IntVector&arr=soa_local[pld.m_lev][index][thread_num].GetIntData(comp); +IntVector&arr=soa_local[pld.m_lev][index][thread_num].GetIntData(comp); arr.push_back(soa.GetIntData(comp)[pindex]); } @@ -1801,7 +1801,7 @@ } else{ auto&particles_to_send=tmp_remote[who][thread_num]; -autoold_size=particles_to_send.size(); +autoold_size=particles_to_send.size(); autonew_size=old_size+superparticle_size; particles_to_send.resize(new_size); @@ -1848,11 +1848,11 @@ iddata.erase(iddata.begin()+last+1,iddata.begin()+npart); } for(intcomp=0;comp<NumRealComps();comp++){ -RealVector&rdata=soa.GetRealData(comp); +RealVector&rdata=soa.GetRealData(comp); rdata.erase(rdata.begin()+last+1,rdata.begin()+npart); } for(intcomp=0;comp<NumIntComps();comp++){ -IntVector&idata=soa.GetIntData(comp); +IntVector&idata=soa.GetIntData(comp); idata.erase(idata.begin()+last+1,idata.begin()+npart); } } @@ -1866,11 +1866,11 @@ //Secondpass-foreachtileinparallel,collecttheparticlesweareowedfromallthread'sbuffers. for(intlev=lev_min;lev<=lev_max;lev++){ -typenamestd::map<std::pair<int,int>,Vector<ParticleVector >>::iteratorpmap_it; +typenamestd::map<std::pair<int,int>,Vector<ParticleVector>>::iteratorpmap_it; ifconstexpr(!ParticleType::is_soa_particle){ -Vector<std::pair<int, int>>grid_tile_ids; -Vector<Vector<ParticleVector>*>pvec_ptrs; +Vector<std::pair<int,int>>grid_tile_ids; +Vector<Vector<ParticleVector>*>pvec_ptrs; //weneedtocreateanymissingmapentriesinserialhere for(pmap_it=tmp_local[lev].begin();pmap_it!=tmp_local[lev].end();pmap_it++) @@ -1883,7 +1883,7 @@ #ifdefAMREX_USE_OMP #pragmaompparallelfor #endif -for(intpit=0;pit<static_cast<int>(pvec_ptrs.size());++pit) +for(intpit=0;pit<static_cast<int>(pvec_ptrs.size());++pit) { autoindex=grid_tile_ids[pit]; auto&ptile=DefineAndReturnParticleTile(lev,index.first,index.second); @@ -1895,21 +1895,21 @@ aos.insert(aos.end(),aos_tmp[i].begin(),aos_tmp[i].end()); aos_tmp[i].erase(aos_tmp[i].begin(),aos_tmp[i].end()); for(intcomp=0;comp<NumRealComps();++comp){ -RealVector&arr=soa.GetRealData(comp); -RealVector&tmp=soa_tmp[i].GetRealData(comp); +RealVector&arr=soa.GetRealData(comp); +RealVector&tmp=soa_tmp[i].GetRealData(comp); arr.insert(arr.end(),tmp.begin(),tmp.end()); tmp.erase(tmp.begin(),tmp.end()); } for(intcomp=0;comp<NumIntComps();++comp){ -IntVector&arr=soa.GetIntData(comp); -IntVector&tmp=soa_tmp[i].GetIntData(comp); +IntVector&arr=soa.GetIntData(comp); +IntVector&tmp=soa_tmp[i].GetIntData(comp); arr.insert(arr.end(),tmp.begin(),tmp.end()); tmp.erase(tmp.begin(),tmp.end()); } } } }else{//soaparticle -Vector<std::pair<int, int>>grid_tile_ids; +Vector<std::pair<int,int>>grid_tile_ids; //weneedtocreateanymissingmapentriesinserialhere for(autosoa_map_it=soa_local[lev].begin();soa_map_it!=soa_local[lev].end();soa_map_it++) @@ -1921,7 +1921,7 @@ #ifdefAMREX_USE_OMP #pragmaompparallelfor #endif -for(intpit=0;pit<static_cast<int>(grid_tile_ids.size());++pit)//NOLINT(modernize-loop-convert) +for(intpit=0;pit<static_cast<int>(grid_tile_ids.size());++pit)//NOLINT(modernize-loop-convert) { autoindex=grid_tile_ids[pit]; auto&ptile=DefineAndReturnParticleTile(lev,index.first,index.second); @@ -1935,14 +1935,14 @@ tmp.erase(tmp.begin(),tmp.end()); } for(intcomp=0;comp<NumRealComps();++comp){ -RealVector&arr=soa.GetRealData(comp); -RealVector&tmp=soa_tmp[i].GetRealData(comp); +RealVector&arr=soa.GetRealData(comp); +RealVector&tmp=soa_tmp[i].GetRealData(comp); arr.insert(arr.end(),tmp.begin(),tmp.end()); tmp.erase(tmp.begin(),tmp.end()); } for(intcomp=0;comp<NumIntComps();++comp){ -IntVector&arr=soa.GetIntData(comp); -IntVector&tmp=soa_tmp[i].GetIntData(comp); +IntVector&arr=soa.GetIntData(comp); +IntVector&tmp=soa_tmp[i].GetIntData(comp); arr.insert(arr.end(),tmp.begin(),tmp.end()); tmp.erase(tmp.begin(),tmp.end()); } @@ -1956,8 +1956,8 @@ not_ours[who]; } -Vector<int>dest_proc_ids; -Vector<Vector<Vector<char>>*>pbuff_ptrs; +Vector<int>dest_proc_ids; +Vector<Vector<Vector<char>>*>pbuff_ptrs; for(auto&kv:tmp_remote) { dest_proc_ids.push_back(kv.first); @@ -1967,10 +1967,10 @@ #ifdefAMREX_USE_OMP #pragmaompparallelfor #endif -for(intpmap_it=0;pmap_it<static_cast<int>(pbuff_ptrs.size());++pmap_it) +for(intpmap_it=0;pmap_it<static_cast<int>(pbuff_ptrs.size());++pmap_it) { intwho=dest_proc_ids[pmap_it]; -Vector<Vector<char>>&tmp=*(pbuff_ptrs[pmap_it]); +Vector<Vector<char>>&tmp=*(pbuff_ptrs[pmap_it]); for(inti=0;i<num_threads;++i){ not_ours[who].insert(not_ours[who].end(),tmp[i].begin(),tmp[i].end()); tmp[i].erase(tmp[i].begin(),tmp[i].end()); diff --git a/amrex/docs_xml/doxygen/AMReX__ParticleContainer_8H.xml b/amrex/docs_xml/doxygen/AMReX__ParticleContainer_8H.xml index 78467455da..fbd232619a 100644 --- a/amrex/docs_xml/doxygen/AMReX__ParticleContainer_8H.xml +++ b/amrex/docs_xml/doxygen/AMReX__ParticleContainer_8H.xml @@ -3072,431 +3072,432 @@ return(lev<m_particles.size())?m_particles[lev].size():0; } -voidreserveData()override; -voidresizeData()override; - -voidInitFromAsciiFile(conststd::string&file,intextradata, -constIntVect*Nrep=nullptr); +voidreserveData()override; -voidInitFromBinaryFile(conststd::string&file,intextradata); - -voidInitFromBinaryMetaFile(conststd::string&file,intextradata); - -voidInitRandom(Longicount,ULongiseed, -constParticleInitData&pdata, -boolserialize=false,RealBoxbx=RealBox()); - - -voidInitRandomPerBox(Longicount,ULongiseed,constParticleInitData&pdata); - - -voidInitOnePerCell(Realx_off,Realy_off,Realz_off, -constParticleInitData&pdata); - - -voidInitNRandomPerCell(intn_per_cell,constParticleInitData&pdata); - -voidIncrement(MultiFab&mf,intlevel); - -LongIncrementWithTotal(MultiFab&mf,intlevel,boollocal=false); - -voidRedistribute(intlev_min=0,intlev_max=-1,intnGrow=0,intlocal=0, -boolremove_negative=true); - - -template<classindex_type> -voidReorderParticles(intlev,constMFIter&mfi,constindex_type*permutations); - -voidSortParticlesForDeposition(IntVectidx_type); - -voidSortParticlesByCell(); - -voidSortParticlesByBin(IntVectbin_size); - -boolOK(intlev_min=0,intlev_max=-1,intnGrow=0)const; - -std::array<Long,3>ByteSpread()const; - -std::array<Long,3>PrintCapacity()const; - -voidShrinkToFit(); - -LongNumberOfParticlesAtLevel(intlevel,boolonly_valid=true,boolonly_local=false)const; - -Vector<Long>NumberOfParticlesInGrid(intlevel,boolonly_valid=true,boolonly_local=false)const; - -LongTotalNumberOfParticles(boolonly_valid=true,boolonly_local=false)const; - +voidresizeData()override; + +voidInitFromAsciiFile(conststd::string&file,intextradata, +constIntVect*Nrep=nullptr); + +voidInitFromBinaryFile(conststd::string&file,intextradata); + +voidInitFromBinaryMetaFile(conststd::string&file,intextradata); + +voidInitRandom(Longicount,ULongiseed, +constParticleInitData&pdata, +boolserialize=false,RealBoxbx=RealBox()); + + +voidInitRandomPerBox(Longicount,ULongiseed,constParticleInitData&pdata); + + +voidInitOnePerCell(Realx_off,Realy_off,Realz_off, +constParticleInitData&pdata); + + +voidInitNRandomPerCell(intn_per_cell,constParticleInitData&pdata); + +voidIncrement(MultiFab&mf,intlevel); + +LongIncrementWithTotal(MultiFab&mf,intlevel,boollocal=false); + +voidRedistribute(intlev_min=0,intlev_max=-1,intnGrow=0,intlocal=0, +boolremove_negative=true); + + +template<classindex_type> +voidReorderParticles(intlev,constMFIter&mfi,constindex_type*permutations); + +voidSortParticlesForDeposition(IntVectidx_type); + +voidSortParticlesByCell(); + +voidSortParticlesByBin(IntVectbin_size); + +boolOK(intlev_min=0,intlev_max=-1,intnGrow=0)const; + +std::array<Long,3>ByteSpread()const; + +std::array<Long,3>PrintCapacity()const; + +voidShrinkToFit(); + +LongNumberOfParticlesAtLevel(intlevel,boolonly_valid=true,boolonly_local=false)const; + +Vector<Long>NumberOfParticlesInGrid(intlevel,boolonly_valid=true,boolonly_local=false)const; -voidRemoveParticlesAtLevel(intlevel); - -voidRemoveParticlesNotAtFinestLevel(); +LongTotalNumberOfParticles(boolonly_valid=true,boolonly_local=false)const; + -voidCreateVirtualParticles(intlevel,AoS&virts)const; +voidRemoveParticlesAtLevel(intlevel); -voidCreateGhostParticles(intlevel,intngrow,AoS&ghosts)const; - -voidAddParticlesAtLevel(AoS&particles,intlevel,intnGrow=0); - -voidCreateVirtualParticles(intlevel,ParticleTileType&virts)const; - -voidCreateGhostParticles(intlevel,intngrow,ParticleTileType&ghosts)const; - -voidAddParticlesAtLevel(ParticleTileType&particles,intlevel,intnGrow=0); - - -voidclearParticles(); - - -template<classPCType, -std::enable_if_t<IsParticleContainer<PCType>::value,int>foo=0> -voidcopyParticles(constPCType&other,boollocal=false); - +voidRemoveParticlesNotAtFinestLevel(); + +voidCreateVirtualParticles(intlevel,AoS&virts)const; + +voidCreateGhostParticles(intlevel,intngrow,AoS&ghosts)const; + +voidAddParticlesAtLevel(AoS&particles,intlevel,intnGrow=0); + +voidCreateVirtualParticles(intlevel,ParticleTileType&virts)const; + +voidCreateGhostParticles(intlevel,intngrow,ParticleTileType&ghosts)const; + +voidAddParticlesAtLevel(ParticleTileType&particles,intlevel,intnGrow=0); + + +voidclearParticles(); + + template<classPCType, std::enable_if_t<IsParticleContainer<PCType>::value,int>foo=0> -voidaddParticles(constPCType&other,boollocal=false); +voidcopyParticles(constPCType&other,boollocal=false); -template<classF,classPCType, -std::enable_if_t<IsParticleContainer<PCType>::value,int>foo=0, -std::enable_if_t<!std::is_integral_v<F>,int>bar=0> -voidcopyParticles(constPCType&other,F&&f,boollocal=false); - -template<classF,classPCType, -std::enable_if_t<IsParticleContainer<PCType>::value,int>foo=0, -std::enable_if_t<!std::is_integral_v<F>,int>bar=0> -voidaddParticles(constPCType&other,Fconst&f,boollocal=false); - -voidWriteParticleRealData(void*data,size_tsize,std::ostream&os)const; - -voidReadParticleRealData(void*data,size_tsize,std::istream&is); - -voidCheckpoint(conststd::string&dir,conststd::string&name, -constVector<std::string>&real_comp_names=Vector<std::string>(), -constVector<std::string>&int_comp_names=Vector<std::string>())const -{ -Checkpoint(dir,name,true,real_comp_names,int_comp_names); -} - -voidCheckpoint(conststd::string&dir,conststd::string&name,boolis_checkpoint, -constVector<std::string>&real_comp_names=Vector<std::string>(), -constVector<std::string>&int_comp_names=Vector<std::string>())const; - -template<classF> -voidWriteBinaryParticleData(conststd::string&dir, -conststd::string&name, -constVector<int>&write_real_comp, -constVector<int>&write_int_comp, -constVector<std::string>&real_comp_names, -constVector<std::string>&int_comp_names, -F&&f,boolis_checkpoint=false)const; - -voidCheckpointPre(); - -voidCheckpointPost(); - -voidRestart(conststd::string&dir,conststd::string&file); - -voidRestart(conststd::string&dir,conststd::string&file,boolis_checkpoint); - -voidWritePlotFile(conststd::string&dir,conststd::string&name)const; - -template<classF,std::enable_if_t<!std::is_same_v<F,Vector<std::string>&>>*=nullptr> -voidWritePlotFile(conststd::string&dir,conststd::string&name,F&&f)const; - -voidWritePlotFile(conststd::string&dir,conststd::string&name, -constVector<std::string>&real_comp_names, -constVector<std::string>&int_comp_names)const; - -template<classF> -voidWritePlotFile(conststd::string&dir,conststd::string&name, -constVector<std::string>&real_comp_names, -constVector<std::string>&int_comp_names,F&&f)const; - -voidWritePlotFile(conststd::string&dir,conststd::string&name, -constVector<std::string>&real_comp_names)const; +template<classPCType, +std::enable_if_t<IsParticleContainer<PCType>::value,int>foo=0> +voidaddParticles(constPCType&other,boollocal=false); + +template<classF,classPCType, +std::enable_if_t<IsParticleContainer<PCType>::value,int>foo=0, +std::enable_if_t<!std::is_integral_v<F>,int>bar=0> +voidcopyParticles(constPCType&other,F&&f,boollocal=false); + +template<classF,classPCType, +std::enable_if_t<IsParticleContainer<PCType>::value,int>foo=0, +std::enable_if_t<!std::is_integral_v<F>,int>bar=0> +voidaddParticles(constPCType&other,Fconst&f,boollocal=false); + +voidWriteParticleRealData(void*data,size_tsize,std::ostream&os)const; + +voidReadParticleRealData(void*data,size_tsize,std::istream&is); + +voidCheckpoint(conststd::string&dir,conststd::string&name, +constVector<std::string>&real_comp_names=Vector<std::string>(), +constVector<std::string>&int_comp_names=Vector<std::string>())const +{ +Checkpoint(dir,name,true,real_comp_names,int_comp_names); +} + +voidCheckpoint(conststd::string&dir,conststd::string&name,boolis_checkpoint, +constVector<std::string>&real_comp_names=Vector<std::string>(), +constVector<std::string>&int_comp_names=Vector<std::string>())const; + +template<classF> +voidWriteBinaryParticleData(conststd::string&dir, +conststd::string&name, +constVector<int>&write_real_comp, +constVector<int>&write_int_comp, +constVector<std::string>&real_comp_names, +constVector<std::string>&int_comp_names, +F&&f,boolis_checkpoint=false)const; + +voidCheckpointPre(); + +voidCheckpointPost(); + +voidRestart(conststd::string&dir,conststd::string&file); + +voidRestart(conststd::string&dir,conststd::string&file,boolis_checkpoint); + +voidWritePlotFile(conststd::string&dir,conststd::string&name)const; + +template<classF,std::enable_if_t<!std::is_same_v<F,Vector<std::string>&>>*=nullptr> +voidWritePlotFile(conststd::string&dir,conststd::string&name,F&&f)const; + +voidWritePlotFile(conststd::string&dir,conststd::string&name, +constVector<std::string>&real_comp_names, +constVector<std::string>&int_comp_names)const; + +template<classF> +voidWritePlotFile(conststd::string&dir,conststd::string&name, +constVector<std::string>&real_comp_names, +constVector<std::string>&int_comp_names,F&&f)const; -template<classF,std::enable_if_t<!std::is_same_v<F,Vector<std::string>>>*=nullptr> -voidWritePlotFile(conststd::string&dir,conststd::string&name, -constVector<std::string>&real_comp_names,F&&f)const; - -voidWritePlotFile(conststd::string&dir, -conststd::string&name, -constVector<int>&write_real_comp, -constVector<int>&write_int_comp)const; - -template<classF> -voidWritePlotFile(conststd::string&dir, -conststd::string&name, -constVector<int>&write_real_comp, -constVector<int>&write_int_comp,F&&f)const; - -voidWritePlotFile(conststd::string&dir, -conststd::string&name, -constVector<int>&write_real_comp, -constVector<int>&write_int_comp, -constVector<std::string>&real_comp_names, -constVector<std::string>&int_comp_names)const; - -template<classF> -voidWritePlotFile(conststd::string&dir, -conststd::string&name, -constVector<int>&write_real_comp, -constVector<int>&write_int_comp, -constVector<std::string>&real_comp_names, -constVector<std::string>&int_comp_names, -F&&f)const; - -voidWritePlotFilePre(); - -voidWritePlotFilePost(); - -voidWriteAsciiFile(conststd::string&file); - -constVector<ParticleLevel>&GetParticles()const{returnm_particles;} - -Vector <ParticleLevel>&GetParticles(){returnm_particles;} - -constParticleLevel&GetParticles(intlev)const{returnm_particles[lev];} - -ParticleLevel&GetParticles(intlev){returnm_particles[lev];} - -constParticleTileType&ParticlesAt(intlev,intgrid,inttile)const -{returnm_particles[lev].at(std::make_pair(grid,tile));} - -ParticleTileType&ParticlesAt(intlev,intgrid,inttile) -{returnm_particles[lev].at(std::make_pair(grid,tile));} - -template<classIterator> -constParticleTileType&ParticlesAt(intlev,constIterator&iter)const -{returnParticlesAt(lev,iter.index(),iter.LocalTileIndex());} - -template<classIterator> -ParticleTileType&ParticlesAt(intlev,constIterator&iter) -{returnParticlesAt(lev,iter.index(),iter.LocalTileIndex());} - -ParticleTileType&DefineAndReturnParticleTile(intlev,intgrid,inttile) -{ -m_particles[lev][std::make_pair(grid,tile)].define(NumRuntimeRealComps(),NumRuntimeIntComps()); -returnParticlesAt(lev,grid,tile); -} - -template<classIterator> -ParticleTileType&DefineAndReturnParticleTile(intlev,constIterator&iter) -{ -autoindex=std::make_pair(iter.index(),iter.LocalTileIndex()); -m_particles[lev][index].define(NumRuntimeRealComps(),NumRuntimeIntComps()); -returnParticlesAt(lev,iter); -} - -voidAssignDensity(intrho_index, -Vector<std::unique_ptr<MultiFab>>&mf_to_be_filled, -intlev_min,intncomp,intfinest_level,intngrow=2)const; - -voidAssignCellDensitySingleLevel(intrho_index,MultiFab&mf,intlevel, -intncomp=1,intparticle_lvl_offset=0)const; - -template<typenameP,typenameAssignor=CellAssignor> -IntVectIndex(constP&p,intlev)const; - -ParticleLocDataReset(ParticleType&prt,boolupdate,boolverbose=true, -ParticleLocDatapld=ParticleLocData())const; - -template<typenameP> -boolPeriodicShift(P&p)const; - -voidSetLevelDirectoriesCreated(booltf){levelDirectoriesCreated=tf;} - -boolGetLevelDirectoriesCreated()const{returnlevelDirectoriesCreated;} - -voidSetUsePrePost(booltf)const{ -usePrePost=tf; -} -boolGetUsePrePost()const{ -returnusePrePost; -} +voidWritePlotFile(conststd::string&dir,conststd::string&name, +constVector<std::string>&real_comp_names)const; + +template<classF,std::enable_if_t<!std::is_same_v<F,Vector<std::string>>>*=nullptr> +voidWritePlotFile(conststd::string&dir,conststd::string&name, +constVector<std::string>&real_comp_names,F&&f)const; + +voidWritePlotFile(conststd::string&dir, +conststd::string&name, +constVector<int>&write_real_comp, +constVector<int>&write_int_comp)const; + +template<classF> +voidWritePlotFile(conststd::string&dir, +conststd::string&name, +constVector<int>&write_real_comp, +constVector<int>&write_int_comp,F&&f)const; + +voidWritePlotFile(conststd::string&dir, +conststd::string&name, +constVector<int>&write_real_comp, +constVector<int>&write_int_comp, +constVector<std::string>&real_comp_names, +constVector<std::string>&int_comp_names)const; + +template<classF> +voidWritePlotFile(conststd::string&dir, +conststd::string&name, +constVector<int>&write_real_comp, +constVector<int>&write_int_comp, +constVector<std::string>&real_comp_names, +constVector<std::string>&int_comp_names, +F&&f)const; + +voidWritePlotFilePre(); + +voidWritePlotFilePost(); + +voidWriteAsciiFile(conststd::string&file); + +constVector<ParticleLevel>&GetParticles()const{returnm_particles;} + +Vector <ParticleLevel>&GetParticles(){returnm_particles;} + +constParticleLevel&GetParticles(intlev)const{returnm_particles[lev];} + +ParticleLevel&GetParticles(intlev){returnm_particles[lev];} + +constParticleTileType&ParticlesAt(intlev,intgrid,inttile)const +{returnm_particles[lev].at(std::make_pair(grid,tile));} + +ParticleTileType&ParticlesAt(intlev,intgrid,inttile) +{returnm_particles[lev].at(std::make_pair(grid,tile));} + +template<classIterator> +constParticleTileType&ParticlesAt(intlev,constIterator&iter)const +{returnParticlesAt(lev,iter.index(),iter.LocalTileIndex());} + +template<classIterator> +ParticleTileType&ParticlesAt(intlev,constIterator&iter) +{returnParticlesAt(lev,iter.index(),iter.LocalTileIndex());} + +ParticleTileType&DefineAndReturnParticleTile(intlev,intgrid,inttile) +{ +m_particles[lev][std::make_pair(grid,tile)].define(NumRuntimeRealComps(),NumRuntimeIntComps()); +returnParticlesAt(lev,grid,tile); +} + +template<classIterator> +ParticleTileType&DefineAndReturnParticleTile(intlev,constIterator&iter) +{ +autoindex=std::make_pair(iter.index(),iter.LocalTileIndex()); +m_particles[lev][index].define(NumRuntimeRealComps(),NumRuntimeIntComps()); +returnParticlesAt(lev,iter); +} + +voidAssignDensity(intrho_index, +Vector<std::unique_ptr<MultiFab>>&mf_to_be_filled, +intlev_min,intncomp,intfinest_level,intngrow=2)const; + +voidAssignCellDensitySingleLevel(intrho_index,MultiFab&mf,intlevel, +intncomp=1,intparticle_lvl_offset=0)const; + +template<typenameP,typenameAssignor=CellAssignor> +IntVectIndex(constP&p,intlev)const; + +ParticleLocDataReset(ParticleType&prt,boolupdate,boolverbose=true, +ParticleLocDatapld=ParticleLocData())const; + +template<typenameP> +boolPeriodicShift(P&p)const; -intGetMaxNextIDPrePost()const{returnmaxnextidPrePost;} -LongGetNParticlesPrePost()const{returnnparticlesPrePost;} - -voidSetUseUnlink(booltf)const{ -doUnlink=tf; -} - -boolGetUseUnlink()const{ -returndoUnlink; +voidSetLevelDirectoriesCreated(booltf){levelDirectoriesCreated=tf;} + +boolGetLevelDirectoriesCreated()const{returnlevelDirectoriesCreated;} + +voidSetUsePrePost(booltf)const{ +usePrePost=tf; +} +boolGetUsePrePost()const{ +returnusePrePost; } -voidRedistributeCPU(intlev_min=0,intlev_max=-1,intnGrow=0,intlocal=0, -boolremove_negative=true); +intGetMaxNextIDPrePost()const{returnmaxnextidPrePost;} +LongGetNParticlesPrePost()const{returnnparticlesPrePost;} -voidRedistributeGPU(intlev_min=0,intlev_max=-1,intnGrow=0,intlocal=0, -boolremove_negative=true); - -LongsuperParticleSize()const{returnsuperparticle_size;} - -template<typenameT, -std::enable_if_t<std::is_same_v<T,bool>,int>=0> -voidAddRealComp(Tcommunicate=true) -{ -m_runtime_comps_defined=true; -m_num_runtime_real++; -h_redistribute_real_comp.push_back(communicate); -SetParticleSize(); -this->resizeData(); - -//resizeruntimeSoA -for(intlev=0;lev<numLevels();++lev){ -for(ParIterTypepti(*this,lev);pti.isValid();++pti){ -auto&tile=DefineAndReturnParticleTile(lev,pti); -autonp=tile.numParticles(); -if(np>0){ -auto&soa=tile.GetStructOfArrays(); -soa.resize(np); -} -} -} -} - -template<typenameT, -std::enable_if_t<std::is_same_v<T,bool>,int>=0> -voidAddIntComp(Tcommunicate=true) -{ -m_runtime_comps_defined=true; -m_num_runtime_int++; -h_redistribute_int_comp.push_back(communicate); -SetParticleSize(); -this->resizeData(); - -//resizeruntimeSoA -for(intlev=0;lev<numLevels();++lev){ -for(ParIterTypepti(*this,lev);pti.isValid();++pti){ -auto&tile=DefineAndReturnParticleTile(lev,pti); -autonp=tile.numParticles(); -if(np>0){ -auto&soa=tile.GetStructOfArrays(); -soa.resize(np); -} -} -} -} - -intNumRuntimeRealComps()const{returnm_num_runtime_real;} -intNumRuntimeIntComps()const{returnm_num_runtime_int;} - -intNumRealComps()const{returnNArrayReal+NumRuntimeRealComps();} -intNumIntComps()const{returnNArrayInt+NumRuntimeIntComps();} - -voidResizeRuntimeRealComp(intnew_size,boolcommunicate); - -voidResizeRuntimeIntComp(intnew_size,boolcommunicate); - -template<template<class>classNewAllocator=amrex::DefaultAllocator> -usingContainerLike=amrex::ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, NewAllocator>; +voidSetUseUnlink(booltf)const{ +doUnlink=tf; +} + +boolGetUseUnlink()const{ +returndoUnlink; +} + +voidRedistributeCPU(intlev_min=0,intlev_max=-1,intnGrow=0,intlocal=0, +boolremove_negative=true); + +voidRedistributeGPU(intlev_min=0,intlev_max=-1,intnGrow=0,intlocal=0, +boolremove_negative=true); + +LongsuperParticleSize()const{returnsuperparticle_size;} + +template<typenameT, +std::enable_if_t<std::is_same_v<T,bool>,int>=0> +voidAddRealComp(Tcommunicate=true) +{ +m_runtime_comps_defined=true; +m_num_runtime_real++; +h_redistribute_real_comp.push_back(communicate); +SetParticleSize(); +this->resizeData(); + +//resizeruntimeSoA +for(intlev=0;lev<numLevels();++lev){ +for(ParIterTypepti(*this,lev);pti.isValid();++pti){ +auto&tile=DefineAndReturnParticleTile(lev,pti); +autonp=tile.numParticles(); +if(np>0){ +auto&soa=tile.GetStructOfArrays(); +soa.resize(np); +} +} +} +} + +template<typenameT, +std::enable_if_t<std::is_same_v<T,bool>,int>=0> +voidAddIntComp(Tcommunicate=true) +{ +m_runtime_comps_defined=true; +m_num_runtime_int++; +h_redistribute_int_comp.push_back(communicate); +SetParticleSize(); +this->resizeData(); + +//resizeruntimeSoA +for(intlev=0;lev<numLevels();++lev){ +for(ParIterTypepti(*this,lev);pti.isValid();++pti){ +auto&tile=DefineAndReturnParticleTile(lev,pti); +autonp=tile.numParticles(); +if(np>0){ +auto&soa=tile.GetStructOfArrays(); +soa.resize(np); +} +} +} +} + +intNumRuntimeRealComps()const{returnm_num_runtime_real;} +intNumRuntimeIntComps()const{returnm_num_runtime_int;} + +intNumRealComps()const{returnNArrayReal+NumRuntimeRealComps();} +intNumIntComps()const{returnNArrayInt+NumRuntimeIntComps();} + +voidResizeRuntimeRealComp(intnew_size,boolcommunicate); -template<template<class>classNewAllocator=amrex::DefaultAllocator> -ContainerLike<NewAllocator> -make_alike()const -{ -ContainerLike<NewAllocator>tmp(m_gdb); - -//addruntimerealcompstotmp -for(intic=0;ic<this->NumRuntimeRealComps();++ic){tmp.AddRealComp(false);} - -//addruntimeintcompstotmp -for(intic=0;ic<this->NumRuntimeIntComps();++ic){tmp.AddIntComp(false);} - -returntmp; -} - -Vector<int>h_redistribute_real_comp; -Vector<int>h_redistribute_int_comp; - -mutableboollevelDirectoriesCreated; -mutableboolusePrePost; -mutablebooldoUnlink; -intmaxnextidPrePost; -mutableintnOutFilesPrePost; -LongnparticlesPrePost; -Vector<Long>nParticlesAtLevelPrePost; -mutableVector<Vector<int>>whichPrePost; -mutableVector<Vector<int>>countPrePost; -mutableVector<Vector<Long>>wherePrePost; -mutablestd::stringHdrFileNamePrePost; -mutableVector<std::string>filePrefixPrePost; - -protected: - -template<typenameP> -boolWhere(constP&prt,ParticleLocData&pld, -intlev_min=0,intlev_max=-1,intnGrow=0,intlocal_grid=-1)const; - - -template<typenameP> -boolEnforcePeriodicWhere(P&prt,ParticleLocData&pld, -intlev_min=0,intlev_max=-1,intlocal_grid=-1)const; - -public: -void -WriteParticles(intlevel,std::ofstream&ofs,intfnum, -Vector<int>&which,Vector<int>&count,Vector<Long>&where, -constVector<int>&write_real_comp,constVector<int>&write_int_comp, -constVector<std::map<std::pair<int,int>,IntVector>>&particle_io_flags,boolis_checkpoint)const; -#ifdefAMREX_USE_HDF5 -#include"AMReX_ParticlesHDF5.H" -#endif - -protected: - -template<classRTYPE> -voidReadParticles(intcnt,intgrd,intlev,std::ifstream&ifs,intfinest_level_in_file,boolconvert_ids); - -voidSetParticleSize(); - -DenseBins<typename ParticleTileType::ParticleTileDataType>m_bins; - -private: -virtualvoidparticlePostLocate(ParticleType&/*p*/,constParticleLocData&/*pld*/, -constint/*lev*/){} +voidResizeRuntimeIntComp(intnew_size,boolcommunicate); + +template<template<class>classNewAllocator=amrex::DefaultAllocator> +usingContainerLike=amrex::ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, NewAllocator>; + +template<template<class>classNewAllocator=amrex::DefaultAllocator> +ContainerLike<NewAllocator> +make_alike()const +{ +ContainerLike<NewAllocator>tmp(m_gdb); + +//addruntimerealcompstotmp +for(intic=0;ic<this->NumRuntimeRealComps();++ic){tmp.AddRealComp(false);} + +//addruntimeintcompstotmp +for(intic=0;ic<this->NumRuntimeIntComps();++ic){tmp.AddIntComp(false);} + +returntmp; +} + +Vector<int>h_redistribute_real_comp; +Vector<int>h_redistribute_int_comp; + +mutableboollevelDirectoriesCreated; +mutableboolusePrePost; +mutablebooldoUnlink; +intmaxnextidPrePost; +mutableintnOutFilesPrePost; +LongnparticlesPrePost; +Vector<Long>nParticlesAtLevelPrePost; +mutableVector<Vector<int>>whichPrePost; +mutableVector<Vector<int>>countPrePost; +mutableVector<Vector<Long>>wherePrePost; +mutablestd::stringHdrFileNamePrePost; +mutableVector<std::string>filePrefixPrePost; + +protected: + +template<typenameP> +boolWhere(constP&prt,ParticleLocData&pld, +intlev_min=0,intlev_max=-1,intnGrow=0,intlocal_grid=-1)const; + + +template<typenameP> +boolEnforcePeriodicWhere(P&prt,ParticleLocData&pld, +intlev_min=0,intlev_max=-1,intlocal_grid=-1)const; + +public: +void +WriteParticles(intlevel,std::ofstream&ofs,intfnum, +Vector<int>&which,Vector<int>&count,Vector<Long>&where, +constVector<int>&write_real_comp,constVector<int>&write_int_comp, +constVector<std::map<std::pair<int,int>,IntVector>>&particle_io_flags,boolis_checkpoint)const; +#ifdefAMREX_USE_HDF5 +#include"AMReX_ParticlesHDF5.H" +#endif + +protected: -virtualvoidcorrectCellVectors(int/*old_index*/,int/*new_index*/, -int/*grid*/,constParticleType&/*p*/){} +template<classRTYPE> +voidReadParticles(intcnt,intgrd,intlev,std::ifstream&ifs,intfinest_level_in_file,boolconvert_ids); -voidRedistributeMPI(std::map<int,Vector<char>>&not_ours, -intlev_min=0,intlev_max=0,intnGrow=0,intlocal=0); - -template<typenameP> -voidlocateParticle(P&p,ParticleLocData&pld, -intlev_min,intlev_max,intnGrow,intlocal_grid=-1)const; - -voidInitialize(); - -boolm_runtime_comps_defined{false}; -intm_num_runtime_real{0}; -intm_num_runtime_int{0}; - -size_tparticle_size,superparticle_size; -intnum_real_comm_comps,num_int_comm_comps; -Vector<ParticleLevel>m_particles; -}; +voidSetParticleSize(); + +DenseBins<typename ParticleTileType::ParticleTileDataType>m_bins; + +private: +virtualvoidparticlePostLocate(ParticleType&/*p*/,constParticleLocData&/*pld*/, +constint/*lev*/){} + +virtualvoidcorrectCellVectors(int/*old_index*/,int/*new_index*/, +int/*grid*/,constParticleType&/*p*/){} + +voidRedistributeMPI(std::map<int,Vector<char>>&not_ours, +intlev_min=0,intlev_max=0,intnGrow=0,intlocal=0); + +template<typenameP> +voidlocateParticle(P&p,ParticleLocData&pld, +intlev_min,intlev_max,intnGrow,intlocal_grid=-1)const; -template<intT_NStructReal,intT_NStructInt,intT_NArrayReal,intT_NArrayInt,template<class>classAllocator,classCellAssignor> -usingParticleContainer=ParticleContainer_impl<Particle<T_NStructReal, T_NStructInt>,T_NArrayReal,T_NArrayInt,Allocator,CellAssignor>; - -template<intT_NArrayReal,intT_NArrayInt,template<class>classAllocator=DefaultAllocator,classCellAssignor=DefaultAssignor> -usingParticleContainerPureSoA=ParticleContainer_impl<SoAParticle<T_NArrayReal, T_NArrayInt>,T_NArrayReal,T_NArrayInt,Allocator,CellAssignor>; +voidInitialize(); + +boolm_runtime_comps_defined{false}; +intm_num_runtime_real{0}; +intm_num_runtime_int{0}; - -#include"AMReX_ParticleInit.H" -#include"AMReX_ParticleContainerI.H" -#include"AMReX_ParticleIO.H" +size_tparticle_size,superparticle_size; +intnum_real_comm_comps,num_int_comm_comps; +Vector<ParticleLevel>m_particles; +}; -#ifdefAMREX_USE_HDF5 -#include"AMReX_ParticleHDF5.H" -#endif - -} +template<intT_NStructReal,intT_NStructInt,intT_NArrayReal,intT_NArrayInt,template<class>classAllocator,classCellAssignor> +usingParticleContainer=ParticleContainer_impl<Particle<T_NStructReal, T_NStructInt>,T_NArrayReal,T_NArrayInt,Allocator,CellAssignor>; + +template<intT_NArrayReal,intT_NArrayInt,template<class>classAllocator=DefaultAllocator,classCellAssignor=DefaultAssignor> +usingParticleContainerPureSoA=ParticleContainer_impl<SoAParticle<T_NArrayReal, T_NArrayInt>,T_NArrayReal,T_NArrayInt,Allocator,CellAssignor>; -#endif/*_PARTICLES_H_*/ + +#include"AMReX_ParticleInit.H" +#include"AMReX_ParticleContainerI.H" +#include"AMReX_ParticleIO.H" + +#ifdefAMREX_USE_HDF5 +#include"AMReX_ParticleHDF5.H" +#endif + +} + +#endif/*_PARTICLES_H_*/ diff --git a/amrex/docs_xml/doxygen/AMReX__ParticleIO_8H.xml b/amrex/docs_xml/doxygen/AMReX__ParticleIO_8H.xml index 7cde637134..8b6bea6fdd 100644 --- a/amrex/docs_xml/doxygen/AMReX__ParticleIO_8H.xml +++ b/amrex/docs_xml/doxygen/AMReX__ParticleIO_8H.xml @@ -2941,7 +2941,7 @@ intnrc=ParticleType::is_soa_particle?NStructReal+NumRealComps()-AMREX_SPACEDIM:NStructReal+NumRealComps(); if(nr!=nrc){ amrex::Abort("ParticleContainer::Restart():nrnottheexpectedvalue"); -} +} std::stringcomp_name; for(inti=0;i<nr;++i){ @@ -2951,8 +2951,8 @@ intni; HdrFile>>ni; if(ni!=NStructInt+NumIntComps()){ -amrex::Abort("ParticleContainer::Restart():ni!=NStructInt"); -} +amrex::Abort("ParticleContainer::Restart():ni!=NStructInt"); +} for(inti=0;i<ni;++i){ HdrFile>>comp_name; @@ -2962,7 +2962,7 @@ HdrFile>>checkpoint; Longnparticles; -HdrFile>>nparticles; +HdrFile>>nparticles; AMREX_ASSERT(nparticles>=0); Longmaxnextid; @@ -2975,9 +2975,9 @@ AMREX_ASSERT(finest_level_in_file>=0); //Determinewhetherthisisadual-gridrestartornot. -Vector<DistributionMapping>old_dms(finest_level_in_file+1); -Vector<BoxArray>old_bas(finest_level_in_file+1); -Vector<BoxArray>particle_box_arrays(finest_level_in_file+1); +Vector<DistributionMapping>old_dms(finest_level_in_file+1); +Vector<BoxArray>old_bas(finest_level_in_file+1); +Vector<BoxArray>particle_box_arrays(finest_level_in_file+1); booldual_grid=false; boolhave_pheaders=false; @@ -3000,20 +3000,20 @@ { old_dms[lev]=ParticleDistributionMap(lev); old_bas[lev]=ParticleBoxArray(lev); -std::stringphdr_name=fullname; +std::stringphdr_name=fullname; phdr_name+="/Level_"; -phdr_name=amrex::Concatenate(phdr_name,lev,1); +phdr_name=amrex::Concatenate(phdr_name,lev,1); phdr_name+="/Particle_H"; if(!amrex::FileExists(phdr_name)){continue;} -Vector<char>phdr_chars; +Vector<char>phdr_chars; ParallelDescriptor::ReadAndBcastFile(phdr_name,phdr_chars); -std::stringphdr_string(phdr_chars.dataPtr()); -std::istringstreamphdr_file(phdr_string,std::istringstream::in); - +std::stringphdr_string(phdr_chars.dataPtr()); +std::istringstreamphdr_file(phdr_string,std::istringstream::in); + if(lev>finestLevel()) -{ +{ dual_grid=true; break; } @@ -3021,24 +3021,24 @@ particle_box_arrays[lev].readFrom(phdr_file); if(!particle_box_arrays[lev].CellEqual(ParticleBoxArray(lev))){dual_grid=true;} } -}else//ifnoparticleboxarrayinformationexistsinthefile,weassumeasinglegridrestart +}else//ifnoparticleboxarrayinformationexistsinthefile,weassumeasinglegridrestart { dual_grid=false; } if(dual_grid){ -for(intlev=0;lev<=finestLevel();lev++){ +for(intlev=0;lev<=finestLevel();lev++){ //thiscanhappeniftherearenoparticlesatagivenlevelinthecheckpoint if(particle_box_arrays[lev].empty()){ -particle_box_arrays[lev]=BoxArray(Geom(lev).Domain()); +particle_box_arrays[lev]=BoxArray(Geom(lev).Domain()); } SetParticleBoxArray(lev,particle_box_arrays[lev]); -DistributionMappingpdm(particle_box_arrays[lev]); +DistributionMappingpdm(particle_box_arrays[lev]); SetParticleDistributionMap(lev,pdm); } } -Vector<int>ngrids(finest_level_in_file+1); +Vector<int>ngrids(finest_level_in_file+1); for(intlev=0;lev<=finest_level_in_file;lev++){ HdrFile>>ngrids[lev]; AMREX_ASSERT(ngrids[lev]>0); @@ -3051,18 +3051,18 @@ } for(intlev=0;lev<=finest_level_in_file;lev++){ -Vector<int>which(ngrids[lev]); -Vector<int>count(ngrids[lev]); -Vector<Long>where(ngrids[lev]); +Vector<int>which(ngrids[lev]); +Vector<int>count(ngrids[lev]); +Vector<Long>where(ngrids[lev]); for(inti=0;i<ngrids[lev];i++){ HdrFile>>which[i]>>count[i]>>where[i]; } -Vector<int>grids_to_read; +Vector<int>grids_to_read; if(lev<=finestLevel()){ -for(MFItermfi(*m_dummy_mf[lev]);mfi.isValid();++mfi){ +for(MFItermfi(*m_dummy_mf[lev]);mfi.isValid();++mfi){ grids_to_read.push_back(mfi.index()); -} +} }else{ //welostalevelonrestart.westillneedtoreadinparticles @@ -3081,7 +3081,7 @@ hi=lo+Navg+1; } else{ -lo=rank*Navg+Nleft; +lo=rank*Navg+Nleft; hi=lo+Navg; } @@ -3092,7 +3092,7 @@ for(intgrid:grids_to_read){ if(count[grid]<=0){continue;} - + //Thefilenamesintheheaderfilearerelative. std::stringname=fullname; @@ -3110,7 +3110,7 @@ ParticleFile.open(name.c_str(),std::ios::in|std::ios::binary); -if(!ParticleFile.good()){ +if(!ParticleFile.good()){ amrex::FileOpenFailed(name); } @@ -3121,7 +3121,7 @@ //underlyingcopycalls if(how=="single"){ ifconstexpr(std::is_same_v<ParticleReal,float>){ -ReadParticles<float>(count[grid],grid,lev,ParticleFile,finest_level_in_file,convert_ids); +ReadParticles<float>(count[grid],grid,lev,ParticleFile,finest_level_in_file,convert_ids); }else{ amrex::Error("Filecontainssingle-precisiondata,whileAMReXiscompiledwithParticleReal==double"); } @@ -3148,7 +3148,7 @@ } if(dual_grid){ -for(intlev=0;lev<=finest_level_in_file;lev++){ +for(intlev=0;lev<=finest_level_in_file;lev++){ SetParticleBoxArray(lev,old_bas[lev]); SetParticleDistributionMap(lev,old_dms[lev]); } @@ -3159,7 +3159,7 @@ AMREX_ASSERT(OK()); if(m_verbose>1){ -autostoptime=amrex::second()-strttime; +autostoptime=amrex::second()-strttime; ParallelDescriptor::ReduceRealMax(stoptime,ParallelDescriptor::IOProcessorNumber()); amrex::Print()<<"ParticleContainer::Restart()time:"<<stoptime<<'\n'; } @@ -3182,22 +3182,22 @@ //them_levandm_griddataondisk.Wecaneasilyrecreate //thatgiventhestructureofthecheckpointfile. constintiChunkSize=2+NStructInt+NumIntComps(); -Vector<int>istuff(std::size_t(cnt)*iChunkSize); -readIntData(istuff.dataPtr(),istuff.size(),ifs,FPC::NativeIntDescriptor()); - +Vector<int>istuff(std::size_t(cnt)*iChunkSize); +readIntData(istuff.dataPtr(),istuff.size(),ifs,FPC::NativeIntDescriptor()); + //Thentherealdatainbinary. -constintrChunkSize=ParticleType::is_soa_particle?NStructReal+NumRealComps():AMREX_SPACEDIM+NStructReal+NumRealComps(); +constintrChunkSize=ParticleType::is_soa_particle?NStructReal+NumRealComps():AMREX_SPACEDIM+NStructReal+NumRealComps(); Vector<RTYPE>rstuff(std::size_t(cnt)*rChunkSize); -ReadParticleRealData(rstuff.dataPtr(),rstuff.size(),ifs); +ReadParticleRealData(rstuff.dataPtr(),rstuff.size(),ifs); //Nowreassembletheparticles. -int*iptr=istuff.dataPtr(); -RTYPE*rptr=rstuff.dataPtr(); - +int*iptr=istuff.dataPtr(); +RTYPE*rptr=rstuff.dataPtr(); + Particle<NStructReal, NStructInt>ptemp; -ParticleLocDatapld; +ParticleLocDatapld; -Vector<std::map<std::pair<int, int>,Gpu::HostVector<ParticleType>>>host_particles; +Vector<std::map<std::pair<int, int>,Gpu::HostVector<ParticleType>>>host_particles; host_particles.reserve(15); host_particles.resize(finest_level_in_file+1); diff --git a/amrex/docs_xml/doxygen/AMReX__ParticleInit_8H.xml b/amrex/docs_xml/doxygen/AMReX__ParticleInit_8H.xml index c10e6d57b0..eee1858f57 100644 --- a/amrex/docs_xml/doxygen/AMReX__ParticleInit_8H.xml +++ b/amrex/docs_xml/doxygen/AMReX__ParticleInit_8H.xml @@ -454,30 +454,30 @@ if(which==MyProc) { while(!nparticles.empty()) -{ +{ ParticleType&p=nparticles.back(); Where(p,pld); - + host_particles[pld.m_lev][std::make_pair(pld.m_grid,pld.m_tile)].push_back(p); -if((host_real_attribs[pld.m_lev][std::make_pair(pld.m_grid,pld.m_tile)]).size()>(longunsignedint)(extradata-NStructReal)){ +if((host_real_attribs[pld.m_lev][std::make_pair(pld.m_grid,pld.m_tile)]).size()>(longunsignedint)(extradata-NStructReal)){ for(intn=NStructReal;n<extradata;n++) { Realrdata=nreals[n-NStructReal].back(); host_real_attribs[pld.m_lev][std::make_pair(pld.m_grid,pld.m_tile)][n-NStructReal].push_back(rdata); } -} +} nparticles.pop_back(); - + if(nreals.size()>extradata-NStructReal){ -for(intn=NStructReal;n<extradata;n++) +for(intn=NStructReal;n<extradata;n++) { nreals[n-NStructReal].pop_back(); } } } } - + for(intlev=0;lev<static_cast<int>(host_particles.size());++lev) { for(auto&kv:host_particles[lev]) @@ -488,7 +488,7 @@ auto&dst_tile=GetParticles(lev)[std::make_pair(grid,tile)]; autoold_size=dst_tile.GetArrayOfStructs().size(); -autonew_size=old_size+src_tile.size(); +autonew_size=old_size+src_tile.size(); dst_tile.resize(new_size); Gpu::copyAsync(Gpu::hostToDevice,src_tile.begin(),src_tile.end(), @@ -497,7 +497,7 @@ for(inti=0;i<NArrayReal;++i){ Gpu::copyAsync(Gpu::hostToDevice, host_real_attribs[lev][std::make_pair(grid,tile)][i].begin(), -host_real_attribs[lev][std::make_pair(grid,tile)][i].end(), +host_real_attribs[lev][std::make_pair(grid,tile)][i].end(), dst_tile.GetStructOfArrays().GetRealData(i).begin()+old_size); } } @@ -508,13 +508,13 @@ } -if(m_verbose>0) +if(m_verbose>0) { constintIOProcNumber=ParallelDescriptor::IOProcessorNumber(); Longnum_particles=how_many; -ParallelDescriptor::ReduceLongSum(num_particles,IOProcNumber); +ParallelDescriptor::ReduceLongSum(num_particles,IOProcNumber); if(AMREX_D_TERM(lNrep[0]==1,&&lNrep[1]==1,&&lNrep[2]==1)) { @@ -525,11 +525,11 @@ Longnum_particles_read=how_many_read; ParallelDescriptor::ReduceLongSum(num_particles_read,IOProcNumber); - + amrex::Print()<<"Replicationthedomainwithvector" <<AMREX_D_TERM(lNrep[0]<<"",<<lNrep[1]<<"",<<lNrep[2])<<"\n" <<"Totalnumberofparticlesreadin:"<<num_particles_read<<'\n' -<<"Totalnumberofparticlesafterreplication:"<<num_particles<<'\n'; +<<"Totalnumberofparticlesafterreplication:"<<num_particles<<'\n'; } } @@ -540,7 +540,7 @@ ByteSpread(); autoruntime=amrex::second()-strttime; - + ParallelDescriptor::ReduceRealMax(runtime,ParallelDescriptor::IOProcessorNumber()); amrex::Print()<<"InitFromAsciiFile()time:"<<runtime<<'\n'; diff --git a/amrex/docs_xml/doxygen/classamrex_1_1ParticleContainer__impl.xml b/amrex/docs_xml/doxygen/classamrex_1_1ParticleContainer__impl.xml index aae4efe66e..0fd18316c4 100644 --- a/amrex/docs_xml/doxygen/classamrex_1_1ParticleContainer__impl.xml +++ b/amrex/docs_xml/doxygen/classamrex_1_1ParticleContainer__impl.xml @@ -295,7 +295,7 @@ - + @@ -421,7 +421,7 @@ - + Vector< int > @@ -434,7 +434,7 @@ - + bool @@ -448,7 +448,7 @@ - + bool @@ -461,7 +461,7 @@ - + bool @@ -474,7 +474,7 @@ - + int @@ -487,7 +487,7 @@ - + int @@ -500,7 +500,7 @@ - + Long @@ -513,7 +513,7 @@ - + Vector< Long > @@ -526,7 +526,7 @@ - + Vector< Vector< int > > @@ -539,7 +539,7 @@ - + Vector< Vector< int > > @@ -552,7 +552,7 @@ - + Vector< Vector< Long > > @@ -565,7 +565,7 @@ - + std::string @@ -578,7 +578,7 @@ - + Vector< std::string > @@ -591,7 +591,7 @@ - + @@ -606,7 +606,7 @@ - + @@ -622,7 +622,7 @@ - + int @@ -636,7 +636,7 @@ - + int @@ -650,7 +650,7 @@ - + size_t @@ -663,7 +663,7 @@ - + size_t @@ -676,7 +676,7 @@ - + int @@ -689,7 +689,7 @@ - + int @@ -702,7 +702,7 @@ - + Vector< ParticleLevel > @@ -715,7 +715,7 @@ - + @@ -1251,12 +1251,13 @@ reserveData reserveData +This reserves data in the vector of dummy MultiFabs used by the ParticleContainer for the maximum number of levels possible. - + void @@ -1265,12 +1266,13 @@ resizeData resizeData +This resizes the vector of dummy MultiFabs used by the ParticleContainer for the current number of levels and calls RedefineDummyMF on each level. Note that this must be done prior to using ParticleIterator. - + void @@ -1296,7 +1298,7 @@ - + void @@ -1317,7 +1319,7 @@ - + void @@ -1338,7 +1340,7 @@ - + void @@ -1416,7 +1418,7 @@ - + void @@ -1469,7 +1471,7 @@ - + void @@ -1533,7 +1535,7 @@ - + void @@ -1573,7 +1575,7 @@ - + void @@ -1596,7 +1598,7 @@ - + Long @@ -1622,7 +1624,7 @@ - + void @@ -1699,7 +1701,7 @@ - + @@ -1757,7 +1759,7 @@ - + void @@ -1786,7 +1788,7 @@ - + void @@ -1800,7 +1802,7 @@ - + void @@ -1819,7 +1821,7 @@ - + bool @@ -1875,7 +1877,7 @@ - + std::array< Long, 3 > @@ -1888,7 +1890,7 @@ - + std::array< Long, 3 > @@ -1901,7 +1903,7 @@ - + void @@ -1914,7 +1916,7 @@ - + Long @@ -1969,7 +1971,7 @@ - + Vector< Long > @@ -1996,7 +1998,7 @@ - + Long @@ -2039,7 +2041,7 @@ - + void @@ -2068,7 +2070,7 @@ - + void @@ -2081,7 +2083,7 @@ - + void @@ -2121,7 +2123,7 @@ - + void @@ -2173,7 +2175,7 @@ - + void @@ -2226,7 +2228,7 @@ - + void @@ -2266,7 +2268,7 @@ - + void @@ -2318,7 +2320,7 @@ - + void @@ -2371,7 +2373,7 @@ - + void @@ -2385,7 +2387,7 @@ - + @@ -2437,7 +2439,7 @@ - + @@ -2489,7 +2491,7 @@ - + @@ -2572,7 +2574,7 @@ - + @@ -2655,7 +2657,7 @@ - + void @@ -2707,7 +2709,7 @@ - + void @@ -2767,7 +2769,7 @@ - + void @@ -2833,7 +2835,7 @@ - + void @@ -2869,7 +2871,7 @@ - + @@ -2996,7 +2998,7 @@ - + void @@ -3009,7 +3011,7 @@ - + void @@ -3022,7 +3024,7 @@ - + void @@ -3062,7 +3064,7 @@ - + void @@ -3114,7 +3116,7 @@ - + void @@ -3154,7 +3156,7 @@ - + @@ -3225,7 +3227,7 @@ - + void @@ -3289,7 +3291,7 @@ - + @@ -3380,7 +3382,7 @@ - + void @@ -3432,7 +3434,7 @@ - + @@ -3515,7 +3517,7 @@ - + void @@ -3579,7 +3581,7 @@ - + @@ -3670,7 +3672,7 @@ - + void @@ -3758,7 +3760,7 @@ - + @@ -3873,7 +3875,7 @@ - + void @@ -3886,7 +3888,7 @@ - + void @@ -3899,7 +3901,7 @@ - + void @@ -3916,7 +3918,7 @@ - + const Vector< ParticleLevel > & @@ -3930,7 +3932,7 @@ - + Vector< ParticleLevel > & @@ -3944,7 +3946,7 @@ - + const ParticleLevel & @@ -3972,7 +3974,7 @@ - + ParticleLevel & @@ -4000,7 +4002,7 @@ - + const ParticleTileType & @@ -4056,7 +4058,7 @@ - + ParticleTileType & @@ -4112,7 +4114,7 @@ - + @@ -4161,7 +4163,7 @@ - + @@ -4210,7 +4212,7 @@ - + ParticleTileType & @@ -4255,7 +4257,7 @@ - + @@ -4300,7 +4302,7 @@ - + void @@ -4389,7 +4391,7 @@ - + void @@ -4424,7 +4426,7 @@ - + @@ -4454,7 +4456,7 @@ - + ParticleLocData @@ -4520,7 +4522,7 @@ - + @@ -4553,7 +4555,7 @@ - + void @@ -4570,7 +4572,7 @@ - + bool @@ -4583,7 +4585,7 @@ - + void @@ -4600,7 +4602,7 @@ - + bool @@ -4613,7 +4615,7 @@ - + int @@ -4626,7 +4628,7 @@ - + Long @@ -4639,7 +4641,7 @@ - + void @@ -4656,7 +4658,7 @@ - + bool @@ -4669,7 +4671,7 @@ - + void @@ -4707,7 +4709,7 @@ - + void @@ -4745,7 +4747,7 @@ - + Long @@ -4758,7 +4760,7 @@ - + @@ -4785,7 +4787,7 @@ - + @@ -4812,7 +4814,7 @@ - + int @@ -4825,7 +4827,7 @@ - + int @@ -4838,7 +4840,7 @@ - + int @@ -4851,7 +4853,7 @@ - + int @@ -4864,7 +4866,7 @@ - + void @@ -4904,7 +4906,7 @@ - + void @@ -4944,7 +4946,7 @@ - + @@ -4979,7 +4981,7 @@ - + void @@ -5032,7 +5034,7 @@ - + @@ -5766,7 +5768,7 @@ - + @@ -5850,7 +5852,7 @@ - + @@ -5892,7 +5894,7 @@ - + void @@ -5905,7 +5907,7 @@ - + @@ -5929,7 +5931,7 @@ - + void @@ -5954,7 +5956,7 @@ - + void @@ -5991,7 +5993,7 @@ - + @@ -6034,7 +6036,7 @@ - + void @@ -6047,7 +6049,7 @@ - + @@ -6328,7 +6330,7 @@ - + amrex::ParticleContainer_implAddIntComp amrex::ParticleContainer_impladdParticles diff --git a/amrex/docs_xml/doxygen/namespaceamrex.xml b/amrex/docs_xml/doxygen/namespaceamrex.xml index a4e92c4404..1c2d0664cc 100644 --- a/amrex/docs_xml/doxygen/namespaceamrex.xml +++ b/amrex/docs_xml/doxygen/namespaceamrex.xml @@ -4038,7 +4038,7 @@ - + ParIter< AMREX_SPACEDIM >