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


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

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


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

示例1: BaseCalculator

CapeOpenCalculator::CapeOpenCalculator(const MaterialCalculatorSetup* setupInfo)
                  : BaseCalculator(setupInfo)
{
    // Get the property package name from the library name
    string packageName = _libraryName.substr(_libraryName.find(".")+1);

    if (packageName.find("StanMix")     != string::npos ||
        packageName.find("PCP-SAFT")    != string::npos ||
        packageName.find("TPSI")        != string::npos ||
        packageName.find("vThermo")     != string::npos ||
        packageName.find("GasMix")      != string::npos ||
        packageName.find("IF97")        != string::npos ||
        packageName.find("RefProp")     != string::npos)
    {
        warningMessage("CapeOpenCalculator", "Calculation of properties under "
                       "specific phases is not supported by this property "
                       "package. The returned values will be an average over "
                       "the present phases.\n");
    }

    // Get the property package by its name
    LPDISPATCH pack;
    HRESULT hr = ppm->getPropertyPackage(packageName, &pack);
    if (FAILED(hr))
    {
        errorMessage("CapeOpenCalculator", "Unable to load the specified "
                     "property package.\nCAPE-OPEN error:\n\t%s",
                     COUtilities::GetCOErrorAsString(pack, hr).c_str());
        return;
    }

    // The socket handles the property package from here.
    _socket = new CapeOpenSocket_1_0(pack);
    pack->Release();

    // Set the substance on the material object
    CVariant compIds;
    compIds.MakeArray(_numCompounds, VT_BSTR);
    compIds.SetStringAt(0, _bstr_t(setupInfo->compounds));

    for(int i = 0; i < _numCompounds; ++i)
    {
        compIds.SetStringAt(i, _bstr_t(_compounds[i].c_str()));
    }

    // set component ids of material object
    _socket->GetMaterialObject()->setComponentIds(compIds.Value());

    // Get the phase ids in order to determine which constants should be available
    CVariant phaseNames;
    //phaseNames.MakeArray(COPhases1Ph::Count, VT_R8);
    _socket->GetSupportedPhases(phaseNames);

    _socket->GetMaterialObject()->setVaporPhasePossible(false);
    _socket->GetMaterialObject()->setLiquidPhasePossible(false);
    _socket->GetMaterialObject()->setSolidPhasePossible(false);

    std::wstring error;
    if (phaseNames.CheckArray(VT_BSTR, error))
    {
        // Add the packages to the list.
        for (int i = 0; i < phaseNames.GetCount(); ++i)
        {
            BSTR phaseName = phaseNames.GetStringAt(i);

            if(lstrcmpi(phaseName, COPhases1Ph::VAPOR) == 0)
                _socket->GetMaterialObject()->setVaporPhasePossible(true);
            if(lstrcmpi(phaseName, COPhases1Ph::LIQUID) == 0)
                _socket->GetMaterialObject()->setLiquidPhasePossible(true);
            if(lstrcmpi(phaseName, COPhases1Ph::SOLID) == 0)
                _socket->GetMaterialObject()->setSolidPhasePossible(true);
        }
    }

    // set the fluid constants
    this->setSubstanceConstants();
}
开发者ID:jwindahlModelon,项目名称:MultiPhaseMixtureMedia,代码行数:77,代码来源:CapeOpenCalculator.cpp


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