Skip to content

Commit

Permalink
Improve ParIter docs (AMReX-Codes#3676)
Browse files Browse the repository at this point in the history
Show how to get the ParIter type from the ParticleContainer - should be
less confusing to new users.

The proposed changes:
- [ ] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX
users
- [ ] include documentation in the code and/or rst files, if appropriate
  • Loading branch information
atmyers authored Dec 18, 2023
1 parent 3497f01 commit 78c4fda
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Docs/sphinx_documentation/source/Particle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ tracked as the particle positions change. To do this, we provide the

::

ParticleContainer<3, 2, 4, 4> mypc;
using MyParticleContainer = ParticleContainer<3, 2, 4, 4>;
MyParticleContainer mypc;

Like the :cpp:`Particle` class itself, the :cpp:`ParticleContainer`
class is templated. The first two template parameters have the same meaning as
Expand Down Expand Up @@ -375,8 +376,8 @@ example, to iterate over all the AoS data:
::


using MyParIter = ConstParIter<2*BL_SPACEDIM>;
for (MyParIter pti(pc, lev); pti.isValid(); ++pti) {
using MyParConstIter = MyParticleContainer::ParConstIterType;
for (MyParConstIter pti(pc, lev); pti.isValid(); ++pti) {
const auto& particles = pti.GetArrayOfStructs();
for (const auto& p : particles) {
// do stuff with p...
Expand All @@ -392,7 +393,7 @@ skipped. You can also access the SoA data using the :math:`ParIter` as follows:
::


using MyParIter = ParIter<0, 0, 2, 2>;
using MyParIter = MyParticleContainer::ParIterType;
for (MyParIter pti(pc, lev); pti.isValid(); ++pti) {
auto& particle_attributes = pti.GetStructOfArrays();
RealVector& real_comp0 = particle_attributes.GetRealData(0);
Expand Down

0 comments on commit 78c4fda

Please sign in to comment.