Skip to content

Commit 78c4fda

Browse files
authored
Improve ParIter docs (#3676)
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
1 parent 3497f01 commit 78c4fda

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Docs/sphinx_documentation/source/Particle.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ tracked as the particle positions change. To do this, we provide the
8686

8787
::
8888

89-
ParticleContainer<3, 2, 4, 4> mypc;
89+
using MyParticleContainer = ParticleContainer<3, 2, 4, 4>;
90+
MyParticleContainer mypc;
9091

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

377378

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

394395

395-
using MyParIter = ParIter<0, 0, 2, 2>;
396+
using MyParIter = MyParticleContainer::ParIterType;
396397
for (MyParIter pti(pc, lev); pti.isValid(); ++pti) {
397398
auto& particle_attributes = pti.GetStructOfArrays();
398399
RealVector& real_comp0 = particle_attributes.GetRealData(0);

0 commit comments

Comments
 (0)