ImpactX
Programmable.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
8  * License: BSD-3-Clause-LBNL
9  */
10 #ifndef IMPACTX_ELEMENTS_PROGRAMMABLE_H
11 #define IMPACTX_ELEMENTS_PROGRAMMABLE_H
12 
13 #include "mixin/thick.H"
15 
16 #include <AMReX_Extension.H>
17 #include <AMReX_REAL.H>
18 
19 #include <functional>
20 
21 
22 namespace impactx
23 {
24  struct Programmable
25  {
26  static constexpr auto name = "Programmable";
28 
32 
34  void operator() (
36  RefPart & ref_part
37  ) const;
38 
43  void operator() (
44  RefPart & refpart
45  ) const;
46 
52  int nslice () const
53  {
54  return m_nslice;
55  }
56 
62  amrex::ParticleReal ds () const
63  {
64  return m_ds;
65  }
66 
67  public:
68  amrex::ParticleReal m_ds = 0.0;
69  int m_nslice = 1;
70 
71  std::function<void(ImpactXParticleContainer::iterator *, RefPart &)> m_beam_particles;
72  std::function<void(RefPart &)> m_ref_particle;
73  };
74 
75 } // namespace impactx
76 
77 #endif // IMPACTX_ELEMENTS_PROGRAMMABLE_H
Definition: ImpactXParticleContainer.H:80
Definition: ImpactX.cpp:31
Definition: Programmable.H:24
amrex::ParticleReal m_ds
Definition: Programmable.H:68
static constexpr auto name
Definition: Programmable.H:26
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice() const
Definition: Programmable.H:52
int m_nslice
segment length in m
Definition: Programmable.H:69
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
void operator()(ImpactXParticleContainer::iterator &pti, RefPart &ref_part) const
Definition: Programmable.cpp:17
std::function< void(ImpactXParticleContainer::iterator *, RefPart &)> m_beam_particles
number of slices used for the application of space charge
Definition: Programmable.H:71
Definition: ReferenceParticle.H:29
std::function< void(RefPart &)> m_ref_particle
hook for beam particles
Definition: Programmable.H:72
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds() const
Definition: Programmable.H:62
Programmable()
Definition: Programmable.H:31