From 78c4fdaf95175f992b87e670780f5cf0d01d0783 Mon Sep 17 00:00:00 2001 From: Andrew Myers Date: Mon, 18 Dec 2023 11:42:06 -0800 Subject: [PATCH] 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 --- Docs/sphinx_documentation/source/Particle.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Docs/sphinx_documentation/source/Particle.rst b/Docs/sphinx_documentation/source/Particle.rst index be8292c772b..e3a28591a72 100644 --- a/Docs/sphinx_documentation/source/Particle.rst +++ b/Docs/sphinx_documentation/source/Particle.rst @@ -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 @@ -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... @@ -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);