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


C++ ObjRef::algebraicIndexCount方法代码示例

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


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

示例1: requiredMemory

double SingleCellViewSimulation::requiredMemory()
{
    // Determine and return the amount of required memory to run our simulation
    // Note #1: we return the amount as a double rather than a qulonglong (as we
    //          do when retrieving the total/free amount of memory available;
    //          see [OpenCOR]/src/plugins/misc/Core/src/coreutils.cpp) in case a
    //          simulation requires an insane amount of memory...
    // Note #2: the 1 is for mPoints in SingleCellViewSimulationResults...

    iface::cellml_services::CellMLCompiledModel*
        compModel(mData->isDAETypeSolver() ?
                  static_cast<iface::cellml_services::CellMLCompiledModel*>
                  (mRuntime->daeCompiledModel()) :
                  static_cast<iface::cellml_services::CellMLCompiledModel*>
                  (mRuntime->odeCompiledModel()));
    ObjRef<iface::cellml_services::CodeInformation> codeInfo
        (compModel->codeInformation());

    // This is not very accurate at all, because the solver caches a lot more
    // information about the problem being solved, some of it bigger than any
    // of the below (e.g. Jacobian matricies. Given the solver dependence of
    // this size, I'm not sure this function is that useful.
    return 
        size() *
        (1 + codeInfo->constantIndexCount() + codeInfo->rateIndexCount() * 3 +
         codeInfo->algebraicIndexCount())
        * sizeof(double);
}
开发者ID:A1kmm,项目名称:opencor,代码行数:28,代码来源:singlecellviewsimulation.cpp

示例2: startNextRepeat

void SingleCellViewSimulationData::startNextRepeat()
{
    mCurrentRepeat++;
    if (mCurrentRepeat >= solverProperties()["nrepeats"].toInt()) {
        emit simulationComplete();
        return;
    }

    if (mCurrentRepeat == 0)
      mStatesWhenRun = mStates;
    else
      mStates = mStatesWhenRun;

    newIntegrationRun();

    if (!mIntegrationRun)
        return;

    mState = SingleCellViewSimulationData::SIMSTATE_WAITING_RESULTS;

    iface::cellml_services::CellMLCompiledModel*
        compModel(isDAETypeSolver() ?
                  static_cast<iface::cellml_services::CellMLCompiledModel*>
                  (mRuntime->daeCompiledModel()) :
                  static_cast<iface::cellml_services::CellMLCompiledModel*>
                  (mRuntime->odeCompiledModel()));
    ObjRef<iface::cellml_services::CodeInformation> codeInfo
        (compModel->codeInformation());

    mResultReceiver = new ResultListener(mIntegrationRun, codeInfo->rateIndexCount(),
                                         codeInfo->algebraicIndexCount());
    mResultReceiver->delay(mDelay);

    mIntegrationRun->setStepSizeControl(mSolverProperties["absTol"].toDouble(),
                                        mSolverProperties["relTol"].toDouble(),
                                        1.0, // Scaling factor: states
                                        1.0, // Scaling factor: rates
                                        mSolverProperties["maxStep"].toDouble());
    mIntegrationRun->setResultRange(mStartingPoint, mEndingPoint,
                                    10000.0 // Maximum density of points in bvar, as an upper bound on the number
                                            // of points returned.
                                   );
    mIntegrationRun->setProgressObserver(mResultReceiver);

    QObject::connect(mResultReceiver, SIGNAL(constantsAvailable(const QList<double>)), this, SIGNAL(constantsAvailable(const QList<double>)));
    QObject::connect(mResultReceiver, SIGNAL(solveDone()), this, SLOT(startNextRepeat()));
    QObject::connect(mResultReceiver, SIGNAL(solveFailure(QString)), this, SIGNAL(simulationFailed(QString)));
    QObject::connect(mResultReceiver, SIGNAL(solvePointAvailable(double,QList<double>,QList<double>,QList<double>)), this, SIGNAL(simulationDataAvailable(double,QList<double>,QList<double>,QList<double>)));

    setupOverrides();
    mIntegrationRun->start();
}
开发者ID:A1kmm,项目名称:opencor,代码行数:52,代码来源:singlecellviewsimulation.cpp

示例3: generateCodeForModel


//.........这里部分代码省略.........
             << "double asinh(double x);\n"
             << "double acos(double x);\n"
             << "double acosh(double x);\n"
             << "double asin(double x);\n"
             << "double asinh(double x);\n"
             << "double atan(double x);\n"
             << "double atanh(double x);\n"
             << "double ceil(double x);\n"
             << "double cos(double x);\n"
             << "double cosh(double x);\n"
             << "double tan(double x);\n"
             << "double tanh(double x);\n"
             << "double sin(double x);\n"
             << "double sinh(double x);\n"
             << "double exp(double x);\n"
             << "double floor(double x);\n"
             << "double pow(double x, double y);\n"
             << "double factorial(double x);\n"
             << "double log(double x);\n"
             << "double arbitrary_log(double x, double base);\n"
             << "double gcd_pair(double a, double b);\n"
             << "double lcm_pair(double a, double b);\n"
             << "double gcd_multi(unsigned int size, ...);\n"
             << "double lcm_multi(unsigned int size, ...);\n"
             << "double multi_min(unsigned int size, ...);\n"
             << "double multi_max(unsigned int size, ...);\n"
             << "void NR_MINIMISE(double(*func)"
                "(double VOI, double *C, double *R, double *S, double *A),"
                "double VOI, double *C, double *R, double *S, double *A, "
                "double *V);\n";
        std::wstring frag = cci->functionsString();
        code << ws2s(frag);

        int nAlgebraic = cci->algebraicIndexCount();
        int nConstants = cci->constantIndexCount();

        code << "\n\nvoid csim_rhs_routine(double VOI, double* CSIM_STATE, double* CSIM_RATE, double* CSIM_OUTPUT, "
             << "double* CSIM_INPUT)\n{\n\n"
             << "double DUMMY_ASSIGNMENT;\n"
             << "double CONSTANTS["
             << nConstants
             << "], ALGEBRAIC["
             << nAlgebraic
             << "];\n\n";

        /* initConsts - all variables which aren't state variables but have
         *              an initial_value attribute, and any variables & rates
         *              which follow.
         */
        code << ws2s(cci->initConstsString());

        /* rates      - All rates which are not static.
         */
        code << ws2s(cci->ratesString());

        /* variables  - All variables not computed by initConsts or rates
         *  (i.e., these are not required for the integration of the model and
         *   thus only need to be called for output or presentation or similar
         *   purposes)
         */
        code << ws2s(cci->variablesString());

        // add in the setting of any outputs that are not already defined
        for (unsigned int i=0; i < capi->cevas->length(); i++)
        {
            ObjRef<iface::cellml_services::ConnectedVariableSet> cvs = capi->cevas->getVariableSet(i);
开发者ID:nickerso,项目名称:csim,代码行数:67,代码来源:cellml_model_definition.cpp

示例4: initialValuesIn

void SingleCellViewSimulationData::initialValuesIn()
{
    iface::cellml_services::CellMLCompiledModel*
        compModel(isDAETypeSolver() ?
                  static_cast<iface::cellml_services::CellMLCompiledModel*>
                  (mRuntime->daeCompiledModel()) :
                  static_cast<iface::cellml_services::CellMLCompiledModel*>
                  (mRuntime->odeCompiledModel()));
    ObjRef<iface::cellml_services::CodeInformation> codeInfo
        (compModel->codeInformation());

    mState = SingleCellViewSimulationData::SIMSTATE_GOT_IV;

    if (mDidReset)
    {
      mInitialConstants.clear();
      mInitialConstants.reserve(codeInfo->constantIndexCount());
      mInitialStates.clear();
      mInitialStates.reserve(codeInfo->rateIndexCount());
    }

    mConstants.clear();
    mConstants.reserve(codeInfo->constantIndexCount());

    std::cout << "Computed " << mIVGrabber->consts().size() << " constants and "
              << mIVGrabber->states().size() << " initial values." << std::endl;
        

    for (std::vector<double>::iterator i = mIVGrabber->consts().begin();
         i != mIVGrabber->consts().end(); i++) {
        if (mDidReset)
            mInitialConstants << *i;
        mConstants << *i;
    }

    std::vector<double>& computedData = mIVGrabber->states();
    mStates.clear();
    mStates.reserve(codeInfo->rateIndexCount());
    for (unsigned int i = 0; i < codeInfo->rateIndexCount(); i++) {
        double v = computedData[1 + i];
        if (mDidReset)
            mInitialStates << v;
        mStates << v;
    }

    mRates.clear();
    mRates.reserve(codeInfo->rateIndexCount());
    const unsigned int rateOffset = codeInfo->rateIndexCount() + 1;
    for (unsigned int i = 0; i < codeInfo->rateIndexCount(); i++) {
      mRates << computedData[rateOffset + i];
    }
    
    mAlgebraic.clear();
    mAlgebraic.reserve(codeInfo->algebraicIndexCount());
    const unsigned int algebraicOffset = codeInfo->rateIndexCount() * 2 + 1;
    for (unsigned int i = 0; i < codeInfo->algebraicIndexCount(); i++) {
      mAlgebraic << computedData[algebraicOffset + i];
    }

    emit updated();
    emit modified(this, !mDidReset);
}
开发者ID:A1kmm,项目名称:opencor,代码行数:62,代码来源:singlecellviewsimulation.cpp


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