COPASI API  4.16.103
test000058.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 #include "test000058.h"
12 
13 #include <sstream>
14 #include "utilities.hpp"
16 #include "copasi/model/CModel.h"
19 
20 #include "sbml/SBMLDocument.h"
21 #include "sbml/Model.h"
22 #include "sbml/Rule.h"
23 #include "sbml/Species.h"
24 #include "sbml/Parameter.h"
25 #include "sbml/math/ASTNode.h"
26 
28 
29 CCopasiDataModel* test000058::pCOPASIDATAMODEL = NULL;
30 
32 {
33  // Create the root container.
34  CCopasiRootContainer::init(0, NULL, false);
35  // Create the global data model.
37 }
38 
40 {
42 }
43 
44 bool test000058::checkIfIdsUnique(const Model* pSBMLModel)
45 {
46  bool result = true;
47  std::set<std::string> ids;
48 
49  if (pSBMLModel != NULL)
50  {
51  // the model itself
52  const SBase* pSBase = NULL;
53  std::string id;
54 
55  if (pSBMLModel->isSetId())
56  {
57  id = pSBMLModel->getId();
58 
59  if (ids.find(id) == ids.end())
60  {
61  ids.insert(id);
62  }
63  else
64  {
65  result = false;
66  }
67  }
68 
69  // ListOfFunctionDefinitions
70  pSBase = pSBMLModel->getListOfFunctionDefinitions();
71 
72  if (pSBase != NULL)
73  {
74  if (pSBase->isSetId())
75  {
76  id = pSBase->getId();
77 
78  if (ids.find(id) == ids.end())
79  {
80  ids.insert(id);
81  }
82  else
83  {
84  result = false;
85  }
86  }
87 
88  unsigned int i, iMax = pSBMLModel->getListOfFunctionDefinitions()->size();
89 
90  for (i = 0; i < iMax; ++i)
91  {
92  pSBase = pSBMLModel->getListOfFunctionDefinitions()->get(i);
93 
94  if (pSBase->isSetId())
95  {
96  id = pSBase->getId();
97 
98  if (ids.find(id) == ids.end())
99  {
100  ids.insert(id);
101  }
102  else
103  {
104  result = false;
105  }
106  }
107  }
108  }
109 
110  // ListOfCompartmentTypes
111  pSBase = pSBMLModel->getListOfCompartmentTypes();
112 
113  if (pSBase != NULL)
114  {
115  if (pSBase->isSetId())
116  {
117  id = pSBase->getId();
118 
119  if (ids.find(id) == ids.end())
120  {
121  ids.insert(id);
122  }
123  else
124  {
125  result = false;
126  }
127  }
128 
129  // each compartment type
130  unsigned int i, iMax = pSBMLModel->getListOfCompartmentTypes()->size();
131 
132  for (i = 0; i < iMax; ++i)
133  {
134  pSBase = pSBMLModel->getCompartmentType(i);
135  assert(pSBase != NULL);
136 
137  if (pSBase->isSetId())
138  {
139  id = pSBase->getId();
140 
141  if (ids.find(id) == ids.end())
142  {
143  ids.insert(id);
144  }
145  else
146  {
147  result = false;
148  }
149  }
150  }
151  }
152 
153  // ListOfSpeciesTypes
154  pSBase = pSBMLModel->getListOfSpeciesTypes();
155 
156  if (pSBase != NULL)
157  {
158  if (pSBase->isSetId())
159  {
160  id = pSBase->getId();
161 
162  if (ids.find(id) == ids.end())
163  {
164  ids.insert(id);
165  }
166  else
167  {
168  result = false;
169  }
170  }
171 
172  // each species type
173  unsigned int i, iMax = pSBMLModel->getListOfSpeciesTypes()->size();
174 
175  for (i = 0; i < iMax; ++i)
176  {
177  pSBase = pSBMLModel->getSpeciesType(i);
178  assert(pSBase != NULL);
179 
180  if (pSBase->isSetId())
181  {
182  id = pSBase->getId();
183 
184  if (ids.find(id) == ids.end())
185  {
186  ids.insert(id);
187  }
188  else
189  {
190  result = false;
191  }
192  }
193  }
194  }
195 
196  // ListOfCompartments
197  pSBase = pSBMLModel->getListOfCompartments();
198 
199  if (pSBase != NULL)
200  {
201  if (pSBase->isSetId())
202  {
203  id = pSBase->getId();
204 
205  if (ids.find(id) == ids.end())
206  {
207  ids.insert(id);
208  }
209  else
210  {
211  result = false;
212  }
213  }
214 
215  // all compartments
216  unsigned int i, iMax = pSBMLModel->getListOfCompartments()->size();
217 
218  for (i = 0; i < iMax; ++i)
219  {
220  pSBase = pSBMLModel->getCompartment(i);
221  assert(pSBase != NULL);
222 
223  if (pSBase->isSetId())
224  {
225  id = pSBase->getId();
226 
227  if (ids.find(id) == ids.end())
228  {
229  ids.insert(id);
230  }
231  else
232  {
233  result = false;
234  }
235  }
236  }
237  }
238 
239  // ListOfSpecies
240  pSBase = pSBMLModel->getListOfSpecies();
241 
242  if (pSBase != NULL)
243  {
244  if (pSBase->isSetId())
245  {
246  id = pSBase->getId();
247 
248  if (ids.find(id) == ids.end())
249  {
250  ids.insert(id);
251  }
252  else
253  {
254  result = false;
255  }
256  }
257 
258  // all species
259  unsigned int i, iMax = pSBMLModel->getListOfSpecies()->size();
260 
261  for (i = 0; i < iMax; ++i)
262  {
263  pSBase = pSBMLModel->getSpecies(i);
264  assert(pSBase != NULL);
265 
266  if (pSBase->isSetId())
267  {
268  id = pSBase->getId();
269 
270  if (ids.find(id) == ids.end())
271  {
272  ids.insert(id);
273  }
274  else
275  {
276  result = false;
277  }
278  }
279  }
280  }
281 
282  // ListOfParameters
283  pSBase = pSBMLModel->getListOfParameters();
284 
285  if (pSBase != NULL)
286  {
287  if (pSBase->isSetId())
288  {
289  id = pSBase->getId();
290 
291  if (ids.find(id) == ids.end())
292  {
293  ids.insert(id);
294  }
295  else
296  {
297  result = false;
298  }
299  }
300 
301  // each parameter
302  unsigned int i, iMax = pSBMLModel->getListOfParameters()->size();
303 
304  for (i = 0; i < iMax; ++i)
305  {
306  pSBase = pSBMLModel->getParameter(i);
307  assert(pSBase != NULL);
308 
309  if (pSBase->isSetId())
310  {
311  id = pSBase->getId();
312 
313  if (ids.find(id) == ids.end())
314  {
315  ids.insert(id);
316  }
317  else
318  {
319  result = false;
320  }
321  }
322  }
323  }
324 
325  // ListOfInitialAssignments
326  pSBase = pSBMLModel->getListOfInitialAssignments();
327 
328  if (pSBase != NULL)
329  {
330  if (pSBase->isSetId())
331  {
332  id = pSBase->getId();
333 
334  if (ids.find(id) == ids.end())
335  {
336  ids.insert(id);
337  }
338  else
339  {
340  result = false;
341  }
342  }
343  }
344 
345  // ListOfRules
346  pSBase = pSBMLModel->getListOfRules();
347 
348  if (pSBase != NULL)
349  {
350  if (pSBase->isSetId())
351  {
352  id = pSBase->getId();
353 
354  if (ids.find(id) == ids.end())
355  {
356  ids.insert(id);
357  }
358  else
359  {
360  result = false;
361  }
362  }
363  }
364 
365  // ListOfConstraints
366  pSBase = pSBMLModel->getListOfConstraints();
367 
368  if (pSBase != NULL)
369  {
370  if (pSBase->isSetId())
371  {
372  id = pSBase->getId();
373 
374  if (ids.find(id) == ids.end())
375  {
376  ids.insert(id);
377  }
378  else
379  {
380  result = false;
381  }
382  }
383  }
384 
385  // ListOfReactions
386  pSBase = pSBMLModel->getListOfReactions();
387 
388  if (pSBase != NULL)
389  {
390  if (pSBase->isSetId())
391  {
392  id = pSBase->getId();
393 
394  if (ids.find(id) == ids.end())
395  {
396  ids.insert(id);
397  }
398  else
399  {
400  result = false;
401  }
402  }
403 
404  // all reactions
405  unsigned int i, iMax = pSBMLModel->getListOfReactions()->size();
406 
407  for (i = 0; i < iMax; ++i)
408  {
409  const Reaction* pReaction = pSBMLModel->getReaction(i);
410  assert(pReaction != NULL);
411 
412  if (pReaction->isSetId())
413  {
414  id = pReaction->getId();
415 
416  if (ids.find(id) == ids.end())
417  {
418  ids.insert(id);
419  }
420  else
421  {
422  result = false;
423  }
424  }
425 
426  // for each reaction: ListOfSubstrates, each substrate, ListOfProducts, each
427  // Product, ListOfModifieres, each modifier, KineticLaw, ListOfparameters,
428  // each parameter
429  if (pReaction->getListOfReactants() != NULL)
430  {
431  pSBase = pReaction->getListOfReactants();
432  unsigned int j, jMax = pReaction->getListOfReactants()->size();
433 
434  for (j = 0; j < jMax; ++j)
435  {
436  pSBase = pReaction->getReactant(j);
437  assert(pSBase != NULL);
438 
439  // since L2V2 species references can have ids
440  if (pSBase->isSetId())
441  {
442  id = pSBase->getId();
443 
444  if (ids.find(id) == ids.end())
445  {
446  ids.insert(id);
447  }
448  else
449  {
450  result = false;
451  }
452  }
453  }
454  }
455 
456  if (pReaction->getListOfProducts() != NULL)
457  {
458  pSBase = pReaction->getListOfProducts();
459  unsigned int j, jMax = pReaction->getListOfProducts()->size();
460 
461  for (j = 0; j < jMax; ++j)
462  {
463  pSBase = pReaction->getProduct(j);
464  assert(pSBase != NULL);
465 
466  // since L2V2 species references can have ids
467  if (pSBase->isSetId())
468  {
469  id = pSBase->getId();
470 
471  if (ids.find(id) == ids.end())
472  {
473  ids.insert(id);
474  }
475  else
476  {
477  result = false;
478  }
479  }
480  }
481  }
482 
483  if (pReaction->getListOfModifiers() != NULL)
484  {
485  pSBase = pReaction->getListOfModifiers();
486  unsigned int j, jMax = pReaction->getListOfModifiers()->size();
487 
488  for (j = 0; j < jMax; ++j)
489  {
490  pSBase = pReaction->getModifier(j);
491  assert(pSBase != NULL);
492 
493  // since L2V2 species references can have ids
494  if (pSBase->isSetId())
495  {
496  id = pSBase->getId();
497 
498  if (ids.find(id) == ids.end())
499  {
500  ids.insert(id);
501  }
502  else
503  {
504  result = false;
505  }
506  }
507  }
508  }
509  }
510  }
511 
512  // ListOfEvents
513  pSBase = pSBMLModel->getListOfEvents();
514 
515  if (pSBase != NULL)
516  {
517  if (pSBase->isSetId())
518  {
519  id = pSBase->getId();
520 
521  if (ids.find(id) == ids.end())
522  {
523  ids.insert(id);
524  }
525  else
526  {
527  result = false;
528  }
529  }
530  }
531  }
532 
533  /*
534  std::cout << "number of ids: " << ids.size() << std::endl;
535  std::set<std::string>::iterator it=ids.begin();
536  while(it!=ids.end())
537  {
538  std::cout << "id: " << *it << std::endl;
539  ++it;
540  }
541  */
542  return result;
543 }
544 
546 {
547  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
548  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000058::MODEL_STRING));
549  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
550  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
551  const Model* pSBMLModel = pDocument->getModel();
552  CPPUNIT_ASSERT(pSBMLModel != NULL);
553  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 1);
554  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
555  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
556  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
557  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
558  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
559  // now we add a new reaction
560  CModel* pModel = pDataModel->getModel();
561  CPPUNIT_ASSERT(pModel != NULL);
562  CReaction* pReaction = pModel->createReaction("influx");
563  CPPUNIT_ASSERT(pReaction != NULL);
564  pReaction->addProduct(pModel->getMetabolites()[0]->getKey());
565  pReaction->setFunction("Constant flux (irreversible)");
566  pReaction->setParameterValue("v", 1.0, true);
567  pModel->compileIfNecessary(NULL);
568  std::set<const CCopasiObject*> changedObjects;
569  changedObjects.insert(pReaction->getParameters().getParameter(0)->getValueReference());
570  std::vector<Refresh*> refreshes = pModel->buildInitialRefreshSequence(changedObjects);
571  std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
572 
573  while (refreshIt != refreshEndit)
574  {
575  (**refreshIt++)();
576  }
577 
578  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 1).empty() == false);
579  pDocument = pDataModel->getCurrentSBMLDocument();
580  pSBMLModel = pDocument->getModel();
581  CPPUNIT_ASSERT(pSBMLModel != NULL);
582  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 2);
583  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
584  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
585  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 2);
586  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
587  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
588  CPPUNIT_ASSERT(checkIfIdsUnique(pSBMLModel) == true);
589 }
590 
592 {
593  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
594  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000058::MODEL_STRING));
595  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
596  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
597  const Model* pSBMLModel = pDocument->getModel();
598  CPPUNIT_ASSERT(pSBMLModel != NULL);
599  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 1);
600  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
601  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
602  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
603  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
604  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
605  // now we add a new compartment
606  CModel* pModel = pDataModel->getModel();
607  CPPUNIT_ASSERT(pModel != NULL);
608  CCompartment* pCompartment = pModel->createCompartment("compartment_2");
609  CPPUNIT_ASSERT(pCompartment != NULL);
610  pModel->compileIfNecessary(NULL);
611  std::set<const CCopasiObject*> changedObjects;
612  const CCopasiObject* pObject = pCompartment->getInitialValueReference();
613  CPPUNIT_ASSERT(pObject != NULL);
614  changedObjects.insert(pObject);
615  std::vector<Refresh*> refreshes = pModel->buildInitialRefreshSequence(changedObjects);
616  std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
617 
618  while (refreshIt != refreshEndit)
619  {
620  (**refreshIt++)();
621  }
622 
623  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 1).empty() == false);
624  pDocument = pDataModel->getCurrentSBMLDocument();
625  pSBMLModel = pDocument->getModel();
626  CPPUNIT_ASSERT(pSBMLModel != NULL);
627  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 1);
628  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 2);
629  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
630  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
631  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
632  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
633  CPPUNIT_ASSERT(checkIfIdsUnique(pSBMLModel) == true);
634 }
635 
637 {
638  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
639  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000058::MODEL_STRING));
640  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
641  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
642  const Model* pSBMLModel = pDocument->getModel();
643  CPPUNIT_ASSERT(pSBMLModel != NULL);
644  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 1);
645  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
646  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
647  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
648  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
649  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
650  // now we add a new species
651  CModel* pModel = pDataModel->getModel();
652  CPPUNIT_ASSERT(pModel != NULL);
653  CMetab* pMetabolite = pModel->createMetabolite("species_2", "compartment_1", 1.0, CModelEntity::FIXED);
654  CPPUNIT_ASSERT(pMetabolite != NULL);
655  pModel->compileIfNecessary(NULL);
656  std::set<const CCopasiObject*> changedObjects;
657  const CCopasiObject* pObject = pMetabolite->getInitialConcentrationReference();
658  CPPUNIT_ASSERT(pObject != NULL);
659  changedObjects.insert(pObject);
660  std::vector<Refresh*> refreshes = pModel->buildInitialRefreshSequence(changedObjects);
661  std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
662 
663  while (refreshIt != refreshEndit)
664  {
665  (**refreshIt++)();
666  }
667 
668  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 1).empty() == false);
669  pDocument = pDataModel->getCurrentSBMLDocument();
670  pSBMLModel = pDocument->getModel();
671  CPPUNIT_ASSERT(pSBMLModel != NULL);
672  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 1);
673  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
674  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 2);
675  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
676  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
677  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
678  CPPUNIT_ASSERT(checkIfIdsUnique(pSBMLModel) == true);
679 }
680 
682 {
683  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
684  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000058::MODEL_STRING));
685  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
686  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
687  const Model* pSBMLModel = pDocument->getModel();
688  CPPUNIT_ASSERT(pSBMLModel != NULL);
689  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 1);
690  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
691  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
692  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
693  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
694  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
695  // now we add a new parameter
696  CModel* pModel = pDataModel->getModel();
697  CPPUNIT_ASSERT(pModel != NULL);
698  CModelValue* pModelValue = pModel->createModelValue("parameter_2");
699  CPPUNIT_ASSERT(pModelValue != NULL);
700  pModel->compileIfNecessary(NULL);
701  std::set<const CCopasiObject*> changedObjects;
702  const CCopasiObject* pObject = pModelValue->getInitialValueReference();
703  CPPUNIT_ASSERT(pObject != NULL);
704  changedObjects.insert(pObject);
705  std::vector<Refresh*> refreshes = pModel->buildInitialRefreshSequence(changedObjects);
706  std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
707 
708  while (refreshIt != refreshEndit)
709  {
710  (**refreshIt++)();
711  }
712 
713  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 1).empty() == false);
714  pDocument = pDataModel->getCurrentSBMLDocument();
715  pSBMLModel = pDocument->getModel();
716  CPPUNIT_ASSERT(pSBMLModel != NULL);
717  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 1);
718  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
719  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
720  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
721  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
722  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 2);
723  CPPUNIT_ASSERT(checkIfIdsUnique(pSBMLModel) == true);
724 }
725 
727 {
728  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
729  CPPUNIT_ASSERT(pDataModel->importSBMLFromString(test000058::MODEL_STRING));
730  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
731  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
732  const Model* pSBMLModel = pDocument->getModel();
733  CPPUNIT_ASSERT(pSBMLModel != NULL);
734  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 1);
735  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
736  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
737  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
738  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
739  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
740  // now we add a new parameter
741  CModel* pModel = pDataModel->getModel();
742  CPPUNIT_ASSERT(pModel != NULL);
743  // add a new function definition
744  CFunction* pFunctionDefinition = new CFunction("function_2");
745  CPPUNIT_ASSERT(pFunctionDefinition != NULL);
746  CPPUNIT_ASSERT(pFunctionDefinition->setInfix("3 * 5") == true);
747  pFunctionDefinition->compile();
748  // add the function definition to the function database
750  CModelValue* pModelValue = pModel->createModelValue("parameter_2");
751  CPPUNIT_ASSERT(pModelValue != NULL);
752  pModelValue->setStatus(CModelEntity::ASSIGNMENT);
753  CPPUNIT_ASSERT(pModelValue->setExpression(std::string(pFunctionDefinition->getObjectName() + "()")) == true);
754  // now create a rule for the parameter
755  pModel->compileIfNecessary(NULL);
756  std::set<const CCopasiObject*> changedObjects;
757  const CCopasiObject* pObject = pModelValue->getInitialValueReference();
758  CPPUNIT_ASSERT(pObject != NULL);
759  changedObjects.insert(pObject);
760  std::vector<Refresh*> refreshes = pModel->buildInitialRefreshSequence(changedObjects);
761  std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
762 
763  while (refreshIt != refreshEndit)
764  {
765  (**refreshIt++)();
766  }
767 
768  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 1).empty() == false);
769  pDocument = pDataModel->getCurrentSBMLDocument();
770  pSBMLModel = pDocument->getModel();
771  CPPUNIT_ASSERT(pSBMLModel != NULL);
772  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 2);
773  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
774  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
775  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
776  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 1);
777  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 2);
778  CPPUNIT_ASSERT(checkIfIdsUnique(pSBMLModel) == true);
779 }
780 
782 {
783  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
784  std::istringstream iss(test000058::MODEL_STRING2);
785  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
786  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
787  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
788  CPPUNIT_ASSERT(pDocument == NULL);
789  // now we add a new reaction
790  CModel* pModel = pDataModel->getModel();
791  CPPUNIT_ASSERT(pModel != NULL);
792  CReaction* pReaction = pModel->createReaction("influx");
793  CPPUNIT_ASSERT(pReaction != NULL);
794  pReaction->addProduct(pModel->getMetabolites()[0]->getKey());
795  pReaction->setFunction("Constant flux (irreversible)");
796  pReaction->setParameterValue("v", 1.0, true);
797  pModel->compileIfNecessary(NULL);
798  std::set<const CCopasiObject*> changedObjects;
799  changedObjects.insert(pReaction->getParameters().getParameter(0)->getValueReference());
800  std::vector<Refresh*> refreshes = pModel->buildInitialRefreshSequence(changedObjects);
801  std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
802 
803  while (refreshIt != refreshEndit)
804  {
805  (**refreshIt++)();
806  }
807 
808  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 1).empty() == false);
809  pDocument = pDataModel->getCurrentSBMLDocument();
810  const Model* pSBMLModel = pDocument->getModel();
811  CPPUNIT_ASSERT(pSBMLModel != NULL);
812  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 2);
813  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
814  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
815  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 2);
816  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
817  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
818  CPPUNIT_ASSERT(checkIfIdsUnique(pSBMLModel) == true);
819 }
820 
822 {
823  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
824  std::istringstream iss(test000058::MODEL_STRING2);
825  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
826  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
827  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
828  CPPUNIT_ASSERT(pDocument == NULL);
829  // now we add a new compartment
830  CModel* pModel = pDataModel->getModel();
831  CPPUNIT_ASSERT(pModel != NULL);
832  CCompartment* pCompartment = pModel->createCompartment("compartment_2");
833  CPPUNIT_ASSERT(pCompartment != NULL);
834  pModel->compileIfNecessary(NULL);
835  std::set<const CCopasiObject*> changedObjects;
836  const CCopasiObject* pObject = pCompartment->getInitialValueReference();
837  CPPUNIT_ASSERT(pObject != NULL);
838  changedObjects.insert(pObject);
839  std::vector<Refresh*> refreshes = pModel->buildInitialRefreshSequence(changedObjects);
840  std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
841 
842  while (refreshIt != refreshEndit)
843  {
844  (**refreshIt++)();
845  }
846 
847  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 1).empty() == false);
848  pDocument = pDataModel->getCurrentSBMLDocument();
849  const Model* pSBMLModel = pDocument->getModel();
850  CPPUNIT_ASSERT(pSBMLModel != NULL);
851  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 1);
852  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 2);
853  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
854  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
855  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
856  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
857  CPPUNIT_ASSERT(checkIfIdsUnique(pSBMLModel) == true);
858 }
859 
861 {
862  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
863  std::istringstream iss(test000058::MODEL_STRING2);
864  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
865  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
866  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
867  CPPUNIT_ASSERT(pDocument == NULL);
868  // now we add a new species
869  CModel* pModel = pDataModel->getModel();
870  CPPUNIT_ASSERT(pModel != NULL);
871  CMetab* pMetabolite = pModel->createMetabolite("species_2", "compartment_1", 1.0, CModelEntity::FIXED);
872  CPPUNIT_ASSERT(pMetabolite != NULL);
873  pModel->compileIfNecessary(NULL);
874  std::set<const CCopasiObject*> changedObjects;
875  const CCopasiObject* pObject = pMetabolite->getInitialConcentrationReference();
876  CPPUNIT_ASSERT(pObject != NULL);
877  changedObjects.insert(pObject);
878  std::vector<Refresh*> refreshes = pModel->buildInitialRefreshSequence(changedObjects);
879  std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
880 
881  while (refreshIt != refreshEndit)
882  {
883  (**refreshIt++)();
884  }
885 
886  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 1).empty() == false);
887  pDocument = pDataModel->getCurrentSBMLDocument();
888  const Model* pSBMLModel = pDocument->getModel();
889  CPPUNIT_ASSERT(pSBMLModel != NULL);
890  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 1);
891  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
892  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 2);
893  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
894  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
895  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 1);
896  CPPUNIT_ASSERT(checkIfIdsUnique(pSBMLModel) == true);
897 }
898 
900 {
901  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
902  std::istringstream iss(test000058::MODEL_STRING2);
903  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
904  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
905  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
906  CPPUNIT_ASSERT(pDocument == NULL);
907  // now we add a new parameter
908  CModel* pModel = pDataModel->getModel();
909  CPPUNIT_ASSERT(pModel != NULL);
910  CModelValue* pModelValue = pModel->createModelValue("parameter_2");
911  CPPUNIT_ASSERT(pModelValue != NULL);
912  pModel->compileIfNecessary(NULL);
913  std::set<const CCopasiObject*> changedObjects;
914  const CCopasiObject* pObject = pModelValue->getInitialValueReference();
915  CPPUNIT_ASSERT(pObject != NULL);
916  changedObjects.insert(pObject);
917  std::vector<Refresh*> refreshes = pModel->buildInitialRefreshSequence(changedObjects);
918  std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
919 
920  while (refreshIt != refreshEndit)
921  {
922  (**refreshIt++)();
923  }
924 
925  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 1).empty() == false);
926  pDocument = pDataModel->getCurrentSBMLDocument();
927  const Model* pSBMLModel = pDocument->getModel();
928  CPPUNIT_ASSERT(pSBMLModel != NULL);
929  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 1);
930  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
931  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
932  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
933  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 0);
934  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 2);
935  CPPUNIT_ASSERT(checkIfIdsUnique(pSBMLModel) == true);
936 }
937 
939 {
940  CCopasiDataModel* pDataModel = pCOPASIDATAMODEL;
941  std::istringstream iss(test000058::MODEL_STRING2);
942  CPPUNIT_ASSERT(load_cps_model_from_stream(iss, *pDataModel) == true);
943  CPPUNIT_ASSERT(pDataModel->getModel() != NULL);
944  const SBMLDocument* pDocument = pDataModel->getCurrentSBMLDocument();
945  CPPUNIT_ASSERT(pDocument == NULL);
946  // now we add a new parameter
947  CModel* pModel = pDataModel->getModel();
948  CPPUNIT_ASSERT(pModel != NULL);
949  // add a new function definition
950  CFunction* pFunctionDefinition = new CFunction("function_2");
951  CPPUNIT_ASSERT(pFunctionDefinition != NULL);
952  CPPUNIT_ASSERT(pFunctionDefinition->setInfix("3 * 5") == true);
953  pFunctionDefinition->compile();
954  // add the function definition to the function database
956  CModelValue* pModelValue = pModel->createModelValue("parameter_2");
957  CPPUNIT_ASSERT(pModelValue != NULL);
958  pModelValue->setStatus(CModelEntity::ASSIGNMENT);
959  CPPUNIT_ASSERT(pModelValue->setExpression(std::string(pFunctionDefinition->getObjectName() + "()")) == true);
960  // now create a rule for the parameter
961  pModel->compileIfNecessary(NULL);
962  std::set<const CCopasiObject*> changedObjects;
963  const CCopasiObject* pObject = pModelValue->getInitialValueReference();
964  CPPUNIT_ASSERT(pObject != NULL);
965  changedObjects.insert(pObject);
966  std::vector<Refresh*> refreshes = pModel->buildInitialRefreshSequence(changedObjects);
967  std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
968 
969  while (refreshIt != refreshEndit)
970  {
971  (**refreshIt++)();
972  }
973 
974  CPPUNIT_ASSERT(pDataModel->exportSBMLToString(NULL, 2, 1).empty() == false);
975  pDocument = pDataModel->getCurrentSBMLDocument();
976  const Model* pSBMLModel = pDocument->getModel();
977  CPPUNIT_ASSERT(pSBMLModel != NULL);
978  CPPUNIT_ASSERT(pSBMLModel->getNumFunctionDefinitions() == 2);
979  CPPUNIT_ASSERT(pSBMLModel->getNumCompartments() == 1);
980  CPPUNIT_ASSERT(pSBMLModel->getNumSpecies() == 1);
981  CPPUNIT_ASSERT(pSBMLModel->getNumReactions() == 1);
982  CPPUNIT_ASSERT(pSBMLModel->getNumRules() == 1);
983  CPPUNIT_ASSERT(pSBMLModel->getNumParameters() == 2);
984  CPPUNIT_ASSERT(checkIfIdsUnique(pSBMLModel) == true);
985 }
986 
987 const char* test000058::MODEL_STRING =
988  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
989  "<sbml xmlns=\"http://www.sbml.org/sbml/level2\" metaid=\"_000000\" level=\"2\" version=\"1\">\n"
990  " <model metaid=\"_000001\" id=\"model_1\" name=\"model_1\">\n"
991  " <listOfFunctionDefinitions>\n"
992  " <functionDefinition metaid=\"_000004\" id=\"function_1\" name=\"function_1\">\n"
993  " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
994  " <lambda>\n"
995  " <bvar>\n"
996  " <ci> k </ci>\n"
997  " </bvar>\n"
998  " <bvar>\n"
999  " <ci> S </ci>\n"
1000  " </bvar>\n"
1001  " <apply>\n"
1002  " <times/>\n"
1003  " <ci> k </ci>\n"
1004  " <ci> S </ci>\n"
1005  " </apply>\n"
1006  " </lambda>\n"
1007  " </math>\n"
1008  " </functionDefinition>\n"
1009  " </listOfFunctionDefinitions> \n"
1010  " <listOfUnitDefinitions>\n"
1011  " <unitDefinition metaid=\"_000002\" id=\"time\" name=\"time\">\n"
1012  " <listOfUnits>\n"
1013  " <unit kind=\"second\" scale=\"0\" multiplier=\"1\"/>\n"
1014  " </listOfUnits>\n"
1015  " </unitDefinition>\n"
1016  " <unitDefinition metaid=\"_000003\" id=\"unit_2\" name=\"unit_2\">\n"
1017  " <listOfUnits>\n"
1018  " <unit kind=\"second\" exponent=\"-1\" scale=\"0\" multiplier=\"1\"/>\n"
1019  " </listOfUnits>\n"
1020  " </unitDefinition>\n"
1021  " </listOfUnitDefinitions> \n"
1022  " <listOfCompartments>\n"
1023  " <compartment metaid=\"_000005\" id=\"compartment_1\" name=\"compartment_1\" size=\"1e-16\">\n"
1024  " </compartment>\n"
1025  " </listOfCompartments>\n"
1026  " <listOfSpecies>\n"
1027  " <species metaid=\"_000006\" id=\"species_1\" name=\"species_1\" compartment=\"compartment_1\" initialAmount=\"1.0\"/>\n"
1028  " </listOfSpecies> \n"
1029  " <listOfParameters>\n"
1030  " <parameter metaid=\"_000007\" id=\"parameter_1\" name=\"parameter_1\" value=\"3.0\" constant=\"false\" units=\"unit_2\"/>\n"
1031  " </listOfParameters>\n"
1032  " <listOfReactions>\n"
1033  " <reaction metaid=\"_000008\" id=\"reaction_1\" name=\"reaction_1\">\n"
1034  " <listOfReactants>\n"
1035  " <speciesReference species=\"species_1\"/>\n"
1036  " </listOfReactants>\n"
1037  " <kineticLaw>\n"
1038  " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
1039  " <apply>\n"
1040  " <times/>\n"
1041  " <ci> compartment_1 </ci>\n"
1042  " <apply>\n"
1043  " <ci> function_1 </ci>\n"
1044  " <ci> parameter_1 </ci>\n"
1045  " <ci> species_1 </ci>\n"
1046  " </apply>\n"
1047  " </apply>\n"
1048  " </math>\n"
1049  " </kineticLaw>\n"
1050  " </reaction>\n"
1051  " </listOfReactions>\n"
1052  " </model>\n"
1053  "</sbml>\n"
1054  ;
1055 
1056 const char* test000058::MODEL_STRING2 =
1057  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1058  "<!-- generated with COPASI 4.3.25 (Debug) (http://www.copasi.org) at 2008-04-29 13:08:40 UTC -->\n"
1059  "<COPASI xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.copasi.org/static/schema.xsd\" versionMajor=\"1\" versionMinor=\"0\" versionDevel=\"25\">\n"
1060  " <ListOfFunctions>\n"
1061  " <Function key=\"Function_40\" name=\"Function for reaction_1\" type=\"UserDefined\" reversible=\"true\">\n"
1062  " <Expression>\n"
1063  " parameter_1*species_1\n"
1064  " </Expression>\n"
1065  " <ListOfParameterDescriptions>\n"
1066  " <ParameterDescription key=\"FunctionParameter_250\" name=\"parameter_1\" order=\"0\" role=\"constant\"/>\n"
1067  " <ParameterDescription key=\"FunctionParameter_254\" name=\"species_1\" order=\"1\" role=\"substrate\"/>\n"
1068  " </ListOfParameterDescriptions>\n"
1069  " </Function>\n"
1070  " </ListOfFunctions>\n"
1071  " <Model key=\"Model_1\" name=\"model_1\" timeUnit=\"s\" volumeUnit=\"l\" quantityUnit=\"mol\" type=\"deterministic\">\n"
1072  " <Comment>\n"
1073  " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
1074  " \n"
1075  " </body>\n"
1076  " </Comment>\n"
1077  " <ListOfCompartments>\n"
1078  " <Compartment key=\"Compartment_0\" name=\"compartment_1\" simulationType=\"fixed\">\n"
1079  " </Compartment>\n"
1080  " </ListOfCompartments>\n"
1081  " <ListOfMetabolites>\n"
1082  " <Metabolite key=\"Metabolite_0\" name=\"species_1\" simulationType=\"reactions\" compartment=\"Compartment_0\">\n"
1083  " </Metabolite>\n"
1084  " </ListOfMetabolites>\n"
1085  " <ListOfModelValues>\n"
1086  " <ModelValue key=\"ModelValue_0\" name=\"parameter_1\" simulationType=\"fixed\">\n"
1087  " </ModelValue>\n"
1088  " </ListOfModelValues>\n"
1089  " <ListOfReactions>\n"
1090  " <Reaction key=\"Reaction_0\" name=\"reaction_1\" reversible=\"true\">\n"
1091  " <ListOfSubstrates>\n"
1092  " <Substrate metabolite=\"Metabolite_0\" stoichiometry=\"1\"/>\n"
1093  " </ListOfSubstrates>\n"
1094  " <ListOfConstants>\n"
1095  " <Constant key=\"Parameter_81\" name=\"parameter_1\" value=\"1\"/>\n"
1096  " </ListOfConstants>\n"
1097  " <KineticLaw function=\"Function_40\">\n"
1098  " <ListOfCallParameters>\n"
1099  " <CallParameter functionParameter=\"FunctionParameter_250\">\n"
1100  " <SourceParameter reference=\"ModelValue_0\"/>\n"
1101  " </CallParameter>\n"
1102  " <CallParameter functionParameter=\"FunctionParameter_254\">\n"
1103  " <SourceParameter reference=\"Metabolite_0\"/>\n"
1104  " </CallParameter>\n"
1105  " </ListOfCallParameters>\n"
1106  " </KineticLaw>\n"
1107  " </Reaction>\n"
1108  " </ListOfReactions>\n"
1109  " <StateTemplate>\n"
1110  " <StateTemplateVariable objectReference=\"Model_1\"/>\n"
1111  " <StateTemplateVariable objectReference=\"Metabolite_0\"/>\n"
1112  " <StateTemplateVariable objectReference=\"ModelValue_0\"/>\n"
1113  " <StateTemplateVariable objectReference=\"Compartment_0\"/>\n"
1114  " </StateTemplate>\n"
1115  " <InitialState type=\"initialState\">\n"
1116  " 0 6.0221415e+23 3 1e-16\n"
1117  " </InitialState>\n"
1118  " </Model>\n"
1119  " <SBMLReference file=\"test000058.xml\">\n"
1120  " <SBMLMap SBMLid=\"compartment_1\" COPASIkey=\"Compartment_0\"/>\n"
1121  " <SBMLMap SBMLid=\"parameter_1\" COPASIkey=\"ModelValue_0\"/>\n"
1122  " <SBMLMap SBMLid=\"reaction_1\" COPASIkey=\"Reaction_0\"/>\n"
1123  " <SBMLMap SBMLid=\"species_1\" COPASIkey=\"Metabolite_0\"/>\n"
1124  " </SBMLReference>\n"
1125  "</COPASI>\n"
1126  ;
SBMLDocument * getCurrentSBMLDocument()
CFunction * addAndAdaptName(CFunction *pFunction)
void test_bug1025_7()
Definition: test000058.cpp:821
Header file of class CModelEntity and CModelValue.
static CCopasiDataModel * pCOPASIDATAMODEL
Definition: test000058.h:43
const CCopasiVector< CMetab > & getMetabolites() const
Definition: CModel.cpp:1051
const std::string & getObjectName() const
static const char * MODEL_STRING2
Definition: test000058.h:42
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
void test_bug1025_9()
Definition: test000058.cpp:899
CCopasiObject * getInitialValueReference() const
void setParameterValue(const std::string &parameterName, const C_FLOAT64 &value, const bool &updateStatus=true)
Definition: CReaction.cpp:303
CCopasiObject * getValueReference() const
void test_bug1025_1()
Definition: test000058.cpp:545
bool addProduct(const std::string &metabKey, const C_FLOAT64 &multiplicity=1.0)
Definition: CReaction.cpp:236
static const char * MODEL_STRING
Definition: test000058.h:41
CModelValue * createModelValue(const std::string &name, const C_FLOAT64 &value=0.0)
Definition: CModel.cpp:2838
Definition: CMetab.h:178
virtual bool setInfix(const std::string &infix)
Definition: CFunction.cpp:73
bool load_cps_model_from_stream(std::istream &is, CCopasiDataModel &dataModel)
Definition: utilities.cpp:21
virtual const std::string & getKey() const
void setUp()
Definition: test000058.cpp:31
bool setFunction(const std::string &functionName)
Definition: CReaction.cpp:255
virtual void setStatus(const CModelEntity::Status &status)
void test_bug1025_2()
Definition: test000058.cpp:591
CReaction * createReaction(const std::string &name)
Definition: CModel.cpp:2760
CCopasiParameter * getParameter(const std::string &name)
static CFunctionDB * getFunctionList()
void test_bug1025_6()
Definition: test000058.cpp:781
static CCopasiDataModel * addDatamodel()
void test_bug1025_10()
Definition: test000058.cpp:938
void tearDown()
Definition: test000058.cpp:39
bool compileIfNecessary(CProcessReport *pProcessReport)
Definition: CModel.cpp:612
const CCopasiParameterGroup & getParameters() const
Definition: CReaction.cpp:333
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
virtual bool compile()
The class for handling a chemical kinetic function.
Definition: CFunction.h:29
static void init(int argc, char *argv[], const bool &withGui=false)
Definition: CModel.h:50
CConcentrationReference * getInitialConcentrationReference() const
Definition: CMetab.cpp:861
std::vector< Refresh * > buildInitialRefreshSequence(std::set< const CCopasiObject * > &changedObjects)
Definition: CModel.cpp:4164
void test_bug1025_8()
Definition: test000058.cpp:860
void test_bug1025_3()
Definition: test000058.cpp:636
bool setExpression(const std::string &expression)
bool checkIfIdsUnique(const Model *pSBMLModel)
Definition: test000058.cpp:44
void test_bug1025_4()
Definition: test000058.cpp:681
CCompartment * createCompartment(const std::string &name, const C_FLOAT64 &volume=1.0)
Definition: CModel.cpp:2698
void test_bug1025_5()
Definition: test000058.cpp:726
CMetab * createMetabolite(const std::string &name, const std::string &compartment, const C_FLOAT64 &iconc=1.0, const CModelEntity::Status &status=CModelEntity::REACTIONS)
Definition: CModel.cpp:2622