Ejemplo n.º 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;
}
Ejemplo n.º 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;
}
Ejemplo n.º 3
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;
}