COPASI API  4.16.103
Public Slots | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CQTrajectoryWidget Class Reference

#include <CQTrajectoryWidget.h>

Inheritance diagram for CQTrajectoryWidget:
Inheritance graph
[legend]
Collaboration diagram for CQTrajectoryWidget:
Collaboration graph
[legend]

Public Slots

void slotDuration ()
 
void slotIntervals ()
 
void slotIntervalSize ()
 
void slotOutputDelay (bool checked)
 
void updateIntervals ()
 
- Public Slots inherited from TaskWidget
void adjustTable ()
 
void slotFinishThread ()
 

Public Member Functions

 CQTrajectoryWidget (QWidget *parent=0, const char *name=0)
 
virtual bool runTask ()
 
virtual bool update (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
 
virtual ~CQTrajectoryWidget ()
 
- Public Member Functions inherited from TaskWidget
CCopasiTaskgetTask ()
 
virtual bool leave ()
 
 TaskWidget (QWidget *parent=0, const char *name=0, Qt::WFlags fl=0)
 
 ~TaskWidget ()
 
- Public Member Functions inherited from CopasiWidget
 CopasiWidget (QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
 
bool enter (const std::string &key)
 
CCopasiDataModelgetDataModel ()
 
bool getIgnoreUpdates ()
 
virtual void setFramework (int framework)
 
void setIgnoreUpdates (bool v)
 

Protected Member Functions

virtual CCopasiMethodcreateMethod (const CCopasiMethod::SubType &type)
 
virtual bool loadTask ()
 
virtual bool saveTask ()
 
virtual bool taskFinishedEvent ()
 
- Protected Member Functions inherited from TaskWidget
bool commonAfterRunTask ()
 
bool commonBeforeRunTask ()
 
bool commonRunTask ()
 
virtual bool enterProtected ()
 
void finishTask ()
 
bool loadCommon ()
 
bool loadMethod ()
 
bool saveCommon ()
 
bool saveMethod ()
 

Private Member Functions

void checkTimeSeries ()
 
void destroy ()
 
void init ()
 
void showUnits ()
 

Private Attributes

CTrajectoryProblemmpTrajectoryProblem
 
CQValidatorDoublempValidatorDelay
 
CQValidatorDoublempValidatorDuration
 
CQValidatorIntmpValidatorIntervals
 
CQValidatorDoublempValidatorIntervalSize
 

Additional Inherited Members

- Protected Slots inherited from TaskWidget
void assistantBtnClicked ()
 
void reportBtnClicked ()
 
void revertBtnClicked ()
 
void runBtnClicked ()
 
- Protected Slots inherited from CopasiWidget
virtual bool protectedNotify (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 
- Protected Attributes inherited from TaskWidget
bool mChanged
 
CQTaskBtnWidgetmpBtnWidget
 
CQTaskHeaderWidgetmpHeaderWidget
 
CCopasiMethodmpMethod
 
QGridLayout * mpMethodLayout
 
CQTaskMethodWidgetmpMethodWidget
 
CProgressBarmProgressBar
 
QSpacerItem * mpSpacer1
 
QSpacerItem * mpSpacer2
 
CCopasiTaskmpTask
 
CQTaskThreadmpTaskThread
 
- Protected Attributes inherited from CopasiWidget
int mFramework
 
bool mIgnoreUpdates
 
std::string mKey
 
CCopasiDataModelmpDataModel
 
ListViewsmpListView
 
CCopasiObjectmpObject
 

Detailed Description

Definition at line 34 of file CQTrajectoryWidget.h.

Constructor & Destructor Documentation

CQTrajectoryWidget::CQTrajectoryWidget ( QWidget *  parent = 0,
const char *  name = 0 
)

Definition at line 39 of file CQTrajectoryWidget.cpp.

References init().

40  : TaskWidget(parent, name)
41 {
42  setupUi(this);
43 
44  init();
45 }
TaskWidget(QWidget *parent=0, const char *name=0, Qt::WFlags fl=0)
Definition: TaskWidget.cpp:52
CQTrajectoryWidget::~CQTrajectoryWidget ( )
virtual

Definition at line 50 of file CQTrajectoryWidget.cpp.

References destroy().

51 {
52  destroy();
53  // no need to delete child widgets, Qt does it all for us
54 }

Member Function Documentation

void CQTrajectoryWidget::checkTimeSeries ( )
private

Definition at line 358 of file CQTrajectoryWidget.cpp.

References CCopasiRootContainer::getDatamodelList(), and TSMAX.

Referenced by loadTask(), runTask(), slotDuration(), slotIntervals(), and slotIntervalSize().

359 {
360  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
361 
362  if (mpEditIntervals->text().toLong() * (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getStateTemplate().getNumVariable() > TSMAX)
363  {
364  mpCheckSave->setChecked(false);
365  mpCheckSave->setEnabled(false);
366  }
367  else
368  {
369  mpCheckSave->setEnabled(true);
370  }
371 }
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
#define TSMAX
CCopasiMethod * CQTrajectoryWidget::createMethod ( const CCopasiMethod::SubType type)
protectedvirtual

Implements TaskWidget.

Definition at line 324 of file CQTrajectoryWidget.cpp.

References CTrajectoryMethod::createMethod().

325 {
326  return CTrajectoryMethod::createMethod(type);
327 }
static CTrajectoryMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::deterministic)
void CQTrajectoryWidget::destroy ( )
private

Definition at line 88 of file CQTrajectoryWidget.cpp.

References mpTrajectoryProblem, and pdelete.

Referenced by ~CQTrajectoryWidget().

89 {
91 }
#define pdelete(p)
Definition: copasi.h:215
CTrajectoryProblem * mpTrajectoryProblem
void CQTrajectoryWidget::init ( )
private

Definition at line 56 of file CQTrajectoryWidget.cpp.

References max, TaskWidget::mpBtnWidget, TaskWidget::mpHeaderWidget, TaskWidget::mpMethodWidget, mpTrajectoryProblem, mpValidatorDelay, mpValidatorDuration, mpValidatorIntervals, mpValidatorIntervalSize, CQValidatorDouble::setRange(), CQValidatorInt::setRange(), CQTaskHeaderWidget::setTaskName(), CQTaskMethodWidget::setValidMethods(), CQTaskMethodWidget::showMethodParameters(), slotOutputDelay(), and CTrajectoryTask::ValidMethods.

Referenced by CQTrajectoryWidget().

57 {
58  mpTrajectoryProblem = NULL;
59 
60  mpHeaderWidget->setTaskName("Time Course");
61 
62  verticalLayout->insertWidget(0, mpHeaderWidget); // header
63  // verticalLayout->insertSpacing(1, 14); // space between header and body
64 
67  verticalLayout->addWidget(mpMethodWidget);
68 
69  verticalLayout->addWidget(mpBtnWidget); // 'footer'
70 
71  slotOutputDelay(false);
72 
73  mpValidatorDuration = new CQValidatorDouble(mpEditDuration);
74  mpEditDuration->setValidator(mpValidatorDuration);
75 
76  mpValidatorIntervalSize = new CQValidatorDouble(mpEditIntervalSize);
78  mpEditIntervalSize->setValidator(mpValidatorIntervalSize);
79 
80  mpValidatorIntervals = new CQValidatorInt(mpEditIntervals);
82  mpEditIntervals->setValidator(mpValidatorIntervals);
83 
84  mpValidatorDelay = new CQValidatorDouble(mpEditDelay);
85  mpEditDelay->setValidator(mpValidatorDelay);
86 }
CQValidatorDouble * mpValidatorDelay
static const unsigned int ValidMethods[]
CQValidatorInt * mpValidatorIntervals
CQValidatorDouble * mpValidatorDuration
CQValidatorDouble * mpValidatorIntervalSize
CTrajectoryProblem * mpTrajectoryProblem
bool setTaskName(const std::string &name)
void showMethodParameters(const bool &show)
CQTaskMethodWidget * mpMethodWidget
Definition: TaskWidget.h:123
CQTaskBtnWidget * mpBtnWidget
Definition: TaskWidget.h:124
CQTaskHeaderWidget * mpHeaderWidget
Definition: TaskWidget.h:122
void setRange(const C_FLOAT64 &lowerBound, const C_FLOAT64 &upperBound)
Definition: CQValidator.cpp:80
void setRange(const int &lowerBound, const int &upperBound)
Definition: CQValidator.cpp:98
void slotOutputDelay(bool checked)
void setValidMethods(const unsigned int *validMethods)
#define max(a, b)
Definition: f2c.h:176
bool CQTrajectoryWidget::loadTask ( )
protectedvirtual

Implements TaskWidget.

Definition at line 268 of file CQTrajectoryWidget.cpp.

References C_FLOAT64, checkTimeSeries(), CTrajectoryProblem::getContinueSimultaneousEvents(), CCopasiRootContainer::getDatamodelList(), CTrajectoryProblem::getDuration(), CTrajectoryProblem::getOutputEvent(), CTrajectoryProblem::getOutputStartTime(), CCopasiTask::getProblem(), CTrajectoryProblem::getStepNumber(), CTrajectoryProblem::getStepSize(), TaskWidget::loadCommon(), TaskWidget::loadMethod(), min, TaskWidget::mpTask, mpTrajectoryProblem, mpValidatorDelay, mpValidatorDuration, mpValidatorIntervals, mpValidatorIntervalSize, pdelete, pTask, CQValidator< Type >::saved(), showUnits(), CTrajectoryProblem::timeSeriesRequested(), and updateIntervals().

269 {
271  dynamic_cast< CTrajectoryTask * >(mpTask);
272 
273  if (!pTask) return false;
274 
275  loadCommon();
276  loadMethod();
277 
278  showUnits();
279 
280  CTrajectoryProblem* trajectoryproblem =
281  dynamic_cast<CTrajectoryProblem *>(pTask->getProblem());
282  assert(trajectoryproblem);
283 
285  mpTrajectoryProblem = new CTrajectoryProblem(*trajectoryproblem);
286 
287  //numbers
288  mpEditIntervalSize->setText(QString::number(trajectoryproblem->getStepSize()));
289  mpEditIntervals->setText(QString::number(trajectoryproblem->getStepNumber()));
290  mpEditDuration->setText(QString::number(trajectoryproblem->getDuration()));
291 
292  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
293  C_FLOAT64 InitialTime = (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getInitialTime();
294 
295  bool Delayed;
296 
297  if (trajectoryproblem->getStepSize() > 0.0)
298  Delayed = (trajectoryproblem->getOutputStartTime() - InitialTime) > std::numeric_limits< C_FLOAT64 >::min();
299  else
300  Delayed = (InitialTime - trajectoryproblem->getOutputStartTime()) > std::numeric_limits< C_FLOAT64 >::min();
301 
302  mpCheckDelay->setChecked(Delayed);
303  mpEditDelay->setEnabled(Delayed);
304 
305  mpEditDelay->setText(QString::number(trajectoryproblem->getOutputStartTime()));
306 
307  mpCheckOutputEvent->setChecked(trajectoryproblem->getOutputEvent());
308  mpCheckContinueEvents->setChecked(trajectoryproblem->getContinueSimultaneousEvents());
309 
310  //store time series checkbox
311  mpCheckSave->setChecked(trajectoryproblem->timeSeriesRequested());
312 
313  checkTimeSeries();
314 
315  updateIntervals();
316 
321  return true;
322 }
CQValidatorDouble * mpValidatorDelay
#define pdelete(p)
Definition: copasi.h:215
CCopasiProblem * getProblem()
bool loadCommon()
Definition: TaskWidget.cpp:247
const unsigned C_INT32 & getStepNumber() const
bool loadMethod()
Definition: TaskWidget.cpp:284
CQValidatorInt * mpValidatorIntervals
CQValidatorDouble * mpValidatorDuration
CQValidatorDouble * mpValidatorIntervalSize
CTrajectoryProblem * mpTrajectoryProblem
CTSSATask * pTask
const C_FLOAT64 & getStepSize() const
virtual void saved() const
Definition: CQValidator.h:71
const C_FLOAT64 & getDuration() const
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CCopasiTask * mpTask
Definition: TaskWidget.h:130
const C_FLOAT64 & getOutputStartTime() const
bool timeSeriesRequested() const
#define C_FLOAT64
Definition: copasi.h:92
const bool & getContinueSimultaneousEvents() const
#define min(a, b)
Definition: f2c.h:175
const bool & getOutputEvent() const
bool CQTrajectoryWidget::runTask ( )
virtual

Implements TaskWidget.

Definition at line 329 of file CQTrajectoryWidget.cpp.

References checkTimeSeries(), TaskWidget::commonBeforeRunTask(), and TaskWidget::commonRunTask().

Referenced by SliderDialog::runTimeCourse().

330 {
331  checkTimeSeries();
332 
333  if (!commonBeforeRunTask()) return false;
334 
335  bool success = true;
336 
337  if (!commonRunTask()) success = false;
338 
339  return success;
340 }
bool commonRunTask()
Definition: TaskWidget.cpp:395
bool commonBeforeRunTask()
Definition: TaskWidget.cpp:317
bool CQTrajectoryWidget::saveTask ( )
protectedvirtual

Implements TaskWidget.

Definition at line 173 of file CQTrajectoryWidget.cpp.

References C_FLOAT64, CTrajectoryProblem::getContinueSimultaneousEvents(), CCopasiRootContainer::getDatamodelList(), CTrajectoryProblem::getDuration(), CTrajectoryProblem::getOutputEvent(), CTrajectoryProblem::getOutputStartTime(), CCopasiTask::getProblem(), CTrajectoryProblem::getStepNumber(), CTrajectoryProblem::getStepSize(), TaskWidget::mChanged, TaskWidget::mpTask, mpValidatorDelay, mpValidatorDuration, mpValidatorIntervals, mpValidatorIntervalSize, pTask, TaskWidget::saveCommon(), CQValidator< Type >::saved(), TaskWidget::saveMethod(), CTrajectoryProblem::setContinueSimultaneousEvents(), CTrajectoryProblem::setDuration(), CTrajectoryProblem::setOutputEvent(), CTrajectoryProblem::setOutputStartTime(), CTrajectoryProblem::setStepNumber(), CTrajectoryProblem::setStepSize(), CTrajectoryProblem::setTimeSeriesRequested(), and CTrajectoryProblem::timeSeriesRequested().

174 {
176  dynamic_cast< CTrajectoryTask * >(mpTask);
177 
178  if (!pTask) return false;
179 
180  saveCommon();
181  saveMethod();
182 
183  CTrajectoryProblem* trajectoryproblem =
184  dynamic_cast<CTrajectoryProblem *>(pTask->getProblem());
185  assert(trajectoryproblem);
186 
187  //numbers
188  if (mpEditIntervalSize->hasAcceptableInput() &&
189  trajectoryproblem->getStepSize() != mpEditIntervalSize->text().toDouble())
190  {
191  trajectoryproblem->setStepSize(mpEditIntervalSize->text().toDouble());
192  mChanged = true;
193  }
194  else if (mpEditIntervals->hasAcceptableInput() &&
195  trajectoryproblem->getStepNumber() != mpEditIntervals->text().toULong())
196  {
197  trajectoryproblem->setStepNumber(mpEditIntervals->text().toLong());
198  mChanged = true;
199  }
200 
201  if (mpEditDuration->hasAcceptableInput() &&
202  trajectoryproblem->getDuration() != mpEditDuration->text().toDouble())
203  {
204  trajectoryproblem->setDuration(mpEditDuration->text().toDouble());
205  mChanged = true;
206  }
207 
208  C_FLOAT64 StartTime = mpEditDelay->text().toDouble();
209 
210  if (mpCheckDelay->isChecked())
211  {
212  if (mpEditDelay->hasAcceptableInput() &&
213  StartTime != trajectoryproblem->getOutputStartTime())
214  {
215  trajectoryproblem->setOutputStartTime(StartTime);
216  mChanged = true;
217  }
218  }
219  else
220  {
221  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
222  C_FLOAT64 InitialTime =
223  (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getInitialTime();
224 
225  if (trajectoryproblem->getStepSize() > 0.0)
226  {
227  if (StartTime > InitialTime)
228  {
229  trajectoryproblem->setOutputStartTime(InitialTime);
230  mChanged = true;
231  }
232  }
233  else
234  {
235  if (StartTime < InitialTime)
236  {
237  trajectoryproblem->setOutputStartTime(InitialTime);
238  mChanged = true;
239  }
240  }
241  }
242 
243  if (trajectoryproblem->timeSeriesRequested() != mpCheckSave->isChecked())
244  {
245  trajectoryproblem->setTimeSeriesRequested(mpCheckSave->isChecked());
246  mChanged = true;
247  }
248 
249  if (trajectoryproblem->getOutputEvent() != mpCheckOutputEvent->isChecked())
250  {
251  trajectoryproblem->setOutputEvent(mpCheckOutputEvent->isChecked());
252  mChanged = true;
253  }
254 
255  if (trajectoryproblem->getContinueSimultaneousEvents() != mpCheckContinueEvents->isChecked())
256  {
257  trajectoryproblem->setContinueSimultaneousEvents(mpCheckContinueEvents->isChecked());
258  mChanged = true;
259  }
260 
265  return true;
266 }
CQValidatorDouble * mpValidatorDelay
bool saveMethod()
Definition: TaskWidget.cpp:308
CCopasiProblem * getProblem()
void setContinueSimultaneousEvents(const bool &continueSimultaneousEvents)
const unsigned C_INT32 & getStepNumber() const
bool saveCommon()
Definition: TaskWidget.cpp:258
CQValidatorInt * mpValidatorIntervals
void setDuration(const C_FLOAT64 &duration)
CQValidatorDouble * mpValidatorDuration
CQValidatorDouble * mpValidatorIntervalSize
bool mChanged
Definition: TaskWidget.h:133
CTSSATask * pTask
const C_FLOAT64 & getStepSize() const
void setStepSize(const C_FLOAT64 &stepSize)
virtual void saved() const
Definition: CQValidator.h:71
const C_FLOAT64 & getDuration() const
void setOutputEvent(const bool &outputEvent)
void setTimeSeriesRequested(bool flag)
void setStepNumber(const unsigned C_INT32 &stepNumber)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
CCopasiTask * mpTask
Definition: TaskWidget.h:130
const C_FLOAT64 & getOutputStartTime() const
bool timeSeriesRequested() const
#define C_FLOAT64
Definition: copasi.h:92
void setOutputStartTime(const C_FLOAT64 &endTime)
const bool & getContinueSimultaneousEvents() const
const bool & getOutputEvent() const
void CQTrajectoryWidget::showUnits ( )
private

Definition at line 451 of file CQTrajectoryWidget.cpp.

References FROM_UTF8, CCopasiDataModel::getModel(), CModel::getTimeUnitsDisplayString(), and CopasiWidget::mpDataModel.

Referenced by loadTask(), and update().

452 {
453  const CModel * pModel = NULL;
454 
455  QString TimeUnits;
456 
457  if (mpDataModel != NULL &&
458  (pModel = mpDataModel->getModel()) != NULL)
459  {
460  TimeUnits = " (" + FROM_UTF8(pModel->getTimeUnitsDisplayString()) + ")";
461  }
462 
463  mpLblDuration->setText("Duration" + TimeUnits);
464  mpLblIntervalSize->setText("Interval Size" + TimeUnits);
465  mpCheckDelay->setText("Suppress Output Before" + TimeUnits);
466  mpLblIntegrationInterval->setText("Integration Interval" + TimeUnits);
467  mpLblOutputInterval->setText("Output Interval" + TimeUnits);
468 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
std::string getTimeUnitsDisplayString() const
Definition: CModel.cpp:4531
CCopasiDataModel * mpDataModel
Definition: copasiWidget.h:65
Definition: CModel.h:50
void CQTrajectoryWidget::slotDuration ( )
slot

Definition at line 93 of file CQTrajectoryWidget.cpp.

References checkTimeSeries(), FROM_UTF8, CCopasiMessage::getAllMessageText(), CTrajectoryProblem::getStepNumber(), CTrajectoryProblem::getStepSize(), CQMessageBox::information(), mpTrajectoryProblem, mpValidatorIntervals, mpValidatorIntervalSize, CQValidator< Type >::revalidate(), CTrajectoryProblem::setDuration(), and updateIntervals().

94 {
95  if (!mpEditDuration->hasAcceptableInput())
96  return;
97 
98  try
99  {
100  mpTrajectoryProblem->setDuration(mpEditDuration->text().toDouble());
101  }
102  catch (...)
103  {
104  CQMessageBox::information(this, QString("Information"),
106  QMessageBox::Ok, QMessageBox::Ok);
107  }
108 
109  mpEditIntervalSize->setText(QString::number(mpTrajectoryProblem->getStepSize()));
111  mpEditIntervals->setText(QString::number(mpTrajectoryProblem->getStepNumber()));
113 
114  checkTimeSeries();
115  updateIntervals();
116 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const unsigned C_INT32 & getStepNumber() const
static std::string getAllMessageText(const bool &chronological=true)
CQValidatorInt * mpValidatorIntervals
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void setDuration(const C_FLOAT64 &duration)
CQValidatorDouble * mpValidatorIntervalSize
CTrajectoryProblem * mpTrajectoryProblem
const C_FLOAT64 & getStepSize() const
virtual State revalidate()
Definition: CQValidator.h:63
void CQTrajectoryWidget::slotIntervals ( )
slot

Definition at line 144 of file CQTrajectoryWidget.cpp.

References checkTimeSeries(), FROM_UTF8, CCopasiMessage::getAllMessageText(), CTrajectoryProblem::getStepSize(), CQMessageBox::information(), mpTrajectoryProblem, mpValidatorIntervalSize, CQValidator< Type >::revalidate(), CTrajectoryProblem::setStepNumber(), and updateIntervals().

145 {
146  if (!mpEditIntervals->hasAcceptableInput())
147  return;
148 
149  try
150  {
151  mpTrajectoryProblem->setStepNumber(mpEditIntervals->text().toULong());
152  }
153  catch (...)
154  {
155  CQMessageBox::information(this, QString("Information"),
157  QMessageBox::Ok, QMessageBox::Ok);
158  }
159 
160  mpEditIntervalSize->setText(QString::number(mpTrajectoryProblem->getStepSize()));
162 
163  checkTimeSeries();
164  updateIntervals();
165 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
static std::string getAllMessageText(const bool &chronological=true)
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
CQValidatorDouble * mpValidatorIntervalSize
CTrajectoryProblem * mpTrajectoryProblem
const C_FLOAT64 & getStepSize() const
virtual State revalidate()
Definition: CQValidator.h:63
void setStepNumber(const unsigned C_INT32 &stepNumber)
void CQTrajectoryWidget::slotIntervalSize ( )
slot

Definition at line 118 of file CQTrajectoryWidget.cpp.

References checkTimeSeries(), FROM_UTF8, CCopasiMessage::getAllMessageText(), CTrajectoryProblem::getStepNumber(), CTrajectoryProblem::getStepSize(), CQMessageBox::information(), mpTrajectoryProblem, mpValidatorIntervals, mpValidatorIntervalSize, CQValidator< Type >::revalidate(), CTrajectoryProblem::setStepSize(), and updateIntervals().

119 {
120  if (!mpEditIntervalSize->hasAcceptableInput())
121  return;
122 
123  try
124  {
125  mpTrajectoryProblem->setStepSize(mpEditIntervalSize->text().toDouble());
126  }
127 
128  catch (...)
129  {
130  CQMessageBox::information(this, QString("Information"),
132  QMessageBox::Ok, QMessageBox::Ok);
133  }
134 
135  mpEditIntervalSize->setText(QString::number(mpTrajectoryProblem->getStepSize()));
137  mpEditIntervals->setText(QString::number(mpTrajectoryProblem->getStepNumber()));
139 
140  checkTimeSeries();
141  updateIntervals();
142 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const unsigned C_INT32 & getStepNumber() const
static std::string getAllMessageText(const bool &chronological=true)
CQValidatorInt * mpValidatorIntervals
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
CQValidatorDouble * mpValidatorIntervalSize
CTrajectoryProblem * mpTrajectoryProblem
const C_FLOAT64 & getStepSize() const
void setStepSize(const C_FLOAT64 &stepSize)
virtual State revalidate()
Definition: CQValidator.h:63
void CQTrajectoryWidget::slotOutputDelay ( bool  checked)
slot

Definition at line 167 of file CQTrajectoryWidget.cpp.

References updateIntervals().

Referenced by init().

168 {
169  mpEditDelay->setEnabled(checked);
170  updateIntervals();
171 }
bool CQTrajectoryWidget::taskFinishedEvent ( )
protectedvirtual

Reimplemented from TaskWidget.

Definition at line 342 of file CQTrajectoryWidget.cpp.

References ListViews::findWidgetFromId(), CQTimeSeriesWidget::loadResult(), CopasiWidget::mpListView, TaskWidget::mpTask, and pResult.

343 {
344  bool success = true;
345  // We need to load the result here as this is the only place where
346  // we know that it is correct.
348  dynamic_cast< CQTimeSeriesWidget * >(mpListView->findWidgetFromId(231));
349 
350  if (pResult == NULL)
351  return false;
352 
353  success &= pResult->loadResult(mpTask);
354 
355  return success;
356 }
virtual bool loadResult(const CCopasiTask *pTask)
CopasiWidget * findWidgetFromId(const size_t &id) const
Definition: listviews.cpp:678
ListViews * mpListView
Definition: copasiWidget.h:62
CCopasiTask * mpTask
Definition: TaskWidget.h:130
const CArrayAnnotation * pResult
bool CQTrajectoryWidget::update ( ListViews::ObjectType  objectType,
ListViews::Action  action,
const std::string &  key 
)
virtual

Reimplemented from TaskWidget.

Definition at line 431 of file CQTrajectoryWidget.cpp.

References ListViews::CHANGE, ListViews::MODEL, and showUnits().

432 {
433  switch (objectType)
434  {
435  case ListViews::MODEL:
436 
437  if (action == ListViews::CHANGE)
438  {
439  showUnits();
440  }
441 
442  break;
443 
444  default:
445  break;
446  }
447 
448  return true;
449 }
objectType
void CQTrajectoryWidget::updateIntervals ( )
slot

Definition at line 373 of file CQTrajectoryWidget.cpp.

References C_FLOAT64, CCopasiRootContainer::getDatamodelList(), max, and min.

Referenced by loadTask(), slotDuration(), slotIntervals(), slotIntervalSize(), and slotOutputDelay().

374 {
375  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
376  C_FLOAT64 InitialTime = (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getInitialTime();
377  C_FLOAT64 Duration = mpEditDuration->text().toDouble();
378  C_FLOAT64 OutputStartTime = InitialTime;
379 
380  if (mpCheckDelay->isChecked())
381  {
382  if (!mpEditIntervalSize->hasAcceptableInput())
383  return;
384 
385  OutputStartTime = mpEditDelay->text().toDouble();
386  }
387 
388  mpEditIntegrationInterval->setText(QString::number(InitialTime) +
389  " to " +
390  QString::number(InitialTime + Duration));
391 
392  if (Duration > 0.0)
393  {
394  if (std::max(InitialTime, OutputStartTime) > InitialTime + Duration)
395  mpEditOutputInterval->setText("empty");
396  else if (InitialTime < OutputStartTime)
397  {
398  C_FLOAT64 StepSize = mpEditIntervalSize->text().toDouble();
399  OutputStartTime = InitialTime + (ceil((OutputStartTime - InitialTime) / StepSize)) * StepSize;
400  mpEditOutputInterval->setText(QString::number(OutputStartTime) +
401  " to " +
402  QString::number(InitialTime + Duration));
403  }
404  else
405  {
406  mpEditOutputInterval->setText(QString::number(InitialTime) +
407  " to " +
408  QString::number(InitialTime + Duration));
409  }
410  }
411  else
412  {
413  if (std::min(InitialTime, OutputStartTime) < InitialTime + Duration)
414  mpEditOutputInterval->setText("empty");
415  else if (InitialTime > OutputStartTime)
416  {
417  C_FLOAT64 StepSize = mpEditIntervalSize->text().toDouble();
418  OutputStartTime = InitialTime + (ceil((OutputStartTime - InitialTime) / StepSize)) * StepSize;
419  mpEditOutputInterval->setText(QString::number(OutputStartTime) +
420  " to " +
421  QString::number(InitialTime + Duration));
422  }
423  else
424  mpEditOutputInterval->setText(QString::number(InitialTime) +
425  " to " +
426  QString::number(InitialTime + Duration));
427  }
428 }
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
#define C_FLOAT64
Definition: copasi.h:92
#define min(a, b)
Definition: f2c.h:175
#define max(a, b)
Definition: f2c.h:176

Member Data Documentation

CTrajectoryProblem* CQTrajectoryWidget::mpTrajectoryProblem
private
CQValidatorDouble* CQTrajectoryWidget::mpValidatorDelay
private

Definition at line 62 of file CQTrajectoryWidget.h.

Referenced by init(), loadTask(), and saveTask().

CQValidatorDouble* CQTrajectoryWidget::mpValidatorDuration
private

Definition at line 64 of file CQTrajectoryWidget.h.

Referenced by init(), loadTask(), and saveTask().

CQValidatorInt* CQTrajectoryWidget::mpValidatorIntervals
private

Definition at line 61 of file CQTrajectoryWidget.h.

Referenced by init(), loadTask(), saveTask(), slotDuration(), and slotIntervalSize().

CQValidatorDouble* CQTrajectoryWidget::mpValidatorIntervalSize
private

The documentation for this class was generated from the following files: