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

Function AbstractState_keyed_output_satState

src/CoolPropLib.cpp:1029–1056  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1027}
1028
1029EXPORT_CODE double CONVENTION AbstractState_keyed_output_satState(const long handle, const char* saturated_state, const long param, long* errcode,
1030 char* message_buffer, const long buffer_length) {
1031 *errcode = 0;
1032 fpu_reset_guard guard;
1033
1034 try {
1035 shared_ptr<CoolProp::AbstractState>& AS = handle_manager.get(handle);
1036 double quality = AS->Q();
1037 std::string string_state(saturated_state);
1038 if (0 <= quality && quality <= 1) {
1039 if (string_state == "liquid") {
1040 return AS->saturated_liquid_keyed_output(static_cast<CoolProp::parameters>(param));
1041 } else if (string_state == "gas") {
1042 return AS->saturated_vapor_keyed_output(static_cast<CoolProp::parameters>(param));
1043 } else {
1044 throw CoolProp::ValueError(
1045 format(R"(Bad info string [%s] to saturated state output, options are "liquid" and "gas")", saturated_state));
1046 }
1047 } else {
1048 throw CoolProp::ValueError(format("AbstractState_keyed_output_satState only returns outputs for saturated states if AbstractState "
1049 "quality [%g] is within two-phase region (0 <= quality <= 1)",
1050 static_cast<double>(quality)));
1051 }
1052 } catch (...) {
1053 HandleException(errcode, message_buffer, buffer_length);
1054 return _HUGE;
1055 }
1056}
1057
1058EXPORT_CODE void CONVENTION AbstractState_backend_name(const long handle, char* backend, long* errcode, char* message_buffer,
1059 const long buffer_length) {

Callers

nothing calls this directly

Calls 6

HandleExceptionFunction · 0.85
formatFunction · 0.70
getMethod · 0.45
QMethod · 0.45

Tested by

no test coverage detected