MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / get_interaction_parameters

Method get_interaction_parameters

src/Backends/Cubics/UNIFACLibrary.cpp:98–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98InteractionParameters UNIFACParameterLibrary::get_interaction_parameters(int mgi1, int mgi2) const {
99
100 // If both mgi are the same, yield all zeros for the interaction parameters
101 if (mgi1 == mgi2) {
102 InteractionParameters ip;
103 ip.mgi1 = mgi1;
104 ip.mgi2 = mgi2;
105 ip.zero_out();
106 return ip;
107 }
108 for (const auto& interaction_parameter : interaction_parameters) {
109 if (interaction_parameter.mgi1 == mgi1 && interaction_parameter.mgi2 == mgi2) {
110 // Correct order, return it
111 return interaction_parameter;
112 }
113 if (interaction_parameter.mgi2 == mgi1 && interaction_parameter.mgi1 == mgi2) {
114 // Backwards, swap the parameters
115 InteractionParameters ip = interaction_parameter;
116 ip.swap();
117 return ip;
118 }
119 }
120 throw CoolProp::ValueError(format("Could not find interaction between pair mgi[%d]-mgi[%d]", static_cast<int>(mgi1), static_cast<int>(mgi2)));
121}
122
123Component UNIFACParameterLibrary::get_component(const std::string& identifier, const std::string& value) const {
124 if (identifier == "name") {

Callers 1

Calls 3

zero_outMethod · 0.80
swapMethod · 0.80
formatFunction · 0.50

Tested by

no test coverage detected