aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/Sorting/Partition.cpp
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-09-24 13:46:17 -0700
committerGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-09-24 13:51:24 -0700
commit37e62ed5e384256699d442fc34c9e5e3c3b9a50a (patch)
tree694e589e1cbb0fba9e2802b1b1893dea81313177 /Source/Particles/Sorting/Partition.cpp
parentb4c4315c77ade3ebb4b11e137ddfe354f1c95d23 (diff)
downloadWarpX-37e62ed5e384256699d442fc34c9e5e3c3b9a50a.tar.gz
WarpX-37e62ed5e384256699d442fc34c9e5e3c3b9a50a.tar.zst
WarpX-37e62ed5e384256699d442fc34c9e5e3c3b9a50a.zip
Add comments
Diffstat (limited to 'Source/Particles/Sorting/Partition.cpp')
-rw-r--r--Source/Particles/Sorting/Partition.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/Source/Particles/Sorting/Partition.cpp b/Source/Particles/Sorting/Partition.cpp
index d000a2c04..4c8e35f38 100644
--- a/Source/Particles/Sorting/Partition.cpp
+++ b/Source/Particles/Sorting/Partition.cpp
@@ -4,15 +4,43 @@
using namespace amrex;
-/* \brief
-*/
+/* \brief Determine which particles deposit/gather in the buffer, and
+ * and reorder the particle arrays accordingly
+ *
+ * More specifically:
+ * - Modify `nfine_current` and `nfine_gather` (in place)
+ * so that they correspond to the number of particles
+ * that deposit/gather in the fine patch respectively.
+ * - Reorder the particle arrays,
+ * so that the `nfine_current`/`nfine_gather` first particles
+ * deposit/gather in the fine patch
+ * and (thus) the `np-nfine_current`/`np-nfine_gather` last particles
+ * deposit/gather in the buffer
+ *
+ * \param nfine_current number of particles that deposit to the fine patch
+ * (modified by this function)
+ * \param nfine_gather number of particles that gather into the fine patch
+ * (modified by this function)
+ * \param np total number of particles in this tile
+ * \param pti object that holds the particle information for this tile
+ * \param lev current refinement level
+ * \param current_masks indicates, for each cell, whether that cell is
+ * in the deposition buffers or in the interior of the fine patch
+ * \param gather_masks indicates, for each cell, whether that cell is
+ * in the gather buffers or in the interior of the fine patch
+ * \param uxp, uyp, uzp, wp references to the particle momenta and weight
+ * (modified by this function)
+ * \param tmp temporary vector, used in reference swapping
+ * \param particle_tmp temporary vector, used in reference swapping
+ */
void
PhysicalParticleContainer::PartitionParticlesInBuffers(
long& nfine_current, long& nfine_gather, long const np,
WarpXParIter& pti, int const lev,
iMultiFab const* current_masks,
iMultiFab const* gather_masks,
- RealVector& uxp, RealVector& uyp, RealVector& uzp, RealVector& wp)
+ RealVector& uxp, RealVector& uyp, RealVector& uzp, RealVector& wp,
+ RealVector& tmp, ParticleVector& particle_tmp)
{
BL_PROFILE("PPC::Evolve::partition");
@@ -80,9 +108,6 @@ PhysicalParticleContainer::PartitionParticlesInBuffers(
if (nfine_current != np || nfine_gather != np)
{
- RealVector tmp;
- ParticleVector particle_tmp;
-
particle_tmp.resize(np);
for (long ip = 0; ip < np; ++ip) {
particle_tmp[ip] = aos[pid[ip]];