OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
Track.cpp
Go to the documentation of this file.
1//
2// Class Track
3// Hold data for tracking.
4// Acts as a communication area between the various tracking commands.
5//
6// Copyright (c) 2008 - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
7// All rights reserved
8//
9// This file is part of OPAL.
10//
11// OPAL is free software: you can redistribute it and/or modify
12// it under the terms of the GNU General Public License as published by
13// the Free Software Foundation, either version 3 of the License, or
14// (at your option) any later version.
15//
16// You should have received a copy of the GNU General Public License
17// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
18//
19
20#include "Track/Track.h"
21
23#ifdef ENABLE_AMR
25#endif
27#include "Utilities/Options.h"
28
30std::stack<Track*> Track::stashedTrack;
31
38
39
40Track::Track(BeamSequence* u, const PartData& ref, const std::vector<double>& dt,
41 const std::vector<unsigned long long>& maxtsteps, int stepsperturn,
42 double zStart, const std::vector<double>& zStop,
43 Steppers::TimeIntegrator timeintegrator,
44 double t0, double dtScInit, double deltaTau):
45 bunch(nullptr),
46 reference(ref),
47 use(u),
48 parser(),
49 dT(dt),
52 t0_m(t0),
53 localTimeSteps(maxtsteps),
54 stepsPerTurn(stepsperturn),
55 zstart(zStart),
56 zstop(zStop),
57 timeIntegrator(timeintegrator),
58 truncOrder(1)
59{
60 if(!OpalData::getInstance()->hasBunchAllocated()) {
61#ifdef ENABLE_AMR
62 if (Options::amr)
64 else
65#endif
67 }
68
70}
71
72
75
77 PAssert_EQ(stashedTrack.size(), 0);
78
79 stashedTrack.push(block);
80 block = 0;
81}
82
84 delete block;
85 block = stashedTrack.top();
86 stashedTrack.pop();
87
88 return block;
89}
#define PAssert_EQ(a, b)
Definition PAssert.h:104
bool amr
Enable AMR if true.
Definition Options.cpp:99
TimeIntegrator
Definition Steppers.h:25
The base class for all OPAL beam lines and sequences.
void setPartBunch(PartBunchBase< double, 3 > *p)
Definition OpalData.cpp:373
static OpalData * getInstance()
Definition OpalData.cpp:196
PartBunchBase< double, 3 > * getPartBunch()
Definition OpalData.cpp:377
Definition Track.h:36
BeamSequence * use
The lattice to be tracked through.
Definition Track.h:53
int stepsPerTurn
The timsteps per revolution period. ONLY available for OPAL-cycl.
Definition Track.h:78
PartBunchBase< double, 3 > * bunch
The particle bunch to be tracked.
Definition Track.h:47
PartData reference
The reference data.
Definition Track.h:50
double zstart
The location at which the simulation starts.
Definition Track.h:81
~Track()
Definition Track.cpp:73
std::vector< unsigned long long > localTimeSteps
Maximal number of timesteps.
Definition Track.h:75
double deltaTau
Definition Track.h:68
std::vector< double > zstop
The location at which the simulation stops.
Definition Track.h:84
static Track * pop()
Definition Track.cpp:83
static Track * block
The block of track data.
Definition Track.h:59
Steppers::TimeIntegrator timeIntegrator
The ID of time integrator.
Definition Track.h:87
TrackParser parser
The parser used during tracking.
Definition Track.h:56
double t0_m
Definition Track.h:72
double dtScInit
Definition Track.h:68
Track(BeamSequence *, const PartData &, const std::vector< double > &dt, const std::vector< unsigned long long > &maxtsteps, int stepsperturn, double zStart, const std::vector< double > &zStop, Steppers::TimeIntegrator timeintegrator, double t0, double dtScInit, double deltaTau)
Definition Track.cpp:40
int truncOrder
Trunction order for map tracking.
Definition Track.h:90
static void stash()
Definition Track.cpp:76
std::vector< double > dT
The initial timestep.
Definition Track.h:65
static std::stack< Track * > stashedTrack
Definition Track.h:98