Class HDF5Output

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class HDF5Output : public Output

Output to HDF5 Format. The base class gives an overview of possible columns.

HDF5 structure:

HDF5 "FILENAME.h5" {
GROUP "/" {
DATASET "OUTPUTTYPE" {
  DATATYPE  H5T_COMPOUND {
  ...
 }
 DATASPACE  SIMPLE { ( 1 ) / ( H5S_UNLIMITED ) }
 DATA {
  ...
 }
  ATTRIBUTE "Version" {
  DATATYPE  H5T_STRING {
      STRSIZE 100;
      STRPAD H5T_STR_NULLTERM;
      CSET H5T_CSET_ASCII;
      CTYPE H5T_C_S1;
      }
  DATASPACE  SCALAR
  DATA { (0): "VERSION" }
 }
} } }

Public Types

enum OutputColumn

Values:

enumerator TrajectoryLengthColumn
enumerator ColumnDensityColumn
enumerator RedshiftColumn
enumerator CurrentIdColumn
enumerator CurrentEnergyColumn
enumerator CurrentPositionColumn
enumerator CurrentDirectionColumn
enumerator SourceIdColumn
enumerator SourceEnergyColumn
enumerator SourcePositionColumn
enumerator SourceDirectionColumn
enumerator CreatedIdColumn
enumerator CreatedEnergyColumn
enumerator CreatedPositionColumn
enumerator CreatedDirectionColumn
enumerator CandidateTagColumn
enumerator SerialNumberColumn
enumerator WeightColumn
enum OutputType

Values:

enumerator Trajectory1D
enumerator Trajectory3D
enumerator Event1D
enumerator Event3D
enumerator Everything

Public Functions

HDF5Output()

Default constructor. Does not run from scratch. At least open() has to be called in addition. Units of energy and length are, by default, EeV and Mpc. This can be changed with setEnergyScale and setLengthScale.

HDF5Output(const std::string &filename)

Constructor with the default OutputType (everything).

Parameters

filename – string containing name of output hdf5 file

HDF5Output(const std::string &filename, OutputType outputtype)

Constructor

Parameters
  • outputtype – type of output: Trajectory1D, Trajectory3D, Event1D, Event3D, Everything

  • filename – string containing name of output hdf5 file

~HDF5Output()
virtual void process(Candidate *candidate) const
herr_t insertStringAttribute(const std::string &key, const std::string &value)
herr_t insertDoubleAttribute(const std::string &key, const double &value)
virtual std::string getDescription() const
void setFlushLimit(unsigned int N)

Force flush after N events. In long running applications with scarse output this can be set to 1 or 0 to avoid data corruption. In applications with frequent output this should be set to a high number (default)

void open(const std::string &filename)

Create and prepare a file as HDF5-file.

void close()
void flush() const
std::string OutputTypeName(OutputType outputtype)
void setEnergyScale(double scale)

Set energy scale.

Parameters

scale – energy scale (scale = 1 corresponds to 1 Joule)

void setLengthScale(double scale)

Set length scale.

Parameters

scale – length scale (scale = 1 corresponds to 1 meter)

void setOutputType(OutputType outputType)

Set type of output.

Parameters

outputType – type of output: Trajectory1D, Trajectory3D, Event1D, Event3D, Everything

void set(OutputColumn field, bool value)

Determines whether a given column will be displayed in the output.

Parameters
  • field – name of the field to be added/removed from output

  • value – boolean flag adding (true) or removing (false) the field

void enableProperty(const std::string &property, const Variant &defaultValue, const std::string &comment = "")

Add a property to output. Default value is required to assign a type in the output.

Parameters
  • property – string containing name of property

  • defaultValue – default value of property

  • comment – string with a comment

void enable(OutputColumn field)

Enable specific column in the output.

Parameters

field – name of the field to be enabled

void disable(OutputColumn field)

Disable specific column in the output.

Parameters

field – name of the field to be disabled

void enableAll()

Enable all fields. Essentially a wrapper for set(field, true).

void disableAll()

Disable all fields. Essentially a wrapper for set(field, false).

void set1D(bool value)

If true, output is of 1D type. 3D quantities such as vectors will be reduced to the relevant components (x, by default).

Parameters

value – boolean flag

size_t size() const

Returns the size of the output

inline void process(ref_ptr<Candidate> candidate) const
void setDescription(const std::string &description)
inline size_t addReference() const
inline size_t removeReference() const
inline int removeReferenceNoDelete() const
inline size_t getReferenceCount() const

Public Members

const std::string outputName

Protected Functions

void modify()

Protected Attributes

double lengthScale
double energyScale
std::bitset<64> fields
std::vector<Property> properties
bool oneDimensional
mutable size_t count
mutable size_t _referenceCount