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


C++ Plugin::execute方法代码示例

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


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

示例1: calculateChiSquare

void lmWorker::calculateChiSquare()
{
    //Calculate ChiSquare(s)
    TelluriumData& modelData    = *(TelluriumData*) mTheHost.mModelData.getValuePointer();
    TelluriumData& obsData      = *(TelluriumData*) mTheHost.mExperimentalData.getValuePointer();
    
    Plugin* chi = mTheHost.mPM->getPlugin("tel_chisquare");

    if(!chi)
    {
        throw(Exception("Failed to get chisquare plugin in lmfit plugin"));
    }

    Property<TelluriumData>* para =  dynamic_cast<Property<TelluriumData>*>(chi->getProperty("ExperimentalData"));
    para->setValue(obsData);

    para =  dynamic_cast<Property<TelluriumData>*>(chi->getProperty("ModelData"));
    para->setValue(modelData);

    Property<int>* intPara =  dynamic_cast< Property<int>* >(chi->getProperty("NrOfModelParameters"));
    intPara->setValue(mLMData.nrOfParameters);

    //Calculate Chi square
    chi->execute();

    Property<double>* chiSquare =  dynamic_cast< Property<double>* >(chi->getProperty("ChiSquare"));
    Property<double>* rChiSquare =  dynamic_cast< Property<double>* >(chi->getProperty("ReducedChiSquare"));

    mTheHost.mChiSquare.setValue(chiSquare->getValue());
    mTheHost.mReducedChiSquare.setValue(rChiSquare->getValue());

    Log(lInfo)<<"Chi Square = "<<chiSquare->getValue();
    Log(lInfo)<<"Reduced Chi Square = "<<rChiSquare->getValue();
}
开发者ID:alexdarling,项目名称:telPlugins,代码行数:34,代码来源:lmWorker.cpp

示例2: getChi

double nmWorker::getChi(const Properties& parameters)
{
    Log(lDebug)<<"Getting chisquare using parameters: "<<parameters;
    //Reset RoadRunner
    mHost.mRRI->reset();

    for(int i = 0; i < parameters.count(); i++)
    {
        Property<double> *para = (Property<double>*) (parameters[i]);
        mHost.mRRI->setValue(para->getName(), para->getValue());
    }

    TelluriumData* expData = (TelluriumData*) mHost.mExperimentalData.getValueHandle();
    rr::SimulateOptions options;
    options.start       = expData->getTimeStart();
    options.duration    = expData->getTimeEnd() - expData->getTimeStart();
    options.steps       = expData->rSize() - 1;

    options.flags = options.flags | rr::SimulateOptions::RESET_MODEL;

    rr::RoadRunnerData *modelData = NULL;
    if(mHost.mRRI->simulate(&options))
    {
        modelData = mHost.mRRI->getSimulationResult();
    }

    TelluriumData& obsData      = *(TelluriumData*) mHost.mExperimentalData.getValuePointer();
    Plugin* chi                 = mHost.mPM->getPlugin("tel_chisquare");

    Property<TelluriumData>* para =  dynamic_cast<Property<TelluriumData>*>(chi->getProperty("ExperimentalData"));
    para->setValue(obsData);

    para =  dynamic_cast<Property<TelluriumData>*>(chi->getProperty("ModelData"));
    para->setValue(TelluriumData(*(modelData)));

    Property<int>* intPara =  dynamic_cast< Property<int>* >(chi->getProperty("NrOfModelParameters"));
    intPara->setValue(getNumberOfParameters());

    //Calculate Chi square
    chi->execute();
    Property<double>* chiSquare =  dynamic_cast< Property<double>* >(chi->getProperty("ChiSquare"));
    return chiSquare->getValue();
}
开发者ID:alexdarling,项目名称:telPlugins,代码行数:43,代码来源:nmWorker.cpp

示例3: execute

bool TestModel::execute(bool inThread)
{
    Log(lDebug)<<"Executing the TestModel plugin by Totte Karlsson";
    RoadRunner rr;
    rr.load(mModel);

    rr::SimulateOptions opt;
    opt.start       = 0;
    opt.duration    = 10;
    opt.steps       = 14;

    TelluriumData data(rr.simulate(&opt));
    mTestData.setValue(data);

    //Add noise
    const PluginManager* PM = this->getPluginManager();
    Plugin* noise = PM->getPlugin("AddNoise");

    if(!noise)
    {
        stringstream msg;
        msg<<"The TestModel plugin dependes on the AddNoise plugin, which is not yet loaded.";

        throw(Exception(msg.str()));

    }
    mTestDataWithNoise.setValue(mTestData.getValue());

    noise->setPropertyValue("Sigma", mSigma.getValueHandle());
    noise->setPropertyValue("InputData", mTestDataWithNoise.getValueHandle());
    noise->execute();

    mTestDataWithNoise.setValue(noise->getPropertyValueHandle("InputData"));

    //Add weights
    addWeights();
    return true;
}
开发者ID:mgaldzic,项目名称:telPlugins,代码行数:38,代码来源:TestModel.cpp

示例4: main

int main()
{
	try
    {
    //Create a RoadRunner object
	RoadRunner rr("r:\\installs\\cg\\xe3\\debug\\rr_support");

    //Get the plugin manager
    PluginManager& plugins = rr.getPluginManager();

    if(!plugins.load())
    {
    	clog<<"Failed loading plugins..\n";
    }

    if(plugins.getNumberOfPlugins() > 0)
    {
    	cout<<"The following plugins are loaded:\n";
        for(int i = 0; i < plugins.getNumberOfPlugins(); i++)
        {
        	Plugin* aPlugin = plugins[i];
            cout<<"Plugin "<<i<<": "<<aPlugin->getName()<<"\n";
            cout<<aPlugin->getInfo();
            aPlugin->execute();
        }
    }

    plugins.unload();
    Pause(true);
    rr.~RoadRunner();
    }
    catch(const rr::Exception& ex)
    {
    	clog<<"There was a problem: "<<ex.what();
    }
	return 0;
}
开发者ID:AngeloTorelli,项目名称:CompuCell3D,代码行数:37,代码来源:pluginChecker.cpp


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