Commit 236d53a0 authored by kraus's avatar kraus

change return type of ElementBase::getType

parent 81c94886
......@@ -92,7 +92,7 @@ const BGeometryBase &AlignWrapper::getGeometry() const {
}
const std::string &AlignWrapper::getType() const {
ElementBase::ElementBase::ElementType AlignWrapper::getType() const {
return itsElement->getType();
}
......@@ -157,4 +157,4 @@ AlignWrapper::~AlignWrapper()
AlignWrapper::AlignWrapper(ElementBase *elem):
ElementBase(elem->getName()), itsElement(elem), itsOffset() {
shareFlag = false;
}
}
\ No newline at end of file
......@@ -95,7 +95,7 @@ public:
/// Get element type std::string.
// Returns the type std::string for the enclosed item.
virtual const std::string &getType() const;
virtual ElementBase::ElementBase::ElementType getType() const;
/// Disallow misalignment of an already misaligned object.
// This method returns [b]this[/b], since "this" is already an
......@@ -158,4 +158,4 @@ private:
mutable Euclid3D itsOffset;
};
#endif // CLASSIC_AlignWrapper_HH
#endif // CLASSIC_AlignWrapper_HH
\ No newline at end of file
......@@ -76,7 +76,6 @@ void BeamBeam::getDimensions(double &zBegin, double &zEnd) const {
}
const std::string &BeamBeam::getType() const {
static const std::string type("BeamBeam");
return type;
ElementBase::ElementType BeamBeam::getType() const {
return BEAMBEAM;
}
......@@ -75,7 +75,7 @@ public:
virtual bool bends() const;
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -569,9 +569,8 @@ void Collimator::getDimensions(double &zBegin, double &zEnd) const {
}
const std::string &Collimator::getType() const {
static const std::string type("Collimator");
return type;
ElementBase::ElementType Collimator::getType() const {
return COLLIMATOR;
}
string Collimator::getCollimatorShape() {
......
......@@ -89,7 +89,7 @@ public:
virtual void goOffline();
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -111,7 +111,6 @@ void Component::getMisalignment(double &x, double &y, double &s) const {
s = ds_m;
}
const std::string &Component::getType() const {
static const std::string type("");
return type;
}
ElementBase::ElementType Component::getType() const {
return ElementBase::ANY;
}
\ No newline at end of file
......@@ -132,7 +132,7 @@ public:
virtual void getDimensions(double &zBegin, double &zEnd) const = 0;
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void setComponentType(std::string name) { };
virtual std::string getComponentType() const { return ""; };
......@@ -207,4 +207,4 @@ inline void Component::setOrientation(const Vector_t &direction)
inline void Component::setExitFaceSlope(const double &m)
{ exit_face_slope_m = m; }
#endif // CLASSIC_Component_HH
#endif // CLASSIC_Component_HH
\ No newline at end of file
......@@ -115,7 +115,6 @@ void Corrector::getDimensions(double &zBegin, double &zEnd) const
zEnd = startField_m + getElementLength();
}
const std::string &Corrector::getType() const {
static const std::string type("Corrector");
return type;
}
\ No newline at end of file
ElementBase::ElementType Corrector::getType() const {
return CORRECTOR;
}
......@@ -91,7 +91,7 @@ public:
virtual bool bends() const;
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -174,10 +174,14 @@ void Cyclotron::setType(std::string t) {
type_m = t;
}
const std::string &Cyclotron::getType() const {
const std::string &Cyclotron::getCyclotronType() const {
return type_m;
}
ElementBase::ElementType Cyclotron::getType() const {
return CYCLOTRON;
}
void Cyclotron::setCyclHarm(double h) {
harm_m = h;
}
......
......@@ -37,21 +37,21 @@ struct BfieldData {
//~ double *dbt; //dBz/dtheta
//~ double *dbtt; //d2Bz/dtheta2
//~ double *dbttt; //d3Bz/dtheta3
//~
//~
//~ // to be calculated in getdiffs: all other derivatives:
//~ double *dbr; // dBz/dr
//~ double *dbrr; // ...
//~ double *dbrrr;
//~
//~
//~ double *dbrt;
//~ double *dbrrt;
//~ double *dbrtt;
//~
//~
//~ // used to get (Br,Btheta,Bz) at any off-plane point
//~ double *f2; // for Bz
//~ double *f3; // for Br
//~ double *g3; // for Btheta
//~
//~
std::vector<double> bfld; //Bz
std::vector<double> dbt; //dBz/dtheta
std::vector<double> dbtt; //d2Bz/dtheta2
......@@ -132,7 +132,8 @@ public:
void setRfFieldMapFN(std::vector<std::string> rffmapfn);
void setType(std::string t);
virtual const std::string &getType() const;
const std::string &getCyclotronType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......@@ -158,7 +159,7 @@ public:
void setZinit(double zinit);
virtual double getZinit() const;
void setPZinit(double zinit);
virtual double getPZinit() const;
......@@ -221,7 +222,7 @@ private:
std::vector<double> rffrequ_m;
std::vector<double> rfphi_m;
std::vector<double> escale_m; // a scale factor for the E-field
std::vector<bool> superpose_m; // electric fields are superposed or not
std::vector<bool> superpose_m; // electric fields are superposed or not
double symmetry_m;
......@@ -260,13 +261,13 @@ private:
BPositions BP;
BFieldType myBFieldType_m;
// RF field map handler
// Fieldmap *RFfield;
std::vector<Fieldmap *> RFfields_m;
std::vector<Fieldmap *> RFfields_m;
std::vector<std::string> RFfilename_m;
// handling for store the particle out of region
// handling for store the particle out of region
std::unique_ptr<LossDataSink> lossDs_m;
void getdiffs();
......@@ -286,4 +287,4 @@ private:
};
#endif // CLASSIC_Cyclotron_HH
#endif // CLASSIC_Cyclotron_HH
\ No newline at end of file
......@@ -205,7 +205,6 @@ void CyclotronValley::getDimensions(double &zBegin, double &zEnd) const {
}
const std::string &CyclotronValley::getType() const {
static const std::string type("CyclotronValley");
return type;
ElementBase::ElementType CyclotronValley::getType() const {
return CYCLOTRONVALLEY;
}
......@@ -57,7 +57,7 @@ public:
void setFast(bool fast);
bool getFast() const;
const std::string &getType() const;
ElementBase::ElementType getType() const;
virtual bool apply(const size_t &i, const double &t, double E[], double B[]);
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B);
......
......@@ -229,9 +229,8 @@ void Degrader::getDimensions(double &zBegin, double &zEnd) const {
}
const std::string &Degrader::getType() const {
static const std::string type("DEGRADER");
return type;
ElementBase::ElementType Degrader::getType() const {
return DEGRADER;
}
string Degrader::getDegraderShape() {
......@@ -245,4 +244,4 @@ void Degrader::setZSize(double z) {
double Degrader::getZSize() {
return deg_width_m;
}
\ No newline at end of file
}
......@@ -78,7 +78,7 @@ public:
virtual void goOffline();
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -71,9 +71,8 @@ bool Diagnostic::bends() const {
return false;
}
const std::string &Diagnostic::getType() const {
static const std::string type("Diagnostic");
return type;
ElementBase::ElementType Diagnostic::getType() const {
return DIAGNOSTIC;
}
void Diagnostic::getDimensions(double &zBegin, double &zEnd) const
......
......@@ -55,7 +55,7 @@ public:
virtual bool bends() const;
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -79,7 +79,6 @@ void Drift::getDimensions(double &zBegin, double &zEnd) const {
zEnd = startField_m + getElementLength();
}
const std::string &Drift::getType() const {
static const std::string type("Drift");
return type;
ElementBase::ElementType Drift::getType() const {
return DRIFT;
}
......@@ -56,7 +56,7 @@ public:
virtual bool bends() const;
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -145,8 +145,79 @@ const ConstChannel *ElementBase::getConstChannel(const std::string &aKey) const
}
std::string ElementBase::getTypeString() const {
switch (getType()) {
case ALIGNWRAPPER:
return "AlignWrapper";
case BEAMBEAM:
return "BeamBeam";
case BEAMLINE:
return "Beamline";
case COLLIMATOR:
return "Collimator";
case CORRECTOR:
return "Corrector";
case CYCLOTRON:
return "Cyclotron";
case CYCLOTRONVALLEY:
return "CyclotronValley";
case DEGRADER:
return "Degrader";
case DIAGNOSTIC:
return "Diagnostic";
case DRIFT:
return "Drift";
case INTEGRATOR:
return "Integrator";
case LAMBERTSON:
return "Lambertson";
case MARKER:
return "Marker";
case MONITOR:
return "Monitor";
case MULTIPOLE:
return "Multipole";
case OFFSET:
return "Offset";
case PARALLELPLATE:
return "ParallelPlate";
case PATCH:
return "Patch";
case PROBE:
return "Probe";
case RBEND:
return "RBend";
case RFCAVITY:
return "RFCavity";
case RFQUADRUPOLE:
return "RFQuadrupole";
case RING:
return "Ring";
case SBEND3D:
return "SBend3D";
case SBEND:
return "SBend";
case SEPARATOR:
return "Separator";
case SEPTUM:
return "Septum";
case SOLENOID:
return "Solenoid";
case STRIPPER:
return "Stripper";
case TRAVELINGWAVE:
return "TravelingWave";
case VARIABLERFCAVITY:
return "VariableRFCavity";
case ANY:
default:
return "";
}
}
ElementImage *ElementBase::getImage() const {
return new ElementImage(getName(), getType(), userAttribs);
std::string type = getTypeString();
return new ElementImage(getName(), type, userAttribs);
}
......@@ -229,4 +300,4 @@ void ElementBase::setBoundaryGeometry(BoundaryGeometry *geo) {
void ElementBase::setSurfacePhysics(SurfacePhysicsHandler *sphys) {
sphys_m = sphys;
}
}
\ No newline at end of file
......@@ -135,8 +135,51 @@ public:
/// Set element name.
virtual void setName(const std::string &name);
enum ElementType {ALIGNWRAPPER
, BEAMBEAM
, BEAMBEAM3D
, BEAMLINE
, COLLIMATOR
, CORRECTOR
, CORRECTORWRAPPER
, CYCLOTRON
, CYCLOTRONWRAPPER
, CYCLOTRONVALLEY
, DEGRADER
, DIAGNOSTIC
, DRIFT
, INTEGRATOR
, LAMBERTSON
, MARKER
, MONITOR
, MPSPLITINTEGRATOR
, MULTIPOLE
, MULTIPOLEWRAPPER
, OFFSET
, PARALLELPLATE
, PATCH
, PROBE
, RBEND
, RBENDWRAPPER
, RFCAVITY
, RFQUADRUPOLE
, RING
, SBEND3D
, SBEND
, SBENDWRAPPER
, SEPARATOR
, SEPTUM
, SOLENOID
, STRIPPER
, TRAVELINGWAVE
, VARIABLERFCAVITY
, ANY};
/// Get element type std::string.
virtual const std::string &getType() const = 0;
virtual ElementType getType() const = 0;
std::string getTypeString() const;
/// Get geometry.
// Return the element geometry.
......@@ -454,4 +497,4 @@ inline ElemType ElementBase::getElType() const
inline void ElementBase::setElType(ElemType elt)
{ elType_m = elt;}
#endif // CLASSIC_ElementBase_HH
#endif // CLASSIC_ElementBase_HH
\ No newline at end of file
......@@ -75,7 +75,6 @@ void Lambertson::getDimensions(double &zBegin, double &zEnd) const {
}
const std::string &Lambertson::getType() const {
static const std::string type("Lambertson");
return type;
ElementBase::ElementType Lambertson::getType() const {
return LAMBERTSON;
}
......@@ -56,7 +56,7 @@ public:
virtual bool bends() const;
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -77,7 +77,6 @@ void Marker::getDimensions(double &zBegin, double &zEnd) const {
}
const std::string &Marker::getType() const {
static const std::string type("Marker");
return type;
ElementBase::ElementType Marker::getType() const {
return MARKER;
}
......@@ -55,7 +55,7 @@ public:
virtual bool bends() const;
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -154,9 +154,8 @@ void Monitor::getDimensions(double &zBegin, double &zEnd) const {
}
const std::string &Monitor::getType() const {
static const std::string type("Monitor");
return type;
ElementBase::ElementType Monitor::getType() const {
return MONITOR;
}
void Monitor::moveBy(const double &dz) {
......
......@@ -87,7 +87,7 @@ public:
virtual void goOffline();
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -378,7 +378,6 @@ void Multipole::getDimensions(double &zBegin, double &zEnd) const {
}
const std::string &Multipole::getType() const {
static const std::string type("Multipole");
return type;
ElementBase::ElementType Multipole::getType() const {
return MULTIPOLE;
}
......@@ -105,7 +105,7 @@ public:
virtual bool bends() const;
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -221,7 +221,6 @@ void ParallelPlate::getDimensions(double &zBegin, double &zEnd) const {
}
const std::string &ParallelPlate::getType() const {
static const std::string type("ParallelPlate");
return type;
ElementBase::ElementType ParallelPlate::getType() const {
return PARALLELPLATE;
}
......@@ -52,7 +52,7 @@ public:
void getDimensions(double &zBegin, double &zEnd) const;
const std::string &getType() const;
ElementBase::ElementType getType() const;
std::string getFieldMapFN() const;
......
......@@ -76,8 +76,7 @@ void Patch::getDimensions(double &zBegin, double &zEnd) const {
}
const std::string &Patch::getType() const {
static const std::string type("Patch");
return type;
ElementBase::ElementType Patch::getType() const {
return PATCH;
}
......@@ -60,7 +60,7 @@ public:
virtual bool bends() const;
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -307,7 +307,6 @@ void Probe::getDimensions(double &zBegin, double &zEnd) const {
zEnd = position_m + 0.005;
}
const std::string &Probe::getType() const {
static const std::string type("Probe");
return type;
ElementBase::ElementType Probe::getType() const {
return PROBE;
}
......@@ -80,7 +80,7 @@ public:
virtual double getWidth() const;
bool checkProbe(PartBunch &bunch, const int turnnumber, const double t, const double tstep);
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
......
......@@ -414,9 +414,8 @@ void RBend::getDimensions(double &sBegin, double &sEnd) const {
sEnd = endField_m;
}
const std::string &RBend::getType() const {
static const std::string type("RBend");
return type;
ElementBase::ElementType RBend::getType() const {
return RBEND;
}
void RBend::initialise(PartBunch *bunch, double &startField, double &endField, const double &scaleFactor) {
......@@ -1661,4 +1660,4 @@ bool RBend::TreatAsDrift(Inform &msg) {
} else
return false;
}
\ No newline at end of file
}
......@@ -200,7 +200,7 @@ public:
virtual void finalise();
virtual void getDimensions(double &sBegin, double &sEnd) const;
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;
virtual void initialise(PartBunch *bunch,
double &startField,
double &endField,
......
......@@ -800,9 +800,8 @@ void RFCavity::getDimensions(double &zBegin, double &zEnd) const {
}
const std::string &RFCavity::getType() const {
static const std::string type("RFCavity");
return type;
ElementBase::ElementType RFCavity::getType() const {
return RFCAVITY;
}
double RFCavity::getAutoPhaseEstimate(const double &E0, const double &t0, const double &q, const double &mass) {
......@@ -1048,4 +1047,4 @@ pair<double, double> RFCavity::trackOnAxisParticle(const double &p0,
const double tErr = (z - zend) / (Physics::c * beta);
return pair<double, double>(p, t - tErr);
}
\ No newline at end of file
}
......@@ -158,7 +158,7 @@ public:
double spline(double z, double *za);
virtual const std::string &getType() const;
virtual ElementBase::ElementType getType() const;