ImpactX
InitDistribution.H
Go to the documentation of this file.
1 /* Copyright 2022-2023 The Regents of the University of California, through Lawrence
2  * Berkeley National Laboratory (subject to receipt of any required
3  * approvals from the U.S. Dept. of Energy). All rights reserved.
4  *
5  * This file is part of ImpactX.
6  *
7  * Authors: Axel Huebl, Andrew Myers
8  * License: BSD-3-Clause-LBNL
9  */
10 #ifndef IMPACTX_INITIALIZATION_INITDISTRIBUTION_H
11 #define IMPACTX_INITIALIZATION_INITDISTRIBUTION_H
12 
14 
15 #include <AMReX_Extension.H> // for AMREX_RESTRICT
16 #include <AMReX_REAL.H>
17 
18 #include <utility> // for std::move
19 
20 
22 {
36  template <typename T_Distribution>
38  {
50  T_Distribution distribution,
51  amrex::ParticleReal* AMREX_RESTRICT part_x,
52  amrex::ParticleReal* AMREX_RESTRICT part_y,
53  amrex::ParticleReal* AMREX_RESTRICT part_t,
54  amrex::ParticleReal* AMREX_RESTRICT part_px,
55  amrex::ParticleReal* AMREX_RESTRICT part_py,
56  amrex::ParticleReal* AMREX_RESTRICT part_pt
57  )
58  : m_distribution(std::move(distribution)),
59  m_part_x(part_x), m_part_y(part_y), m_part_t(part_t),
60  m_part_px(part_px), m_part_py(part_py), m_part_pt(part_pt)
61  {
62  }
63 
68 
75  void
77  amrex::Long i,
78  amrex::RandomEngine const & engine
79  ) const
80  {
82  m_part_x[i],
83  m_part_y[i],
84  m_part_t[i],
85  m_part_px[i],
86  m_part_py[i],
87  m_part_pt[i],
88  engine
89  );
90  }
91 
92  private:
93  T_Distribution const m_distribution;
94  amrex::ParticleReal* const AMREX_RESTRICT m_part_x;
95  amrex::ParticleReal* const AMREX_RESTRICT m_part_y;
96  amrex::ParticleReal* const AMREX_RESTRICT m_part_t;
97  amrex::ParticleReal* const AMREX_RESTRICT m_part_px;
98  amrex::ParticleReal* const AMREX_RESTRICT m_part_py;
99  amrex::ParticleReal* const AMREX_RESTRICT m_part_pt;
100  };
101 } // namespace impactx::initialization
102 
103 #endif // IMPACTX_INITIALIZATION_INITDISTRIBUTION_H
#define AMREX_FORCE_INLINE
#define AMREX_RESTRICT
#define AMREX_GPU_DEVICE
i
Definition: AmrCoreData.cpp:16
Definition: InitDistribution.H:38
amrex::ParticleReal *const AMREX_RESTRICT m_part_px
Definition: InitDistribution.H:97
amrex::ParticleReal *const AMREX_RESTRICT m_part_pt
Definition: InitDistribution.H:99
amrex::ParticleReal *const AMREX_RESTRICT m_part_t
Definition: InitDistribution.H:96
amrex::ParticleReal *const AMREX_RESTRICT m_part_py
Definition: InitDistribution.H:98
amrex::ParticleReal *const AMREX_RESTRICT m_part_y
Definition: InitDistribution.H:95
amrex::ParticleReal *const AMREX_RESTRICT m_part_x
Definition: InitDistribution.H:94
InitSingleParticleData(InitSingleParticleData const &)=default
InitSingleParticleData(InitSingleParticleData &&)=default
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void operator()(amrex::Long i, amrex::RandomEngine const &engine) const
Definition: InitDistribution.H:76
InitSingleParticleData(T_Distribution distribution, amrex::ParticleReal *AMREX_RESTRICT part_x, amrex::ParticleReal *AMREX_RESTRICT part_y, amrex::ParticleReal *AMREX_RESTRICT part_t, amrex::ParticleReal *AMREX_RESTRICT part_px, amrex::ParticleReal *AMREX_RESTRICT part_py, amrex::ParticleReal *AMREX_RESTRICT part_pt)
Definition: InitDistribution.H:49
T_Distribution const m_distribution
Definition: InitDistribution.H:93