1818#include  < AMReX_MultiFab.H> 
1919#include  < AMReX_ParIter.H> 
2020#include  < AMReX_Particles.H> 
21+ #include  < AMReX_ParticleTile.H> 
2122
2223#include  < AMReX_IntVect.H> 
2324#include  < AMReX_Vector.H> 
@@ -35,43 +36,16 @@ namespace impactx
3536        t   // /< fixed t as the independent variable
3637    };
3738
38-     /* * AMReX pre-defined Real attributes
39-      * 
40-      * These are the AMReX pre-defined struct indexes for the Real attributes 
41-      * stored in an AoS in ImpactXParticleContainer. We document this here, 
42-      * because we change the meaning of these "positions" depending on the 
43-      * coordinate system we are currently in. 
44-      */  
45-     struct  RealAoS 
46-     {
47-         enum 
48-         {
49-             x,  // /< position in x [m] (at fixed s OR fixed t)
50-             y,  // /< position in y [m] (at fixed s OR fixed t)
51-             t,  // /< c * time-of-flight [m] (at fixed s)
52-             nattribs // /< the number of attributes above (always last)
53-         };
54- 
55-         //  at fixed t, the third component represents the position z
56-         enum  {
57-             z = t  // /< position in z [m] (at fixed t)
58-         };
59- 
60-         // ! named labels for fixed s
61-         static  constexpr  auto  names_s = { " position_x"  , " position_y"  , " position_t"   };
62-         // ! named labels for fixed t
63-         static  constexpr  auto  names_t  = { " position_x"  , " position_y"  , " position_z"   };
64-         static_assert (names_s.size() == nattribs);
65-         static_assert (names_t .size() == nattribs);
66-     };
67- 
68-     /* * This struct indexes the additional Real attributes
39+     /* * This struct indexes the Real attributes
6940     *  stored in an SoA in ImpactXParticleContainer 
7041     */  
7142    struct  RealSoA 
7243    {
7344        enum 
7445        {
46+             x,   // /< position in x [m] (at fixed s or t)
47+             y,   // /< position in y [m] (at fixed s or t)
48+             t,   // /< time-of-flight ct [m] (at fixed s)
7549            px,  // /< momentum in x, scaled by the magnitude of the reference momentum [unitless] (at fixed s or t)
7650            py,  // /< momentum in y, scaled by the magnitude of the reference momentum [unitless] (at fixed s or t)
7751            pt,  // /< energy deviation, scaled by speed of light * the magnitude of the reference momentum [unitless] (at fixed s)
@@ -80,27 +54,28 @@ namespace impactx
8054            nattribs // /< the number of attributes above (always last)
8155        };
8256
83-         //  at fixed t, the third component represents the momentum in z
57+         //  at fixed t, the third component represents the position z, the 6th component represents the  momentum in z
8458        enum  {
59+             z = t,   // /< position in z [m] (at fixed t)
8560            pz = pt  // /< momentum in z, scaled by the magnitude of the reference momentum [unitless] (at fixed t)
8661        };
8762
8863        // ! named labels for fixed s
89-         static  constexpr  auto  names_s = { " momentum_x"  , " momentum_y"  , " momentum_t"  , " qm"  , " weighting"   };
64+         static  constexpr  auto  names_s = { " position_x " ,  " position_y " ,  " position_t " ,  " momentum_x"  , " momentum_y"  , " momentum_t"  , " qm"  , " weighting"   };
9065        // ! named labels for fixed t
91-         static  constexpr  auto  names_t  = { " momentum_x"  , " momentum_y"  , " momentum_z"  , " qm"  , " weighting"   };
66+         static  constexpr  auto  names_t  = { " position_x " ,  " position_y " ,  " position_z " ,  " momentum_x"  , " momentum_y"  , " momentum_z"  , " qm"  , " weighting"   };
9267        static_assert (names_s.size() == nattribs);
9368        static_assert (names_t .size() == nattribs);
9469    };
9570
96-     /* * This struct indexes the additional  Integer attributes
71+     /* * This struct indexes the Integer attributes
9772     *  stored in an SoA in ImpactXParticleContainer 
9873     */  
9974    struct  IntSoA 
10075    {
10176        enum 
10277        {
103-             nattribs // /< the number of particles  above (always last)
78+             nattribs // /< the number of attributes  above (always last)
10479        };
10580    };
10681
@@ -109,46 +84,46 @@ namespace impactx
10984     * We subclass here to change the default threading strategy, which is 
11085     * `static` in AMReX, to `dynamic` in ImpactX. 
11186     */  
112-     class  ParIter 
113-         : public amrex::ParIter< 0 ,  0 ,  RealSoA::nattribs, IntSoA::nattribs>
87+     class  ParIterSoA 
88+         : public amrex::ParIterSoA< RealSoA::nattribs, IntSoA::nattribs>
11489    {
11590    public: 
116-         using  amrex::ParIter< 0 ,  0 ,  RealSoA::nattribs, IntSoA::nattribs>::ParIter ;
91+         using  amrex::ParIterSoA< RealSoA::nattribs, IntSoA::nattribs>::ParIterSoA ;
11792
118-         ParIter  (ContainerType& pc, int  level);
93+         ParIterSoA  (ContainerType& pc, int  level);
11994
120-         ParIter  (ContainerType& pc, int  level, amrex::MFItInfo& info);
95+         ParIterSoA  (ContainerType& pc, int  level, amrex::MFItInfo& info);
12196    };
12297
12398    /* * Const AMReX iterator for particle boxes - data is read only.
12499     * 
125100     * We subclass here to change the default threading strategy, which is 
126101     * `static` in AMReX, to `dynamic` in ImpactX. 
127102     */  
128-     class  ParConstIter 
129-         : public amrex::ParConstIter< 0 ,  0 ,  RealSoA::nattribs, IntSoA::nattribs>
103+     class  ParConstIterSoA 
104+         : public amrex::ParConstIterSoA< RealSoA::nattribs, IntSoA::nattribs>
130105    {
131106    public: 
132-         using  amrex::ParConstIter< 0 ,  0 ,  RealSoA::nattribs, IntSoA::nattribs>::ParConstIter ;
107+         using  amrex::ParConstIterSoA< RealSoA::nattribs, IntSoA::nattribs>::ParConstIterSoA ;
133108
134-         ParConstIter  (ContainerType& pc, int  level);
109+         ParConstIterSoA  (ContainerType& pc, int  level);
135110
136-         ParConstIter  (ContainerType& pc, int  level, amrex::MFItInfo& info);
111+         ParConstIterSoA  (ContainerType& pc, int  level, amrex::MFItInfo& info);
137112    };
138113
139114    /* * Beam Particles in ImpactX
140115     * 
141116     * This class stores particles, distributed over MPI ranks. 
142117     */  
143118    class  ImpactXParticleContainer 
144-         : public amrex::ParticleContainer< 0 ,  0 ,  RealSoA::nattribs, IntSoA::nattribs>
119+         : public amrex::ParticleContainerPureSoA< RealSoA::nattribs, IntSoA::nattribs>
145120    {
146121    public: 
147122        // ! amrex iterator for particle boxes
148-         using  iterator = impactx::ParIter ;
123+         using  iterator = impactx::ParIterSoA ;
149124
150125        // ! amrex constant iterator for particle boxes (read-only)
151-         using  const_iterator = impactx::ParConstIter ;
126+         using  const_iterator = impactx::ParConstIterSoA ;
152127
153128        // ! Construct a new particle container
154129        ImpactXParticleContainer  (initialization::AmrCoreData* amr_core);
@@ -276,10 +251,6 @@ namespace impactx
276251        DepositCharge  (std::unordered_map<int , amrex::MultiFab> & rho,
277252                       amrex::Vector<amrex::IntVect> const  & ref_ratio);
278253
279-         /* * Get the name of each Real AoS component */ 
280-         std::vector<std::string>
281-         RealAoS_names  () const ;
282- 
283254        /* * Get the name of each Real SoA component */ 
284255        std::vector<std::string>
285256        RealSoA_names  () const ;
@@ -311,10 +282,6 @@ namespace impactx
311282
312283    }; //  ImpactXParticleContainer
313284
314-     /* * Get the name of each Real AoS component */ 
315-     std::vector<std::string>
316-     get_RealAoS_names  ();
317- 
318285    /* * Get the name of each Real SoA component
319286     * 
320287     * @param num_real_comps number of compile-time + runtime arrays 
0 commit comments