# Enthalpy lookup table

class CMixtureEnthalpyLookup

  Bidirectional lookup table to find the correspondence between temperature and enthalpy of a mixture of materials.

  Public Functions

  CMixtureEnthalpyLookup() = default

    Default constructor.

  CMixtureEnthalpyLookup(const CMaterialsDatabase *_materialsDB, std::vector<std::string> _compounds)

    Constructs lookup table with the pointer to materials database and compounds and default values of limits and number of intervals.

    Parameters:

      - _materialsDB – Pointer to materials database.

      - _compounds – List of compounds.

  CMixtureEnthalpyLookup(const CMaterialsDatabase *_materialsDB, std::vector<std::string> _compounds, const SInterval &_limits, size_t _intervalsNumber)

    Constructs lookup table with the pointer to materials database, compounds, values of limits and number of intervals.

    Parameters:

      - _materialsDB – Pointer to materials database.

      - _compounds – List of compounds.

      - _limits – Temperature limits.

      - _intervalsNumber – Number of temperature intervals.

  CMixtureEnthalpyLookup(const CMixtureEnthalpyLookup &_other) = default

    Copy constructor.

  void SetLimits(const SInterval &_limits, size_t _number)

    Sets temperature limits and number of intervals for the lookup table.

    Parameters:

      - _limits – Temperature limits.

      - _number – Number of temperature intervals.

  SInterval GetLimits() const

    Returns current temperature limits.

    Returns:

      Temperature limits.

  size_t GetIntervalsNumber() const

    Returns current number of temperature intervals.

    Returns:

      Number of intervals.

  void SetMaterialsDatabase(const CMaterialsDatabase *_materialsDB)

    Sets pointer to materials database.

    Parameters:

      _materialsDB – Pointer to materials database.

  void SetCompounds(const std::vector<std::string> &_compounds)

    Sets new list of _compounds.

    Parameters:

      _compounds – List of compounds.

  void SetCompoundFractions(const std::vector<double> &_fractions)

    Sets new fractions of all compounds.

    The length of fractions must be equal to the number of previously defined compounds.

    Parameters:

      _fractions – Compounds fractions.

  std::vector<double> GetCompoundFractions() const

    Returns current fractions of compounds.

    Returns:

      Compounds fractions.

  size_t Size() const

    Returns the number of entries in the lookup table.

    Returns:

      Number of entries.

  double GetEnthalpy(double _temperature) const

    Returns enthalpy for the given temperature.

    Parameters:

      _temperature – Temperature.

    Returns:

      Enthalpy.

  double GetTemperature(double _enthalpy) const

    Returns temperature for the given _enthalpy.

    Parameters:

      _enthalpy – Enthalpy.

    Returns:

      Temperature.

  double GetEnthalpy(double _temperature, const std::vector<double> &_fractions)

    Sets new fractions of all compounds and returns enthalpy for the given temperature.

    The length of fractions must be equal to the number of previously defined compounds.

    Parameters:

      - _temperature – Temperature.

      - _fractions – Compounds fractions.

    Returns:

      Enthalpy.

  double GetTemperature(double _enthalpy, const std::vector<double> &_fractions)

    Sets new _fractions of all compounds and returns temperature for the given enthalpy.

    The length of fractions must be equal to the number of previously defined compounds.

    Parameters:

      - _enthalpy – Enthalpy.

      - _fractions – Compounds fractions.

    Returns:

      Temperature.

  void Clear()

    Removes all information.

  void Add(double _value)

    Adds value to each right (dependent) entry of the mixture table.

    Parameters:

      _value – New value.

  void Add(const CDependentValues &_component, double _weight = 1.)

    Adds a component with some weight to each right (dependent) entry of the mixture table.

    Parameters:

      - _component – New component.

      - _weight – Weight of the component.

  void Add(const CMixtureEnthalpyLookup &_table, double _weight = 1.)

    Adds another mixture table with some weight to each right (dependent) entry of the mixture table.

    Table must have the same number of compounds.

    Parameters:

      - _table – Mixture table.

      - _weight – Weight of the component.

  void Multiply(double _value)

    Multiplies each right (dependent) entry of the mixture table with a value.

    Parameters:

      _value – Value.

  CMixtureEnthalpyLookup operator+(double _d) const

    Adds a value to all entries of the lookup table.

    Parameters:

      _d – Value.

    Returns:

      Copy of the lookup table.

  CMixtureEnthalpyLookup operator*(double _d) const

    Multiplies all entries of the lookup table with a value.

    Parameters:

      _d – Value.

    Returns:

      Copy of the lookup table.

  CMixtureEnthalpyLookup operator+(const CMixtureEnthalpyLookup &_t) const

    Adds another lookup table.

    Parameters:

      _t – Lookup table.

    Returns:

      Copy of the lookup table.

  CMixtureEnthalpyLookup &operator+=(double _d)

    Adds a value to all entries of the lookup table.

    Parameters:

      _d – Value.

    Returns:

      Reference to the lookup table.

  CMixtureEnthalpyLookup &operator*=(double _d)

    Multiplies all entries of the lookup table with a value.

    Parameters:

      _d – Value.

    Returns:

      Reference to the lookup table.

  CMixtureEnthalpyLookup &operator+=(const CMixtureEnthalpyLookup &_t)

    Adds another lookup table.

    Parameters:

      _t – Lookup table.

    Returns:

      Reference to the lookup table.

  bool operator==(const CMixtureEnthalpyLookup &_t) const

    Compares two lookup tables.

    Parameters:

      _t – Lookup table.

    Returns:

      Whether lookup tables are the same.