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

#include <CLNAResultSubwidget.h>

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

Public Member Functions

virtual void clear ()
 
 CLNAResultSubwidget (QWidget *parent=0, const char *name=0, Qt::WindowFlags fl=0)
 
virtual void loadAll (const CLNAMethod *lnaMethod)
 
virtual void loadBMatrixReduced (const CLNAMethod *lnaMethod)
 
virtual void loadCovarianceMatrix (const CLNAMethod *lnaMethod)
 
virtual void loadCovarianceMatrixReduced (const CLNAMethod *lnaMethod)
 
 ~CLNAResultSubwidget ()
 
- 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 bool leave ()
 
virtual void setFramework (int framework)
 
void setIgnoreUpdates (bool v)
 
virtual bool update (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
 

Protected Slots

virtual void slotSave ()
 
virtual void slotScaled ()
 
- Protected Slots inherited from CopasiWidget
virtual bool protectedNotify (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 

Protected Member Functions

virtual void init ()
 
- Protected Member Functions inherited from CopasiWidget
virtual bool enterProtected ()
 

Private Attributes

const CLNAMethodmLNAMethod
 

Additional Inherited Members

- Protected Attributes inherited from CopasiWidget
int mFramework
 
bool mIgnoreUpdates
 
std::string mKey
 
CCopasiDataModelmpDataModel
 
ListViewsmpListView
 
CCopasiObjectmpObject
 

Detailed Description

Definition at line 33 of file CLNAResultSubwidget.h.

Constructor & Destructor Documentation

CLNAResultSubwidget::CLNAResultSubwidget ( QWidget *  parent = 0,
const char *  name = 0,
Qt::WindowFlags  fl = 0 
)

Definition at line 38 of file CLNAResultSubwidget.cpp.

References init().

39  : CopasiWidget(parent, name, fl)
40 {
41  setupUi(this);
42 
43  init();
44 }
CopasiWidget(QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
bool fl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
CLNAResultSubwidget::~CLNAResultSubwidget ( )

Definition at line 49 of file CLNAResultSubwidget.cpp.

50 {
51  // no need to delete child widgets, Qt does it all for us
52 }

Member Function Documentation

void CLNAResultSubwidget::clear ( )
virtual

Definition at line 243 of file CLNAResultSubwidget.cpp.

Referenced by init(), and loadAll().

244 {
245  mTopLabel->setText("No result available, please execute the LNA task.");
246 
247  mpArrayCovarianceMatrix->setArrayAnnotation(NULL);
248  mpArrayCovarianceMatrixReduced->setArrayAnnotation(NULL);
249  mpArrayBMatrixReduced->setArrayAnnotation(NULL);
250 
251  return;
252 }
void CLNAResultSubwidget::init ( )
protectedvirtual

Definition at line 54 of file CLNAResultSubwidget.cpp.

References clear(), and mLNAMethod.

Referenced by CLNAResultSubwidget().

55 {
56  /*
57  mSaveButton->setEnabled(false);
58  mSaveButton->hide();
59  */
60  mLNAMethod = NULL;
61 
62  clear();
63 }
const CLNAMethod * mLNAMethod
void CLNAResultSubwidget::loadAll ( const CLNAMethod lnaMethod)
virtual

Definition at line 65 of file CLNAResultSubwidget.cpp.

References CLNAMethod::allNeg, clear(), CSteadyStateMethod::found, CSteadyStateMethod::foundEquilibrium, CSteadyStateMethod::foundNegative, CLNAMethod::getEigenValueStatus(), CLNAMethod::getModel(), CLNAMethod::getSteadyStateStatus(), loadBMatrixReduced(), loadCovarianceMatrix(), loadCovarianceMatrixReduced(), mLNAMethod, CLNAMethod::nonNegEigenvaluesExist, and CSteadyStateMethod::notFound.

Referenced by CLNAResultWidget::loadFromBackend(), slotScaled(), and CLNAResultWidget::update().

66 {
67  mLNAMethod = lnaMethod;
68 
69  if (lnaMethod)
70  {
71  if (!lnaMethod->getModel())
72  {
73  clear();
74  return;
75  }
76 
78  {
79  mTopLabel->setText("Steady State found.");
80  this->loadCovarianceMatrix(lnaMethod);
81  this->loadCovarianceMatrixReduced(lnaMethod);
82  this->loadBMatrixReduced(lnaMethod);
83  mTabWidget->setTabEnabled(0, true);
84  mTabWidget->setTabEnabled(1, true);
85  mTabWidget->setTabEnabled(2, true);
86  }
88  {
89  mTopLabel->setText("Equilibrium steady state.");
90  this->loadCovarianceMatrix(lnaMethod);
91  this->loadCovarianceMatrixReduced(lnaMethod);
92  this->loadBMatrixReduced(lnaMethod);
93  mTabWidget->setTabEnabled(0, true);
94  mTabWidget->setTabEnabled(1, true);
95  mTabWidget->setTabEnabled(2, true);
96  }
97  else
98  {
100  {
101  mTopLabel->setText("Invalid steady state (negative concentrations). No LNA calculated!");
102  }
103  else if (lnaMethod->getSteadyStateStatus() == CSteadyStateMethod::notFound)
104  {
105  mTopLabel->setText("No steady state found. No LNA calculated!");
106  }
108  {
109  mTopLabel->setText("The reduced system has non-negative Eigen values! No LNA calculated!");
110  }
111 
112  /*
113  this->loadCovarianceMatrix(lnaMethod);
114  this->loadCovarianceMatrixReduced(lnaMethod);
115  this->loadBMatrixReduced(lnaMethod);
116  */
117 
118  mpArrayCovarianceMatrix->setArrayAnnotation(NULL);
119  mpArrayCovarianceMatrixReduced->setArrayAnnotation(NULL);
120  mpArrayBMatrixReduced->setArrayAnnotation(NULL);
121  }
122  }
123  else
124  {
125  clear();
126  return;
127  }
128 }
const CLNAMethod::EVStatus & getEigenValueStatus() const
Definition: CLNAMethod.h:188
virtual void loadCovarianceMatrix(const CLNAMethod *lnaMethod)
virtual void loadBMatrixReduced(const CLNAMethod *lnaMethod)
const CSteadyStateMethod::ReturnCode & getSteadyStateStatus() const
Definition: CLNAMethod.h:185
const CModel * getModel() const
Definition: CLNAMethod.cpp:657
const CLNAMethod * mLNAMethod
virtual void loadCovarianceMatrixReduced(const CLNAMethod *lnaMethod)
void CLNAResultSubwidget::loadBMatrixReduced ( const CLNAMethod lnaMethod)
virtual

Definition at line 178 of file CLNAResultSubwidget.cpp.

References CLNAMethod::getScaledBMatrixReducedAnn(), and CLNAMethod::getUnscaledBMatrixReducedAnn().

Referenced by loadAll().

179 {
180  const CArrayAnnotation * bMatrixReducedAnn;
181 
182  if (mComboScale->currentIndex() == 0)
183  {
184  bMatrixReducedAnn = lnaMethod->getScaledBMatrixReducedAnn();
185 
186  CColorScaleBiLog * tcs = new CColorScaleBiLog();
187  mpArrayBMatrixReduced->setColorCoding(tcs);
188  mpArrayBMatrixReduced->setColorScalingAutomatic(true);
189  }
190  else
191  {
192  bMatrixReducedAnn = lnaMethod->getUnscaledBMatrixReducedAnn();
193 
194  CColorScaleBiLog * tcs = new CColorScaleBiLog();
195  mpArrayBMatrixReduced->setColorCoding(tcs);
196  mpArrayBMatrixReduced->setColorScalingAutomatic(true);
197  }
198 
199  mpArrayBMatrixReduced->setArrayAnnotation(bMatrixReducedAnn);
200 }
const CArrayAnnotation * getUnscaledBMatrixReducedAnn() const
Definition: CLNAMethod.h:124
const CArrayAnnotation * getScaledBMatrixReducedAnn() const
Definition: CLNAMethod.h:121
void CLNAResultSubwidget::loadCovarianceMatrix ( const CLNAMethod lnaMethod)
virtual

Definition at line 130 of file CLNAResultSubwidget.cpp.

References CLNAMethod::getScaledCovarianceMatrixAnn(), and CLNAMethod::getUnscaledCovarianceMatrixAnn().

Referenced by loadAll().

131 {
132  const CArrayAnnotation * covarianceMatrixAnn;
133 
134  if (mComboScale->currentIndex() == 0)
135  {
136  covarianceMatrixAnn = lnaMethod->getScaledCovarianceMatrixAnn();
137 
138  CColorScaleBiLog * tcs = new CColorScaleBiLog();
139  mpArrayCovarianceMatrix->setColorCoding(tcs);
140  mpArrayCovarianceMatrix->setColorScalingAutomatic(true);
141  }
142  else
143  {
144  covarianceMatrixAnn = lnaMethod->getUnscaledCovarianceMatrixAnn();
145 
146  CColorScaleBiLog * tcs = new CColorScaleBiLog();
147  mpArrayCovarianceMatrix->setColorCoding(tcs);
148  mpArrayCovarianceMatrix->setColorScalingAutomatic(true);
149  }
150 
151  mpArrayCovarianceMatrix->setArrayAnnotation(covarianceMatrixAnn);
152 }
const CArrayAnnotation * getScaledCovarianceMatrixAnn() const
Definition: CLNAMethod.h:127
const CArrayAnnotation * getUnscaledCovarianceMatrixAnn() const
Definition: CLNAMethod.h:133
void CLNAResultSubwidget::loadCovarianceMatrixReduced ( const CLNAMethod lnaMethod)
virtual

Definition at line 154 of file CLNAResultSubwidget.cpp.

References CLNAMethod::getScaledCovarianceMatrixReducedAnn(), and CLNAMethod::getUnscaledCovarianceMatrixReducedAnn().

Referenced by loadAll().

155 {
156  const CArrayAnnotation * covarianceMatrixReducedAnn;
157 
158  if (mComboScale->currentIndex() == 0)
159  {
160  covarianceMatrixReducedAnn = lnaMethod->getScaledCovarianceMatrixReducedAnn();
161 
162  CColorScaleBiLog * tcs = new CColorScaleBiLog();
163  mpArrayCovarianceMatrixReduced->setColorCoding(tcs);
164  mpArrayCovarianceMatrixReduced->setColorScalingAutomatic(true);
165  }
166  else
167  {
168  covarianceMatrixReducedAnn = lnaMethod->getUnscaledCovarianceMatrixReducedAnn();
169 
170  CColorScaleBiLog * tcs = new CColorScaleBiLog();
171  mpArrayCovarianceMatrixReduced->setColorCoding(tcs);
172  mpArrayCovarianceMatrixReduced->setColorScalingAutomatic(true);
173  }
174 
175  mpArrayCovarianceMatrixReduced->setArrayAnnotation(covarianceMatrixReducedAnn);
176 }
const CArrayAnnotation * getUnscaledCovarianceMatrixReducedAnn() const
Definition: CLNAMethod.h:136
const CArrayAnnotation * getScaledCovarianceMatrixReducedAnn() const
Definition: CLNAMethod.h:130
void CLNAResultSubwidget::slotSave ( )
protectedvirtualslot

Definition at line 202 of file CLNAResultSubwidget.cpp.

References C_INT32, checkSelection(), CLocaleString::fromUtf8(), CCopasiRootContainer::getDatamodelList(), CCopasiTask::getResult(), CopasiFileDialog::getSaveFileName(), and TO_UTF8.

203 {
204  C_INT32 Answer = QMessageBox::No;
205  QString fileName;
206 
207  while (Answer == QMessageBox::No)
208  {
209  fileName =
210  CopasiFileDialog::getSaveFileName(this, "Save File Dialog",
211  "untitled.txt", "TEXT Files (*.txt)", "Save to");
212 
213  if (fileName.isEmpty()) return;
214 
215  // Checks whether the file exists
216  Answer = checkSelection(fileName);
217 
218  if (Answer == QMessageBox::Cancel) return;
219  }
220 
221  std::ofstream file(CLocaleString::fromUtf8(TO_UTF8(fileName)).c_str());
222 
223  if (file.fail())
224  return;
225 
226  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
227  CCopasiTask* mpTask =
228  dynamic_cast<CLNATask *>((*(*CCopasiRootContainer::getDatamodelList())[0]->getTaskList())["Linear Noise Approximation"]);
229 
230  if (mpTask != NULL)
231  file << mpTask->getResult();
232 
233 // mpTask->printResult(file);
234 
235  return;
236 }
#define C_INT32
Definition: copasi.h:90
C_INT32 checkSelection(const QString &file)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
const CResult & getResult() const
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
static CLocaleString fromUtf8(const std::string &utf8)
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
void CLNAResultSubwidget::slotScaled ( )
protectedvirtualslot

Definition at line 238 of file CLNAResultSubwidget.cpp.

References loadAll(), and mLNAMethod.

239 {
241 }
virtual void loadAll(const CLNAMethod *lnaMethod)
const CLNAMethod * mLNAMethod

Member Data Documentation

const CLNAMethod* CLNAResultSubwidget::mLNAMethod
private

Definition at line 57 of file CLNAResultSubwidget.h.

Referenced by init(), loadAll(), and slotScaled().


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