CoolProp  6.6.0
An open-source fluid property and humid air property database
HelmholtzEOSBackend.h
Go to the documentation of this file.
1 /*
2  * AbstractBackend.h
3  *
4  * Created on: 20 Dec 2013
5  * Author: jowr
6  */
7 
8 #ifndef HELMHOLTZEOSBACKEND_H_
9 #define HELMHOLTZEOSBACKEND_H_
10 
11 #include <vector>
13 #include "Fluids/FluidLibrary.h"
14 #include "MixtureParameters.h"
15 #include "DataStructures.h"
16 
17 namespace CoolProp {
18 
20 inline std::string vecstring_to_string(const std::vector<std::string>& a) {
21  std::stringstream out;
22  out << "[ " << format("%s", a[0].c_str());
23  for (size_t j = 1; j < a.size(); j++) {
24  out << ", " << format("%s", a[j].c_str());
25  }
26  out << " ]";
27  return out.str();
28 };
29 
31 {
32  public:
35  set_components(std::vector<CoolPropFluid>(1, Fluid));
36  };
38  Dictionary dict;
39  std::vector<double> mole_fractions;
40  std::vector<CoolPropFluid> components;
42  if (is_predefined_mixture(name, dict)) {
43  std::vector<std::string> fluids = dict.get_string_vector("fluids");
44  mole_fractions = dict.get_double_vector("mole_fractions");
45  if (get_debug_level() > 0) {
46  std::cout << "Got the fluids" << vecstring_to_string(fluids) << std::endl;
47  std::cout << "Got the fractions" << vec_to_string(mole_fractions, "%g") << std::endl;
48  }
49  for (unsigned int i = 0; i < fluids.size(); ++i) {
50  components.push_back(library.get(fluids[i]));
51  }
52  } else {
53  components.push_back(library.get(name)); // Until now it's empty
54  mole_fractions.push_back(1.);
55  }
56  // Set the components
58  // Set the mole fractions
59  set_mole_fractions(std::vector<CoolPropDbl>(mole_fractions.begin(), mole_fractions.end()));
60  if (get_debug_level() > 0) {
61  std::cout << "successfully set up state" << std::endl;
62  }
63  };
64  virtual ~HelmholtzEOSBackend(){};
65  std::string backend_name(void) {
67  }
68 };
69 
70 } /* namespace CoolProp */
71 #endif /* HELMHOLTZEOSBACKEND_H_ */