22#ifndef OPAL_ParallelTracker_HH
23#define OPAL_ParallelTracker_HH
56class ParticleMatterInteractionHandler;
138 bool revTrack,
const std::vector<unsigned long long>& maxSTEPS,
double zstart,
139 const std::vector<double>& zstop,
const std::vector<double>& dt);
191 void changeDT(
bool backTrack =
false);
239 void writePhaseSpace(
const long long step,
bool psDump,
bool statDump);
251 void selectDT(
bool backTrack =
false);
258 void dumpStats(
long long step,
bool psDump,
bool statDump);
306 auto Rview =
itsBunch_m->getParticleContainer()->R.getView();
307 auto Pview =
itsBunch_m->getParticleContainer()->P.getView();
308 auto dtview =
itsBunch_m->getParticleContainer()->dt.getView();
309 auto Efview =
itsBunch_m->getParticleContainer()->E.getView();
310 auto Bfview =
itsBunch_m->getParticleContainer()->B.getView();
316 Kokkos::parallel_for(
317 "kickParticles", ippl::getRangePolicy(Rview),
318 KOKKOS_LAMBDA(
const int i) {
323 double dt = dtview(i);
353 p += 0.5 * dt * charge *
Physics::c / mass * e;
357 const double gamma = Kokkos::sqrt(1.0 +
dot(p, p));
365 p += 0.5 * dt * charge *
Physics::c / mass * e;
372 ippl::Comm->barrier();
379 auto Rview =
itsBunch_m->getParticleContainer()->R.getView();
380 auto Pview =
itsBunch_m->getParticleContainer()->P.getView();
381 auto dtview =
itsBunch_m->getParticleContainer()->dt.getView();
383 Kokkos::parallel_for(
384 "pushParticles", ippl::getRangePolicy(Rview),
385 KOKKOS_LAMBDA(
const int i) {
388 double dt = dtview(i);
400 x = 0.5 * dt * p / Kokkos::sqrt(1.0 +
dot(p));
407 ippl::Comm->barrier();
Vector3D cross(const Vector3D &lhs, const Vector3D &rhs)
Vector cross product.
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.
PartBunch< PLayout_t< double, 3 >, double, 3 > PartBunch_t
ippl::Vector< T, Dim > Vector_t
constexpr double c
The velocity of light in m/s.
Interface for a single beam element.
Interface for drift space.
Interface for general multipole.
Ring describes a ring type geometry for tracking.
const PartData itsReference
The reference information.
std::set< std::shared_ptr< Component > > value_t
virtual void visitScalingFFAMagnet(const ScalingFFAMagnet &bend)
Apply the algorithm to a scaling FFA.
ParallelTracker(const ParallelTracker &)
void pushParticles(const BorisPusher &pusher)
void emitParticles(long long step)
void updateRFElement(std::string elName, double maxPhi)
void changeDT(bool backTrack=false)
std::vector< int > ivector_t
IpplTimings::TimerRef BinRepartTimer_m
void restoreCavityPhases()
virtual void visitSolenoid(const Solenoid &)
Apply the algorithm to a RF cavity.
std::list< type_pair * > beamline_list
virtual void visitOffset(const Offset &)
Apply the algorithm to a offset (placement).
beamline_list FieldDimensions
void doBinaryRepartition()
void updateRefToLabCSTrafo()
void autophaseCavities(const BorisPusher &pusher)
double bega
The reference variables.
std::set< ParticleMatterInteractionHandler * > activeParticleMatterInteractionHandlers_m
IpplTimings::TimerRef WakeFieldTimer_m
bool applyPluginElements(const double dt)
IpplTimings::TimerRef OrbThreader_m
virtual void visitMultipole(const Multipole &)
Apply the algorithm to a multipole.
bool particleMatterStatus_m
virtual void visitDrift(const Drift &)
Apply the algorithm to a drift space.
virtual void execute()
Apply the algorithm to the top-level beamline.
std::vector< PluginElement * > pluginElements_m
void kickParticles(const BorisPusher &pusher)
virtual void visitMultipoleT(const MultipoleT &)
Apply the algorithm to an arbitrary multipole.
std::vector< double > dvector_t
void setOptionalVariables()
unsigned long long repartFreq_m
void transformBunch(const CoordinateSystemTrafo &trafo)
virtual void visitRing(const Ring &ring)
Apply the algorithm to a ring.
void writePhaseSpace(const long long step, bool psDump, bool statDump)
void timeIntegration2(BorisPusher &pusher)
void computeWakefield(IndexMap::value_t &elements)
virtual void visitBeamline(const Beamline &)
Apply the algorithm to a beam line.
double zstart_m
where to start
size_t numParticlesInSimulation_m
void applyFractionalStep(const BorisPusher &pusher, double tau)
std::list< Component * > myElements
void updateReference(const BorisPusher &pusher)
void updateReferenceParticle(const BorisPusher &pusher)
void buildupFieldList(double BcParameter[], ElementType elementType, Component *elptr)
IpplTimings::TimerRef timeIntegrationTimer2_m
void computeExternalFields(OrbitThreader &oth)
unsigned int emissionSteps_m
virtual void visitTravelingWave(const TravelingWave &)
Apply the algorithm to a traveling wave.
void computeSpaceChargeFields(unsigned long long step)
std::pair< ElementType, element_pair > type_pair
bool hasEndOfLineReached(const BoundingBox &globalBoundingBox)
std::pair< double[8], Component * > element_pair
ParallelTracker(const Beamline &bl, const PartData &data, bool revBeam, bool revTrack)
Constructor.
WakeFunction * wakeFunction_m
void dumpStats(long long step, bool psDump, bool statDump)
void computeParticleMatterInteraction(IndexMap::value_t elements, OrbitThreader &oth)
void operator=(const ParallelTracker &)
IpplTimings::TimerRef timeIntegrationTimer1_m
IpplTimings::TimerRef PluginElemTimer_m
void selectDT(bool backTrack=false)
virtual void visitMarker(const Marker &)
Apply the algorithm to a marker.
void findStartPosition(const BorisPusher &pusher)
virtual void visitRFCavity(const RFCavity &)
Apply the algorithm to a RF cavity.
IpplTimings::TimerRef fieldEvaluationTimer_m
void timeIntegration1(BorisPusher &pusher)
StepSizeConfig stepSizes_m
virtual ~ParallelTracker()
OpalBeamline itsOpalBeamline_m
virtual void visitVerticalFFAMagnet(const VerticalFFAMagnet &bend)
Apply the algorithm to a vertical FFA magnet.
Tracker(const Beamline &, const PartData &, bool backBeam, bool backTrack)
Constructor.
PartBunch_t * itsBunch_m
The bunch of particles to be tracked.
An abstract sequence of beam line components.