Commit 80552eaa authored by kraus's avatar kraus
Browse files

Merge branch '548-remove-mapintegrator-and-trackintegrator-classes' into 'master'

Resolve "Remove MapIntegrator and TrackIntegrator classes"

Closes #548

See merge request OPAL/src!375
parents 7579ca5c 63ab6a1f
......@@ -76,9 +76,6 @@ class VerticalFFAMagnet;
// Integrators.
class Integrator;
class MapIntegrator;
class TrackIntegrator;
// Class BeamlineVisitor
// ------------------------------------------------------------------------
......@@ -252,12 +249,6 @@ public:
/// Apply the algorithm to a generic integrator.
virtual void visitIntegrator(const Integrator &) = 0;
/// Apply the algorithm to an integrator capable of tracking.
virtual void visitTrackIntegrator(const TrackIntegrator &) = 0;
/// Apply the algorithm to an integrator capable of mapping.
virtual void visitMapIntegrator(const MapIntegrator &) = 0;
/// Apply the algorithm to a vertical FFA magnet
virtual void visitVerticalFFAMagnet(const VerticalFFAMagnet &) = 0;
......
......@@ -54,9 +54,6 @@
#include "ComponentWrappers/RBendWrapper.h"
#include "ComponentWrappers/SBendWrapper.h"
#include "Algorithms/MapIntegrator.h"
#include "Algorithms/TrackIntegrator.h"
template <class ELEM1, class ELEM2>
struct CastsTrait {
typedef std::list<const ELEM1*> ElementList_t;
......@@ -229,12 +226,6 @@ public:
/// Apply the algorithm to a generic integrator.
virtual void visitIntegrator(const Integrator &);
/// Apply the algorithm to an integrator capable of mapping.
virtual void visitMapIntegrator(const MapIntegrator &);
/// Apply the algorithm to an integrator capable of tracking.
virtual void visitTrackIntegrator(const TrackIntegrator &);
size_t size() const;
typedef std::list<const ELEM*> ElementList_t;
......@@ -513,14 +504,6 @@ template<class ELEM>
void SpecificElementVisitor<ELEM>::visitIntegrator(const Integrator & /*elem*/) {
}
template<class ELEM>
void SpecificElementVisitor<ELEM>::visitMapIntegrator(const MapIntegrator &/*element*/) {
}
template<class ELEM>
void SpecificElementVisitor<ELEM>::visitTrackIntegrator(const TrackIntegrator &/*element*/) {
}
template<class ELEM>
size_t SpecificElementVisitor<ELEM>::size() const{
return allElementsOfTypeE.size();
......
......@@ -6,7 +6,6 @@ set (_SRCS
DefaultVisitor.cpp
Flagger.cpp
LinearMapper.cpp
MapIntegrator.cpp
Mapper.cpp
PartBunch.cpp
PartBins.cpp
......@@ -18,7 +17,6 @@ set (_SRCS
Surveyor.cpp
ThinMapper.cpp
ThinTracker.cpp
TrackIntegrator.cpp
Tracker.cpp
Quaternion.cpp
)
......@@ -42,7 +40,6 @@ set (HDRS
Flagger.h
LinearMapper.h
ListElem.h
MapIntegrator.h
Mapper.h
PartBinsCyc.h
PartBins.h
......@@ -59,7 +56,6 @@ set (HDRS
ThinMapper.h
ThinTracker.h
Tracker.h
TrackIntegrator.h
Vektor.h
)
......
......@@ -26,42 +26,40 @@
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Cyclotron.h"
#include "AbsBeamline/Degrader.h"
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/Drift.h"
#include "AbsBeamline/Degrader.h"
#include "AbsBeamline/ElementBase.h"
#include "AbsBeamline/FlexibleCollimator.h"
#include "AbsBeamline/Integrator.h"
#include "AbsBeamline/Lambertson.h"
#include "AbsBeamline/Offset.h"
#include "AbsBeamline/Marker.h"
#include "AbsBeamline/Monitor.h"
#include "AbsBeamline/Multipole.h"
#include "AbsBeamline/MultipoleT.h"
#include "AbsBeamline/MultipoleTStraight.h"
#include "AbsBeamline/MultipoleTCurvedConstRadius.h"
#include "AbsBeamline/MultipoleTCurvedVarRadius.h"
#include "AbsBeamline/MultipoleTStraight.h"
#include "AbsBeamline/Offset.h"
#include "AbsBeamline/ParallelPlate.h"
#include "AbsBeamline/Patch.h"
#include "AbsBeamline/Probe.h"
#include "AbsBeamline/RBend.h"
#include "AbsBeamline/RBend3D.h"
#include "AbsBeamline/RFCavity.h"
#include "AbsBeamline/VariableRFCavity.h"
#include "AbsBeamline/VariableRFCavityFringeField.h"
#include "AbsBeamline/TravelingWave.h"
#include "AbsBeamline/RFQuadrupole.h"
#include "AbsBeamline/SBend.h"
#include "AbsBeamline/SBend3D.h"
#include "AbsBeamline/ScalingFFAMagnet.h"
#include "AbsBeamline/VerticalFFAMagnet.h"
#include "AbsBeamline/Separator.h"
#include "AbsBeamline/Septum.h"
#include "AbsBeamline/Solenoid.h"
#include "AbsBeamline/Source.h"
#include "AbsBeamline/ParallelPlate.h"
#include "AbsBeamline/Stripper.h"
#include "Algorithms/MapIntegrator.h"
#include "Algorithms/TrackIntegrator.h"
#include "AbsBeamline/TravelingWave.h"
#include "AbsBeamline/VariableRFCavity.h"
#include "AbsBeamline/VariableRFCavityFringeField.h"
#include "AbsBeamline/VerticalFFAMagnet.h"
#include "Beamlines/Beamline.h"
#include "Beamlines/FlaggedElmPtr.h"
......@@ -317,17 +315,5 @@ void DefaultVisitor::visitIntegrator(const Integrator &i) {
}
void DefaultVisitor::visitMapIntegrator(const MapIntegrator &i) {
// Default: cannot use integrator.
i.getElement()->accept(*this);
}
void DefaultVisitor::visitTrackIntegrator(const TrackIntegrator &i) {
// Default: cannot use integrator.
i.getElement()->accept(*this);
}
void DefaultVisitor::applyDefault(const ElementBase &)
{}
{}
\ No newline at end of file
......@@ -198,12 +198,6 @@ public:
/// Apply the algorithm to a generic integrator.
virtual void visitIntegrator(const Integrator &);
/// Apply the algorithm to an integrator capable of mapping.
virtual void visitMapIntegrator(const MapIntegrator &);
/// Apply the algorithm to an integrator capable of tracking.
virtual void visitTrackIntegrator(const TrackIntegrator &);
protected:
// The top level beamline.
......@@ -234,4 +228,4 @@ private:
bool local_flip;
};
#endif // CLASSIC_DefaultVisitor_HH
\ No newline at end of file
#endif // CLASSIC_DefaultVisitor_HH
......@@ -41,7 +41,6 @@
#include "AbsBeamline/Solenoid.h"
#include "AbsBeamline/ParallelPlate.h"
#include "Algorithms/MapIntegrator.h"
#include "BeamlineGeometry/Euclid3D.h"
#include "BeamlineGeometry/PlanarArcGeometry.h"
#include "BeamlineGeometry/RBendGeometry.h"
......@@ -395,13 +394,6 @@ void LinearMapper::visitAlignWrapper(const AlignWrapper &wrap) {
}
void LinearMapper::visitMapIntegrator(const MapIntegrator &i) {
FVps<double, 6> map(itsMap);
i.trackMap(map, itsReference, back_beam, back_track);
itsMap = LinearMap<double, 6>(map);
}
void LinearMapper::makeFocus
(double k, double L, double &c, double &s, double &d, double &f) {
double t = k * L * L;
......
......@@ -165,9 +165,6 @@ public:
/// Apply the algorithm to a ParallelPlate.
virtual void visitParallelPlate(const ParallelPlate &);
/// Apply the algorithm to an integrator capable of mapping.
virtual void visitMapIntegrator(const MapIntegrator &);
protected:
/// Apply drift length.
......@@ -221,4 +218,4 @@ private:
};
#endif // MAD_LinearMapper_HH
\ No newline at end of file
#endif // MAD_LinearMapper_HH
// ------------------------------------------------------------------------
// $RCSfile: MapIntegrator.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: MapIntegrator
// An abstract base class for integrators.
// A MapIntegrator propagates a single particle or particle bunch,
// as well as a truncated Taylor series map.
//
// ------------------------------------------------------------------------
// Class category: Algorithms
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:33 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "Algorithms/MapIntegrator.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Algorithms/PartBunchBase.h"
#include "Algorithms/OpalParticle.h"
#include "FixedAlgebra/FVps.h"
#include "FixedAlgebra/LinearMap.h"
// Class MapIntegrator
// ------------------------------------------------------------------------
MapIntegrator::MapIntegrator(ElementBase *elem):
TrackIntegrator(elem)
{}
MapIntegrator::MapIntegrator(const MapIntegrator &rhs):
TrackIntegrator(rhs)
{}
MapIntegrator::~MapIntegrator()
{}
void MapIntegrator::accept(BeamlineVisitor &visitor) const {
visitor.visitMapIntegrator(*this);
}
void MapIntegrator::trackParticle(OpalParticle &part, const PartData &ref,
bool backBeam, bool backTrack) const {
// Default behaviour: track particle using own map.
FVps<double, 6> ownMap;
getMap(ownMap, ref, backBeam, backTrack);
FVector<double, 6> z;
z[0] = part.x();
z[1] = part.px();
z[2] = part.x();
z[3] = part.py();
z[4] = part.x();
z[5] = part.pt();
z = ownMap.constantTerm(z);
part.x() = z[0];
part.px() = z[1];
part.y() = z[2];
part.py() = z[3];
part.y() = z[4];
part.pt() = z[5];
}
void MapIntegrator::trackBunch(PartBunchBase<double, 3> *bunch, const PartData &ref,
bool backBeam, bool backTrack) const {
// Default behaviour: track particle bunch using own map.
FVps<double, 6> ownMap;
getMap(ownMap, ref, backBeam, backTrack);
FVector<double, 6> z;
// PartBunch::iterator last = bunch.end();
// for (PartBunch::iterator part = bunch.begin(); part != last; ++part) {
for(unsigned int i = 0; i < bunch->getLocalNum(); i++) {
const OpalParticle part = bunch->get_part(i);
z[0] = part[0];
z[1] = part[1];
z[2] = part[2];
z[3] = part[3];
z[4] = part[4];
z[5] = part[5];
z = ownMap.constantTerm(z);
bunch->set_part(z, i);
}
}
void MapIntegrator::trackMap(FVps<double, 6> &map, const PartData &ref,
bool backBeam, bool backTrack) const {
// Default behaviour: track map using own map.
FVps<double, 6> ownMap;
getMap(ownMap, ref, backBeam, backTrack);
map = ownMap.substitute(map);
}
#ifndef CLASSIC_MapIntegrator_HH
#define CLASSIC_MapIntegrator_HH
// ------------------------------------------------------------------------
// $RCSfile: MapIntegrator.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: MapIntegrator
//
// ------------------------------------------------------------------------
// Class category: Algorithms
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:33 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "Algorithms/TrackIntegrator.h"
template <class T, unsigned Dim>
class PartBunchBase;
class PartData;
class OpalParticle;
template <class T, int N> class FVps;
// Class MapIntegrator
// ------------------------------------------------------------------------
/// Integrate a map.
// An abstract base class for all integrators capable of tracking a
// transfer map through a beam element.
// Implements some default behaviour for such integrators.
class MapIntegrator: public TrackIntegrator {
public:
explicit MapIntegrator(ElementBase *);
MapIntegrator(const MapIntegrator &right);
virtual ~MapIntegrator();
/// Apply visitor.
virtual void accept(BeamlineVisitor &visitor) const;
/// Make a clone.
virtual MapIntegrator *clone() const = 0;
/// Track a particle.
// The particle is stored in [b]part[/b].
// The particle reference data are taken from [b]data[/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.
virtual void trackParticle(OpalParticle &part, const PartData &,
bool revBeam, bool revTrack) const;
/// Track a particle bunch.
// The bunch is stored in [b]bunch[/b].
// The particle reference data are taken from [b]data[/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.
virtual void trackBunch(PartBunchBase<double, 3> *, const PartData &,
bool revBeam, bool revTrack) const;
/// Track a map.
// The map is stored in [b]map[/b].
// The particle reference data are taken from [b]data[/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.
virtual void trackMap(FVps<double, 6> &, const PartData &,
bool revBeam, bool revTrack) const;
private:
// Not implemented.
MapIntegrator();
void operator=(const MapIntegrator &);
// Return the map for this MapIntegrator.
virtual void getMap(FVps<double, 6> &, const PartData &,
bool revBeam, bool revTrack) const = 0;
};
#endif // CLASSIC_MapIntegrator_HH
......@@ -21,7 +21,6 @@
#include "Algorithms/Mapper.h"
#include "AbsBeamline/AlignWrapper.h"
#include "Algorithms/MapIntegrator.h"
#include "Fields/BMultipoleField.h"
#include "FixedAlgebra/FTpsMath.h"
#include "FixedAlgebra/LinearMap.h"
......@@ -110,11 +109,6 @@ void Mapper::visitAlignWrapper(const AlignWrapper &wrap) {
}
void Mapper::visitMapIntegrator(const MapIntegrator &i) {
i.trackMap(itsMap, itsReference, back_beam, back_track);
}
void Mapper::applyDrift(double length) {
double kin = itsReference.getM() / itsReference.getP();
double refTime = length / itsReference.getBeta();
......
......@@ -126,10 +126,6 @@ public:
/// Apply the algorithm to an align wrapper.
virtual void visitAlignWrapper(const AlignWrapper &);
/// Apply the algorithm to an integrator capable of mapping.
virtual void visitMapIntegrator(const MapIntegrator &);
protected:
/// Apply drift length.
......
......@@ -41,7 +41,6 @@
#include "AbsBeamline/Solenoid.h"
#include "AbsBeamline/ParallelPlate.h"
#include "Algorithms/MapIntegrator.h"
#include "BeamlineGeometry/Euclid3D.h"
#include "BeamlineGeometry/Geometry.h"
#include "Beamlines/Beamline.h"
......@@ -337,4 +336,4 @@ void ThinMapper::applyDrift(double length) {
itsMap[X] += px * lByPz;
itsMap[Y] += py * lByPz;
itsMap[T] += length * (pt * ref - (px * px + py * py + 3.0 * pt * pt * ref) / 2.0);
}
\ No newline at end of file
}
......@@ -43,7 +43,6 @@
#include "AbsBeamline/Solenoid.h"
#include "AbsBeamline/ParallelPlate.h"
#include "Algorithms/MapIntegrator.h"
#include "Algorithms/PartBunchBase.h"
#include "Algorithms/PartData.h"
#include "Algorithms/OpalParticle.h"
......@@ -463,4 +462,4 @@ void ThinTracker::applyDrift(double length) {
part.t() += length * (pt * ref - (px * px + py * py + 3.0 * pt * pt * ref) / 2.0);
itsBunch_m->set_part(part, i);
}
}
\ No newline at end of file
}
// ------------------------------------------------------------------------
// $RCSfile: TrackIntegrator.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: TrackIntegrator
// An abstract base class for integrators.
// A TrackIntegrator propagates a single particle or particle bunch.
//
// ------------------------------------------------------------------------
// Class category: Algorithms
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:33 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "Algorithms/TrackIntegrator.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Utilities/LogicalError.h"
// Class TrackIntegrator
// ------------------------------------------------------------------------
TrackIntegrator::TrackIntegrator(ElementBase *elem):
Integrator(elem)
{}
TrackIntegrator::TrackIntegrator(const TrackIntegrator &rhs):
Integrator(rhs)
{}
TrackIntegrator::~TrackIntegrator()
{}
void TrackIntegrator::accept(BeamlineVisitor &visitor) const {
visitor.visitTrackIntegrator(*this);
}
void TrackIntegrator::trackMap(FVps<double, 6> &, const PartData &,
bool, bool) const {
throw LogicalError("TrackIntegrator::trackMap()",
"You cannot track a map using a track integrator.");
}
\ No newline at end of file
#ifndef CLASSIC_TrackIntegrator_HH
#define CLASSIC_TrackIntegrator_HH
// ------------------------------------------------------------------------
// $RCSfile: TrackIntegrator.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: TrackIntegrator
//
// ------------------------------------------------------------------------
// Class category: Algorithms
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:33 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/Integrator.h"
class PartData;
namespace classic {
class Particle;
}
template <class T, int N> class FVps;
// Class TrackIntegrator
// ------------------------------------------------------------------------
/// Integrate particle.
// An abstract base class for all integrators capable of tracking particles
// or particle bunches through a beam element. It is assumed that this
// integrator has no maps available. It can therefore not track a map.
class TrackIntegrator: public Integrator {
public:
explicit TrackIntegrator(ElementBase *);
TrackIntegrator(const TrackIntegrator &);
virtual ~TrackIntegrator();
/// Apply visitor.
virtual void accept(BeamlineVisitor &visitor) const;
/// Make a clone.
virtual TrackIntegrator *clone() const = 0;
/// Track a map.
// The map is stored in [b]map[/b].
// The particle reference data are taken from [b]data[/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.
// This version throws LogicalError, since the integrator has no map.
virtual void trackMap(FVps<double, 6> &map, const PartData &data,
bool backBeam, bool backTrack) const;
private:
// Not Implemented.
TrackIntegrator();
void operator=(const TrackIntegrator &);
};
#endif // CLASSIC_TrackIntegrator_HH
\ No newline at end of file
......@@ -22,7 +22,6 @@
#include "Algorithms/Tracker.h"
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/Patch.h"
#include "Algorithms/MapIntegrator.h"
#include "Fields/BMultipoleField.h"
//FIXME Remove headers and dynamic_cast in readOneBunchFromFile
......@@ -113,16 +112,6 @@ void Tracker::visitAlignWrapper(const AlignWrapper &wrap) {
}