OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
H5PartWrapperForPC Class Reference

#include <H5PartWrapperForPC.h>

Inheritance diagram for H5PartWrapperForPC:
Collaboration diagram for H5PartWrapperForPC:

Public Member Functions

 H5PartWrapperForPC (const std::string &fileName, h5_int32_t flags=H5_O_WRONLY)
 H5PartWrapperForPC (const std::string &fileName, int restartStep, std::string sourceFile, h5_int32_t flags=H5_O_RDWR)
virtual ~H5PartWrapperForPC ()
virtual void readHeader ()
virtual void readStep (PartBunchBase< double, 3 > *, h5_ssize_t firstParticle, h5_ssize_t lastParticle)
virtual void writeHeader ()
virtual void writeStep (PartBunchBase< double, 3 > *, const std::map< std::string, double > &additionalStepAttributes)
virtual bool predecessorIsSameFlavour () const
bool getPreviousH5Local () const
double getReferenceR () const
double getReferenceT () const
double getReferenceZ () const
double getReferencePr () const
double getReferencePt () const
double getReferencePz () const
double getMeanKineticEnergy () const
double getMeanMomentum () const
double getAzimuth () const
double getElevation () const
void close ()
double getLastPosition ()
void storeCavityInformation ()
size_t getNumParticles () const

Protected Member Functions

void open (h5_int32_t flags)
void copyFile (const std::string &sourceFile, int lastStep=-1, h5_int32_t flags=H5_O_WRONLY)
void copyFileSystem (const std::string &sourceFile)
void copyHeader (h5_file_t source)
void copyStep (h5_file_t source, int step)
void copyStepHeader (h5_file_t source)
void copyStepData (h5_file_t source)
void sendFailureMessage (bool failed, const std::string &where, const std::string &what)
void receiveFailureMessage (int sourceNode, const std::string &where, const std::string &what)

Static Protected Member Functions

static void reportOnError (h5_int64_t rc, const char *file, int line)

Protected Attributes

h5_file_t file_m
std::string fileName_m
std::string predecessorOPALFlavour_m
h5_int64_t numSteps_m
bool startedFromExistingFile_m

Static Protected Attributes

static std::string copyFilePrefix_m = ".copy"

Private Member Functions

void readStepHeader (PartBunchBase< double, 3 > *)
void readStepData (PartBunchBase< double, 3 > *, h5_ssize_t, h5_ssize_t)
void writeStepHeader (PartBunchBase< double, 3 > *, const std::map< std::string, double > &)
void writeStepData (PartBunchBase< double, 3 > *)

Private Attributes

bool previousH5Local_m
Vector_t referenceMomentum_m
Vector_t referenceLocation_m
h5_float64_t meanE_m
h5_float64_t meanMomentum_m
h5_float64_t azimuth_m
h5_float64_t elevation_m

Detailed Description

H5PartWrapperForPC: a class that manages calls to H5Part for the cyclotron tracker

Definition at line 14 of file H5PartWrapperForPC.h.

Constructor & Destructor Documentation

◆ H5PartWrapperForPC() [1/2]

H5PartWrapperForPC::H5PartWrapperForPC ( const std::string & fileName,
h5_int32_t flags = H5_O_WRONLY )

Definition at line 18 of file H5PartWrapperForPC.cpp.

References azimuth_m, elevation_m, H5PartWrapper::H5PartWrapper(), meanE_m, meanMomentum_m, previousH5Local_m, referenceLocation_m, and referenceMomentum_m.

Here is the call graph for this function:

◆ H5PartWrapperForPC() [2/2]

H5PartWrapperForPC::H5PartWrapperForPC ( const std::string & fileName,
int restartStep,
std::string sourceFile,
h5_int32_t flags = H5_O_RDWR )

Definition at line 29 of file H5PartWrapperForPC.cpp.

References azimuth_m, elevation_m, H5PartWrapper::H5PartWrapper(), meanE_m, meanMomentum_m, previousH5Local_m, referenceLocation_m, and referenceMomentum_m.

Here is the call graph for this function:

◆ ~H5PartWrapperForPC()

H5PartWrapperForPC::~H5PartWrapperForPC ( )
virtual

Definition at line 43 of file H5PartWrapperForPC.cpp.

Member Function Documentation

◆ close()

◆ copyFile()

void H5PartWrapper::copyFile ( const std::string & sourceFile,
int lastStep = -1,
h5_int32_t flags = H5_O_WRONLY )
protectedinherited

Definition at line 128 of file H5PartWrapper.cpp.

References close(), IpplInfo::Comm, copyFilePrefix_m, copyFileSystem(), copyHeader(), copyStep(), fileName_m, IpplInfo::getComm(), IpplInfo::myNode(), numSteps_m, open(), PAssert, predecessorOPALFlavour_m, READSTEPATTRIB, and REPORTONERROR.

Referenced by H5PartWrapper().

Here is the call graph for this function:

◆ copyFileSystem()

void H5PartWrapper::copyFileSystem ( const std::string & sourceFile)
protectedinherited

Definition at line 253 of file H5PartWrapper.cpp.

References fileName_m, IpplInfo::myNode(), receiveFailureMessage(), and sendFailureMessage().

Referenced by copyFile().

Here is the call graph for this function:

◆ copyHeader()

void H5PartWrapper::copyHeader ( h5_file_t source)
protectedinherited

Definition at line 290 of file H5PartWrapper.cpp.

References file_m, READFILEATTRIB, REPORTONERROR, WRITEFILEATTRIB, and WRITESTRINGFILEATTRIB.

Referenced by copyFile().

◆ copyStep()

void H5PartWrapper::copyStep ( h5_file_t source,
int step )
protectedinherited

Definition at line 360 of file H5PartWrapper.cpp.

References copyStepData(), copyStepHeader(), file_m, numSteps_m, and REPORTONERROR.

Referenced by copyFile().

Here is the call graph for this function:

◆ copyStepData()

void H5PartWrapper::copyStepData ( h5_file_t source)
protectedinherited

Definition at line 445 of file H5PartWrapper.cpp.

References Util::c_data(), file_m, IpplInfo::getNodes(), IpplInfo::myNode(), READDATA, REPORTONERROR, and WRITEDATA.

Referenced by copyStep().

Here is the call graph for this function:

◆ copyStepHeader()

void H5PartWrapper::copyStepHeader ( h5_file_t source)
protectedinherited

◆ getAzimuth()

double H5PartWrapperForPC::getAzimuth ( ) const
inline

Definition at line 106 of file H5PartWrapperForPC.h.

References azimuth_m.

Referenced by TrackRun::setupCyclotronTracker().

◆ getElevation()

double H5PartWrapperForPC::getElevation ( ) const
inline

Definition at line 111 of file H5PartWrapperForPC.h.

References elevation_m.

Referenced by TrackRun::setupCyclotronTracker().

◆ getLastPosition()

double H5PartWrapper::getLastPosition ( )
inlineinherited

Definition at line 89 of file H5PartWrapper.h.

References file_m, open(), readStep(), READSTEPATTRIB, and REPORTONERROR.

Here is the call graph for this function:

◆ getMeanKineticEnergy()

double H5PartWrapperForPC::getMeanKineticEnergy ( ) const
inline

Definition at line 96 of file H5PartWrapperForPC.h.

References meanE_m.

◆ getMeanMomentum()

double H5PartWrapperForPC::getMeanMomentum ( ) const
inline

Definition at line 101 of file H5PartWrapperForPC.h.

References meanMomentum_m.

Referenced by TrackRun::setupCyclotronTracker().

◆ getNumParticles()

◆ getPreviousH5Local()

bool H5PartWrapperForPC::getPreviousH5Local ( ) const
inline

Definition at line 61 of file H5PartWrapperForPC.h.

References previousH5Local_m.

Referenced by TrackRun::setupCyclotronTracker().

◆ getReferencePr()

double H5PartWrapperForPC::getReferencePr ( ) const
inline

Definition at line 81 of file H5PartWrapperForPC.h.

References referenceMomentum_m.

Referenced by TrackRun::setupCyclotronTracker().

◆ getReferencePt()

double H5PartWrapperForPC::getReferencePt ( ) const
inline

Definition at line 86 of file H5PartWrapperForPC.h.

References referenceMomentum_m.

Referenced by TrackRun::setupCyclotronTracker().

◆ getReferencePz()

double H5PartWrapperForPC::getReferencePz ( ) const
inline

Definition at line 91 of file H5PartWrapperForPC.h.

References referenceMomentum_m.

Referenced by TrackRun::setupCyclotronTracker().

◆ getReferenceR()

double H5PartWrapperForPC::getReferenceR ( ) const
inline

Definition at line 66 of file H5PartWrapperForPC.h.

References referenceLocation_m.

Referenced by TrackRun::setupCyclotronTracker().

◆ getReferenceT()

double H5PartWrapperForPC::getReferenceT ( ) const
inline

Definition at line 71 of file H5PartWrapperForPC.h.

References referenceLocation_m.

Referenced by TrackRun::setupCyclotronTracker().

◆ getReferenceZ()

double H5PartWrapperForPC::getReferenceZ ( ) const
inline

Definition at line 76 of file H5PartWrapperForPC.h.

References referenceLocation_m.

Referenced by TrackRun::setupCyclotronTracker().

◆ open()

void H5PartWrapper::open ( h5_int32_t flags)
protectedinherited

Definition at line 71 of file H5PartWrapper.cpp.

References close(), file_m, fileName_m, IpplInfo::getComm(), and PAssert.

Referenced by copyFile(), getLastPosition(), H5PartWrapper(), H5PartWrapper(), storeCavityInformation(), H5PartWrapperForPC::writeStep(), and H5PartWrapperForPT::writeStep().

Here is the call graph for this function:

◆ predecessorIsSameFlavour()

bool H5PartWrapperForPC::predecessorIsSameFlavour ( ) const
inlinevirtual

Implements H5PartWrapper.

Definition at line 56 of file H5PartWrapperForPC.h.

References H5PartWrapper::predecessorOPALFlavour_m.

◆ readHeader()

void H5PartWrapperForPC::readHeader ( )
virtual

Implements H5PartWrapper.

Definition at line 46 of file H5PartWrapperForPC.cpp.

References H5PartWrapper::file_m, OpalData::getInstance(), READFILEATTRIB, REPORTONERROR, and OpalData::setRestartDumpFreq().

Here is the call graph for this function:

◆ readStep()

void H5PartWrapperForPC::readStep ( PartBunchBase< double, 3 > * bunch,
h5_ssize_t firstParticle,
h5_ssize_t lastParticle )
virtual

Implements H5PartWrapper.

Definition at line 73 of file H5PartWrapperForPC.cpp.

References H5PartWrapper::file_m, readStep(), readStepData(), readStepHeader(), and REPORTONERROR.

Referenced by MultiBunchHandler::readBunch(), and readStep().

Here is the call graph for this function:

◆ readStepData()

void H5PartWrapperForPC::readStepData ( PartBunchBase< double, 3 > * bunch,
h5_ssize_t firstParticle,
h5_ssize_t lastParticle )
private

◆ readStepHeader()

◆ receiveFailureMessage()

void H5PartWrapper::receiveFailureMessage ( int sourceNode,
const std::string & where,
const std::string & what )
protectedinherited

Definition at line 512 of file H5PartWrapper.cpp.

References IpplInfo::Comm, getMessage(), and where().

Referenced by copyFileSystem().

Here is the call graph for this function:

◆ reportOnError()

void H5PartWrapper::reportOnError ( h5_int64_t rc,
const char * file,
int line )
inlinestaticprotectedinherited

Definition at line 83 of file H5PartWrapper.h.

References endl(), and ERRORMSG.

Referenced by H5PartWrapperForPT::writeStepData().

Here is the call graph for this function:

◆ sendFailureMessage()

void H5PartWrapper::sendFailureMessage ( bool failed,
const std::string & where,
const std::string & what )
protectedinherited

Definition at line 500 of file H5PartWrapper.cpp.

References IpplInfo::Comm, putMessage(), and where().

Referenced by copyFileSystem().

Here is the call graph for this function:

◆ storeCavityInformation()

void H5PartWrapper::storeCavityInformation ( )
inherited

Write number of Cavities with autophase information

Definition at line 86 of file H5PartWrapper.cpp.

References close(), end(), endl(), file_m, OpalData::getFirstMaxPhases(), OpalData::getInstance(), OpalData::getLastMaxPhases(), OpalData::getNumberOfMaxPhases(), INFOMSG, open(), WRITEFILEATTRIB, and WRITESTRINGFILEATTRIB.

Here is the call graph for this function:

◆ writeHeader()

void H5PartWrapperForPC::writeHeader ( )
virtual

Write file dump frequency.

Implements H5PartWrapper.

Definition at line 225 of file H5PartWrapperForPC.cpp.

References Options::ebDump, H5PartWrapper::file_m, Util::getGitRevision(), Options::psDumpFreq, WRITEFILEATTRIB, and WRITESTRINGFILEATTRIB.

Referenced by MultiBunchHandler::saveBunch().

Here is the call graph for this function:

◆ writeStep()

void H5PartWrapperForPC::writeStep ( PartBunchBase< double, 3 > * bunch,
const std::map< std::string, double > & additionalStepAttributes )
virtual

Implements H5PartWrapper.

Definition at line 311 of file H5PartWrapperForPC.cpp.

References H5PartWrapper::close(), PartBunchBase< T, Dim >::getTotalNum(), H5PartWrapper::numSteps_m, H5PartWrapper::open(), writeStepData(), and writeStepHeader().

Referenced by MultiBunchHandler::saveBunch().

Here is the call graph for this function:

◆ writeStepData()

void H5PartWrapperForPC::writeStepData ( PartBunchBase< double, 3 > * bunch)
private

◆ writeStepHeader()

void H5PartWrapperForPC::writeStepHeader ( PartBunchBase< double, 3 > * bunch,
const std::map< std::string, double > & additionalStepAttributes )
private

Write particle mass and charge per particle. (Consider making these file attributes.)

Definition at line 324 of file H5PartWrapperForPC.cpp.

References Physics::c, PartBunchBase< T, Dim >::calcBeamParameters(), endl(), Physics::epsilon_0, ERRORMSG, Units::eV2GeV, H5PartWrapper::file_m, PartBunchBase< T, Dim >::get_centroid(), PartBunchBase< T, Dim >::get_emit(), PartBunchBase< T, Dim >::get_gamma(), PartBunchBase< T, Dim >::get_maxExtent(), PartBunchBase< T, Dim >::get_meanKineticEnergy(), PartBunchBase< T, Dim >::get_norm_emit(), PartBunchBase< T, Dim >::get_origin(), PartBunchBase< T, Dim >::get_PBounds(), PartBunchBase< T, Dim >::get_pmean(), PartBunchBase< T, Dim >::get_prms(), PartBunchBase< T, Dim >::get_rmean(), PartBunchBase< T, Dim >::get_rrms(), PartBunchBase< T, Dim >::get_sPos(), PartBunchBase< T, Dim >::getCharge(), PartBunchBase< T, Dim >::getdE(), PartBunchBase< T, Dim >::getGlobalTrackStep(), PartBunchBase< T, Dim >::getLocalTrackStep(), PartBunchBase< T, Dim >::getM(), PartBunchBase< T, Dim >::getNumBunch(), PartBunchBase< T, Dim >::getQ(), PartBunchBase< T, Dim >::getSteptoLastInj(), PartBunchBase< T, Dim >::getT(), GLOBAL, H5PartWrapper::numSteps_m, Physics::pi, Options::psDumpFrame, PartBunchBase< T, Dim >::RefPartP_m, PartBunchBase< T, Dim >::RefPartR_m, REPORTONERROR, WRITESTEPATTRIB, and WRITESTRINGSTEPATTRIB.

Referenced by writeStep().

Here is the call graph for this function:

Member Data Documentation

◆ azimuth_m

h5_float64_t H5PartWrapperForPC::azimuth_m
private

◆ copyFilePrefix_m

std::string H5PartWrapper::copyFilePrefix_m = ".copy"
staticprotectedinherited

Definition at line 79 of file H5PartWrapper.h.

Referenced by copyFile().

◆ elevation_m

h5_float64_t H5PartWrapperForPC::elevation_m
private

◆ file_m

◆ fileName_m

std::string H5PartWrapper::fileName_m
protectedinherited

Definition at line 74 of file H5PartWrapper.h.

Referenced by copyFile(), copyFileSystem(), H5PartWrapper(), H5PartWrapper(), and open().

◆ meanE_m

h5_float64_t H5PartWrapperForPC::meanE_m
private

◆ meanMomentum_m

h5_float64_t H5PartWrapperForPC::meanMomentum_m
private

◆ numSteps_m

◆ predecessorOPALFlavour_m

◆ previousH5Local_m

bool H5PartWrapperForPC::previousH5Local_m
private

◆ referenceLocation_m

Vector_t H5PartWrapperForPC::referenceLocation_m
private

◆ referenceMomentum_m

Vector_t H5PartWrapperForPC::referenceMomentum_m
private

◆ startedFromExistingFile_m

bool H5PartWrapper::startedFromExistingFile_m
protectedinherited

Definition at line 77 of file H5PartWrapper.h.

Referenced by H5PartWrapper(), and H5PartWrapper().


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