コード例 #1
0
bool CQTrajectoryWidget::loadTask()
{
  CTrajectoryTask * pTask =
    dynamic_cast< CTrajectoryTask * >(mpTask);

  if (!pTask) return false;

  loadCommon();
  loadMethod();

  showUnits();

  CTrajectoryProblem* TrajectoryProblem =
    dynamic_cast<CTrajectoryProblem *>(pTask->getProblem());
  assert(TrajectoryProblem);

  pdelete(mpTrajectoryProblem);

  mpTrajectoryProblem = new CTrajectoryProblem(*TrajectoryProblem, NO_PARENT);

  //numbers
  mpEditIntervalSize->setText(QString::number(TrajectoryProblem->getStepSize()));
  mpEditIntervals->setText(QString::number(TrajectoryProblem->getStepNumber()));
  mpEditDuration->setText(QString::number(TrajectoryProblem->getDuration()));
  mpCheckAutomaticInterval->setChecked(TrajectoryProblem->getAutomaticStepSize());

  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
  C_FLOAT64 InitialTime = CCopasiRootContainer::getDatamodelList()->operator[](0).getModel()->getInitialTime();

  bool Delayed;

  if (TrajectoryProblem->getStepSize() > 0.0)
    Delayed = (TrajectoryProblem->getOutputStartTime() - InitialTime) > std::numeric_limits< C_FLOAT64 >::min();
  else
    Delayed = (InitialTime - TrajectoryProblem->getOutputStartTime()) > std::numeric_limits< C_FLOAT64 >::min();

  mpCheckDelay->setChecked(Delayed);
  mpEditDelay->setEnabled(Delayed);

  mpEditDelay->setText(QString::number(TrajectoryProblem->getOutputStartTime()));

  mpCheckOutputEvent->setChecked(TrajectoryProblem->getOutputEvent());
  mpCheckContinueEvents->setChecked(TrajectoryProblem->getContinueSimultaneousEvents());
  mpCheckStartInSteadyState->setChecked(TrajectoryProblem->getStartInSteadyState());

  //store time series checkbox
  mpCheckSave->setChecked(TrajectoryProblem->timeSeriesRequested());

  checkTimeSeries();

  updateIntervals();

  mpValidatorDuration->saved();
  mpValidatorIntervalSize->saved();
  mpValidatorIntervals->saved();
  mpValidatorDelay->saved();
  return true;
}
コード例 #2
0
bool CQTrajectoryWidget::loadTask()
{
    CTrajectoryTask * pTask =
        dynamic_cast< CTrajectoryTask * >(mpTask);

    if (!pTask) return false;

    loadCommon();
    loadMethod();

    showUnits();

    CTrajectoryProblem* trajectoryproblem =
        dynamic_cast<CTrajectoryProblem *>(pTask->getProblem());
    assert(trajectoryproblem);

    pdelete(mpTrajectoryProblem);
    mpTrajectoryProblem = new CTrajectoryProblem(*trajectoryproblem);

    //numbers
    mpEditIntervalSize->setText(QString::number(trajectoryproblem->getStepSize()));
    mpEditIntervals->setText(QString::number(trajectoryproblem->getStepNumber()));
    mpEditDuration->setText(QString::number(trajectoryproblem->getDuration()));

    assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
    C_FLOAT64 InitialTime = (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getInitialTime();

    bool Delayed;

    if (trajectoryproblem->getStepSize() > 0.0)
        Delayed = (trajectoryproblem->getOutputStartTime() - InitialTime) > DBL_MIN;
    else
        Delayed = (InitialTime - trajectoryproblem->getOutputStartTime()) > DBL_MIN;

    mpCheckDelay->setChecked(Delayed);
    mpEditDelay->setEnabled(Delayed);

    mpEditDelay->setText(QString::number(trajectoryproblem->getOutputStartTime()));

    //store time series checkbox
    mpCheckSave->setChecked(trajectoryproblem->timeSeriesRequested());

    checkTimeSeries();

    updateIntervals();

    mpValidatorDuration->saved();
    mpValidatorIntervalSize->saved();
    mpValidatorIntervals->saved();
    mpValidatorDelay->saved();
    return true;
}
コード例 #3
0
ファイル: CSEDMLExporter.cpp プロジェクト: cpanchal/COPASI
/**
 * Creates the simulations for SEDML.
 */
std::string CSEDMLExporter::createTimeCourseTask(CCopasiDataModel& dataModel, const std::string & modelId)
{
  mpTimecourse = this->mpSEDMLDocument->createUniformTimeCourse();
  mpTimecourse->setId(SEDMLUtils::getNextId("sim", mpSEDMLDocument->getNumSimulations()));
  //presently SEDML only supports time course
  CCopasiTask* pTask = (*dataModel.getTaskList())["Time-Course"];
  CTrajectoryProblem* tProblem = static_cast<CTrajectoryProblem*>(pTask->getProblem());
  mpTimecourse->setInitialTime(0.0);
  mpTimecourse->setOutputStartTime(tProblem->getOutputStartTime());
  mpTimecourse->setOutputEndTime(tProblem->getStepNumber()*tProblem->getStepSize());
  mpTimecourse->setNumberOfPoints(tProblem->getStepNumber());

  // set the correct KISAO Term
  SedAlgorithm* alg = mpTimecourse->createAlgorithm();

  if (pTask->getMethod()->getObjectName().find("Stochastic") != std::string::npos)
    alg->setKisaoID("KISAO:0000241");
  else
    alg->setKisaoID("KISAO:0000019");

  mpTimecourseTask = this->mpSEDMLDocument->createTask();
  std::string taskId = SEDMLUtils::getNextId("task", mpSEDMLDocument->getNumTasks());
  mpTimecourseTask->setId(taskId);
  mpTimecourseTask->setSimulationReference(mpTimecourse->getId());
  mpTimecourseTask->setModelReference(modelId);

  return taskId;
}
コード例 #4
0
bool CQTrajectoryWidget::saveTask()
{
    CTrajectoryTask * pTask =
        dynamic_cast< CTrajectoryTask * >(mpTask);

    if (!pTask) return false;

    saveCommon();
    saveMethod();

    CTrajectoryProblem* trajectoryproblem =
        dynamic_cast<CTrajectoryProblem *>(pTask->getProblem());
    assert(trajectoryproblem);

    //numbers
    if (mpEditIntervalSize->hasAcceptableInput() &&
            trajectoryproblem->getStepSize() != mpEditIntervalSize->text().toDouble())
    {
        trajectoryproblem->setStepSize(mpEditIntervalSize->text().toDouble());
        mChanged = true;
    }
    else if (mpEditIntervals->hasAcceptableInput() &&
             trajectoryproblem->getStepNumber() != mpEditIntervals->text().toULong())
    {
        trajectoryproblem->setStepNumber(mpEditIntervals->text().toLong());
        mChanged = true;
    }

    if (mpEditDuration->hasAcceptableInput() &&
            trajectoryproblem->getDuration() != mpEditDuration->text().toDouble())
    {
        trajectoryproblem->setDuration(mpEditDuration->text().toDouble());
        mChanged = true;
    }

    C_FLOAT64 StartTime = mpEditDelay->text().toDouble();

    if (mpCheckDelay->isChecked())
    {
        if (mpEditDelay->hasAcceptableInput() &&
                StartTime != trajectoryproblem->getOutputStartTime())
        {
            trajectoryproblem->setOutputStartTime(StartTime);
            mChanged = true;
        }
    }
    else
    {
        assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
        C_FLOAT64 InitialTime =
            (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getInitialTime();

        if (trajectoryproblem->getStepSize() > 0.0)
        {
            if (StartTime > InitialTime)
            {
                trajectoryproblem->setOutputStartTime(InitialTime);
                mChanged = true;
            }
        }
        else
        {
            if (StartTime < InitialTime)
            {
                trajectoryproblem->setOutputStartTime(InitialTime);
                mChanged = true;
            }
        }
    }

    if (trajectoryproblem->timeSeriesRequested() != mpCheckSave->isChecked())
    {
        trajectoryproblem->setTimeSeriesRequested(mpCheckSave->isChecked());
        mChanged = true;
    }

    mpValidatorDuration->saved();
    mpValidatorIntervalSize->saved();
    mpValidatorIntervals->saved();
    mpValidatorDelay->saved();
    return true;
}