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


C++ CVariant::GetVariantAt方法代码示例

本文整理汇总了C++中CVariant::GetVariantAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CVariant::GetVariantAt方法的具体用法?C++ CVariant::GetVariantAt怎么用?C++ CVariant::GetVariantAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CVariant的用法示例。


在下文中一共展示了CVariant::GetVariantAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setSubstanceConstants

void CapeOpenCalculator::setSubstanceConstants()
{
    // Let the property package calc the constant props
    CVariant props;

    if(_socket->GetMaterialObject()->getLiquidPhasePossible())
        props.MakeArray(COPropsConst::Count, VT_BSTR);
    else
        props.MakeArray(1, VT_BSTR);

    for (int i = 0; i < COPropsConst::Count; i++)
    {
        if(wcscmp(COPropsConst::At[i], COPropsConst::TCRIT) == 0 || wcscmp(COPropsConst::At[i], COPropsConst::PCRIT) == 0)
        {
            if(_socket->GetMaterialObject()->getLiquidPhasePossible())
            {
                props.SetStringAt(i, COPropsConst::At[i]);
            }
            else
            {
                warningMessage("CapeOpenCalculator", "Fluid constant \"%S\" is unavailable for %s.",
                       COPropsConst::At[i], _libraryName.c_str());
            }
        }
        else
        {
            props.SetStringAt(i, COPropsConst::At[i]);
        }
    }

    CVariant results;
    results.MakeArray(COPropsConst::Count * _numCompounds, VT_VARIANT);

    _socket->GetConstants(props, results);

    // Get the results
    for(int i = 0; i < _numCompounds; ++i)
    {
        FluidConstants fc;
        fc.MM = V_R8(&results.GetVariantAt(COPropsConst::MMOL_ID * _numCompounds + i)); // result is expected in kg/mol (SI)!

        if(_socket->GetMaterialObject()->getLiquidPhasePossible())
        {
            fc.Tc = V_R8(&results.GetVariantAt(COPropsConst::TCRIT_ID * _numCompounds + i));
            fc.pc = V_R8(&results.GetVariantAt(COPropsConst::PCRIT_ID * _numCompounds + i));
        }
        this->_fluidConstants.push_back(fc);
    }

    // set molar mass of material object (mixtures: temporarily set to molar mass of first compound, total/average is calculated in setSubstanceProperties())
    _socket->GetMaterialObject()->setMM(_fluidConstants[0].MM);

    // TODO: Get the other constants using a flash
    /*
    this->doFlash(this->_fluidConstants.pc, this->_fluidConstants.Tc,
                  COPropsOverall::PRESSURE, COPropsOverall::TEMPERATURE,
                  COFlashTypes::TP);
    this->doCalcOverall();
    this->getPropOverall(COPropsOverall::DENSITY, this->_fluidConstants.dc);
    this->getPropOverall(COPropsOverall::ENTHALPY, this->_fluidConstants.hc);
    this->getPropOverall(COPropsOverall::ENTROPY, this->_fluidConstants.sc);
    */
}
开发者ID:jwindahlModelon,项目名称:MultiPhaseMixtureMedia,代码行数:63,代码来源:CapeOpenCalculator.cpp


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