本文整理汇总了C++中AbstractStateLibrary::get方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractStateLibrary::get方法的具体用法?C++ AbstractStateLibrary::get怎么用?C++ AbstractStateLibrary::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractStateLibrary
的用法示例。
在下文中一共展示了AbstractStateLibrary::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
EXPORT_CODE double CONVENTION AbstractState_keyed_output(const long handle, const long param, long *errcode, char *message_buffer, const long buffer_length)
{
*errcode = 0;
try{
shared_ptr<CoolProp::AbstractState> &AS = handle_manager.get(handle);
return AS->keyed_output(static_cast<CoolProp::parameters>(param));
}
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;
}
示例2: catch
EXPORT_CODE void CONVENTION AbstractState_update_and_5_out(const long handle, const long input_pair, const double* value1, const double* value2, const long length, long* outputs, double* out1, double* out2, double* out3, double* out4, double* out5, long *errcode, char *message_buffer, const long buffer_length)
{
*errcode = 0;
try{
shared_ptr<CoolProp::AbstractState> &AS = handle_manager.get(handle);
for (int i = 0; i<length; i++){
try{
AS->update(static_cast<CoolProp::input_pairs>(input_pair), *(value1+i), *(value2+i));
*(out1+i) = AS->keyed_output(static_cast<CoolProp::parameters>(outputs[0]));
*(out2+i) = AS->keyed_output(static_cast<CoolProp::parameters>(outputs[1]));
*(out3+i) = AS->keyed_output(static_cast<CoolProp::parameters>(outputs[2]));
*(out4+i) = AS->keyed_output(static_cast<CoolProp::parameters>(outputs[3]));
*(out5+i) = AS->keyed_output(static_cast<CoolProp::parameters>(outputs[4]));
}
catch (...){
}
};
}
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 (...){
*errcode = 3;
}
}
示例3: catch
EXPORT_CODE void CONVENTION AbstractState_set_fluid_parameter_double(const long handle, const long i, const char* parameter, const double value , long *errcode, char *message_buffer, const long buffer_length) {
*errcode = 0;
try {
shared_ptr<CoolProp::AbstractState> &AS = handle_manager.get(handle);
AS->set_fluid_parameter_double(static_cast<std::size_t>(i), parameter, value);
}
catch (...) {
HandleException(errcode, message_buffer, buffer_length);
}
}
示例4: ValueError
EXPORT_CODE void CONVENTION AbstractState_get_spinodal_data(const long handle, const long length, double* tau, double* delta, double* M1, long *errcode, char *message_buffer, const long buffer_length) {
*errcode = 0;
try {
shared_ptr<CoolProp::AbstractState> &AS = handle_manager.get(handle);
CoolProp::SpinodalData spin = AS->get_spinodal_data();
if (spin.tau.size() > static_cast<std::size_t>(length)){
throw CoolProp::ValueError(format("Length of spinodal vectors [%d] is greater than allocated buffer length [%d]", static_cast<int>(spin.tau.size()), static_cast<int>(length)));
}
for (std::size_t i = 0; i<spin.tau.size(); ++i){
*(tau+i) = spin.tau[i];
*(delta+i) = spin.delta[i];
*(M1+i) = spin.M1[i];
}
}
catch (...) {
HandleException(errcode, message_buffer, buffer_length);
}
}
示例5: if
EXPORT_CODE void CONVENTION AbstractState_set_fractions(const long handle, const double *fractions, const long N, long *errcode, char *message_buffer, const long buffer_length)
{
*errcode = 0;
std::vector<double> _fractions(fractions, fractions + N);
try{
shared_ptr<CoolProp::AbstractState> &AS = handle_manager.get(handle);
if (AS->using_mole_fractions()){
AS->set_mole_fractions(_fractions);
}
else if (AS->using_mass_fractions()){
AS->set_mass_fractions(_fractions);
}
else if (AS->using_volu_fractions()){
AS->set_volu_fractions(_fractions);
}
}
catch (...) {
HandleException(errcode, message_buffer, buffer_length);
}
}
示例6: if
EXPORT_CODE void CONVENTION AbstractState_set_fractions(const long handle, const double *fractions, const long N, long *errcode, char *message_buffer, const long buffer_length)
{
*errcode = 0;
std::vector<double> _fractions(fractions, fractions + N);
try{
shared_ptr<CoolProp::AbstractState> &AS = handle_manager.get(handle);
if (AS->using_mole_fractions()){
AS->set_mole_fractions(_fractions);
}
else if (AS->using_mass_fractions()){
AS->set_mass_fractions(_fractions);
}
else if (AS->using_volu_fractions()){
AS->set_volu_fractions(_fractions);
}
}
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;
}
}