class Database
Declaration
class Database { /* full declaration omitted */ };
Description
The Database class stores maps of elements, substances and reactions. A database instance can be used to create a ThermoEngine instance which can be further used to calculate the standard thermodynamic properties of substances and reactions at T and P
Declared at: ThermoFun/Database.h:32
Method Overview
- public Database(std::string filename)
- public Database(std::vector<std::string> jsonRecords, std::string _label)
- public Database(const ThermoFun::Database & other)
- public Database()
- public auto addElement(const ThermoFun::Element & element) -> void
- public auto addElement(const std::string & jsonElement) -> void
- public auto addMapElements(const ThermoFun::ElementsMap & elements) -> void
- public auto addMapReactions(const ThermoFun::ReactionsMap & reactions) -> void
- public auto addMapSubstances(const ThermoFun::SubstancesMap & substances) -> void
- public auto addReaction(const std::string & jsonReaction) -> void
- public auto addReaction(const ThermoFun::Reaction & reaction) -> void
- public auto addSubstance(const ThermoFun::Substance & substance) -> void
- public auto addSubstance(const std::string & jsonSubstance) -> void
- public auto appendData(std::string filename) -> void
- public auto appendData(std::vector<std::string> jsonRecords, std::string _label) -> void
- public auto containsElement(std::string symbol) const -> bool
- public auto containsReaction(std::string symbol) const -> bool
- public auto containsSubstance(std::string symbol) const -> bool
- public auto elementalEntropyFormula(std::string formula) const -> double
- public auto getElement(std::string symbol) const -> const ThermoFun::Element &
- public auto getElements() const -> std::vector<Element>
- public auto getReaction(std::string symbol) const -> const ThermoFun::Reaction &
- public auto getReactions() const -> std::vector<Reaction>
- public auto getSubstance(std::string symbol) const -> const ThermoFun::Substance &
- public auto getSubstances() const -> std::vector<Substance>
- public auto mapElements() const -> const ThermoFun::ElementsMap &
- public auto mapReactions() const -> const ThermoFun::ReactionsMap &
- public auto mapSubstances() const -> const ThermoFun::SubstancesMap &
- public auto numberOfElements() const -> size_t
- public auto numberOfReactions() const -> size_t
- public auto numberOfSubstances() const -> size_t
- public auto parseSubstanceFormula(std::string formula) const -> std::map<Element, double>
- public auto setElement(const ThermoFun::Element & element) -> void
- public auto setElement(const std::string & jsonElement) -> void
- public auto setMapElements(const ThermoFun::ElementsMap & elements) -> void
- public auto setMapReactions(const ThermoFun::ReactionsMap & reactions) -> void
- public auto setMapSubstances(const ThermoFun::SubstancesMap & substances) -> void
- public auto setReaction(const std::string & jsonReaction) -> void
- public auto setReaction(const ThermoFun::Reaction & reaction) -> void
- public auto setSubstance(const std::string & jsonSubstance) -> void
- public auto setSubstance(const ThermoFun::Substance & substance) -> void
Methods
¶Database(std::string filename)
Database(std::string filename)
Description
Construct a new Database object
Declared at: ThermoFun/Database.h:43
Parameters
- std::string filename
- name/path of the file or a string containing a ThermoDataSet in JSON format
¶Database(std::vector<std::string> jsonRecords,
std::string _label)
Database(std::vector<std::string> jsonRecords,
std::string _label)
Description
Database constructs a database instance from a vector of records in json format Records with the same symbol will be overwritten!
Declared at: ThermoFun/Database.h:52
Parameters
- std::vector<std::string> jsonRecords
- vector of records in JSON string format
- std::string _label
¶Database(const ThermoFun::Database& other)
Database(const ThermoFun::Database& other)
Description
Construct a copy of an Database instance
Declared at: ThermoFun/Database.h:58
Parameters
- const ThermoFun::Database& other
¶Database()
Database()
Description
Construct default database instance
Declared at: ThermoFun/Database.h:36
¶auto addElement(const ThermoFun::Element& element)
-> void
auto addElement(const ThermoFun::Element& element)
-> void
Description
Add an Element instance in the database. If the element with the symbol exists the record will not be added.
Declared at: ThermoFun/Database.h:77
Parameters
- const ThermoFun::Element& element
¶auto addElement(const std::string& jsonElement)
-> void
auto addElement(const std::string& jsonElement)
-> void
Description
Add an Element instance in the database from a JSON string. If the element with the symbol exists the record will not be added.
Declared at: ThermoFun/Database.h:83
Parameters
- const std::string& jsonElement
¶auto addMapElements(
const ThermoFun::ElementsMap& elements)
-> void
auto addMapElements(
const ThermoFun::ElementsMap& elements)
-> void
Description
Add a map of Elements in the database. If the element with the symbol exists the record will not be added.
Declared at: ThermoFun/Database.h:89
Parameters
- const ThermoFun::ElementsMap& elements
¶auto addMapReactions(
const ThermoFun::ReactionsMap& reactions)
-> void
auto addMapReactions(
const ThermoFun::ReactionsMap& reactions)
-> void
Description
Add a map of Reactions in the database. If the reaction with the symbol exists the record will not be added.
Declared at: ThermoFun/Database.h:128
Parameters
- const ThermoFun::ReactionsMap& reactions
¶auto addMapSubstances(
const ThermoFun::SubstancesMap& substances)
-> void
auto addMapSubstances(
const ThermoFun::SubstancesMap& substances)
-> void
Description
Add a map of Substances in the database. If the substance with the symbol exists the record will not be added.
Declared at: ThermoFun/Database.h:107
Parameters
- const ThermoFun::SubstancesMap& substances
¶auto addReaction(const std::string& jsonReaction)
-> void
auto addReaction(const std::string& jsonReaction)
-> void
Description
Add a Reaction instance in the database from a JSON string. If the reaction with the symbol exists the record will not be added.
Declared at: ThermoFun/Database.h:119
Parameters
- const std::string& jsonReaction
¶auto addReaction(
const ThermoFun::Reaction& reaction) -> void
auto addReaction(
const ThermoFun::Reaction& reaction) -> void
Description
Add a Reaction instance in the database. If the reaction with the symbol exists the record will not be added.
Declared at: ThermoFun/Database.h:113
Parameters
- const ThermoFun::Reaction& reaction
¶auto addSubstance(
const ThermoFun::Substance& substance) -> void
auto addSubstance(
const ThermoFun::Substance& substance) -> void
Description
Add a Substance instance in the database. If the substance with the symbol exists the record will not be added.
Declared at: ThermoFun/Database.h:95
Parameters
- const ThermoFun::Substance& substance
¶auto addSubstance(
const std::string& jsonSubstance) -> void
auto addSubstance(
const std::string& jsonSubstance) -> void
Description
Add a Substance instance in the database from a JSON string. If the substance with the symbol exists the record will not be added.
Declared at: ThermoFun/Database.h:98
Parameters
- const std::string& jsonSubstance
¶auto appendData(std::string filename) -> void
auto appendData(std::string filename) -> void
Description
appendData append records to the database from a file. Records with the same symbol will be overwritten!
Declared at: ThermoFun/Database.h:65
Parameters
- std::string filename
- name/path of the file or a string containing a ThermoDataSet in JSON format
¶auto appendData(
std::vector<std::string> jsonRecords,
std::string _label) -> void
auto appendData(
std::vector<std::string> jsonRecords,
std::string _label) -> void
Description
appendData append records to the database from a vector of JSON strings Records with the same symbol will be overwritten!
Declared at: ThermoFun/Database.h:74
Parameters
- std::vector<std::string> jsonRecords
- vector of records in JSON string format
- std::string _label
¶auto containsElement(std::string symbol) const
-> bool
auto containsElement(std::string symbol) const
-> bool
Description
Check if the database contains a given element
Declared at: ThermoFun/Database.h:171
Parameters
- std::string symbol
- The name of the element
¶auto containsReaction(std::string symbol) const
-> bool
auto containsReaction(std::string symbol) const
-> bool
Description
Check if the database contains a given reaction
Declared at: ThermoFun/Database.h:179
Parameters
- std::string symbol
- The name of the reaction
¶auto containsSubstance(std::string symbol) const
-> bool
auto containsSubstance(std::string symbol) const
-> bool
Description
Check if the database contains a given substance
Declared at: ThermoFun/Database.h:175
Parameters
- std::string symbol
- The name of the substance
¶auto elementalEntropyFormula(
std::string formula) const -> double
auto elementalEntropyFormula(
std::string formula) const -> double
Description
Pareses a given substance formula present in the database
Declared at: ThermoFun/Database.h:189
Parameters
- std::string formula
Returns
elemental entropy
¶auto getElement(std::string symbol) const
-> const ThermoFun::Element&
auto getElement(std::string symbol) const
-> const ThermoFun::Element&
Description
Return a element in the database
Declared at: ThermoFun/Database.h:161
Parameters
- std::string symbol
¶auto getElements() const -> std::vector<Element>
auto getElements() const -> std::vector<Element>
Description
Return all elements in the database
Declared at: ThermoFun/Database.h:134
¶auto getReaction(std::string symbol) const
-> const ThermoFun::Reaction&
auto getReaction(std::string symbol) const
-> const ThermoFun::Reaction&
Description
Return a reactions in the database
Declared at: ThermoFun/Database.h:167
Parameters
- std::string symbol
¶auto getReactions() const -> std::vector<Reaction>
auto getReactions() const -> std::vector<Reaction>
Description
Return all reactions in the database
Declared at: ThermoFun/Database.h:140
¶auto getSubstance(std::string symbol) const
-> const ThermoFun::Substance&
auto getSubstance(std::string symbol) const
-> const ThermoFun::Substance&
Description
Return a substance in the database
Declared at: ThermoFun/Database.h:164
Parameters
- std::string symbol
¶auto getSubstances() const
-> std::vector<Substance>
auto getSubstances() const
-> std::vector<Substance>
Description
Return all substances in the database
Declared at: ThermoFun/Database.h:137
¶auto mapElements() const
-> const ThermoFun::ElementsMap&
auto mapElements() const
-> const ThermoFun::ElementsMap&
Description
Returns the map of elements in the database
Declared at: ThermoFun/Database.h:143
¶auto mapReactions() const
-> const ThermoFun::ReactionsMap&
auto mapReactions() const
-> const ThermoFun::ReactionsMap&
Description
Returns the map of reactions in the database
Declared at: ThermoFun/Database.h:149
¶auto mapSubstances() const
-> const ThermoFun::SubstancesMap&
auto mapSubstances() const
-> const ThermoFun::SubstancesMap&
Description
Returns the map of substances in the database
Declared at: ThermoFun/Database.h:146
¶auto numberOfElements() const -> size_t
auto numberOfElements() const -> size_t
Description
Returns the number of elements in the databse
Declared at: ThermoFun/Database.h:152
¶auto numberOfReactions() const -> size_t
auto numberOfReactions() const -> size_t
Description
Returns the number of reactions in the database
Declared at: ThermoFun/Database.h:158
¶auto numberOfSubstances() const -> size_t
auto numberOfSubstances() const -> size_t
Description
Returns the number of substances in the databse
Declared at: ThermoFun/Database.h:155
¶auto parseSubstanceFormula(std::string formula)
const -> std::map<Element, double>
auto parseSubstanceFormula(std::string formula)
const -> std::map<Element, double>
Description
Pareses a given substance formula present in the database
Declared at: ThermoFun/Database.h:184
Parameters
- std::string formula
Returns
map of Elements and coefficients
¶auto setElement(const ThermoFun::Element& element)
-> void
auto setElement(const ThermoFun::Element& element)
-> void
Description
Sets an Element in the database. If the element with the symbol exists the record will be overwritten.
Declared at: ThermoFun/Database.h:80
Parameters
- const ThermoFun::Element& element
¶auto setElement(const std::string& jsonElement)
-> void
auto setElement(const std::string& jsonElement)
-> void
Description
Sets an Element in the database from a JSON string. If the element with the symbol exists the record will be overwritten.
Declared at: ThermoFun/Database.h:86
Parameters
- const std::string& jsonElement
¶auto setMapElements(
const ThermoFun::ElementsMap& elements)
-> void
auto setMapElements(
const ThermoFun::ElementsMap& elements)
-> void
Description
Add a map of Elements in the database. If the element with the symbol exists the record will be overwritten.
Declared at: ThermoFun/Database.h:92
Parameters
- const ThermoFun::ElementsMap& elements
¶auto setMapReactions(
const ThermoFun::ReactionsMap& reactions)
-> void
auto setMapReactions(
const ThermoFun::ReactionsMap& reactions)
-> void
Description
Sets a map of Reactions in the database. If the reaction with the symbol exists the record will be overwritten.
Declared at: ThermoFun/Database.h:131
Parameters
- const ThermoFun::ReactionsMap& reactions
¶auto setMapSubstances(
const ThermoFun::SubstancesMap& substances)
-> void
auto setMapSubstances(
const ThermoFun::SubstancesMap& substances)
-> void
Description
Set a map of Substances in the database. If the substance with the symbol exists the record will be overwritten.
Declared at: ThermoFun/Database.h:110
Parameters
- const ThermoFun::SubstancesMap& substances
¶auto setReaction(const std::string& jsonReaction)
-> void
auto setReaction(const std::string& jsonReaction)
-> void
Description
Set a reaction in the database from a JSON string. If the reaction with the symbol exists the record will be overwritten.
Declared at: ThermoFun/Database.h:122
Parameters
- const std::string& jsonReaction
¶auto setReaction(
const ThermoFun::Reaction& reaction) -> void
auto setReaction(
const ThermoFun::Reaction& reaction) -> void
Description
Set a reaction in the database. If the reaction with the symbol exists the record will be overwritten.
Declared at: ThermoFun/Database.h:116
Parameters
- const ThermoFun::Reaction& reaction
¶auto setSubstance(
const std::string& jsonSubstance) -> void
auto setSubstance(
const std::string& jsonSubstance) -> void
Description
Sets a substance in the database from a JSON string. If the substance with the symbol exists the record will be overwritten.
Declared at: ThermoFun/Database.h:104
Parameters
- const std::string& jsonSubstance
¶auto setSubstance(
const ThermoFun::Substance& substance) -> void
auto setSubstance(
const ThermoFun::Substance& substance) -> void
Description
Sets a substance in the database. If the substance with the symbol exists the record will be overwritten.
Declared at: ThermoFun/Database.h:101
Parameters
- const ThermoFun::Substance& substance