| 1027 | } |
| 1028 | |
| 1029 | EXPORT_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 | |
| 1058 | EXPORT_CODE void CONVENTION AbstractState_backend_name(const long handle, char* backend, long* errcode, char* message_buffer, |
| 1059 | const long buffer_length) { |
nothing calls this directly
no test coverage detected