Commit 23889ce0 authored by kraus's avatar kraus
Browse files

renaming Collimator to CCollimator where C stands for cyclotron; all other...

renaming Collimator to CCollimator where C stands for cyclotron; all other collimators are implemented using FlexibleCollimator; This also fixes #224
parent daf89f40
This diff is collapsed.
......@@ -22,7 +22,7 @@
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/BeamBeam.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/Drift.h"
......
......@@ -20,7 +20,7 @@
#include "Algorithms/LinearMapper.h"
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/Drift.h"
......
......@@ -31,7 +31,7 @@
#include "Physics/Physics.h"
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/Drift.h"
......
......@@ -20,7 +20,7 @@
// ------------------------------------------------------------------------
#include "Algorithms/ThinMapper.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/Drift.h"
......
......@@ -21,7 +21,7 @@
#include "Algorithms/ThinTracker.h"
#include "AbsBeamline/BeamBeam.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/Drift.h"
......
......@@ -16,7 +16,8 @@ class ClassicField;
#include "Beamlines/Beamline.h"
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/BeamBeam.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/FlexibleCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Degrader.h"
#include "AbsBeamline/Diagnostic.h"
......@@ -66,7 +67,7 @@ public:
virtual void visitBeamline(const Beamline &bl);
AP_VISITELEMENT(AlignWrapper)
AP_IGNOREELEMENT(BeamBeam)
AP_IGNOREELEMENT(Collimator)
AP_IGNOREELEMENT(CCollimator)
AP_IGNOREELEMENT(Corrector)
AP_IGNOREELEMENT(CyclotronValley)
AP_IGNOREELEMENT(Degrader)
......
......@@ -20,7 +20,7 @@
#include "Algorithms/LieMapper.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Degrader.h"
#include "AbsBeamline/Diagnostic.h"
......@@ -109,7 +109,7 @@ void LieMapper::visitBeamBeam(const BeamBeam &map) {
}
void LieMapper::visitCollimator(const Collimator &coll) {
void LieMapper::visitCCollimator(const CCollimator &coll) {
applyDrift(flip_s * coll.getElementLength());
}
......
......@@ -94,7 +94,7 @@ public:
virtual void visitBeamBeam(const BeamBeam &);
/// Apply the algorithm to a Collimator.
virtual void visitCollimator(const Collimator &);
virtual void visitCCollimator(const CCollimator &);
/// Apply the algorithm to a Component.
virtual void visitComponent(const Component &);
......
......@@ -18,7 +18,7 @@ template <class T, unsigned Dim>
class PartBunchBase;
class AlignWrapper;
class BeamBeam;
class Collimator;
class CCollimator;
class Corrector;
class CyclotronValley;
class Degrader;
......@@ -55,7 +55,7 @@ public:
NIL_VISITELEMENT(AlignWrapper)
NIL_VISITELEMENT(Beamline)
NIL_VISITELEMENT(BeamBeam)
NIL_VISITELEMENT(Collimator)
NIL_VISITELEMENT(CCollimator)
NIL_VISITELEMENT(Corrector)
NIL_VISITELEMENT(CyclotronValley)
NIL_VISITELEMENT(Degrader)
......
......@@ -27,7 +27,7 @@
#include <vector>
#include "AbstractObjects/OpalData.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Cyclotron.h"
#include "AbsBeamline/Degrader.h"
......@@ -608,11 +608,11 @@ void ParallelCyclotronTracker::visitBeamBeam(const BeamBeam &) {
*
* @param coll
*/
void ParallelCyclotronTracker::visitCollimator(const Collimator &coll) {
void ParallelCyclotronTracker::visitCCollimator(const CCollimator &coll) {
*gmsg << "* --------- Collimator -----------------------------" << endl;
Collimator* elptr = dynamic_cast<Collimator *>(coll.clone());
CCollimator* elptr = dynamic_cast<CCollimator *>(coll.clone());
myElements.push_back(elptr);
double xstart = elptr->getXStart();
......@@ -648,7 +648,7 @@ void ParallelCyclotronTracker::visitCollimator(const Collimator &coll) {
BcParameter[3] = 0.001 * yend;
BcParameter[4] = 0.001 * width ;
buildupFieldList(BcParameter, ElementBase::COLLIMATOR, elptr);
buildupFieldList(BcParameter, ElementBase::CCOLLIMATOR, elptr);
}
/**
......@@ -694,9 +694,9 @@ void ParallelCyclotronTracker::visitDrift(const Drift &drift) {
}
/**
*
*
* @param
*
* @param
*/
void ParallelCyclotronTracker::visitFlexibleCollimator(const FlexibleCollimator &) {
......@@ -1650,11 +1650,11 @@ void ParallelCyclotronTracker::saveOneBunch() {
*gmsg << endl;
*gmsg << "* Store beam to H5 file for multibunch simulation ... ";
Ppos_t coord, momentum;
ParticleAttrib<double> mass, charge;
ParticleAttrib<short> ptype;
std::size_t localNum = itsBunch_m->getLocalNum();
coord.create(localNum);
......@@ -1700,21 +1700,21 @@ void ParallelCyclotronTracker::saveOneBunch() {
std::make_pair("E-tail_z", 0.0),
std::make_pair("E-tail_y", 0.0)
};
H5PartWrapperForPC h5wrapper(onebunch_m, H5_O_WRONLY);
h5wrapper.writeHeader();
h5wrapper.writeStep(itsBunch_m, additionalAttributes);
h5wrapper.close();
*gmsg << "Done." << endl;
}
bool ParallelCyclotronTracker::readOneBunchFromFile(const size_t BinID) {
*gmsg << endl;
*gmsg << "* Read beam from H5 file for multibunch simulation ... ";
std::size_t localNum = itsBunch_m->getLocalNum();
/*
......@@ -1723,25 +1723,25 @@ bool ParallelCyclotronTracker::readOneBunchFromFile(const size_t BinID) {
* 4th argument: H5_O_RDONLY does not work with this constructor
*/
H5PartWrapperForPC h5wrapper(onebunch_m, 0, "", H5_O_WRONLY);
size_t numParticles = h5wrapper.getNumParticles();
if ( numParticles == 0 ) {
throw OpalException("ParallelCyclotronTracker::readOneBunchFromFile()",
"No particles in file " + onebunch_m + ".");
}
size_t numParticlesPerNode = numParticles / Ippl::getNodes();
size_t firstParticle = numParticlesPerNode * Ippl::myNode();
size_t lastParticle = firstParticle + numParticlesPerNode - 1;
if (Ippl::myNode() == Ippl::getNodes() - 1)
lastParticle = numParticles - 1;
PAssert_LT(firstParticle, lastParticle +1);
numParticles = lastParticle - firstParticle + 1;
//FIXME
std::unique_ptr<PartBunchBase<double, 3> > tmpBunch = 0;
#ifdef ENABLE_AMR
......@@ -1750,14 +1750,14 @@ bool ParallelCyclotronTracker::readOneBunchFromFile(const size_t BinID) {
else
#endif
tmpBunch.reset(new PartBunch(&itsReference));
tmpBunch->create(numParticles);
h5wrapper.readStep(tmpBunch.get(), firstParticle, lastParticle);
h5wrapper.close();
itsBunch_m->create(numParticles);
for(size_t ii = 0; ii < numParticles; ++ ii, ++ localNum) {
itsBunch_m->R[localNum] = tmpBunch->R[ii];
itsBunch_m->P[localNum] = tmpBunch->P[ii];
......@@ -1766,11 +1766,11 @@ bool ParallelCyclotronTracker::readOneBunchFromFile(const size_t BinID) {
itsBunch_m->PType[localNum] = ParticleType::REGULAR;
itsBunch_m->Bin[localNum] = BinID;
}
itsBunch_m->boundp();
*gmsg << "Done." << endl;
return true;
}
......@@ -2219,9 +2219,9 @@ void ParallelCyclotronTracker::applyPluginElements(const double dt) {
}
}
if(((*sindex)->first) == ElementBase::COLLIMATOR) {
Collimator * collim;
collim = static_cast<Collimator *>(((*sindex)->second).second);
if(((*sindex)->first) == ElementBase::CCOLLIMATOR) {
CCollimator * collim;
collim = static_cast<CCollimator *>(((*sindex)->second).second);
collim->checkCollimator(itsBunch_m, turnnumber_m, itsBunch_m->getT() * 1e9 /*[ns]*/, dt);
}
}
......@@ -2592,11 +2592,11 @@ void ParallelCyclotronTracker::singleParticleDump() {
}
void ParallelCyclotronTracker::bunchDumpStatData(){
// don't dump stat file in case of multi-bunch mode
if ( multiBunchMode_m != MB_MODE::NONE )
return;
IpplTimings::startTimer(DumpTimer_m);
/*
......@@ -2685,7 +2685,7 @@ void ParallelCyclotronTracker::bunchDumpPhaseSpaceData() {
Vector_t meanR;
Vector_t meanP;
// in case of multi-bunch mode take always bunch mean (although it takes all bunches)
if (Options::psDumpFrame == Options::BUNCH_MEAN || multiBunchMode_m != MB_MODE::NONE ) {
meanR = calcMeanR();
......@@ -2901,12 +2901,12 @@ std::tuple<double, double, double> ParallelCyclotronTracker::initializeTracking_
restartStep0_m = itsBunch_m->getLocalTrackStep();
step_m = restartStep0_m;
*gmsg << "* Restart at integration step " << restartStep0_m << endl;
}
initDistInGlobalFrame();
if ( OpalData::getInstance()->inRestartRun() && numBunch_m > 1)
itsBunch_m->resetPartBinID2(eta_m);
......@@ -3574,7 +3574,7 @@ void ParallelCyclotronTracker::injectBunch_m(bool& flagTransition) {
throw OpalException("ParallelCyclotronTracker::injectBunch_m()",
"We shouldn't be here in single bunch mode.");
}
itsBunch_m->setNumBunch(BunchCount_m);
setup_m.stepsNextCheck += setup_m.stepsPerTurn;
......@@ -3589,4 +3589,4 @@ void ParallelCyclotronTracker::injectBunch_m(bool& flagTransition) {
// After this, numBunch_m is wrong but not needed anymore...
numBunch_m--;
}
}
}
\ No newline at end of file
......@@ -103,7 +103,7 @@ public:
virtual void visitBeamBeam(const BeamBeam &);
/// Apply the algorithm to a collimator.
virtual void visitCollimator(const Collimator &);
virtual void visitCCollimator(const CCollimator &);
/// Apply the algorithm to a Corrector.
virtual void visitCorrector(const Corrector &);
......
......@@ -15,7 +15,8 @@
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/BeamBeam.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/FlexibleCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/Drift.h"
......@@ -62,7 +63,7 @@ public:
virtual void visitAlignWrapper(const AlignWrapper &);
virtual void visitBeamBeam(const BeamBeam &);
virtual void visitCollimator(const Collimator &);
virtual void visitCCollimator(const CCollimator &);
virtual void visitCorrector(const Corrector &);
virtual void visitDegrader(const Degrader &);
virtual void visitDiagnostic(const Diagnostic &);
......@@ -163,7 +164,7 @@ inline void ParallelSliceTracker::visitBeamBeam(const BeamBeam &bb) {
itsOpalBeamline_m->visit(bb, *this, itsBunch_m);
}
inline void ParallelSliceTracker::visitCollimator(const Collimator &coll) {
inline void ParallelSliceTracker::visitCCollimator(const CCollimator &coll) {
itsOpalBeamline_m->visit(coll, *this, itsBunch_m);
}
......@@ -338,4 +339,4 @@ inline void ParallelSliceTracker::writeLastStepPhaseSpace(const long long step,
INFOMSG("* Invalid bunch! No statistics dumped." << endl);
}
#endif
#endif
\ No newline at end of file
......@@ -1041,10 +1041,10 @@ void ParallelTTracker::writePhaseSpace(const long long step, bool psDump, bool s
if (statDump) {
std::vector<std::pair<std::string, unsigned int> > collimatorLosses;
FieldList collimators = itsOpalBeamline_m.getElementByType(ElementBase::COLLIMATOR);
FieldList collimators = itsOpalBeamline_m.getElementByType(ElementBase::CCOLLIMATOR);
if (collimators.size() != 0) {
for (FieldList::iterator it = collimators.begin(); it != collimators.end(); ++ it) {
Collimator* coll = static_cast<Collimator*>(it->getElement().get());
FlexibleCollimator* coll = static_cast<FlexibleCollimator*>(it->getElement().get());
std::string name = coll->getName();
unsigned int losses = coll->getLosses();
collimatorLosses.push_back(std::make_pair(name, losses));
......
......@@ -31,7 +31,7 @@
#include "Algorithms/IndexMap.h"
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/BeamBeam.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/Degrader.h"
......@@ -106,7 +106,7 @@ public:
virtual void visitBeamBeam(const BeamBeam &);
/// Apply the algorithm to a collimator.
virtual void visitCollimator(const Collimator &);
virtual void visitCCollimator(const CCollimator &);
/// Apply the algorithm to a Corrector.
......@@ -332,7 +332,7 @@ inline void ParallelTTracker::visitBeamBeam(const BeamBeam &bb) {
}
inline void ParallelTTracker::visitCollimator(const Collimator &coll) {
inline void ParallelTTracker::visitCCollimator(const CCollimator &coll) {
itsOpalBeamline_m.visit(coll, *this, itsBunch_m);
}
......
......@@ -24,7 +24,7 @@ class BMultipoleField;
class PartBunch;
class AlignWrapper;
class BeamBeam;
class Collimator;
class CCollimator;
class Corrector;
class CyclotronValley;
class Degrader;
......@@ -67,7 +67,7 @@ public:
SE_VISITELEMENT(AlignWrapper)
SE_VISITELEMENT(Beamline)
SE_VISITELEMENT(BeamBeam)
SE_VISITELEMENT(Collimator)
SE_VISITELEMENT(CCollimator)
SE_VISITELEMENT(Corrector)
SE_VISITELEMENT(CyclotronValley)
SE_VISITELEMENT(Degrader)
......
......@@ -20,7 +20,7 @@
#include "Algorithms/ThickMapper.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Degrader.h"
#include "AbsBeamline/Diagnostic.h"
......@@ -93,7 +93,7 @@ void ThickMapper::visitBeamBeam(const BeamBeam &) {
}
void ThickMapper::visitCollimator(const Collimator &coll) {
void ThickMapper::visitCCollimator(const CCollimator &coll) {
applyDrift(flip_s * coll.getElementLength());
}
......
......@@ -99,7 +99,7 @@ public:
virtual void visitBeamBeam(const BeamBeam &);
/// Apply the algorithm to a collimator.
virtual void visitCollimator(const Collimator &);
virtual void visitCCollimator(const CCollimator &);
/// Apply the algorithm to a Corrector.
virtual void visitCorrector(const Corrector &);
......
......@@ -33,7 +33,7 @@
#include <typeinfo>
#include <fstream>
#include "Algorithms/ThickTracker.h"
#include "Algorithms/OrbitThreader.h"
#include "Algorithms/OrbitThreader.h"
#include "Algorithms/CavityAutophaser.h"
#include <cfloat>
......@@ -107,7 +107,7 @@ ThickTracker::ThickTracker(const Beamline &beamline,
ThickTracker::ThickTracker(const Beamline &beamline,
PartBunchBase<double, 3> *bunch,
DataSink &ds,
const PartData &reference,
const PartData &reference,
bool revBeam, bool revTrack,
const std::vector<unsigned long long> &maxSteps,
double zstart,
......@@ -719,7 +719,7 @@ void ThickTracker::execute() {
msg << std::setprecision(10);
msg << "Tuncation order: " << this->truncOrder_m << endl;
series_t::setGlobalTruncOrder(truncOrder_m+1);
......@@ -765,7 +765,7 @@ void ThickTracker::execute() {
twiss.open ("twiss.txt");
tmap << std::setprecision(16);
#endif
FieldList allElements = itsOpalBeamline_m.getElementByType(ElementBase::ANY);
//sorts beamline according elementposition
......@@ -922,7 +922,7 @@ void ThickTracker::execute() {
outfile,
#endif
mapBeamLine);
//-------------------------
......@@ -932,7 +932,7 @@ void ThickTracker::execute() {
// linTAnalyze(tFMatrix);
/*
FMatrix<double, 2 * DIM, 2 * DIM> sigmaSFMatrix= sFMatrix*skewMatrix;
cfMatrix_t eigenValM, eigenVecM, invEigenValM;*/
......@@ -977,7 +977,7 @@ void ThickTracker::trackParticles_m(
const std::list<structMapTracking>& mapBeamLine) {
int sliceidx=0;
FVector<double, 6> particle, partout;
dumpStats(sliceidx, true, true);
......@@ -996,7 +996,7 @@ void ThickTracker::trackParticles_m(
particle[2 * d] = itsBunch_m->R[partidx](d);
particle[2 *d + 1] = itsBunch_m->P[partidx](d);
}
#ifdef PHIL_WRITE
if (sliceidx==0) outfile << sliceidx <<" "<< partidx << " ["<< particle;
#endif
......@@ -1017,7 +1017,7 @@ void ThickTracker::trackParticles_m(
particle[3]*=betagamma;
particle[5] = (particle[5] + 1./itsBunch_m->getInitialBeta()) * itsBunch_m->getP()/itsBunch_m->getM() //TODO change P to P0
/std::sqrt( 1./(itsBunch_m ->get_part(partidx)[5]* itsBunch_m ->get_part(partidx)[5]) +1) ;
/std::sqrt( 1./(itsBunch_m ->get_part(partidx)[5]* itsBunch_m ->get_part(partidx)[5]) +1) ;
#ifdef PHIL_WRITE
//Write in File
......@@ -1041,7 +1041,7 @@ void ThickTracker::trackParticles_m(
dumpStats(sliceidx, psDump, statDump);
sliceidx ++;
}
}
}
}
//TODO: Write a nice comment
......@@ -1345,10 +1345,10 @@ void ThickTracker::writePhaseSpace(const long long step, bool psDump, bool statD
if (statDump) {
std::vector<std::pair<std::string, unsigned int> > collimatorLosses;
FieldList collimators = itsOpalBeamline_m.getElementByType(ElementBase::COLLIMATOR);
FieldList collimators = itsOpalBeamline_m.getElementByType(ElementBase::CCOLLIMATOR);
if (collimators.size() != 0) {
for (FieldList::iterator it = collimators.begin(); it != collimators.end(); ++ it) {
Collimator* coll = static_cast<Collimator*>(it->getElement().get());
CCollimator* coll = static_cast<CCollimator*>(it->getElement().get());
std::string name = coll->getName();
unsigned int losses = coll->getLosses();
collimatorLosses.push_back(std::make_pair(name, losses));
......@@ -1368,7 +1368,7 @@ void ThickTracker::writePhaseSpace(const long long step, bool psDump, bool statD
collimatorLosses[i].second = bareLosses[i];
}
}
// Write statistical data.
itsDataSink_m->writeStatData(itsBunch_m, FDext, collimatorLosses);
......@@ -1430,6 +1430,4 @@ void ThickTracker::setTime() {
for (unsigned int i = 0; i < localNum; ++i) {
itsBunch_m->dt[i] = itsBunch_m->getdT();
}
}
}
\ No newline at end of file
......@@ -30,7 +30,7 @@
#include "Algorithms/IndexMap.h"
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/BeamBeam.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/Degrader.h"
......@@ -146,7 +146,7 @@ public:
virtual void visitBeamBeam(const BeamBeam &);
/// Apply the algorithm to a collimator.
virtual void visitCollimator(const Collimator &);
virtual void visitCCollimator(const CCollimator &);
/// Apply the algorithm to a Corrector.
virtual void visitCorrector(const Corrector &);
......@@ -323,7 +323,7 @@ inline void ThickTracker::visitBeamBeam(const BeamBeam &bb) {
}
inline void ThickTracker::visitCollimator(const Collimator &coll) {
inline void ThickTracker::visitCCollimator(const CCollimator &coll) {
itsOpalBeamline_m.visit(coll, *this, itsBunch_m);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment