Export first_partial_deriv to DLL wrapper of AbstractState, see #946 (#1062)

This commit is contained in:
JonWel
2016-05-11 15:10:51 +02:00
committed by Ian Bell
parent 85d2157ca4
commit a5c7886e47
3 changed files with 48 additions and 1 deletions

View File

@@ -523,6 +523,39 @@ EXPORT_CODE double CONVENTION AbstractState_first_saturation_deriv(const long ha
return _HUGE;
}
EXPORT_CODE double CONVENTION AbstractState_first_partial_deriv(const long handle, const long Of, const long Wrt, const long Constant, long *errcode, char *message_buffer, const long buffer_length)
{
*errcode = 0;
try{
shared_ptr<CoolProp::AbstractState> &AS = handle_manager.get(handle);
return AS->first_partial_deriv(static_cast<CoolProp::parameters>(Of), static_cast<CoolProp::parameters>(Wrt), static_cast<CoolProp::parameters>(Constant));
}
catch (CoolProp::HandleError &e){
std::string errmsg = std::string("HandleError: ") + e.what();
if (errmsg.size() < static_cast<std::size_t>(buffer_length)){
*errcode = 1;
strcpy(message_buffer, errmsg.c_str());
}
else{
*errcode = 2;
}
}
catch (CoolProp::CoolPropBaseError &e){
std::string errmsg = std::string("Error: ") + e.what();
if (errmsg.size() < static_cast<std::size_t>(buffer_length)){
*errcode = 1;
strcpy(message_buffer, errmsg.c_str());
}
else{
*errcode = 2;
}
}
catch (...){
*errcode = 3;
}
return _HUGE;
}
EXPORT_CODE void CONVENTION AbstractState_update_and_common_out(const long handle, const long input_pair, const double* value1, const double* value2, const long length, double* T, double* p, double* rhomolar, double* hmolar, double* smolar, long *errcode, char *message_buffer, const long buffer_length)
{
*errcode = 0;