Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
DataReducer Class Reference

#include <datareducer.h>

Public Member Functions

 DataReducer ()
 ~DataReducer ()
bool addOperator (DRO::DataReductionOperator *op)
bool getDataVectorInfo (const unsigned int &operatorID, std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
bool addMetadata (const unsigned int operatorID, std::string unit, std::string unitLaTeX, std::string variableLaTeX, std::string unitConversion)
bool getMetadata (const unsigned int &operatorID, std::string &unit, std::string &unitLaTeX, std::string &variableLaTeX, std::string &unitConversion) const
std::string getName (const unsigned int &operatorID) const
bool hasParameters (const unsigned int &operatorID) const
bool reduceData (const SpatialCell *cell, const unsigned int &operatorID, char *buffer)
bool reduceDiagnostic (const SpatialCell *cell, const unsigned int &operatorID, Real *result)
unsigned int size () const
bool writeParameters (const unsigned int &operatorID, vlsv::Writer &vlsvWriter)
bool writeFsGridData (const FieldSolverData &fieldSolverData, const std::string &meshName, const unsigned int operatorID, vlsv::Writer &vlsvWriter, const bool writeAsFloat=false)
bool writeIonosphereGridData (SBC::SphericalTriGrid &grid, const std::string &meshName, const unsigned int operatorID, vlsv::Writer &vlsvWriter)

Private Member Functions

 DataReducer (const DataReducer &dr)

Private Attributes

std::vector< DRO::DataReductionOperator * > operators

Detailed Description

The purpose of DataReducer is to contain DRO::DataReductionOperators, and apply them to simulation data when writing output files. Files containing full distribution functions of every spatial cell require so much disk space that they cannot be written out so often as user would want. Thus, derived quantities need to be calculated for every spatial cell, which are then written to data files. This process is here called data reduction.

Definition at line 42 of file datareducer.h.

Constructor & Destructor Documentation

◆ DataReducer() [1/2]

DataReducer::DataReducer ( )

Constructor for class DataReducer.

Definition at line 2887 of file datareducer.cpp.

Here is the caller graph for this function:

◆ ~DataReducer()

DataReducer::~DataReducer ( )

Destructor for class DataReducer. All stored DataReductionOperators are deleted.

Definition at line 2892 of file datareducer.cpp.

◆ DataReducer() [2/2]

DataReducer::DataReducer ( const DataReducer & dr)
private

Private copy-constructor to prevent copying the class.

Here is the call graph for this function:

Member Function Documentation

◆ addMetadata()

bool DataReducer::addMetadata ( const unsigned int operatorID,
std::string unit,
std::string unitLaTeX,
std::string variableLaTeX,
std::string unitConversion )

Add a metadata to the specified DRO::DataReductionOperator.

Parameters
operatorIDID number of the DataReductionOperator to add metadata to
unitstring with the physical unit of the DRO result
unitLaTeXLaTeX-formatted string with the physical unit of the DRO result
variableLaTeXLaTeX-formatted string with a descriptive short name for the DRO result
conversionFactorfloating point conversion factor between DRO result and SI units
Returns
If true, the given metadata was added successfully.

Definition at line 2941 of file datareducer.cpp.

Here is the caller graph for this function:

◆ addOperator()

bool DataReducer::addOperator ( DRO::DataReductionOperator * op)

Add a new DRO::DataReductionOperator which has been created with new operation. DataReducer will take care of deleting it.

Returns
If true, the given DRO::DataReductionOperator was added successfully.

Definition at line 2904 of file datareducer.cpp.

Here is the caller graph for this function:

◆ getDataVectorInfo()

bool DataReducer::getDataVectorInfo ( const unsigned int & operatorID,
std::string & dataType,
unsigned int & dataSize,
unsigned int & vectorSize ) const

Get info on the type of data calculated by the given DataReductionOperator. A DataReductionOperator writes an array on disk. Each element of the array is a vector with n elements. Finally, each vector element has a byte size, as given by the sizeof function.

Parameters
operatorIDID number of the DataReductionOperator whose output data info is requested.
dataTypeBasic datatype, must be int, uint, or float.
dataSizeByte size of written datatype, for example double-precision floating points have byte size of sizeof(double).
vectorSizeHow many elements are in the vector returned by the DataReductionOperator.
Returns
If true, DataReductionOperator was found and it returned sensible values.

Definition at line 2928 of file datareducer.cpp.

Here is the caller graph for this function:

◆ getMetadata()

bool DataReducer::getMetadata ( const unsigned int & operatorID,
std::string & unit,
std::string & unitLaTeX,
std::string & variableLaTeX,
std::string & unitConversion ) const

Get metadata on the unit of data calculated by the given DataReductionOperator.

Parameters
operatorIDID number of the DataReductionOperator whose output unit metadata is requested.
unitPhysical unit of variable
unitLaTeXPhysical unit of variable, written using LaTeX notation
unitConversionFloating point value of conversion factor to SI units
Returns
If true, DataReductionOperator was found and it returned sensible values.

Definition at line 2953 of file datareducer.cpp.

Here is the caller graph for this function:

◆ getName()

std::string DataReducer::getName ( const unsigned int & operatorID) const

Get the name of a DataReductionOperator.

Parameters
operatorIDID number of the operator whose name is requested.
Returns
Name of the operator.

Definition at line 2913 of file datareducer.cpp.

Here is the caller graph for this function:

◆ hasParameters()

bool DataReducer::hasParameters ( const unsigned int & operatorID) const

Ask a DataReductionOperator if it wants to write parameters to the vlsv file header

Parameters
operatorIDID number of the DataReductionOperator.
Returns
If true, then VLSVWriter should be passed to the DataReductionOperator.

Definition at line 2961 of file datareducer.cpp.

Here is the caller graph for this function:

◆ reduceData()

bool DataReducer::reduceData ( const SpatialCell * cell,
const unsigned int & operatorID,
char * buffer )

Request a DataReductionOperator to calculate its output data and to write it to the given buffer.

Parameters
cellPointer to spatial cell whose data is to be reduced.
operatorIDID number of the applied DataReductionOperator.
bufferBuffer in which DataReductionOperator should write its data.
Returns
If true, DataReductionOperator calculated and wrote data successfully.

Definition at line 2972 of file datareducer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduceDiagnostic()

bool DataReducer::reduceDiagnostic ( const SpatialCell * cell,
const unsigned int & operatorID,
Real * result )

Request a DataReductionOperator to calculate its output data and to write it to the given variable.

Parameters
cellPointer to spatial cell whose data is to be reduced.
operatorIDID number of the applied DataReductionOperator.
resultReal variable in which DataReductionOperator should write its result.
Returns
If true, DataReductionOperator calculated and wrote data successfully.

Definition at line 2987 of file datareducer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

unsigned int DataReducer::size ( ) const

Get the number of DataReductionOperators stored in DataReducer.

Returns
Number of DataReductionOperators stored in DataReducer.

Definition at line 2999 of file datareducer.cpp.

Here is the caller graph for this function:

◆ writeFsGridData()

bool DataReducer::writeFsGridData ( const FieldSolverData & fieldSolverData,
const std::string & meshName,
const unsigned int operatorID,
vlsv::Writer & vlsvWriter,
const bool writeAsFloat = false )

Write all data thet the given DataReductionOperator wants to obtain from fsgrid into the output file.

Definition at line 3015 of file datareducer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeIonosphereGridData()

bool DataReducer::writeIonosphereGridData ( SBC::SphericalTriGrid & grid,
const std::string & meshName,
const unsigned int operatorID,
vlsv::Writer & vlsvWriter )

Definition at line 3030 of file datareducer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeParameters()

bool DataReducer::writeParameters ( const unsigned int & operatorID,
vlsv::Writer & vlsvWriter )

Write parameters related to given DataReductionOperator to the output file.

Parameters
operatorIDID number of the selected DataReductionOperator.
vlsvWriterVLSV file writer that has output file open.
Returns
If true, DataReductionOperator wrote its parameters successfully.

Definition at line 3005 of file datareducer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ operators

std::vector<DRO::DataReductionOperator*> DataReducer::operators
private

A container for all DRO::DataReductionOperators stored in DataReducer.

Definition at line 69 of file datareducer.h.


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