Transformation matrix

class CTransformMatrix

Class for description of the transformation matrix.

Applied to describe laws of changes for multidimensional distributions. Each cell of matrix describes how much of material will be transferred from one class of multidimensional distribution to another. See also Transformation matrices

Public Functions

CTransformMatrix(void)

Basic constructor.

Creates an empty matrix.

CTransformMatrix(unsigned _nType, unsigned _nClasses)

Creates matrix to transform one-dimensional distribution with the given type and number of classes.

Type is one of the EDistrTypes. All values in the matrix will be set to 0.

Parameters
  • _nType – Distribution type.

  • _nClasses – Number of classes.

CTransformMatrix(unsigned _nType1, unsigned _nClasses1, unsigned _nType2, unsigned _nClasses2)

Creates matrix to transform two-dimensional distribution with the given types and number of classes.

Types are types from EDistrTypes. All values in the matrix will be set to 0.

Parameters
  • _nType1 – First distribution type.

  • _nClasses1 – Number of classes of first distribution.

  • _nType2 – Second distribution type.

  • _nClasses2 – Number of classes of second distribution.

CTransformMatrix(const std::vector<unsigned> &_vTypes, const std::vector<unsigned> &_vClasses)

Creates transformation matrix for distribution with specified types and classes.

Vectors with types and classes must have the same length. Types are types from EDistrTypes. All values in the matrix will be set to 0.

Parameters
  • _vTypes – Distribution types.

  • _vClasses – Numbers of classes of distributions.

bool SetDimensions(unsigned _nType, unsigned _nClasses)

Sets new dimensions set to the matrix in order to transform one-dimensional distribution with the given type and number of classes.

Type is one of the EDistrTypes. Old data will be erased and the matrix will be initialized with zeroes.

Parameters
  • _nType – Distribution type.

  • _nClasses – Number of classes.

Returns

Error flag.

bool SetDimensions(unsigned _nType1, unsigned _nClasses1, unsigned _nType2, unsigned _nClasses2)

Sets new dimensions set to the matrix in order to transform two-dimensional distribution.

Types are types of the EDistrTypes. Types must be unique. Old data will be erased and the matrix will be initialized with zeroes.

Parameters
  • _nType1 – First distribution type.

  • _nClasses1 – Number of classes of first distribution.

  • _nType2 – Second distribution type.

  • _nClasses2 – Number of classes of second distribution.

Returns

Error flag.

bool SetDimensions(unsigned _nType1, unsigned _nClasses1, unsigned _nType2, unsigned _nClasses2, unsigned _nType3, unsigned _nClasses3)

Sets new dimensions set to the matrix in order to transform three-dimensional distribution.

Types are one of the EDistrTypes. Types must be unique. Old data will be erased and the matrix will be initialized with zeroes.

Parameters
  • _nType1 – First distribution type.

  • _nClasses1 – Number of classes of first distribution.

  • _nType2 – Second distribution type.

  • _nClasses2 – Number of classes of second distribution.

  • _nType3 – Third distribution type.

  • _nClasses3 – Number of classes of third distribution.

Returns

Error flag.

bool SetDimensions(const std::vector<unsigned> &_vTypes, const std::vector<unsigned> &_vClasses)

Sets new dimensions set with the given types and numbers of classes.

Types is the vector of EDistrTypes. All old data will be erased and the matrix will be initialized with zeroes. Sizes of vectors with types and classes must be equal.

Parameters
  • _vTypes – Distribution types.

  • _vClasses – Numbers of classes of distributions.

Returns

Error flag.

std::vector<unsigned> GetDimensions() const

Returns vector with all current defined dimensions types.

Types is the vector of EDistrTypes.

Returns

Vector of defined dimensions types.

std::vector<unsigned> GetClasses() const

Returns vector with current numbers of classes.

Returns

Vector with numbers of classes.

size_t GetDimensionsNumber() const

Returns current number of dimensions.

Returns

Number of defined dimensions

void Clear()

Clears all data and information about dimensions.

void ClearData()

Clears all data in the matrix.

Dimensions set won’t be erased.

void Normalize()

Normalizes data in matrix.

Sets sum of material which transfers from each single class to 1.

double GetValue(unsigned _nCoordSrc, unsigned _nCoordDst) const

Returns value by specified coordinates according to all defined dimensions in transformation matrix for one-dimensional distribution.

Works with one-dimensional distribution only. Returns -1 on error.

Parameters
  • _nCoordSrc – Coordinate of a source class.

  • _nCoordDst – Coordinate of a destination class.

Returns

Mass fraction, which will be transferred from the source class to the destination class.

double GetValue(unsigned _nCoordSrc1, unsigned _nCoordSrc2, unsigned _nCoordDst1, unsigned _nCoordDst2) const

Returns value by specified coordinates according to all defined dimensions in transformation matrix for two-dimensional distribution.

Works with two-dimensional distribution only. Returns -1 on error.

Parameters
  • _nCoordSrc1 – First coordinate of a source class.

  • _nCoordSrc2 – Second coordinate of a source class.

  • _nCoordDst1 – First coordinate of a destination class.

  • _nCoordDst2 – Second coordinate of a destination class.

Returns

Mass fraction, which will be transferred from the source class to the destination class.

double GetValue(const std::vector<unsigned> &_vCoordsSrc, const std::vector<unsigned> &_vCoordsDst) const

Returns value by specified coordinates according the all defined dimensions.

Sizes of vectors with coordinates must be equal and must correspond to the number of currently defined dimensions. Returns -1 on error.

Parameters
  • _vCoordsSrc – Coordinates of a source class.

  • _vCoordsDst – Coordinates of a destination class.

Returns

Mass fraction, which will be transferred from the source class to the destination class.

double GetValue(const std::vector<unsigned> &_vDimsSrc, const std::vector<unsigned> &_vCoordsSrc, const std::vector<unsigned> &_vDimsDst, const std::vector<unsigned> &_vCoordsDst) const

Returns value by specified coordinates and dimensions sequence.

Number of dimensions must be the same as defined in the transformation matrix. Returns -1 on error.

Parameters
  • _vDimsSrc – Dimensions of a source class.

  • _vCoordsSrc – Coordinates of a source class.

  • _vDimsDst – Dimensions of a destination class.

  • _vCoordsDst – Coordinates of a destination class.

Returns

Mass fraction, which will be transferred from the source class to the destination class.

bool GetVectorValue(const std::vector<unsigned> &_vCoordsSrc, const std::vector<unsigned> &_vCoordsDst, std::vector<double> &_vResult) const

Returns vector of values for specified coordinates according to all defined dimensions.

Parameters
  • _vCoordsSrc – Coordinates of a source class.

  • _vCoordsDst – Coordinates of a destination class.

  • _vResult – Vector of mass fractions, which will be transferred from the source to the destination.

Returns

Error flag.

std::vector<double> GetVectorValue(const std::vector<unsigned> &_vCoordsSrc, const std::vector<unsigned> &_vCoordsDst) const

Returns vector of values for specified coordinates according to all defined dimensions.

Parameters
  • _vCoordsSrc – Coordinates of a source class.

  • _vCoordsDst – Coordinates of a destination class.

Returns

Vector of mass fractions, which will be transferred from the source to the destination.

bool GetVectorValue(const std::vector<unsigned> &_vDimsSrc, const std::vector<unsigned> &_vCoordsSrc, const std::vector<unsigned> &_vDimsDst, const std::vector<unsigned> &_vCoordsDst, std::vector<double> &_vResult) const

Returns vector of values according to specified coordinates and dimensions sequence.

Number of dimensions must be the same as defined in the transformation matrix.

Parameters
  • _vDimsSrc – Dimensions of a source class.

  • _vCoordsSrc – Coordinates of a source class.

  • _vDimsDst – Dimensions of a destination class.

  • _vCoordsDst – Coordinates of a destination class.

  • _vResult – Vector of mass fractions, which will be transferred from the source to the destination.

Returns

Error flag.

bool SetValue(unsigned _nCoordSrc, unsigned _nCoordDst, double _dValue)

Sets value by specified coordinates for 1-dimensional transformation matrix.

Parameters
  • _nCoordSrc – Coordinate of a source class.

  • _nCoordDst – Coordinate of a destination class.

  • _dValue – Mass fraction, which will be transferred from the source class to the destination class.

Returns

Error flag.

bool SetValue(unsigned _nCoordSrc1, unsigned _nCoordSrc2, unsigned _nCoordDst1, unsigned _nCoordDst2, double _dValue)

Sets value by specified coordinates for 2-dimensional transformation matrix.

Parameters
  • _nCoordSrc1 – First coordinate of a source class.

  • _nCoordSrc2 – Second coordinate of a source class.

  • _nCoordDst1 – First coordinate of a destination class.

  • _nCoordDst2 – Second coordinate of a destination class.

  • _dValue – Mass fraction, which will be transferred from the source class to the destination class.

Returns

Error flag.

bool SetValue(const std::vector<unsigned> &_vCoordsSrc, const std::vector<unsigned> &_vCoordsDst, double _dValue)

Sets value according the all defined dimensions.

Number of dimensions must be the same as defined in the transformation matrix.

Parameters
  • _vCoordsSrc – Coordinates of a source class.

  • _vCoordsDst – Coordinates of a destination class.

  • _dValue – Mass fraction, which will be transferred from the source class to the destination class.

Returns

Error flag.

bool SetValue(const std::vector<unsigned> &_vDimsSrc, const std::vector<unsigned> &_vCoordsSrc, const std::vector<unsigned> &_vDimsDst, const std::vector<unsigned> &_vCoordsDst, double _dValue)

Sets value by specified coordinates and dimensions sequence.

Number of dimensions must be the same as defined in the transformation matrix.

Parameters
  • _vDimsSrc – Dimensions of a source class.

  • _vCoordsSrc – Coordinates of a source class.

  • _vDimsDst – Dimensions of a destination class.

  • _vCoordsDst – Coordinates of a destination class.

  • _dValue – Mass fraction, which will be transferred from the source class to the destination class.

Returns

Error flag.

bool SetVectorValue(const std::vector<unsigned> &_vCoordsSrc, const std::vector<unsigned> &_vCoordsDst, const std::vector<double> &_vValue)

Sets vector of values for specified coordinates according to all defined dimensions.

Parameters
  • _vCoordsSrc – Coordinates of a source class.

  • _vCoordsDst – Coordinates of a destination class.

  • _vValue – Vector of mass fractions, which will be transferred from the source to the destination.

Returns

Error flag.

bool SetVectorValue(const std::vector<unsigned> &_vDimsSrc, const std::vector<unsigned> &_vCoordsSrc, const std::vector<unsigned> &_vDimsDst, const std::vector<unsigned> &_vCoordsDst, const std::vector<double> &_vValue)

Sets vector of values according to specified dimensions and coordinates.

Number of dimensions must be the same as defined in the transformation matrix.

Parameters
  • _vDimsSrc – Dimensions of a source class.

  • _vCoordsSrc – Coordinates of a source class.

  • _vDimsDst – Dimensions of a destination class.

  • _vCoordsDst – Coordinates of a destination class.

  • _vValue – Vector of mass fractions, which will be transferred from the source to the destination.

Returns

Error flag.

CMatrix2D GetMatrix() const

Returns 2D matrix of values.

Returns

2D matrix of values.

bool SetMatrix(const CMatrix2D &_matrix)

Sets matrix of values if the sizes correspond.

If the sizes of matrices do not correspond, nothing is done.

Parameters

_matrix – New matrix.

Returns

Error flag.