Skip to content

Commit

Permalink
Cleanup: no AoS
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Feb 21, 2024
1 parent d79fbc3 commit 08c1de9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
10 changes: 3 additions & 7 deletions Docs/source/developers/particles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,14 @@ A typical loop over particles reads:
}
}
The innermost step ``[MY INNER LOOP]`` typically calls ``amrex::ParallelFor`` to perform operations on all particles in a portable way. For this reasons, the particle data needs to be converted in plain-old-data structures. The innermost loop in the code snippet above could look like:
The innermost step ``[MY INNER LOOP]`` typically calls ``amrex::ParallelFor`` to perform operations on all particles in a portable way. The innermost loop in the code snippet above could look like:

.. code-block:: cpp
// Get Array-Of-Struct particle data, also called data
// (x, y, z, id, cpu)
const auto& particles = pti.GetArrayOfStructs();
// Get Struct-Of-Array particle data, also called attribs
// (ux, uy, uz, w, Exp, Ey, Ez, Bx, By, Bz)
// (x, y, z, ux, uy, uz, w)
auto& attribs = pti.GetAttribs();
auto& Exp = attribs[PIdx::Ex];
auto& x = attribs[PIdx::x];
// [...]
// Number of particles in this box
const long np = pti.numParticles();
Expand All @@ -66,7 +63,6 @@ On a loop over boxes in a ``MultiFab`` (``MFIter``), it can be useful to access
const int tile_id = mfi.LocalTileIndex();
// Get GPU-friendly arrays of particle data
auto& ptile = GetParticles(lev)[std::make_pair(grid_id,tile_id)];
ParticleType* pp = particle_tile.GetArrayOfStructs()().data();
// Only need attribs (i.e., SoA data)
auto& soa = ptile.GetStructOfArrays();
// As an example, let's get the ux momentum
Expand Down
1 change: 0 additions & 1 deletion Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include <AMReX_Algorithm.H>
#include <AMReX_Array.H>
#include <AMReX_Array4.H>
#include <AMReX_ArrayOfStructs.H>
#include <AMReX_BLassert.H>
#include <AMReX_Box.H>
#include <AMReX_BoxArray.H>
Expand Down
1 change: 0 additions & 1 deletion Source/Particles/Sorting/Partition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "Utils/WarpXProfilerWrapper.H"
#include "WarpX.H"

#include <AMReX_ArrayOfStructs.H>
#include <AMReX_GpuContainers.H>
#include <AMReX_GpuDevice.H>
#include <AMReX_GpuLaunch.H>
Expand Down

0 comments on commit 08c1de9

Please sign in to comment.