14 #include "utilities.hpp"
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"
47 std::set<std::string> ids;
49 if (pSBMLModel != NULL)
52 const SBase* pSBase = NULL;
55 if (pSBMLModel->isSetId())
57 id = pSBMLModel->getId();
59 if (ids.find(
id) == ids.end())
70 pSBase = pSBMLModel->getListOfFunctionDefinitions();
74 if (pSBase->isSetId())
78 if (ids.find(
id) == ids.end())
88 unsigned int i, iMax = pSBMLModel->getListOfFunctionDefinitions()->size();
90 for (i = 0; i < iMax; ++i)
92 pSBase = pSBMLModel->getListOfFunctionDefinitions()->get(i);
94 if (pSBase->isSetId())
98 if (ids.find(
id) == ids.end())
111 pSBase = pSBMLModel->getListOfCompartmentTypes();
115 if (pSBase->isSetId())
117 id = pSBase->getId();
119 if (ids.find(
id) == ids.end())
130 unsigned int i, iMax = pSBMLModel->getListOfCompartmentTypes()->size();
132 for (i = 0; i < iMax; ++i)
134 pSBase = pSBMLModel->getCompartmentType(i);
135 assert(pSBase != NULL);
137 if (pSBase->isSetId())
139 id = pSBase->getId();
141 if (ids.find(
id) == ids.end())
154 pSBase = pSBMLModel->getListOfSpeciesTypes();
158 if (pSBase->isSetId())
160 id = pSBase->getId();
162 if (ids.find(
id) == ids.end())
173 unsigned int i, iMax = pSBMLModel->getListOfSpeciesTypes()->size();
175 for (i = 0; i < iMax; ++i)
177 pSBase = pSBMLModel->getSpeciesType(i);
178 assert(pSBase != NULL);
180 if (pSBase->isSetId())
182 id = pSBase->getId();
184 if (ids.find(
id) == ids.end())
197 pSBase = pSBMLModel->getListOfCompartments();
201 if (pSBase->isSetId())
203 id = pSBase->getId();
205 if (ids.find(
id) == ids.end())
216 unsigned int i, iMax = pSBMLModel->getListOfCompartments()->size();
218 for (i = 0; i < iMax; ++i)
220 pSBase = pSBMLModel->getCompartment(i);
221 assert(pSBase != NULL);
223 if (pSBase->isSetId())
225 id = pSBase->getId();
227 if (ids.find(
id) == ids.end())
240 pSBase = pSBMLModel->getListOfSpecies();
244 if (pSBase->isSetId())
246 id = pSBase->getId();
248 if (ids.find(
id) == ids.end())
259 unsigned int i, iMax = pSBMLModel->getListOfSpecies()->size();
261 for (i = 0; i < iMax; ++i)
263 pSBase = pSBMLModel->getSpecies(i);
264 assert(pSBase != NULL);
266 if (pSBase->isSetId())
268 id = pSBase->getId();
270 if (ids.find(
id) == ids.end())
283 pSBase = pSBMLModel->getListOfParameters();
287 if (pSBase->isSetId())
289 id = pSBase->getId();
291 if (ids.find(
id) == ids.end())
302 unsigned int i, iMax = pSBMLModel->getListOfParameters()->size();
304 for (i = 0; i < iMax; ++i)
306 pSBase = pSBMLModel->getParameter(i);
307 assert(pSBase != NULL);
309 if (pSBase->isSetId())
311 id = pSBase->getId();
313 if (ids.find(
id) == ids.end())
326 pSBase = pSBMLModel->getListOfInitialAssignments();
330 if (pSBase->isSetId())
332 id = pSBase->getId();
334 if (ids.find(
id) == ids.end())
346 pSBase = pSBMLModel->getListOfRules();
350 if (pSBase->isSetId())
352 id = pSBase->getId();
354 if (ids.find(
id) == ids.end())
366 pSBase = pSBMLModel->getListOfConstraints();
370 if (pSBase->isSetId())
372 id = pSBase->getId();
374 if (ids.find(
id) == ids.end())
386 pSBase = pSBMLModel->getListOfReactions();
390 if (pSBase->isSetId())
392 id = pSBase->getId();
394 if (ids.find(
id) == ids.end())
405 unsigned int i, iMax = pSBMLModel->getListOfReactions()->size();
407 for (i = 0; i < iMax; ++i)
409 const Reaction* pReaction = pSBMLModel->getReaction(i);
410 assert(pReaction != NULL);
412 if (pReaction->isSetId())
414 id = pReaction->getId();
416 if (ids.find(
id) == ids.end())
429 if (pReaction->getListOfReactants() != NULL)
431 pSBase = pReaction->getListOfReactants();
432 unsigned int j, jMax = pReaction->getListOfReactants()->size();
434 for (j = 0; j < jMax; ++j)
436 pSBase = pReaction->getReactant(j);
437 assert(pSBase != NULL);
440 if (pSBase->isSetId())
442 id = pSBase->getId();
444 if (ids.find(
id) == ids.end())
456 if (pReaction->getListOfProducts() != NULL)
458 pSBase = pReaction->getListOfProducts();
459 unsigned int j, jMax = pReaction->getListOfProducts()->size();
461 for (j = 0; j < jMax; ++j)
463 pSBase = pReaction->getProduct(j);
464 assert(pSBase != NULL);
467 if (pSBase->isSetId())
469 id = pSBase->getId();
471 if (ids.find(
id) == ids.end())
483 if (pReaction->getListOfModifiers() != NULL)
485 pSBase = pReaction->getListOfModifiers();
486 unsigned int j, jMax = pReaction->getListOfModifiers()->size();
488 for (j = 0; j < jMax; ++j)
490 pSBase = pReaction->getModifier(j);
491 assert(pSBase != NULL);
494 if (pSBase->isSetId())
496 id = pSBase->getId();
498 if (ids.find(
id) == ids.end())
513 pSBase = pSBMLModel->getListOfEvents();
517 if (pSBase->isSetId())
519 id = pSBase->getId();
521 if (ids.find(
id) == ids.end())
549 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
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);
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)");
567 pModel->compileIfNecessary(NULL);
568 std::set<const CCopasiObject*> changedObjects;
570 std::vector<Refresh*> refreshes = pModel->buildInitialRefreshSequence(changedObjects);
571 std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
573 while (refreshIt != refreshEndit)
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);
595 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
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);
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;
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();
618 while (refreshIt != refreshEndit)
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);
640 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
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);
652 CPPUNIT_ASSERT(pModel != NULL);
654 CPPUNIT_ASSERT(pMetabolite != NULL);
655 pModel->compileIfNecessary(NULL);
656 std::set<const CCopasiObject*> changedObjects;
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();
663 while (refreshIt != refreshEndit)
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);
685 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
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);
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;
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();
708 while (refreshIt != refreshEndit)
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);
730 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
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);
742 CPPUNIT_ASSERT(pModel != NULL);
745 CPPUNIT_ASSERT(pFunctionDefinition != NULL);
746 CPPUNIT_ASSERT(pFunctionDefinition->
setInfix(
"3 * 5") ==
true);
747 pFunctionDefinition->
compile();
750 CModelValue* pModelValue = pModel->createModelValue(
"parameter_2");
751 CPPUNIT_ASSERT(pModelValue != NULL);
755 pModel->compileIfNecessary(NULL);
756 std::set<const CCopasiObject*> changedObjects;
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();
763 while (refreshIt != refreshEndit)
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);
786 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
788 CPPUNIT_ASSERT(pDocument == NULL);
791 CPPUNIT_ASSERT(pModel != NULL);
793 CPPUNIT_ASSERT(pReaction != NULL);
795 pReaction->
setFunction(
"Constant flux (irreversible)");
798 std::set<const CCopasiObject*> changedObjects;
801 std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
803 while (refreshIt != refreshEndit)
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);
826 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
828 CPPUNIT_ASSERT(pDocument == NULL);
831 CPPUNIT_ASSERT(pModel != NULL);
833 CPPUNIT_ASSERT(pCompartment != NULL);
835 std::set<const CCopasiObject*> changedObjects;
837 CPPUNIT_ASSERT(pObject != NULL);
838 changedObjects.insert(pObject);
840 std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
842 while (refreshIt != refreshEndit)
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);
865 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
867 CPPUNIT_ASSERT(pDocument == NULL);
870 CPPUNIT_ASSERT(pModel != NULL);
872 CPPUNIT_ASSERT(pMetabolite != NULL);
874 std::set<const CCopasiObject*> changedObjects;
876 CPPUNIT_ASSERT(pObject != NULL);
877 changedObjects.insert(pObject);
879 std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
881 while (refreshIt != refreshEndit)
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);
904 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
906 CPPUNIT_ASSERT(pDocument == NULL);
909 CPPUNIT_ASSERT(pModel != NULL);
911 CPPUNIT_ASSERT(pModelValue != NULL);
913 std::set<const CCopasiObject*> changedObjects;
915 CPPUNIT_ASSERT(pObject != NULL);
916 changedObjects.insert(pObject);
918 std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
920 while (refreshIt != refreshEndit)
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);
943 CPPUNIT_ASSERT(pDataModel->
getModel() != NULL);
945 CPPUNIT_ASSERT(pDocument == NULL);
948 CPPUNIT_ASSERT(pModel != NULL);
951 CPPUNIT_ASSERT(pFunctionDefinition != NULL);
952 CPPUNIT_ASSERT(pFunctionDefinition->
setInfix(
"3 * 5") ==
true);
953 pFunctionDefinition->
compile();
957 CPPUNIT_ASSERT(pModelValue != NULL);
962 std::set<const CCopasiObject*> changedObjects;
964 CPPUNIT_ASSERT(pObject != NULL);
965 changedObjects.insert(pObject);
967 std::vector<Refresh*>::iterator refreshIt = refreshes.begin(), refreshEndit = refreshes.end();
969 while (refreshIt != refreshEndit)
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);
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"
1008 " </functionDefinition>\n"
1009 " </listOfFunctionDefinitions> \n"
1010 " <listOfUnitDefinitions>\n"
1011 " <unitDefinition metaid=\"_000002\" id=\"time\" name=\"time\">\n"
1013 " <unit kind=\"second\" scale=\"0\" multiplier=\"1\"/>\n"
1015 " </unitDefinition>\n"
1016 " <unitDefinition metaid=\"_000003\" id=\"unit_2\" name=\"unit_2\">\n"
1018 " <unit kind=\"second\" exponent=\"-1\" scale=\"0\" multiplier=\"1\"/>\n"
1020 " </unitDefinition>\n"
1021 " </listOfUnitDefinitions> \n"
1022 " <listOfCompartments>\n"
1023 " <compartment metaid=\"_000005\" id=\"compartment_1\" name=\"compartment_1\" size=\"1e-16\">\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"
1038 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n"
1041 " <ci> compartment_1 </ci>\n"
1043 " <ci> function_1 </ci>\n"
1044 " <ci> parameter_1 </ci>\n"
1045 " <ci> species_1 </ci>\n"
1051 " </listOfReactions>\n"
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"
1063 " parameter_1*species_1\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"
1070 " </ListOfFunctions>\n"
1071 " <Model key=\"Model_1\" name=\"model_1\" timeUnit=\"s\" volumeUnit=\"l\" quantityUnit=\"mol\" type=\"deterministic\">\n"
1073 " <body xmlns=\"http://www.w3.org/1999/xhtml\">\n"
1077 " <ListOfCompartments>\n"
1078 " <Compartment key=\"Compartment_0\" name=\"compartment_1\" simulationType=\"fixed\">\n"
1080 " </ListOfCompartments>\n"
1081 " <ListOfMetabolites>\n"
1082 " <Metabolite key=\"Metabolite_0\" name=\"species_1\" simulationType=\"reactions\" compartment=\"Compartment_0\">\n"
1084 " </ListOfMetabolites>\n"
1085 " <ListOfModelValues>\n"
1086 " <ModelValue key=\"ModelValue_0\" name=\"parameter_1\" simulationType=\"fixed\">\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"
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"
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"
SBMLDocument * getCurrentSBMLDocument()
CFunction * addAndAdaptName(CFunction *pFunction)
Header file of class CModelEntity and CModelValue.
static CCopasiDataModel * pCOPASIDATAMODEL
const CCopasiVector< CMetab > & getMetabolites() const
const std::string & getObjectName() const
static const char * MODEL_STRING2
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
CCopasiObject * getInitialValueReference() const
void setParameterValue(const std::string ¶meterName, const C_FLOAT64 &value, const bool &updateStatus=true)
CCopasiObject * getValueReference() const
bool addProduct(const std::string &metabKey, const C_FLOAT64 &multiplicity=1.0)
static const char * MODEL_STRING
CModelValue * createModelValue(const std::string &name, const C_FLOAT64 &value=0.0)
virtual bool setInfix(const std::string &infix)
bool load_cps_model_from_stream(std::istream &is, CCopasiDataModel &dataModel)
virtual const std::string & getKey() const
bool setFunction(const std::string &functionName)
virtual void setStatus(const CModelEntity::Status &status)
CReaction * createReaction(const std::string &name)
CCopasiParameter * getParameter(const std::string &name)
static CFunctionDB * getFunctionList()
static CCopasiDataModel * addDatamodel()
bool compileIfNecessary(CProcessReport *pProcessReport)
const CCopasiParameterGroup & getParameters() const
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
The class for handling a chemical kinetic function.
static void init(int argc, char *argv[], const bool &withGui=false)
std::vector< Refresh * > buildInitialRefreshSequence(std::set< const CCopasiObject * > &changedObjects)
bool setExpression(const std::string &expression)
bool checkIfIdsUnique(const Model *pSBMLModel)
CCompartment * createCompartment(const std::string &name, const C_FLOAT64 &volume=1.0)
CMetab * createMetabolite(const std::string &name, const std::string &compartment, const C_FLOAT64 &iconc=1.0, const CModelEntity::Status &status=CModelEntity::REACTIONS)