当前位置: 首页>>代码示例>>C++>>正文


C++ AbstractStateLibrary::get方法代码示例

本文整理汇总了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;
}
开发者ID:davideziviani,项目名称:CoolProp-1,代码行数:32,代码来源:CoolPropLib.cpp

示例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;
    }
}
开发者ID:bilderbuchi,项目名称:CoolProp,代码行数:34,代码来源:CoolPropLib.cpp

示例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);
	}
}
开发者ID:CoolProp,项目名称:CoolProp,代码行数:10,代码来源:CoolPropLib.cpp

示例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);
    }
}
开发者ID:CoolProp,项目名称:CoolProp,代码行数:18,代码来源:CoolPropLib.cpp

示例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);
	}
}
开发者ID:CoolProp,项目名称:CoolProp,代码行数:20,代码来源:CoolPropLib.cpp

示例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;
    }
}
开发者ID:davideziviani,项目名称:CoolProp-1,代码行数:40,代码来源:CoolPropLib.cpp


注:本文中的AbstractStateLibrary::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。