Exemplo n.º 1
0
bool CLyapTask::process(const bool & useInitialValues)
{
  if (useInitialValues)
    {
      mpContainer->applyInitialValues();
    }

  output(COutputInterface::BEFORE);

  //  bool flagProceed = true;
  mPercentage = 0;

  if (mpCallBack)
    {
      mpCallBack->setName("performing lyapunov exponent calculation...");
      C_FLOAT64 hundred = 100;
      mhProcess = mpCallBack->addItem("Completion",
                                      mPercentage,
                                      &hundred);
    }

  try
    {
      mpLyapMethod->calculate();
    }
  catch (CCopasiException & Exception)
    {
      //mpLyapProblem->getModel()->setState(*mpCurrentState);
      mpContainer->updateSimulatedValues(true);

      calculationsBeforeOutput();
      output(COutputInterface::DURING);

      if (mpCallBack) mpCallBack->finishItem(mhProcess);

      output(COutputInterface::AFTER);

      throw CCopasiException(Exception.getMessage());
    }

  if (mpCallBack) mpCallBack->finishItem(mhProcess);

  calculationsBeforeOutput();
  output(COutputInterface::AFTER);

  mResultAvailable = true;
  mResultHasDivergence = mpLyapProblem->divergenceRequested();
  mModelVariablesInResult = mpContainer->getState(true).size() - mpContainer->getCountFixedEventTargets() - 1;
  mNumExponentsCalculated = mpLyapProblem->getExponentNumber();

  return true;
}
Exemplo n.º 2
0
bool CLyapTask::methodCallback(const C_FLOAT64 & percentage, bool onlyProgress)
{
  if (!onlyProgress)
    {
      calculationsBeforeOutput();
      output(COutputInterface::DURING);
    }

  mPercentage = percentage;

  if (mpCallBack)
    {
      return mpCallBack->progressItem(mhProcess);
    }

  return true;
}