OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
DataSink Class Reference

#include <DataSink.h>

Public Member Functions

 DataSink ()
 Default constructor. More...
 
 DataSink (H5PartWrapper *h5wrapper, bool restart, short numBunch)
 
 DataSink (H5PartWrapper *h5wrapper, short numBunch)
 
void dumpH5 (PartBunchBase< double, 3 > *beam, Vector_t FDext[]) const
 
int dumpH5 (PartBunchBase< double, 3 > *beam, Vector_t FDext[], double meanEnergy, double refPr, double refPt, double refPz, double refR, double refTheta, double refZ, double azimuth, double elevation, bool local) const
 
void dumpSDDS (PartBunchBase< double, 3 > *beam, Vector_t FDext[], const double &azimuth=-1) const
 
void dumpSDDS (PartBunchBase< double, 3 > *beam, Vector_t FDext[], const losses_t &losses=losses_t(), const double &azimuth=-1) const
 
void storeCavityInformation ()
 Write cavity information from H5 file. More...
 
void changeH5Wrapper (H5PartWrapper *h5wrapper)
 
void writeGeomToVtk (BoundaryGeometry &bg, std::string fn)
 
void writeImpactStatistics (const PartBunchBase< double, 3 > *beam, long long int &step, size_t &impact, double &sey_num, size_t numberOfFieldEmittedParticles, bool nEmissionMode, std::string fn)
 
void writeMultiBunchStatistics (PartBunchBase< double, 3 > *beam, MultiBunchHandler *mbhandler)
 
void setMultiBunchInitialPathLengh (MultiBunchHandler *mbhandler_p)
 

Private Types

typedef StatWriter::losses_t losses_t
 
typedef std::unique_ptr< StatWriterstatWriter_t
 
typedef std::unique_ptr< SDDSWritersddsWriter_t
 
typedef std::unique_ptr< H5Writerh5Writer_t
 
typedef std::unique_ptr< MultiBunchDumpmbWriter_t
 

Private Member Functions

 DataSink (const DataSink &ds)=delete
 
DataSinkoperator= (const DataSink &)=delete
 
void rewindLines ()
 
void init (bool restart=false, H5PartWrapper *h5wrapper=nullptr, short numBunch=1)
 
void initMultiBunchDump (short numBunch)
 

Static Private Member Functions

static std::string convertToString (int number, int setw=5)
 

Private Attributes

h5Writer_t h5Writer_m
 
statWriter_t statWriter_m
 
std::vector< sddsWriter_tsddsWriter_m
 
std::vector< mbWriter_tmbWriter_m
 
unsigned int lossWrCounter_m
 needed to create index for vtk file More...
 
IpplTimings::TimerRef StatMarkerTimer_m
 Timer to track statistics write time. More...
 
const bool isMultiBunch_m
 

Detailed Description

Definition at line 48 of file DataSink.h.

Member Typedef Documentation

◆ h5Writer_t

typedef std::unique_ptr<H5Writer> DataSink::h5Writer_t
private

Definition at line 53 of file DataSink.h.

◆ losses_t

Definition at line 50 of file DataSink.h.

◆ mbWriter_t

typedef std::unique_ptr<MultiBunchDump> DataSink::mbWriter_t
private

Definition at line 54 of file DataSink.h.

◆ sddsWriter_t

typedef std::unique_ptr<SDDSWriter> DataSink::sddsWriter_t
private

Definition at line 52 of file DataSink.h.

◆ statWriter_t

typedef std::unique_ptr<StatWriter> DataSink::statWriter_t
private

Definition at line 51 of file DataSink.h.

Constructor & Destructor Documentation

◆ DataSink() [1/4]

DataSink::DataSink ( )

Default constructor.

The default constructor is called at the start of a new calculation (as opposed to a calculation restart).

Definition at line 59 of file DataSink.cpp.

References init().

Here is the call graph for this function:

◆ DataSink() [2/4]

DataSink::DataSink ( H5PartWrapper h5wrapper,
bool  restart,
short  numBunch 
)

Definition at line 66 of file DataSink.cpp.

References Options::enableHDF5, init(), and rewindLines().

Here is the call graph for this function:

◆ DataSink() [3/4]

DataSink::DataSink ( H5PartWrapper h5wrapper,
short  numBunch 
)

Definition at line 81 of file DataSink.cpp.

◆ DataSink() [4/4]

DataSink::DataSink ( const DataSink ds)
privatedelete

Member Function Documentation

◆ changeH5Wrapper()

void DataSink::changeH5Wrapper ( H5PartWrapper h5wrapper)

Definition at line 141 of file DataSink.cpp.

References Options::enableHDF5, and h5Writer_m.

Referenced by TrackRun::initDataSink().

◆ convertToString()

std::string DataSink::convertToString ( int  number,
int  setw = 5 
)
inlinestaticprivate

Definition at line 154 of file DataSink.h.

Referenced by initMultiBunchDump().

◆ dumpH5() [1/2]

void DataSink::dumpH5 ( PartBunchBase< double, 3 > *  beam,
Vector_t  FDext[] 
) const

◆ dumpH5() [2/2]

int DataSink::dumpH5 ( PartBunchBase< double, 3 > *  beam,
Vector_t  FDext[],
double  meanEnergy,
double  refPr,
double  refPt,
double  refPz,
double  refR,
double  refTheta,
double  refZ,
double  azimuth,
double  elevation,
bool  local 
) const

Definition at line 93 of file DataSink.cpp.

References Options::enableHDF5, and h5Writer_m.

◆ dumpSDDS() [1/2]

void DataSink::dumpSDDS ( PartBunchBase< double, 3 > *  beam,
Vector_t  FDext[],
const double &  azimuth = -1 
) const

Definition at line 105 of file DataSink.cpp.

References dumpSDDS().

Referenced by ParallelCyclotronTracker::bunchDumpStatData(), ThickTracker::dump_m(), dumpSDDS(), and ParallelTTracker::writePhaseSpace().

Here is the call graph for this function:

◆ dumpSDDS() [2/2]

void DataSink::dumpSDDS ( PartBunchBase< double, 3 > *  beam,
Vector_t  FDext[],
const losses_t losses = losses_t(),
const double &  azimuth = -1 
) const

◆ init()

void DataSink::init ( bool  restart = false,
H5PartWrapper h5wrapper = nullptr,
short  numBunch = 1 
)
private

◆ initMultiBunchDump()

void DataSink::initMultiBunchDump ( short  numBunch)
private

Definition at line 311 of file DataSink.cpp.

References convertToString(), OpalData::getInputBasename(), OpalData::getInstance(), OpalData::inRestartRun(), and mbWriter_m.

Referenced by init().

Here is the call graph for this function:

◆ operator=()

DataSink & DataSink::operator= ( const DataSink )
privatedelete

◆ rewindLines()

void DataSink::rewindLines ( )
private

Definition at line 232 of file DataSink.cpp.

References h5Writer_m, isMultiBunch_m, mbWriter_m, sddsWriter_m, and statWriter_m.

Referenced by DataSink().

◆ setMultiBunchInitialPathLengh()

void DataSink::setMultiBunchInitialPathLengh ( MultiBunchHandler mbhandler_p)

In restart mode we need to set the correct path length of each bunch

Parameters
mbhandleris the multi-bunch handler

Definition at line 218 of file DataSink.cpp.

References MultiBunchHandler::getBunchInfo(), MultiBunchHandler::getNumBunch(), mbWriter_m, MultiBunchHandler::beaminfo_t::pathlength, and statWriter_m.

Referenced by ParallelCyclotronTracker::initPathLength().

Here is the call graph for this function:

◆ storeCavityInformation()

void DataSink::storeCavityInformation ( )

Write cavity information from H5 file.

Definition at line 134 of file DataSink.cpp.

References Options::enableHDF5, and h5Writer_m.

Referenced by ParallelTTracker::saveCavityPhases().

◆ writeGeomToVtk()

void DataSink::writeGeomToVtk ( BoundaryGeometry bg,
std::string  fn 
)

Write geometry points and surface triangles to vtk file

Parameters
fnspecifies the name of vtk file contains the geometry

Definition at line 148 of file DataSink.cpp.

References Options::enableVTK, IpplInfo::myNode(), and BoundaryGeometry::writeGeomToVtk().

Here is the call graph for this function:

◆ writeImpactStatistics()

void DataSink::writeImpactStatistics ( const PartBunchBase< double, 3 > *  beam,
long long int &  step,
size_t &  impact,
double &  sey_num,
size_t  numberOfFieldEmittedParticles,
bool  nEmissionMode,
std::string  fn 
)

Write impact number and outgoing secondaries in each time step

Parameters
fnspecifies the name of vtk file contains the geometry

Definition at line 155 of file DataSink.cpp.

References Inform::APPEND, endl(), PartBunchBase< T, Dim >::getCharge(), PartBunchBase< T, Dim >::getChargePerParticle(), PartBunchBase< T, Dim >::getT(), PartBunchBase< T, Dim >::getTotalNum(), IpplInfo::myNode(), Inform::precision(), and Units::s2ns.

Here is the call graph for this function:

◆ writeMultiBunchStatistics()

void DataSink::writeMultiBunchStatistics ( PartBunchBase< double, 3 > *  beam,
MultiBunchHandler mbhandler 
)

no statWriter_m dump

Parameters
beam
mbhandleris the multi-bunch handler

Start timer.

Stop timer.

Definition at line 197 of file DataSink.cpp.

References MultiBunchHandler::calcBunchBeamParameters(), MultiBunchHandler::getBunchInfo(), MultiBunchHandler::getNumBunch(), mbWriter_m, sddsWriter_m, IpplTimings::startTimer(), StatMarkerTimer_m, and IpplTimings::stopTimer().

Referenced by ParallelCyclotronTracker::bunchDumpStatData().

Here is the call graph for this function:

Member Data Documentation

◆ h5Writer_m

h5Writer_t DataSink::h5Writer_m
private

Definition at line 134 of file DataSink.h.

Referenced by changeH5Wrapper(), dumpH5(), init(), rewindLines(), and storeCavityInformation().

◆ isMultiBunch_m

const bool DataSink::isMultiBunch_m
private

Definition at line 147 of file DataSink.h.

Referenced by init(), and rewindLines().

◆ lossWrCounter_m

unsigned int DataSink::lossWrCounter_m
private

needed to create index for vtk file

Definition at line 142 of file DataSink.h.

Referenced by init().

◆ mbWriter_m

std::vector<mbWriter_t> DataSink::mbWriter_m
private

◆ sddsWriter_m

std::vector<sddsWriter_t> DataSink::sddsWriter_m
private

Definition at line 136 of file DataSink.h.

Referenced by dumpSDDS(), init(), rewindLines(), and writeMultiBunchStatistics().

◆ StatMarkerTimer_m

IpplTimings::TimerRef DataSink::StatMarkerTimer_m
private

Timer to track statistics write time.

Definition at line 145 of file DataSink.h.

Referenced by dumpSDDS(), init(), and writeMultiBunchStatistics().

◆ statWriter_m

statWriter_t DataSink::statWriter_m
private

Definition at line 135 of file DataSink.h.

Referenced by dumpSDDS(), init(), rewindLines(), and setMultiBunchInitialPathLengh().


The documentation for this class was generated from the following files: