Commit 8ac8b5a5 authored by frey_m's avatar frey_m
Browse files

Multi bunch dump:

modified:   Algorithms/ParallelCyclotronTracker.cpp
modified:   Algorithms/ParallelCyclotronTracker.h
modified:   Classic/Algorithms/PartBunchBase.hpp
modified:   Structure/CMakeLists.txt
modified:   Structure/MultiBunchDump.cpp
modified:   Structure/MultiBunchDump.h
parent de5c71de
......@@ -128,20 +128,22 @@ extern Inform *gmsg;
*/
ParallelCyclotronTracker::ParallelCyclotronTracker(const Beamline &beamline,
const PartData &reference,
bool revBeam, bool revTrack):
Tracker(beamline, reference, revBeam, revTrack),
itsDataSink(nullptr),
bgf_m(nullptr),
lastDumpedStep_m(0),
eta_m(0.01),
myNode_m(Ippl::myNode()),
initialLocalNum_m(0),
initialTotalNum_m(0),
onebunch_m(OpalData::getInstance()->getInputBasename() + "-onebunch.h5"),
opalRing_m(nullptr),
itsStepper_mp(nullptr),
mode_m(MODE::UNDEFINED),
stepper_m(stepper::INTEGRATOR::UNDEFINED) {
bool revBeam, bool revTrack)
: Tracker(beamline, reference, revBeam, revTrack)
, itsDataSink(nullptr)
, itsMBDump_m(new MultiBunchDump())
, bgf_m(nullptr)
, lastDumpedStep_m(0)
, eta_m(0.01)
, myNode_m(Ippl::myNode())
, initialLocalNum_m(0)
, initialTotalNum_m(0)
, onebunch_m(OpalData::getInstance()->getInputBasename() + "-onebunch.h5")
, opalRing_m(nullptr)
, itsStepper_mp(nullptr)
, mode_m(MODE::UNDEFINED)
, stepper_m(stepper::INTEGRATOR::UNDEFINED)
{
itsBeamline = dynamic_cast<Beamline *>(beamline.clone());
}
......@@ -162,18 +164,20 @@ ParallelCyclotronTracker::ParallelCyclotronTracker(const Beamline &beamline,
DataSink &ds,
const PartData &reference,
bool revBeam, bool revTrack,
int maxSTEPS, int timeIntegrator):
Tracker(beamline, bunch, reference, revBeam, revTrack),
bgf_m(nullptr),
maxSteps_m(maxSTEPS),
lastDumpedStep_m(0),
eta_m(0.01),
myNode_m(Ippl::myNode()),
initialLocalNum_m(bunch->getLocalNum()),
initialTotalNum_m(bunch->getTotalNum()),
onebunch_m(OpalData::getInstance()->getInputBasename() + "-onebunch.h5"),
opalRing_m(nullptr),
itsStepper_mp(nullptr) {
int maxSTEPS, int timeIntegrator)
: Tracker(beamline, bunch, reference, revBeam, revTrack)
, itsMBDump_m(new MultiBunchDump())
, bgf_m(nullptr)
, maxSteps_m(maxSTEPS)
, lastDumpedStep_m(0)
, eta_m(0.01)
, myNode_m(Ippl::myNode())
, initialLocalNum_m(bunch->getLocalNum())
, initialTotalNum_m(bunch->getTotalNum())
, onebunch_m(OpalData::getInstance()->getInputBasename() + "-onebunch.h5")
, opalRing_m(nullptr)
, itsStepper_mp(nullptr)
{
itsBeamline = dynamic_cast<Beamline *>(beamline.clone());
itsDataSink = &ds;
// scaleFactor_m = itsBunch_m->getdT() * c;
......@@ -2704,11 +2708,11 @@ void ParallelCyclotronTracker::bunchDumpStatDataPerBin() {
for (int bin = 0; bin < itsBunch_m->getNumBins(); ++bin) {
beaminfo_t binfo;
MultiBunchDump::beaminfo_t binfo;
itsBunch_m->calcBinBeamParameters(binfo, bin);
binfo.time = beam->getT() * 1e9;
binfo.time = itsBunch_m->getT() * 1e9;
itsMBDump_m->writeData(binfo, bin);
}
......
......@@ -485,6 +485,8 @@ private:
void singleParticleDump();
void bunchDumpStatData();
void bunchDumpStatDataPerBin();
void bunchDumpPhaseSpaceData();
......
......@@ -1382,7 +1382,7 @@ void PartBunchBase<T, Dim>::calcBeamParametersInitial() {
template <class T, unsigned Dim>
void PartBunchBase<T, Dim>::calcBinBeamParameters(MultiBunchDump::beaminfo_t, int bin) {
if ( !OpalData::getInstance()->isInOPALCyclMode() ) {
return
return;
}
const unsigned long localNum = getLocalNum();
......
......@@ -12,6 +12,7 @@ set (_SRCS
H5PartWrapperForPS.cpp
H5PartWrapperForPT.cpp
# SDDSParser.cpp
MultiBunchDump.cpp
OpalInputInterpreter.cpp
IpplInfoWrapper.cpp
TracerParticles.cpp
......@@ -33,6 +34,7 @@ set (HDRS
H5PartWrapperForPT.h
H5PartWrapper.h
IpplInfoWrapper.h
MultiBunchDump.h
OpalInputInterpreter.h
OpalWake.h
PriEmissionPhysics.h
......
......@@ -2,6 +2,11 @@
#include <boost/filesystem.hpp>
#include <iomanip>
#include "AbstractObjects/OpalData.h"
#include "Utilities/Timer.h"
MultiBunchDump::MultiBunchDump()
: nBins_m(-1)
, fbase_m(OpalData::getInstance()->getInputBasename())
......@@ -9,7 +14,7 @@ MultiBunchDump::MultiBunchDump()
{ }
void MultiBunchDump::writeHeader(const std::string& fname) {
void MultiBunchDump::writeHeader(const std::string& fname) const {
if ( boost::filesystem::exists(fname) ) {
return;
......@@ -155,7 +160,7 @@ void MultiBunchDump::writeData(const beaminfo_t& binfo, int bin) {
out << binfo.time << std::setw(pwi) << "\t"
<< binfo.nParticles << std::setw(pwi) << "\t"
<< binfo.ekin << std::setw(pwi) << "\t"
<< binfo.dEkin << std::setw(pwi) << "\t";
<< binfo.dEkin << std::setw(pwi) << "\t"
<< binfo.rms[0] << std::setw(pwi) << "\t"
<< binfo.rms[1] << std::setw(pwi) << "\t"
<< binfo.rms[2] << std::setw(pwi) << "\t"
......@@ -181,7 +186,7 @@ void MultiBunchDump::open_m(std::ofstream& out,
mode = std::ios::app;
}
out.open(fileName.c_str(), mode);
out.open(fname.c_str(), mode);
out.precision(15);
out.setf(std::ios::scientific, std::ios::floatfield);
}
......
......@@ -11,12 +11,12 @@ public:
double time;
unsigned int nParticles;
double ekin;
double dE;
double dEkin;
double rms[3];
double emit[3];
double mean[3];
double halo[3];
}
};
public:
MultiBunchDump();
......
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