WarpX
AcceleratorLattice.H
Go to the documentation of this file.
1 /* Copyright 2022 David Grote
2  *
3  * This file is part of WarpX.
4  *
5  * License: BSD-3-Clause-LBNL
6  */
7 #ifndef WARPX_ACCELERATORLATTICE_ACCELERATORLATTICE_H_
8 #define WARPX_ACCELERATORLATTICE_ACCELERATORLATTICE_H_
9 
10 #include "LatticeElementFinder.H"
11 #include "LatticeElements/Drift.H"
14 
15 #include <memory>
16 #include <string>
17 
18 /* \brief AcceleratorLattice contains the lattice elements
19  */
21 {
22 public:
23 
25 
32  void
33  ReadLattice (std::string const & root_name, amrex::ParticleReal & z_location);
34 
35  /* Refinement level at which this accelerator lattice is defined */
36  int m_level;
37 
38  /* Flags where any lattice elements have been specified by the user */
39  bool m_lattice_defined = false;
40 
48  void InitElementFinder (int lev, amrex::BoxArray const & ba, amrex::DistributionMapping const & dm);
49 
55  void UpdateElementFinder (int lev);
56 
57  /* The lattice element finder handles the lookup that finds the elements at the particle locations.
58  * It should follow the same grid layout as the main grids.
59  */
60  std::unique_ptr<amrex::LayoutData<LatticeElementFinder>> m_element_finder;
61 
69  [[nodiscard]] LatticeElementFinderDevice
70  GetFinderDeviceInstance (WarpXParIter const& a_pti, int a_offset) const;
71 
72  /* All of the available lattice element types */
76 
77 };
78 
79 #endif // WARPX_ACCELERATORLATTICE_ACCELERATORLATTICE_H_
Definition: AcceleratorLattice.H:21
std::unique_ptr< amrex::LayoutData< LatticeElementFinder > > m_element_finder
Definition: AcceleratorLattice.H:60
void UpdateElementFinder(int lev)
Update the element finder, needed when the simulation frame has moved relative to the lab frame.
Definition: AcceleratorLattice.cpp:91
void ReadLattice(std::string const &root_name, amrex::ParticleReal &z_location)
Read in the MAD like lattice description.
Definition: AcceleratorLattice.cpp:34
HardEdgedPlasmaLens h_plasmalens
Definition: AcceleratorLattice.H:75
LatticeElementFinderDevice GetFinderDeviceInstance(WarpXParIter const &a_pti, int a_offset) const
Return an instance of a lattice finder associated with the grid and that can be used on the device (s...
Definition: AcceleratorLattice.cpp:103
Drift h_drift
Definition: AcceleratorLattice.H:73
bool m_lattice_defined
Definition: AcceleratorLattice.H:39
HardEdgedQuadrupole h_quad
Definition: AcceleratorLattice.H:74
AcceleratorLattice()
Definition: AcceleratorLattice.cpp:20
int m_level
Definition: AcceleratorLattice.H:36
void InitElementFinder(int lev, amrex::BoxArray const &ba, amrex::DistributionMapping const &dm)
Initialize the element finder instance at the given level of refinement.
Definition: AcceleratorLattice.cpp:79
Definition: WarpXParticleContainer.H:53
Definition: Drift.H:16
Definition: HardEdgedPlasmaLens.H:26
Definition: HardEdgedQuadrupole.H:26
The lattice element finder class that can be trivially copied to the device. This only has simple dat...
Definition: LatticeElementFinder.H:100