OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Track.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: Track.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Struct: Track
10 // This structure holds all data for tracking.
11 //
12 // ------------------------------------------------------------------------
13 //
14 // $Date: 2000/03/27 09:33:46 $
15 // $Author: Andreas Adelmann $
16 //
17 // ------------------------------------------------------------------------
18 
19 #include "Track/Track.h"
20 // #include "Algorithms/PartBunchBase.h"
21 #include "Algorithms/PartBunch.h" //FIXME
22 #ifdef ENABLE_AMR
23  #include "Algorithms/AmrPartBunch.h"
24 #endif
27 #include "Utilities/Options.h"
28 // Class Track
29 // ------------------------------------------------------------------------
30 
31 Track *Track::block = 0;
32 std::stack<Track*> Track::stashedTrack;
33 
43 Track::Track(BeamSequence *u, const PartData &ref, const std::vector<double> & dt,
44  const std::vector<unsigned long long> & maxtsteps, int stepsperturn,
45  double zStart, const std::vector<double> & zStop, int timeintegrator,
46  int nslices, double t0, double dtScInit, double deltaTau):
47  bunch(nullptr),
48  slbunch(nullptr),
49  reference(ref),
50  use(u),
51  parser(),
52  dT(dt),
53  dtScInit(dtScInit),
54  deltaTau(deltaTau),
55  t0_m(t0),
56  localTimeSteps(maxtsteps),
57  stepsPerTurn(stepsperturn),
58  zstart(zStart),
59  zstop(zStop),
60  timeIntegrator(timeintegrator),
61  truncOrder(1)
62  {
63  if(nslices > 0) {
64  if(!OpalData::getInstance()->hasSLBunchAllocated())
66 
67  if(!OpalData::getInstance()->hasBunchAllocated()) { // we need this for Autophasing
68 #ifdef ENABLE_AMR
69  if ( Options::amr )
71  else
72 #endif
74  }
75 
77  } else {
78  if(!OpalData::getInstance()->hasBunchAllocated()) {
79 #ifdef ENABLE_AMR
80  if ( Options::amr )
82  else
83 #endif
85  }
86 
87  }
89 }
90 
91 
93 {}
94 
95 void Track::stash() {
96  PAssert_EQ(stashedTrack.size(), 0);
97 
98  stashedTrack.push(block);
99  block = 0;
100 }
101 
103  delete block;
104  block = stashedTrack.top();
105  stashedTrack.pop();
106 
107  return block;
108 }
void setPartBunch(PartBunchBase< double, 3 > *p)
Definition: OpalData.cpp:417
PartBunchBase< double, 3 > * getPartBunch()
Definition: OpalData.cpp:421
static void stash()
Definition: Track.cpp:95
~Track()
Definition: Track.cpp:92
core of the envelope tracker based on Rene Bakkers BET implementation
Definition: EnvelopeBunch.h:60
Particle reference data.
Definition: PartData.h:38
static OpalData * getInstance()
Definition: OpalData.cpp:209
EnvelopeBunch * slbunch
Definition: Track.h:51
#define PAssert_EQ(a, b)
Definition: PAssert.h:119
static Track * block
The block of track data.
Definition: Track.h:63
EnvelopeBunch * getSLPartBunch()
Definition: OpalData.cpp:405
PartBunchBase< double, 3 > * bunch
The particle bunch to be tracked.
Definition: Track.h:49
static Track * pop()
Definition: Track.cpp:102
bool amr
Definition: Options.cpp:100
The base class for all OPAL beam lines and sequences.
Definition: BeamSequence.h:32
Particle Bunch.
Definition: PartBunch.h:30
static std::stack< Track * > stashedTrack
Definition: Track.h:107
void setSLPartBunch(EnvelopeBunch *p)
Definition: OpalData.cpp:401
Hold data for tracking.
Definition: Track.h:38