Commit 1e12c2cf authored by frey_m's avatar frey_m
Browse files

AMR: Make OPAL compile again.

- additional OPAL input option: AMR

Modified files:

modified:   src/AbstractObjects/OpalData.cpp
modified:   src/AbstractObjects/OpalData.h
modified:   src/Algorithms/AutophaseTracker.h
modified:   src/Algorithms/BeamBeam3D.cpp
modified:   src/Algorithms/BeamBeam3D.h
modified:   src/Algorithms/CavityAutophaser.cpp
modified:   src/Algorithms/MPSplitIntegrator.cpp
modified:   src/Algorithms/MPSplitIntegrator.h
modified:   src/Algorithms/NilTracker.h
modified:   src/Algorithms/ParallelCyclotronTracker.cpp
modified:   src/Algorithms/ParallelCyclotronTracker.h
modified:   src/Algorithms/ParallelTTracker.cpp
modified:   src/Algorithms/ParallelTTracker.h
modified:   src/Algorithms/ThickTracker.cpp
modified:   src/Algorithms/ThickTracker.h
modified:   src/Algorithms/bet/EnvelopeBunch.cpp
modified:   src/Algorithms/bet/EnvelopeBunch.h
modified:   src/BasicActions/Option.cpp
modified:   src/Classic/AbsBeamline/Collimator.cpp
modified:   src/Classic/AbsBeamline/Collimator.h
modified:   src/Classic/AbsBeamline/Component.cpp
modified:   src/Classic/AbsBeamline/Component.h
modified:   src/Classic/AbsBeamline/Integrator.h
modified:   src/Classic/AbsBeamline/Probe.cpp
modified:   src/Classic/AbsBeamline/Probe.h
modified:   src/Classic/AbsBeamline/Ring.cpp
modified:   src/Classic/AbsBeamline/Ring.h
modified:   src/Classic/AbsBeamline/Septum.cpp
modified:   src/Classic/AbsBeamline/Septum.h
modified:   src/Classic/AbsBeamline/Source.cpp
modified:   src/Classic/AbsBeamline/Stripper.cpp
modified:   src/Classic/AbsBeamline/Stripper.h
modified:   src/Classic/Algorithms/AmrPartBunch.cpp
modified:   src/Classic/Algorithms/AmrPartBunch.h
modified:   src/Classic/Algorithms/MapIntegrator.cpp
modified:   src/Classic/Algorithms/MapIntegrator.h
modified:   src/Classic/Algorithms/OrbitTracker.cpp
modified:   src/Classic/Algorithms/PBunchDefs.h
modified:   src/Classic/Algorithms/PartBunch.cpp
modified:   src/Classic/Algorithms/PartBunch.h
modified:   src/Classic/Algorithms/PartBunchBase.h
modified:   src/Classic/Algorithms/PartBunchBase.hpp
modified:   src/Classic/Algorithms/ThinTracker.cpp
modified:   src/Classic/Algorithms/ThinTracker.h
modified:   src/Classic/Algorithms/Tracker.cpp
modified:   src/Classic/Algorithms/Tracker.h
modified:   src/Classic/Solvers/CSRIGFWakeFunction.cpp
modified:   src/Classic/Solvers/CSRIGFWakeFunction.hh
modified:   src/Classic/Solvers/CSRWakeFunction.cpp
modified:   src/Classic/Solvers/CSRWakeFunction.hh
modified:   src/Classic/Solvers/CollimatorPhysics.cpp
modified:   src/Classic/Solvers/CollimatorPhysics.hh
modified:   src/Classic/Solvers/GreenWakeFunction.cpp
modified:   src/Classic/Solvers/GreenWakeFunction.hh
modified:   src/Classic/Solvers/SurfacePhysicsHandler.hh
modified:   src/Classic/Solvers/WakeFunction.hh
modified:   src/Classic/Utilities/Options.cpp
modified:   src/Classic/Utilities/Options.h
modified:   src/Distribution/Distribution.cpp
modified:   src/Distribution/Distribution.h
modified:   src/Expressions/Expressions.cpp
modified:   src/Solvers/AmrPoissonSolver.h
modified:   src/Solvers/FFTBoxPoissonSolver.h
modified:   src/Solvers/FFTPoissonSolver.h
modified:   src/Solvers/MGPoissonSolver.h
modified:   src/Solvers/P3MPoissonSolver.cpp
modified:   src/Solvers/P3MPoissonSolver.h
modified:   src/Solvers/PoissonSolver.h
modified:   src/Structure/BoundaryGeometry.cpp
modified:   src/Structure/BoundaryGeometry.h
modified:   src/Structure/DataSink.cpp
modified:   src/Structure/DataSink.h
modified:   src/Structure/FieldSolver.cpp
modified:   src/Structure/FieldSolver.h
modified:   src/Structure/H5PartWrapper.h
modified:   src/Structure/H5PartWrapperForPC.cpp
modified:   src/Structure/H5PartWrapperForPC.h
modified:   src/Structure/H5PartWrapperForPS.cpp
modified:   src/Structure/H5PartWrapperForPS.h
modified:   src/Structure/H5PartWrapperForPT.cpp
modified:   src/Structure/H5PartWrapperForPT.h
modified:   src/Track/Track.cpp
modified:   src/Track/Track.h
modified:   src/Track/TrackRun.cpp
modified:   src/Track/TrackSave.cpp
modified:   src/Track/TrackStart.cpp
parent cb0ac0de
......@@ -145,10 +145,6 @@ struct OpalDataImpl {
bool isInOPALTMode_m;
bool isInOPALEnvMode_m;
#ifdef HAVE_AMR_SOLVER
bool isInAmrMode_m;
#endif
bool isInPrepState_m;
};
......@@ -305,16 +301,6 @@ void OpalData::setInOPALEnvMode() {
p->isInOPALEnvMode_m = true;
}
#ifdef HAVE_AMR_SOLVER
void OpalData::setInAmrMode() {
p->isInAmrMode_m = true;
}
bool OpalData::isInAmrMode() const {
return p->isInAmrMode_m;
}
#endif
bool OpalData::isInPrepState() {
return p->isInPrepState_m;
}
......
......@@ -153,11 +153,6 @@ public:
void setInOPALCyclMode();
void setInOPALTMode();
void setInOPALEnvMode();
#ifdef HAVE_AMR_SOLVER
void setInAmrMode();
bool isInAmrMode() const;
#endif
bool isInPrepState();
void setInPrepState(bool state);
......
......@@ -5,7 +5,7 @@
// Copyright & License: See Copyright.readme in src directory
//
#include "Algorithms/PartBunch.h"
#include "Algorithms/PartBunchBase.h"
#include "Algorithms/PartPusher.h"
#include "Algorithms/PartData.h"
#include "Algorithms/PBunchDefs.h"
......@@ -111,7 +111,7 @@ private:
void printCavityPhases();
OpalBeamline itsOpalBeamline_m;
PartBunch itsBunch_m;
PartBunchBase<double, 3> itsBunch_m;
BorisPusher itsPusher_m;
Layout_t *particleLayout_m;
......
......@@ -19,7 +19,7 @@
#include "Algorithms/BeamBeam3D.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "AbsBeamline/ElementImage.h"
#include "Algorithms/PartBunch.h"
#include "Algorithms/PartBunchBase.h"
#include "BeamlineGeometry/Matrix3D.h"
#include "BeamlineGeometry/Vector3D.h"
#include "FixedAlgebra/FTpsMath.h"
......@@ -196,12 +196,12 @@ void BeamBeam3D::setSlices(int slices) {
void BeamBeam3D::trackBunch
(PartBunch &bunch, const PartData &, bool revBeam, bool revTrack) const {
(PartBunchBase<double, 3> *bunch, const PartData &, bool revBeam, bool revTrack) const {
boost(bunch);
synchroBeamCollision(bunch);
boosti(bunch);
double ax, ay;
bunch.maximumAmplitudes(D, ax, ay);
bunch->maximumAmplitudes(D, ax, ay);
axmax = max(axmax, ax);
aymax = max(aymax, ay);
}
......@@ -215,10 +215,10 @@ void BeamBeam3D::trackMap
}
void BeamBeam3D::boost(PartBunch &bunch) const {
void BeamBeam3D::boost(PartBunchBase<double, 3> *bunch) const {
for(unsigned int i = 0; i < bunch.getLocalNum(); i++) {
OpalParticle part = bunch.get_part(i);
for(unsigned int i = 0; i < bunch->getLocalNum(); i++) {
OpalParticle part = bunch->get_part(i);
double a = (sqr(part.px()) + sqr(part.py())) / sqr(1.0 + part.pt());
double sqr1a = sqrt(1.0 - a);
......@@ -237,7 +237,7 @@ void BeamBeam3D::boost(PartBunch &bunch) const {
part.y() = part.y() + sphi * h1y * part.x();
part.t() = part.t() / cphi - sphi * h1z * part.x();
part.x() = x1;
bunch.set_part(part, i);
bunch->set_part(part, i);
}
}
......@@ -263,9 +263,9 @@ void BeamBeam3D::boost(FVps<double, 6> &map) const {
}
void BeamBeam3D::boosti(PartBunch &bunch) const {
for(unsigned int i = 0; i < bunch.getLocalNum(); i++) {
OpalParticle part = bunch.get_part(i);
void BeamBeam3D::boosti(PartBunchBase<double, 3> *bunch) const {
for(unsigned int i = 0; i < bunch->getLocalNum(); i++) {
OpalParticle part = bunch->get_part(i);
double a1 = (sqr(part.px()) + sqr(part.py())) / sqr(1.0 + part.pt());
double sqr1a = sqrt(1.0 - a1);
......@@ -281,7 +281,7 @@ void BeamBeam3D::boosti(PartBunch &bunch) const {
part.pt() = part.pt() + sphi * part.px();
part.px() = (part.px() + sphi * h1) * cphi;
part.py() = part.py() * cphi;
bunch.set_part(part, i);
bunch->set_part(part, i);
}
}
......@@ -342,15 +342,15 @@ void BeamBeam3D::computeSlices() {
}
void BeamBeam3D::synchroBeamCollision(PartBunch &bunch) const {
void BeamBeam3D::synchroBeamCollision(PartBunchBase<double, 3> *bunch) const {
std::vector<Slice>::const_iterator last_slice = slices.end();
std::vector<Slice>::const_iterator slice = slices.begin();
for(; slice != last_slice; ++slice) {
for(unsigned int i = 0; i < bunch.getLocalNum(); i++) {
OpalParticle part = bunch.get_part(i);
for(unsigned int i = 0; i < bunch->getLocalNum(); i++) {
OpalParticle part = bunch->get_part(i);
double s = (part.t() - slice->zstar) / 2.0;
double sx = slice->sigx + slice->sigpx * s * s;
double sy = slice->sigy + slice->sigpy * s * s;
......@@ -387,7 +387,7 @@ void BeamBeam3D::synchroBeamCollision(PartBunch &bunch) const {
part.py() -= bbfy;
part.pt() -= s * (slice->sigpx * bbgx + slice->sigpy * bbgy) +
(bbfx * (part.px() - bbfx / 2.0) + bbfy * (part.py() - bbfy / 2.0)) / 2.0;
bunch.set_part(part, i);
bunch->set_part(part, i);
}
}
}
......
......@@ -26,7 +26,8 @@
#include <complex>
#include <vector>
class PartBunch;
template <class T, unsigned Dim>
class PartBunchBase;
template <class T, int N> class FTps;
template <class T, int N> class FVps;
......@@ -136,7 +137,7 @@ public:
/// Track a particle bunch.
virtual void trackBunch
(PartBunch &, const PartData &, bool revBeam, bool revTrack) const;
(PartBunchBase<double, 3> *, const PartData &, bool revBeam, bool revTrack) const;
/// Track a transfer map.
virtual void trackMap
......@@ -154,11 +155,11 @@ private:
void operator=(const BeamBeam3D &);
// Lorenz boost.
void boost(PartBunch &bunch) const;
void boost(PartBunchBase<double, 3> *bunch) const;
void boost(Map &map) const;
// Inverse Lorenz boost.
void boosti(PartBunch &bunch) const;
void boosti(PartBunchBase<double, 3> *bunch) const;
void boosti(Map &map) const;
// Compute internal quantities.
......@@ -166,7 +167,7 @@ private:
void computeSlices();
// Apply synchro-beam collision.
void synchroBeamCollision(PartBunch &bunch) const;
void synchroBeamCollision(PartBunchBase<double, 3> *bunch) const;
void synchroBeamCollision(Map &map) const;
// Apply beam-beam kick for one slice.
......
......@@ -15,7 +15,7 @@ CavityAutophaser::CavityAutophaser(const PartData &ref,
itsCavity_m(cavity)
{
double zbegin = 0.0, zend = 0.0;
PartBunch *fakeBunch = NULL;
PartBunchBase<double, 3> *fakeBunch = NULL;
cavity->initialise(fakeBunch, zbegin, zend);
initialR_m = Vector_t(0, 0, zbegin);
}
......
......@@ -21,7 +21,7 @@
#include "Algorithms/MPSplitIntegrator.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "AbsBeamline/Multipole.h"
#include "Algorithms/PartBunch.h"
#include "Algorithms/PartBunchBase.h"
#include "Algorithms/PartData.h"
#include "Fields/BMultipoleField.h"
#include "FixedAlgebra/FTps.h"
......@@ -137,7 +137,7 @@ void MPSplitIntegrator::trackParticle(OpalParticle &part, const PartData &ref,
}
void MPSplitIntegrator::trackBunch(PartBunch &bunch,
void MPSplitIntegrator::trackBunch(PartBunchBase<double, 3> *bunch,
const PartData &ref,
bool revBeam, bool revTrack) const {
double length = itsMultipole->getElementLength();
......@@ -150,8 +150,8 @@ void MPSplitIntegrator::trackBunch(PartBunch &bunch,
std::vector<double> slices;
getSlices(slices);
scale *= length / double(itsSlices);
for(unsigned int i = 0; i < bunch.getLocalNum(); i++) {
OpalParticle part = bunch.get_part(i);
for(unsigned int i = 0; i < bunch->getLocalNum(); i++) {
OpalParticle part = bunch->get_part(i);
// Drift to first slice position.
applyDrift(part, length * slices[0], ref);
......@@ -163,14 +163,14 @@ void MPSplitIntegrator::trackBunch(PartBunch &bunch,
// Drift to next slice position or to end.
applyDrift(part, length * (slices[s+1] - slices[s]), ref);
}
bunch.set_part(part, i);
bunch->set_part(part, i);
}
} else {
// Length == 0, slicing not possible.
for(unsigned int i = 0; i < bunch.getLocalNum(); i++) {
OpalParticle part = bunch.get_part(i);
for(unsigned int i = 0; i < bunch->getLocalNum(); i++) {
OpalParticle part = bunch->get_part(i);
applyMultipole(part, field, scale);
bunch.set_part(part, i);
bunch->set_part(part, i);
}
}
}
......
......@@ -24,7 +24,8 @@
class BeamlineVisitor;
class BMultipoleField;
class Multipole;
class PartBunch;
template <class T, unsigned Dim>
class PartBunchBase;
class PartData;
class OpalParticle;
......@@ -112,7 +113,7 @@ public:
/// Track particle bunch through MPSplitIntegrator.
// The bunch tracked is [b]buch[/b], the other values are the same
// as in the calling mapper.
virtual void trackBunch(PartBunch &bunch, const PartData &data,
virtual void trackBunch(PartBunchBase<double, 3> *bunch, const PartData &data,
bool revBeam, bool revTrack) const;
/// Return slice positions.
......
......@@ -14,7 +14,8 @@
#include "Algorithms/Tracker.h"
class BMultipoleField;
class PartBunch;
template <class T, unsigned Dim>
class PartBunchBase;
class AlignWrapper;
class BeamBeam;
class Collimator;
......
......@@ -85,6 +85,10 @@
#include <hdf5.h>
#include "H5hut.h"
//FIXME Remove headers and dynamic_cast in readOneBunchFromFile
#include "Algorithms/PartBunch.h"
#include "Algorithms/AmrPartBunch.h"
class Beamline;
class PartData;
......@@ -141,7 +145,7 @@ ParallelCyclotronTracker::ParallelCyclotronTracker(const Beamline &beamline,
* @param timeIntegrator
*/
ParallelCyclotronTracker::ParallelCyclotronTracker(const Beamline &beamline,
PartBunch &bunch,
PartBunchBase<double, 3> *bunch,
DataSink &ds,
const PartData &reference,
bool revBeam, bool revTrack,
......@@ -151,12 +155,12 @@ ParallelCyclotronTracker::ParallelCyclotronTracker(const Beamline &beamline,
timeIntegrator_m(timeIntegrator),
eta_m(0.01),
myNode_m(Ippl::myNode()),
initialLocalNum_m(bunch.getLocalNum()),
initialTotalNum_m(bunch.getTotalNum()),
initialLocalNum_m(bunch->getLocalNum()),
initialTotalNum_m(bunch->getTotalNum()),
opalRing_m(NULL),
lastDumpedStep_m(0) {
itsBeamline = dynamic_cast<Beamline *>(beamline.clone());
itsBunch = &bunch;
itsBunch = bunch;
itsDataSink = &ds;
// scaleFactor_m = itsBunch->getdT() * c;
scaleFactor_m = 1;
......@@ -4023,7 +4027,7 @@ void ParallelCyclotronTracker::saveOneBunch() {
H5PartWrapperForPC h5wrapper(fileName);
h5wrapper.writeHeader();
h5wrapper.writeStep(*itsBunch, additionalAttributes);
h5wrapper.writeStep(itsBunch, additionalAttributes);
h5wrapper.close();
}
......@@ -4069,8 +4073,15 @@ bool ParallelCyclotronTracker::readOneBunchFromFile(const size_t BinID) {
if(restartflag) {
*gmsg << "----------------Read beam from hdf5 file----------------" << endl;
size_t localNum = itsBunch->getLocalNum();
PartBunch tmpBunch(&itsReference);
//FIXME
std::unique_ptr<PartBunchBase<double, 3> > tmpBunch = 0;
#ifdef HAVE_AMR_SOLVER
if ( dynamic_cast<AmrPartBunch*>(itsBunch) != 0 )
tmpBunch.reset(new AmrPartBunch(&itsReference));
else
#endif
tmpBunch.reset(new PartBunch(&itsReference));
std::string fn_appendix = "-onebunch";
std::string fileName = OpalData::getInstance()->getInputBasename() + fn_appendix + ".h5";
......@@ -4087,15 +4098,15 @@ bool ParallelCyclotronTracker::readOneBunchFromFile(const size_t BinID) {
numParticles = lastParticle - firstParticle + 1;
PAssert(numParticles >= 0);
dataSource.readStep(tmpBunch, firstParticle, lastParticle);
dataSource.readStep(tmpBunch.get(), firstParticle, lastParticle);
dataSource.close();
tmpBunch.boundp();
tmpBunch->boundp();
// itsDataSink->readOneBunch(*itsBunch, fn_appendix, BinID);
// itsDataSink->readOneBunch(itsBunch, fn_appendix, BinID);
restartflag = false;
npart_mb = tmpBunch.getLocalNum();
npart_mb = tmpBunch->getLocalNum();
itsBunch->create(npart_mb);
r_mb.create(npart_mb);
......@@ -4105,10 +4116,10 @@ bool ParallelCyclotronTracker::readOneBunchFromFile(const size_t BinID) {
ptype_mb.create(npart_mb);
for(size_t ii = 0; ii < npart_mb; ++ ii, ++ localNum) {
itsBunch->R[localNum] = tmpBunch.R[ii];
itsBunch->P[localNum] = tmpBunch.P[ii];
itsBunch->M[localNum] = tmpBunch.M[ii];
itsBunch->Q[localNum] = tmpBunch.Q[ii];
itsBunch->R[localNum] = tmpBunch->R[ii];
itsBunch->P[localNum] = tmpBunch->P[ii];
itsBunch->M[localNum] = tmpBunch->M[ii];
itsBunch->Q[localNum] = tmpBunch->Q[ii];
itsBunch->PType[localNum] = ParticleType::REGULAR;
itsBunch->Bin[localNum] = BinID;
......@@ -4944,16 +4955,16 @@ void ParallelCyclotronTracker::applyPluginElements(const double dt) {
for(beamline_list::iterator sindex = ++(FieldDimensions.begin()); sindex != FieldDimensions.end(); sindex++) {
if(((*sindex)->first) == ElementBase::SEPTUM) {
(static_cast<Septum *>(((*sindex)->second).second))->checkSeptum(*itsBunch);
(static_cast<Septum *>(((*sindex)->second).second))->checkSeptum(itsBunch);
}
if(((*sindex)->first) == ElementBase::PROBE) {
(static_cast<Probe *>(((*sindex)->second).second))->checkProbe(*itsBunch, turnnumber_m, itsBunch->getT() * 1e9, dt);
(static_cast<Probe *>(((*sindex)->second).second))->checkProbe(itsBunch, turnnumber_m, itsBunch->getT() * 1e9, dt);
}
if(((*sindex)->first) == ElementBase::STRIPPER) {
bool flag_stripper = (static_cast<Stripper *>(((*sindex)->second).second))
-> checkStripper(*itsBunch, turnnumber_m, itsBunch->getT() * 1e9, dt);
-> checkStripper(itsBunch, turnnumber_m, itsBunch->getT() * 1e9, dt);
if(flag_stripper) {
itsBunch->boundp();
*gmsg << "* Total number of particles after stripping = " << itsBunch->getTotalNum() << endl;
......@@ -4963,7 +4974,7 @@ void ParallelCyclotronTracker::applyPluginElements(const double dt) {
if(((*sindex)->first) == ElementBase::COLLIMATOR) {
Collimator * collim;
collim = static_cast<Collimator *>(((*sindex)->second).second);
collim->checkCollimator(*itsBunch, turnnumber_m, itsBunch->getT() * 1e9, dt);
collim->checkCollimator(itsBunch, turnnumber_m, itsBunch->getT() * 1e9, dt);
}
}
}
......@@ -5386,7 +5397,7 @@ void ParallelCyclotronTracker::bunchDumpStatData(){
FDext_m[1] = extE_m;
// Save the stat file
itsDataSink->writeStatData(*itsBunch, FDext_m, E);
itsDataSink->writeStatData(itsBunch, FDext_m, E);
itsBunch->R *= Vector_t(1000.0); // m -> mm
......@@ -5459,7 +5470,7 @@ void ParallelCyclotronTracker::bunchDumpPhaseSpaceData() {
FDext_m[0] = extB_m * 0.1; // kgauss --> T
FDext_m[1] = extE_m;
lastDumpedStep_m = itsDataSink->writePhaseSpace_cycl(*itsBunch, // Global and in m
lastDumpedStep_m = itsDataSink->writePhaseSpace_cycl(itsBunch, // Global and in m
FDext_m, E,
referencePr,
referencePt,
......@@ -5491,7 +5502,7 @@ void ParallelCyclotronTracker::bunchDumpPhaseSpaceData() {
FDext_m[0] = extB_m * 0.1; // kgauss --> T
FDext_m[1] = extE_m;
lastDumpedStep_m = itsDataSink->writePhaseSpace_cycl(*itsBunch, // Local and in m
lastDumpedStep_m = itsDataSink->writePhaseSpace_cycl(itsBunch, // Local and in m
FDext_m, E,
referencePr,
referencePt,
......
......@@ -25,7 +25,8 @@
#include <vector>
class BMultipoleField;
class PartBunch;
template <class T, unsigned Dim>
class PartBunchBase;
class PlanarArcGeometry;
class Ring;
class SBend3D;
......@@ -65,7 +66,7 @@ public:
// The particle bunch tracked is taken from [b]bunch[/b].
// If [b]revBeam[/b] is true, the beam runs from s = C to s = 0.
// If [b]revTrack[/b] is true, we track against the beam.
explicit ParallelCyclotronTracker(const Beamline &bl, PartBunch &bunch, DataSink &ds,
explicit ParallelCyclotronTracker(const Beamline &bl, PartBunchBase<double, 3> *bunch, DataSink &ds,
const PartData &data, bool revBeam, bool revTrack, int maxSTEPS, int timeIntegrator);
virtual ~ParallelCyclotronTracker();
......@@ -197,7 +198,7 @@ private:
int LastVisited;
Beamline *itsBeamline;
PartBunch *itsBunch;
PartBunchBase<double, 3> *itsBunch;
DataSink *itsDataSink;
......
......@@ -99,7 +99,7 @@ ParallelTTracker::ParallelTTracker(const Beamline &beamline,
}
ParallelTTracker::ParallelTTracker(const Beamline &beamline,
PartBunch &bunch,
PartBunchBase<double, 3> *bunch,
DataSink &ds,
const PartData &reference,
bool revBeam,
......@@ -109,7 +109,7 @@ ParallelTTracker::ParallelTTracker(const Beamline &beamline,
const std::vector<double> &zstop,
const std::vector<double> &dt):
Tracker(beamline, reference, revBeam, revTrack),
itsBunch_m(&bunch),
itsBunch_m(bunch),
itsDataSink_m(&ds),
itsOpalBeamline_m(beamline.getOrigin3D(), beamline.getCoordTransformationTo()),
RefPartR_m(0.0),
......@@ -741,7 +741,7 @@ void ParallelTTracker::computeWakefield(IndexMap::value_t &elements) {
itsBunch_m->Ef[i] = referenceToBeamCSTrafo.rotateTo(itsBunch_m->Ef[i]);
}
wfInstance->apply(*itsBunch_m);
wfInstance->apply(itsBunch_m);
for (unsigned int i = 0; i < localNum; ++ i) {
itsBunch_m->R[i] = beamToReferenceCSTrafo.transformTo(itsBunch_m->R[i]);
......@@ -861,7 +861,7 @@ void ParallelTTracker::computeParticleMatterInteraction(IndexMap::value_t elemen
}
boundingSphere.first = refToLocalCSTrafo.transformTo(boundingSphere.first);
it->apply(*itsBunch_m, boundingSphere, totalParticlesInSimulation_m);
it->apply(itsBunch_m, boundingSphere, totalParticlesInSimulation_m);
it->print(msg);
boundingSphere.first = localToRefCSTrafo.transformTo(boundingSphere.first);
......@@ -1081,7 +1081,7 @@ void ParallelTTracker::writePhaseSpace(const long long step, bool psDump, bool s
}
}
// Write statistical data.
itsDataSink_m->writeStatData(*itsBunch_m, FDext, collimatorLosses);
itsDataSink_m->writeStatData(itsBunch_m, FDext, collimatorLosses);
msg << level3 << "* Wrote beam statistics." << endl;
}
......@@ -1118,7 +1118,7 @@ void ParallelTTracker::writePhaseSpace(const long long step, bool psDump, bool s
if (!statDump && !driftToCorrectPosition) itsBunch_m->calcBeamParameters();
msg << *itsBunch_m << endl;
itsDataSink_m->writePhaseSpace(*itsBunch_m, FDext);
itsDataSink_m->writePhaseSpace(itsBunch_m, FDext);
if (driftToCorrectPosition) {
if (localNum > 0) {
......
......@@ -88,7 +88,7 @@ public:
// If [b]revBeam[/b] is true, the beam runs from s = C to s = 0.
// If [b]revTrack[/b] is true, we track against the beam.
explicit ParallelTTracker(const Beamline &bl,
PartBunch &bunch,
PartBunchBase<double, 3> *bunch,
DataSink &ds,
const PartData &data,
bool revBeam,
......@@ -191,7 +191,7 @@ private:
/******************** STATE VARIABLES ***********************************/
PartBunch *itsBunch_m;
PartBunchBase<double, 3> *itsBunch_m;
DataSink *itsDataSink_m;
OpalBeamline itsOpalBeamline_m;
......
......@@ -91,7 +91,7 @@ ThickTracker::ThickTracker(const Beamline &beamline,
ThickTracker::ThickTracker(const Beamline &beamline,
const PartBunch &bunch,
PartBunchBase<double, 3> *bunch,
const PartData &reference,
bool revBeam, bool revTrack):
Tracker(beamline, bunch, reference, revBeam, revTrack)
......@@ -125,11 +125,11 @@ void ThickTracker::visitCorrector(const Corrector &corr) {
if(length != 0.0) scale *= length; // Is this right?!?
const BDipoleField &field = corr.getField();
for(unsigned int i = 0; i < itsBunch.getLocalNum(); i++) {
OpalParticle part = itsBunch.get_part(i);
for(unsigned int i = 0; i < itsBunch->getLocalNum(); i++) {
OpalParticle part = itsBunch->get_part(i);
part.px() -= field.getBy() * scale;
part.py() += field.getBx() * scale;
itsBunch.set_part(part, i);
itsBunch->set_part(part, i);
}
// Drift through second half of length.
......@@ -200,8 +200,8 @@ void ThickTracker::visitMultipole(const Multipole &mult) {
As.setTruncOrder(Series::EXACT);
// Use implicit integration to propagate particles.
for(unsigned int i = 0; i < itsBunch.getLocalNum(); i++) {
OpalParticle part = itsBunch.get_part(i);
for(unsigned int i = 0; i < itsBunch->getLocalNum(); i++) {
OpalParticle part = itsBunch->get_part(i);
Vector zin;
zin[X] = part.x();
zin[PX] = part.px();
......@@ -254,7 +254,7 @@ void ThickTracker::visitMultipole(const Multipole &mult) {
part.pt() = DBL_MAX;
}
}
itsBunch.set_part(part, i);
itsBunch->set_part(part, i);
}
// Apply exit fringe field.
......@@ -325,8 +325,8 @@ void ThickTracker::visitRBend(const RBend &bend) {
// Use implicit integration to propagate particles.
for(unsigned int i = 0; i < itsBunch.getLocalNum(); i++) {
OpalParticle part = itsBunch.get_part(i);
for(unsigned int i = 0; i < itsBunch->getLocalNum(); i++) {
OpalParticle part = itsBunch->get_part(i);
Vector zin, zf;
zin[X] = part.x();
zin[PX] = part.px();
......@@ -385,7 +385,7 @@ void ThickTracker::visitRBend(const RBend &bend) {
part.pt() = DBL_MAX;
}
}
itsBunch.set_part(part, i);
itsBunch->set_part(part, i);
}
if(back_path) {
......@@ -416,13 +416,13 @@ void ThickTracker::visitRFCavity(const RFCavity &as) {
double kin = itsReference.getM() / itsReference.getP();
double peak