LCOV - code coverage report
Current view: top level - src/Particle - ParticleLayout.h (source / functions) Coverage Total Hit
Test: final_report.info Lines: 100.0 % 3 3
Test Date: 2025-07-18 17:15:09 Functions: 94.7 % 38 36

            Line data    Source code
       1              : //
       2              : // Class ParticleLayout
       3              : //   Base class for all particle layout classes.
       4              : //
       5              : //   This class is used as the generic base class for all classes
       6              : //   which maintain the information on where all the particles are located
       7              : //   on a parallel machine.  It is responsible for performing particle
       8              : //   load balancing.
       9              : //
      10              : //   If more general layout information is needed, such as the global -> local
      11              : //   mapping for each particle, then derived classes must provide this info.
      12              : //
      13              : //   When particles are created or destroyed, this class is also responsible
      14              : //   for determining where particles are to be created, gathering this
      15              : //   information, and recalculating the global indices of all the particles.
      16              : //   For consistency, creation and destruction requests are cached, and then
      17              : //   performed all in one step when the update routine is called.
      18              : //
      19              : //   Derived classes must provide the following:
      20              : //     1) Specific version of update and loadBalance.  These are not virtual,
      21              : //        as this class is used as a template parameter (instead of being
      22              : //        assigned to a base class pointer).
      23              : //     2) Internal storage to maintain their specific layout mechanism
      24              : //     3) the definition of a class pair_iterator, and a function
      25              : //        void getPairlist(int, pair_iterator&, pair_iterator&) to get a
      26              : //        begin/end iterator pair to access the local neighbor of the Nth
      27              : //        local atom.  This is not a virtual function, it is a requirement of
      28              : //        the templated class for use in other parts of the code.
      29              : //
      30              : 
      31              : #ifndef IPPL_PARTICLE_LAYOUT_H
      32              : #define IPPL_PARTICLE_LAYOUT_H
      33              : 
      34              : #include <map>
      35              : 
      36              : #include "Particle/ParticleAttrib.h"
      37              : #include "Particle/ParticleBC.h"
      38              : 
      39              : namespace ippl {
      40              :     namespace detail {
      41              :         // ParticleLayout class definition.  Template parameters are the type
      42              :         // and dimension of the ParticlePos object used for the particles.
      43              :         template <typename T, unsigned Dim, typename... PositionProperties>
      44              :         class ParticleLayout {
      45              :         public:
      46              :             typedef T value_type;
      47              :             typedef std::int64_t index_type;
      48              :             typedef Vector<T, Dim> vector_type;
      49              : 
      50              :             using particle_position_type   = ParticleAttrib<vector_type, PositionProperties...>;
      51              :             using position_memory_space    = typename particle_position_type::memory_space;
      52              :             using position_execution_space = typename particle_position_type::execution_space;
      53              : 
      54              :             typedef std::array<BC, 2 * Dim> bc_container_type;
      55              : 
      56              :             static constexpr unsigned dim = Dim;
      57              : 
      58              :         public:
      59          408 :             ParticleLayout() { bcs_m.fill(BC::NO); };
      60              : 
      61              :             ~ParticleLayout() = default;
      62              : 
      63              :             template <class PBase>
      64              :             void update(PBase&) {
      65              :                 // FIXME
      66              :                 std::cout << "TODO" << std::endl;
      67              :             }
      68              : 
      69              :             /*!
      70              :              * Copy over the given boundary conditions.
      71              :              * @param bcs are the boundary conditions
      72              :              */
      73           24 :             void setParticleBC(bc_container_type bcs) { bcs_m = bcs; }
      74              : 
      75              :             /*!
      76              :              * Copy over the given boundary conditions.
      77              :              * @param bcs are the boundary conditions
      78              :              */
      79              :             const bc_container_type& getParticleBC() const { return bcs_m; }
      80              : 
      81              :             /*!
      82              :              * Use the same boundary condition on each face
      83              :              * @param bcs are the boundary conditions
      84              :              */
      85          192 :             void setParticleBC(BC bc) { bcs_m.fill(bc); }
      86              : 
      87              :             /*!
      88              :              * Apply the given boundary conditions to the current particle positions.
      89              :              * @tparam R is the particle position attribute
      90              :              * @tparam nr is the NDRegion
      91              :              * @param
      92              :              */
      93              :             void applyBC(const particle_position_type& R, const NDRegion<T, Dim>& nr);
      94              : 
      95              :         private:
      96              :             //! the list of boundary conditions for this set of particles
      97              :             bc_container_type bcs_m;
      98              :         };
      99              :     }  // namespace detail
     100              : }  // namespace ippl
     101              : 
     102              : #include "Particle/ParticleLayout.hpp"
     103              : 
     104              : #endif
        

Generated by: LCOV version 2.0-1