51 #ifdef USE_MATH_CONTAINER
53 #endif //USE_MATH_CONTAINER
59 #define CCHECK {check();}
64 #define MNumMetabolitesReactionDependent (mNumMetabolitesReaction - mNumMetabolitesReactionIndependent)
67 {
"dimensionless",
"m\xc2\xb3",
"l",
"ml",
"\xc2\xb5l",
"nl",
"pl",
"fl", NULL};
70 {
"dimensionless",
"m\xc2\xb2",
"dm\xc2\xb2",
"cm\xc2\xb2",
"mm\xc2\xb2",
"\xc2\xb5m\xc2\xb2",
"nm\xc2\xb2",
"pm\xc2\xb2",
"fm\xc2\xb2", NULL};
73 {
"dimensionless",
"m",
"dm",
"cm",
"mm",
"\xc2\xb5m",
"nm",
"pm",
"fm", NULL};
76 {
"dimensionless",
"d",
"h",
"min",
"s",
"ms",
"\xc2\xb5s",
"ns",
"ps",
"fs", NULL};
82 {
"dimensionless",
"Mol",
"mMol",
"\xc2\xb5Mol",
"nMol",
"pMol",
"fMol",
"#", NULL};
85 {
"dimensionless",
"mol",
"mmol",
"\xc2\xb5mol",
"nmol",
"pmol",
"fmol",
"#", NULL};
88 {
"deterministic",
"stochastic", NULL};
94 mStateTemplate(*this, this->mInitialState, this->mCurrentState),
95 mSimulatedUpToDateObjects(),
96 mInitialDependencies(),
97 mTransientDependencies(),
98 mPhysicalDependencies(),
99 #ifdef USE_MATH_CONTAINER
100 mpMathContainer(NULL),
107 mType(deterministic),
108 mCompartments(
"Compartments", this),
109 mMetabolites(
"Metabolites", this),
110 mMetabolitesX(
"Reduced Model Metabolites", this),
111 mSteps(
"Reactions", this),
112 mEvents(
"Events", this),
114 mValues(
"Values", this),
115 mParameterSet(
"Initial State", this),
116 mParameterSets(
"ParameterSets", this),
117 mActiveParameterSetKey(
""),
118 mMoieties(
"Moieties", this),
120 mpStoiAnnotation(NULL),
123 mpRedStoiAnnotation(NULL),
124 mNumMetabolitesUnused(0),
125 mNumMetabolitesODE(0),
126 mNumMetabolitesReaction(0),
127 mNumMetabolitesAssignment(0),
128 mNumMetabolitesReactionIndependent(0),
130 mpLinkMatrixAnnotation(NULL),
132 mAvogadro(6.02214179e23),
133 mQuantity2NumberFactor(1.0),
134 mNumber2QuantityFactor(1.0),
135 mpCompileHandler(NULL),
137 mSimulatedRefreshes(),
138 mApplyInitialValuesRefreshes(),
139 mNonSimulatedRefreshes(),
140 mReorderNeeded(false),
142 mBuildInitialSequence(true),
151 *
mpValue = std::numeric_limits<C_FLOAT64>::quiet_NaN();
155 for (i = 0; i < imax; i++)
236 #ifdef USE_MATH_CONTAINER
238 #endif // USE_MATH_CONTAINER
263 if ((Fail = configBuffer.
getVariable(
"TotalMetabolites",
"C_INT32",
269 assert(pDataModel != NULL);
272 if ((Fail = configBuffer.
getVariable(
"Title",
"string", &tmp,
282 Fail = configBuffer.
getVariable(
"Comments",
"multiline", &Notes,
298 Fail = configBuffer.
getVariable(
"TimeUnit",
"string", &tmp,
313 Fail = configBuffer.
getVariable(
"ConcentrationUnit",
"string", &tmp,
328 Fail = configBuffer.
getVariable(
"VolumeUnit",
"string", &tmp,
343 if ((Fail = configBuffer.
getVariable(
"TotalCompartments",
"C_INT32", &Size,
356 addMetabolite(pMetabolite);
366 if ((Fail = configBuffer.
getVariable(
"TotalSteps",
"C_INT32", &Size,
394 unsigned C_INT32 CompileStep = 0;
400 unsigned C_INT32 totalSteps = 7;
494 for (; itSpecies != endSpecies; ++itSpecies)
496 (*itSpecies)->compileIsInitialConcentrationChangeAllowed();
520 #ifdef USE_MATH_CONTAINER
525 #endif // USE_MATH_CONTAINER
558 for (; ppEntity != ppEntityEnd; ++ppEntity)
560 CMetab * pSpecies =
dynamic_cast< CMetab *
>(*ppEntity);
565 if (pSpecies != NULL)
571 switch ((*ppEntity)->getStatus())
586 for (; itMoiety != endMoiety; ++itMoiety)
593 #ifdef COPASI_DEBUG_TRACE
596 File.open(
"InitialDependencies.dot");
600 File.open(
"SimulationDependencies.dot");
603 #endif //COPASI_DEBUG_TRACE
676 for (; pCol < pColEnd; ++pCol, ++itStep)
682 if (!(*itStep)->getFunction()->isUsable())
684 (*itStep)->getObjectName().c_str(),
685 (*itStep)->getFunction()->getObjectName().c_str());
688 (*itStep)->getChemEq().getBalances();
692 for (; itBalance != endBalance; ++itBalance)
694 const std::string & key = (*itBalance)->getMetaboliteKey();
698 pRow += numCols, ++itMetab)
699 if ((*itMetab)->getKey() == key)
701 *pRow = (*itBalance)->getMultiplicity();
713 DebugFile <<
"Stoichiometry Matrix" << std::endl;
725 size_t numRows, numCols;
735 std::vector< size_t > Unused;
737 for (i = 0; i < numRows; i++)
741 for (pRowEnd = pStoi + numCols; pStoi < pRowEnd; ++pStoi)
747 NumUnused = Unused.size();
749 if (NumUnused == 0)
return false;
754 numRows -= NumUnused;
758 std::vector< CMetab * > UsedMetabolites(numRows);
759 std::vector< CMetab * >::iterator itUsedMetabolites = UsedMetabolites.begin();
760 std::vector< CMetab * > UnusedMetabolites(NumUnused);
761 std::vector< CMetab * >::iterator itUnusedMetabolites = UnusedMetabolites.begin();
762 std::vector< size_t >::const_iterator itUnused = Unused.begin();
763 std::vector< size_t >::const_iterator endUnused = Unused.end();
771 for (i = 0; itMetab != endMetab; ++itMetab, i++, pStoi += numCols)
773 if (itUnused != endUnused && i == *itUnused)
775 (*itMetab)->setUsed(
false);
776 *itUnusedMetabolites = (*itMetab);
778 ++itUnusedMetabolites;
783 (*itMetab)->setUsed(
true);
784 *itUsedMetabolites = (*itMetab);
788 memcpy(pNewStoi, pStoi,
sizeof(
C_FLOAT64) * numCols);
798 itUsedMetabolites = UsedMetabolites.begin();
799 std::vector< CMetab * >::iterator itMetabolitesEnd = UsedMetabolites.end();
801 for (; itUsedMetabolites != itMetabolitesEnd; ++itUsedMetabolites, ++itMetab)
802 *itMetab = *itUsedMetabolites;
808 for (; itMetab != endMetab; ++itMetab)
809 *itMetab = *(itMetab + NumUnused);
812 itUnusedMetabolites = UnusedMetabolites.begin();
813 itMetabolitesEnd = UnusedMetabolites.end();
815 for (; itUnusedMetabolites != itMetabolitesEnd; ++itUnusedMetabolites, ++itMetab)
816 *itMetab = *itUnusedMetabolites;
820 mNumMetabolitesReaction -= NumUnused;
821 mNumMetabolitesUnused += NumUnused;
843 for (; ppMetab != ppMetabEnd; ++ppMetab, ++itMetabX)
845 *ppMetab = *itMetabX;
852 ppMetab = ReactionMetabolites.
array();
855 for (; ppMetab != ppMetabEnd; ++ppMetab, ++itMetabX)
857 *itMetabX = *ppMetab;
875 for (j = 0; it != end; ++it, j++)
887 for (; it != end; ++it, j++)
901 for (; it != end; ++it)
902 (*it)->refreshInitialValue();
920 for (; itDependent != endDependent; ++itDependent)
922 pMoiety =
new CMoiety((*itDependent)->getObjectName());
923 pMoiety->
add(1.0, *itDependent);
928 if (fabs(*pFactor) > std::numeric_limits< C_FLOAT64 >::epsilon())
929 pMoiety->
add(- *pFactor, *itIndependent);
953 for (; itCompartment != endCompartment; ++itCompartment)
955 itMetab = (*itCompartment)->getMetabolites().
begin();
956 endMetab = (*itCompartment)->getMetabolites().
end();
958 for (; itMetab != endMetab; ++itMetab)
961 (*itMetab)->setDependentOn(NULL);
970 std::vector< CMetab *> ODEMetabs;
971 std::vector< CMetab *> ReactionMetabs;
972 std::vector< CMetab *> AssignmentMetabs;
973 std::vector< CMetab *> FixedMetabs;
975 for (; itMetab != endMetab; ++itMetab)
976 switch ((*itMetab)->getStatus())
979 FixedMetabs.push_back(*itMetab);
980 (*itMetab)->setUsed(
false);
984 AssignmentMetabs.push_back(*itMetab);
985 (*itMetab)->setUsed(
true);
989 ODEMetabs.push_back(*itMetab);
990 (*itMetab)->setUsed(
true);
994 ReactionMetabs.push_back(*itMetab);
995 (*itMetab)->setUsed(
true);
1009 std::vector< CMetab *>::const_iterator itSorted = ODEMetabs.begin();
1010 std::vector< CMetab *>::const_iterator endSorted = ODEMetabs.end();
1012 for (; itSorted != endSorted; ++itSorted, ++itMetab)
1013 *itMetab = *itSorted;
1016 itSorted = ReactionMetabs.begin();
1017 endSorted = ReactionMetabs.end();
1019 for (; itSorted != endSorted; ++itSorted, ++itMetab)
1020 *itMetab = *itSorted;
1023 itSorted = AssignmentMetabs.begin();
1024 endSorted = AssignmentMetabs.end();
1026 for (; itSorted != endSorted; ++itSorted, ++itMetab)
1027 *itMetab = *itSorted;
1030 itSorted = FixedMetabs.begin();
1031 endSorted = FixedMetabs.end();
1033 for (; itSorted != endSorted; ++itSorted, ++itMetab)
1034 *itMetab = *itSorted;
1087 if (pParameterSet != NULL)
1203 std::string Name =
unQuote(name);
1205 for (i = 0; i < imax; i++, Target++)
1207 ((*Target)->getObjectName() == name ||
1208 (*Target)->getObjectName() == Name))
return i;
1223 for (i = 0; i <
s; i++)
1248 while (itRefresh != endRefresh)
1270 for (; itValue != endValue; ++itValue)
1271 if ((*itValue)->getStatus() ==
ODE)
1273 *ppEntity = *itValue;
1280 for (; itCompartment != endCompartment; ++itCompartment)
1281 if ((*itCompartment)->getStatus() ==
ODE)
1283 *ppEntity = *itCompartment;
1290 for (; itMetab != endMetab; ++itMetab)
1292 if (!(*itMetab)->isUsed())
break;
1294 *ppEntity++ = *itMetab;
1299 for (; itCompartment != endCompartment; ++itCompartment)
1300 if ((*itCompartment)->getStatus() ==
ASSIGNMENT)
1302 *ppEntity = *itCompartment;
1308 for (; itValue != endValue; ++itValue)
1311 *ppEntity = *itValue;
1315 for (; itMetab != endMetab; ++itMetab)
1316 *ppEntity++ = *itMetab;
1320 for (; itCompartment != endCompartment; ++itCompartment)
1321 if ((*itCompartment)->isFixed())
1322 *ppEntity++ = *itCompartment;
1326 for (; itValue != endValue; ++itValue)
1327 if ((*itValue)->isFixed())
1328 *ppEntity++ = *itValue;
1337 for (; ppEntity != ppEntityEnd; ++ppEntity)
1343 for (; itReaction != endReaction; ++itReaction)
1344 (*itReaction)->compile();
1357 for (; itMetab != endMetab; ++itMetab)
1358 *ppEntity++ = *itMetab;;
1363 for (; itCompartment != endCompartment; ++itCompartment)
1364 *ppEntity++ = *itCompartment;
1369 for (; itValue != endValue; ++itValue)
1370 *ppEntity++ = *itValue;
1383 for (i = 0; pUserOrder != pUserOrderEnd; ++pUserOrder)
1385 const Status &
Status = ppEntity[*pUserOrder]->getStatus();
1387 if (Status ==
ODE ||
1397 bool success =
true;
1414 for (; ppEntity != ppEntityEnd; ++ppEntity)
1417 if ((*ppEntity)->getStatus() !=
ASSIGNMENT ||
1418 (*ppEntity)->getInitialValueReference()->getDirectDependencies().size() == 0)
1419 Objects.insert((*ppEntity)->getInitialValueReference());
1427 for (; itReaction != endReaction; ++itReaction)
1431 for (i = 0, imax = Group.
size(); i < imax; i++)
1477 while (itRefresh != endRefresh)
1485 bool success =
true;
1495 for (; ppEntity != ppEntityEnd; ++ppEntity)
1510 for (; itReaction != endReaction; ++itReaction)
1515 bool UnusedFound =
true;
1517 std::set<const CCopasiObject * > Candidate;
1518 std::set< const CCopasiObject * >::iterator it;
1526 UnusedFound =
false;
1530 for (; ppEntity != ppEntityEnd; ++ppEntity)
1531 if ((*ppEntity)->isUsed())
1534 pObject = *ppEntity;
1535 else if ((pMetab = dynamic_cast< CMetab *>(*ppEntity)) != NULL)
1538 pObject = (*ppEntity)->getValueReference();
1540 Candidate.insert(pObject);
1543 if (*it != pObject &&
1551 (*ppEntity)->setUsed(
false);
1554 Candidate.erase(pObject);
1567 for (; ppEntity != ppEntityEnd; ++ppEntity, ++ppReorder)
1568 *ppReorder = *ppEntity;
1576 for (; ppEntity != ppEntityEnd; ++ppEntity)
1577 if ((*ppEntity)->isUsed())
1578 *ppReorder++ = *ppEntity;
1582 for (; ppEntity != ppEntityEnd; ++ppEntity)
1583 if (!(*ppEntity)->isUsed())
1584 *ppReorder++ = *ppEntity;
1588 for (; ppEntity != ppEntityEnd; ++ppEntity, ++ppReorder)
1589 *ppReorder = *ppEntity;
1598 for (; ppEntity != ppEntityEnd; ++ppEntity)
1604 for (; itReaction != endReaction; ++itReaction)
1605 (*itReaction)->compile();
1612 std::set< const CCopasiObject * > UpToDate;
1629 bool success =
true;
1633 std::set< const CCopasiObject * > Objects;
1640 for (; ppEntity != ppEntityEnd; ++ppEntity)
1642 if ((*ppEntity)->getStatus() ==
ODE)
1646 Objects.insert((*ppEntity)->getRateReference());
1651 if ((*ppEntity)->getStatus() ==
ASSIGNMENT &&
1652 (pMetab =
dynamic_cast< const CMetab *
>(*ppEntity)) != NULL)
1658 std::set< const CCopasiObject * > UpToDate;
1662 std::vector< Refresh * > RateRefreshes =
1666 RateRefreshes.begin(),
1667 RateRefreshes.end());
1680 bool success =
true;
1688 for (; itComp != endComp; ++itComp)
1690 Objects.insert((*itComp)->getValueReference());
1692 switch ((*itComp)->getStatus())
1695 Objects.insert((*itComp)->getRateReference());
1707 for (; itMetab != endMetab; ++itMetab)
1709 Objects.insert((*itMetab)->getConcentrationReference());
1710 Objects.insert((*itMetab)->getValueReference());
1712 switch ((*itMetab)->getStatus())
1716 Objects.insert(static_cast< const CCopasiObject *>((*itMetab)->getObject(
CCopasiObjectName(
"Reference=TransitionTime"))));
1717 Objects.insert((*itMetab)->getConcentrationRateReference());
1718 Objects.insert((*itMetab)->getRateReference());
1730 for (; itStep != endStep; ++itStep)
1732 Objects.insert(static_cast< const CCopasiObject * >((*itStep)->getObject(
CCopasiObjectName(
"Reference=Flux"))));
1733 Objects.insert((*itStep)->getParticleFluxReference());
1740 for (; itValue != endValue; ++itValue)
1742 Objects.insert((*itValue)->getValueReference());
1744 switch ((*itValue)->getStatus())
1747 Objects.insert((*itValue)->getRateReference());
1822 updateSequence.clear();
1827 *reinterpret_cast< const CObjectInterface::ObjectSet *>(&changedObjects),
1828 *reinterpret_cast< const CObjectInterface::ObjectSet *>(&requestedObjects),
1834 CObjectInterface::UpdateSequence::iterator it = UpdateSequence.begin();
1835 CObjectInterface::UpdateSequence::iterator end = UpdateSequence.end();
1838 for (; it != end; ++it)
1842 if (pRefresh != NULL)
1844 updateSequence.push_back(pRefresh);
1861 for (; itMoiety != endMoiety; ++itMoiety, ++pDependent)
1862 *pDependent = (*itMoiety)->dependentNumber();
1868 while (itRefresh != endRefresh)
1877 for (; it != end; ++it, ++pFlux)
1879 *pFlux = (*it)->getParticleFlux();
1885 std::cout <<
"Reaction Flux[" << it -
mSteps.
begin() <<
"] is NaN" << std::endl;
1888 #endif // COPASI_DEBUG
1897 while (itRefresh != endRefresh)
1914 for (; ppIt != ppEnd; ++ppIt, ++pTmp)
1916 *pTmp = (*ppIt)->getRate();
1925 #endif // COPASI_DEBUG
1952 for (; ppIt != ppEnd; ++ppIt, ++pTmp)
1953 *pTmp = (*ppIt)->getRate();
1985 for (itEntity = beginEntity, Col = 0; itEntity != endEntity; ++itEntity, ++Col)
1994 for (itReaction = beginReaction, itE = beginE + Col;
1995 itReaction != endReaction;
1996 ++itReaction, itE += nCol)
1997 * itE = invVolume * (*itReaction)->calculatePartialDerivative(pX, factor, resolution);
2010 C_FLOAT64 DerivationFactor =
std::max(derivationFactor, 100.0 * std::numeric_limits< C_FLOAT64 >::epsilon());
2018 jacobian.
resize(Dim, Dim);
2037 for (Col = 0; pX != pXEnd; ++pX, ++Col)
2042 if (fabs(Store) < DerivationFactor)
2047 X2 = -2.0 * DerivationFactor;
2049 X2 = 2.0 * DerivationFactor;
2053 X1 = Store * (1.0 + DerivationFactor);
2054 X2 = Store * (1.0 - DerivationFactor);
2057 InvDelta = 1.0 / (X2 - X1);
2069 pJacobian = jacobian.
array() + Col;
2073 for (; pJacobian < pJacobianEnd; pJacobian += Dim, ++pY1, ++pY2)
2074 * pJacobian = (*pY2 - *pY1) * InvDelta;
2086 C_FLOAT64 DerivationFactor =
std::max(derivationFactor, 100.0 * std::numeric_limits< C_FLOAT64 >::epsilon());
2091 jacobianX.
resize(Dim, Dim);
2110 for (Col = 0; pX != pXEnd; ++pX, ++Col)
2115 if (fabs(Store) < DerivationFactor)
2120 X2 = -2.0 * DerivationFactor;
2122 X2 = 2.0 * DerivationFactor;;
2126 X1 = Store * (1.0 + DerivationFactor);
2127 X2 = Store * (1.0 - DerivationFactor);
2130 InvDelta = 1.0 / (X2 - X1);
2142 pJacobian = jacobianX.
array() + Col;
2146 for (; pJacobian < pJacobianEnd; pJacobian += Dim, ++pY1, ++pY2)
2147 * pJacobian = (*pY2 - *pY1) * InvDelta;
2262 bool success =
true;
2311 for (i = 0; i < imax; ++i)
2337 {
mType = modelType;}
2365 std::set< const CCopasiObject * > & dependentReactions,
2366 std::set< const CCopasiObject * > & dependentMetabolites,
2367 std::set< const CCopasiObject * > & dependentCompartments,
2368 std::set< const CCopasiObject * > & dependentModelValues,
2369 std::set< const CCopasiObject * > & dependentEvents)
const
2372 std::set< const CCopasiObject * > DeletedObjects = deletedObjects;
2374 bool ObjectsAppended =
false;
2375 bool DeleteObjects = DeletedObjects.size() > 0;
2380 while (DeleteObjects)
2382 DeleteObjects =
false;
2386 if (dependentReactions.size() > 0)
2388 std::set< const CCopasiObject * >::const_iterator it, itEnd = dependentReactions.end();
2390 for (it = dependentReactions.begin(); it != itEnd; ++it)
2391 if (DeletedObjects.find(*it) == DeletedObjects.end())
2396 std::set< const CCopasiObject * >::const_iterator itDeleted = AdditionalObjects.begin();
2397 std::set< const CCopasiObject * >::const_iterator endDeleted = AdditionalObjects.end();
2399 for (; itDeleted != endDeleted; ++itDeleted)
2400 DeletedObjects.insert(*itDeleted);
2406 if (dependentMetabolites.size() > 0)
2408 std::set< const CCopasiObject * >::const_iterator it, itEnd = dependentMetabolites.end();
2410 for (it = dependentMetabolites.begin(); it != itEnd; ++it)
2411 if (DeletedObjects.find(*it) == DeletedObjects.end())
2416 std::set< const CCopasiObject * >::const_iterator itDeleted = AdditionalObjects.begin();
2417 std::set< const CCopasiObject * >::const_iterator endDeleted = AdditionalObjects.end();
2419 for (; itDeleted != endDeleted; ++itDeleted)
2420 DeletedObjects.insert(*itDeleted);
2426 if (dependentModelValues.size() > 0)
2428 std::set< const CCopasiObject * >::const_iterator it, itEnd = dependentModelValues.end();
2430 for (it = dependentModelValues.begin(); it != itEnd; ++it)
2431 if (DeletedObjects.find(*it) == DeletedObjects.end())
2436 std::set< const CCopasiObject * >::const_iterator itDeleted = AdditionalObjects.begin();
2437 std::set< const CCopasiObject * >::const_iterator endDeleted = AdditionalObjects.end();
2439 for (; itDeleted != endDeleted; ++itDeleted)
2440 DeletedObjects.insert(*itDeleted);
2446 if (dependentCompartments.size() > 0)
2448 std::set< const CCopasiObject * >::const_iterator it, itEnd = dependentCompartments.end();
2450 for (it = dependentCompartments.begin(); it != itEnd; ++it)
2451 if (DeletedObjects.find(*it) == DeletedObjects.end())
2456 std::set< const CCopasiObject * >::const_iterator itDeleted = AdditionalObjects.begin();
2457 std::set< const CCopasiObject * >::const_iterator endDeleted = AdditionalObjects.end();
2459 for (; itDeleted != endDeleted; ++itDeleted)
2460 DeletedObjects.insert(*itDeleted);
2466 ObjectsAppended |= DeleteObjects;
2469 return ObjectsAppended;
2473 std::set< const CCopasiObject * > & dependents)
const
2477 size_t Size = dependents.size();
2482 CCopasiObject::DataObjectSet::const_iterator itSet;
2483 CCopasiObject::DataObjectSet::const_iterator endSet;
2485 for (; it != end; ++it)
2486 if (candidates.find(*it) == candidates.end())
2489 if (candidates.find(*it) == candidates.end())
2491 if ((*it)->mustBeDeleted(candidates))
2493 dependents.insert(*it);
2498 return Size < dependents.size();
2502 std::set< const CCopasiObject * > & dependents)
const
2506 size_t Size = dependents.size();
2514 CCopasiObject::DataObjectSet::const_iterator itSet;
2515 CCopasiObject::DataObjectSet::const_iterator endSet;
2517 for (; itComp != endComp; ++itComp)
2519 it = (*itComp)->getMetabolites().
begin();
2520 end = (*itComp)->getMetabolites().
end();
2522 for (; it != end; ++it)
2525 if (candidates.find(*it) == candidates.end())
2527 if ((*it)->mustBeDeleted(candidates))
2529 dependents.insert(*it);
2535 return Size < dependents.size();
2539 std::set< const CCopasiObject * > & dependents)
const
2543 size_t Size = dependents.size();
2548 std::set< const CCopasiObject * >::const_iterator itSet;
2549 std::set< const CCopasiObject * >::const_iterator endSet;
2551 for (; it != end; ++it)
2554 if (candidates.find(*it) == candidates.end())
2556 if ((*it)->mustBeDeleted(candidates))
2558 dependents.insert(*it);
2563 return Size < dependents.size();
2567 std::set< const CCopasiObject * > & dependents)
const
2571 size_t Size = dependents.size();
2576 std::set< const CCopasiObject * >::const_iterator itSet;
2577 std::set< const CCopasiObject * >::const_iterator endSet;
2579 for (; it != end; ++it)
2582 if (candidates.find(*it) == candidates.end())
2584 if ((*it)->mustBeDeleted(candidates))
2586 dependents.insert(*it);
2590 return Size < dependents.size();
2594 std::set< const CCopasiObject * > & dependents)
const
2598 size_t Size = dependents.size();
2603 std::set< const CCopasiObject * >::const_iterator itSet;
2604 std::set< const CCopasiObject * >::const_iterator endSet;
2606 for (; it != end; ++it)
2609 if (candidates.find(*it) == candidates.end())
2611 if ((*it)->mustBeDeleted(candidates))
2613 dependents.insert(*it);
2617 return Size < dependents.size();
2623 const std::string & compartment,
2632 if (compartment ==
"")
2661 const bool & recursive)
2668 const bool & recursive)
2676 const bool & recursive)
2721 const bool & recursive)
2728 const bool & recursive)
2736 const bool & recursive)
2748 mCompartments.CCopasiVector< CCompartment >::getIndex(pCompartment);
2778 const bool & recursive)
2786 const bool & recursive)
2793 const bool & recursive)
2805 mSteps.CCopasiVector< CReaction >::getIndex(pReaction);
2810 mSteps.CCopasiVector< CReaction >::remove(index);
2819 const bool & recursive)
2824 if (pParameter == NULL)
2829 std::set< const CCopasiObject * > DeletedObjects;
2861 std::set<const CCopasiObject*> Reactions;
2862 std::set<const CCopasiObject*> Metabolites;
2863 std::set<const CCopasiObject*> Values;
2864 std::set<const CCopasiObject*> Compartments;
2865 std::set<const CCopasiObject*> Events;
2869 std::set<const CCopasiObject*>::const_iterator it, end;
2871 for (it = Reactions.begin(), end = Reactions.end(); it != end; ++it)
2874 for (it = Metabolites.begin(), end = Metabolites.end(); it != end; ++it)
2877 for (it = Compartments.begin(), end = Compartments.end(); it != end; ++it)
2880 for (it = Values.begin(), end = Values.end(); it != end; ++it)
2883 for (it = Events.begin(), end = Events.end(); it != end; ++it)
2890 const bool & recursive)
2896 const bool & recursive)
2904 const bool & recursive)
2916 mValues.CCopasiVector< CModelValue >::getIndex(pModelValue);
2921 mValues.CCopasiVector< CModelValue >::remove(index);
2946 const bool & recursive)
2954 const bool & recursive)
2969 mEvents.CCopasiVector< CEvent >::getIndex(pEvent);
2974 mEvents.CCopasiVector< CEvent >::remove(index);
2983 #ifdef WITH_PE_EVENT_CREATION
2997 std::string getNextId(
const std::string& base,
int count)
2999 std::stringstream str;
3000 str << base << count;
3005 getDependentOrNull(
const std::map< CCopasiObject *, size_t > & dependentMap,
int index)
3008 std::map< CCopasiObject *, size_t >::const_iterator it = dependentMap.begin();
3010 while (it != dependentMap.end())
3012 if (it->second == index)
3022 CModel::createEventsForTimeseries(
CExperiment* experiment)
3025 #pragma region //find_experiment
3027 if (experiment == NULL)
3038 "The parameter estimation was not correctly setup.");
3047 for (
size_t i = 0; i < experiments.
size(); ++i)
3053 theExperiment = exp;
3059 if (theExperiment == NULL)
3062 "No suitable experiment could be found, please first define a time course experiment and map the data.");
3066 if (experiments.
size() > 1)
3069 "You have defined multiple experiments, this function will only create events for the first time course experiment, unless another is specified.");
3072 return createEventsForTimeseries(const_cast<CExperiment*>(theExperiment));
3075 #pragma endregion //find_experiment
3080 "The selected experiment, is not a time series experiment.");
3089 size_t CurrentLine = 1;
3091 if (!experiment->
read(File, CurrentLine))
3094 "The data file could not be read.");
3101 "The experiment could not be compiled.");
3112 "Need at least 2 data rows in the experiment.");
3121 const std::map< CCopasiObject *, size_t > & dependentMap = experiment->
getDependentObjects();
3124 for (
size_t i = 0; i < numRows; ++i)
3126 double current = time[i];
3129 if (current == 0)
continue;
3136 "Could not create event, please verify that the events have not been created before.");
3140 std::stringstream trigger; trigger
3142 <<
">" <<
" > " << current;
3149 for (
size_t j = 0; j < data.
numCols(); ++j)
3152 const CCopasiObject* currentObject = getDependentOrNull(dependentMap, j);
3154 if (currentObject == NULL || currentObject->
getObjectParent() == NULL)
continue;
3156 double value = data(i, j);
3163 "At time %.2f: a missing data point was encountered for '%s', the value has been ignored."
3164 , current, displayName.c_str());
3170 std::stringstream assignmentStr; assignmentStr << value;
3181 if (!hadEvents)
return true;
3193 "Since the model contained events, the option 'Continue on Simultaneous Events' "
3194 "has been enabled in the 'Time 'Course' task to ensure that simulation continues "
3195 "if multiple events trigger at the same time.");
3214 bool success =
true;
3216 std::vector< CReaction * > reactionsToDelete;
3219 std::string fn, rn1, rn2;
3226 size_t i, imax = steps.
size();
3228 for (i = 0; i < imax; ++i)
3229 if (steps[i]->isReversible())
3231 std::vector< std::pair< const CCopasiObject * , const CCopasiObject * > > ParameterMap;
3241 bool massaction = (fn ==
"Mass action (reversible)");
3243 std::pair<CFunction *, CFunction *> tmp;
3251 tmp.second = tmp.first;
3259 if ((tmp.first == NULL) || (tmp.second == NULL))
3284 for (i = 0; i < imax; ++i)
3291 for (i = 0; i < imax; ++i)
3304 for (i = 0; i < imax; ++i)
3311 for (i = 0; i < imax; ++i)
3348 for (i = 0; i < imax; ++i)
3426 if (pNewParameter == NULL)
3455 std::vector< std::pair< const CCopasiObject *, const CCopasiObject * > >::const_iterator itParameter = ParameterMap.begin();
3456 std::vector< std::pair< const CCopasiObject *, const CCopasiObject * > >::const_iterator endParameter = ParameterMap.end();
3458 for (; itParameter != endParameter; ++itParameter)
3460 Old =
"<" + itParameter->first->getCN() +
">";
3461 New =
"<" + itParameter->second->getCN() +
">";
3468 for (; itComp != endComp; ++itComp)
3470 const CExpression * pExpression = (*itComp)->getExpressionPtr();
3472 if (pExpression != NULL)
3476 if (Dependencies.find(itParameter->first) != Dependencies.end())
3478 Infix = (*itComp)->getExpression();
3480 (*itComp)->setExpression(Infix);
3484 pExpression = (*itComp)->getInitialExpressionPtr();
3486 if (pExpression != NULL)
3490 if (Dependencies.find(itParameter->first) != Dependencies.end())
3492 Infix = (*itComp)->getInitialExpression();
3494 (*itComp)->setInitialExpression(Infix);
3503 for (; itMetab != endMetab; ++itMetab)
3505 const CExpression * pExpression = (*itMetab)->getExpressionPtr();
3507 if (pExpression != NULL)
3511 if (Dependencies.find(itParameter->first) != Dependencies.end())
3513 Infix = (*itMetab)->getExpression();
3515 (*itMetab)->setExpression(Infix);
3519 pExpression = (*itMetab)->getInitialExpressionPtr();
3521 if (pExpression != NULL)
3525 if (Dependencies.find(itParameter->first) != Dependencies.end())
3527 Infix = (*itMetab)->getInitialExpression();
3529 (*itMetab)->setInitialExpression(Infix);
3538 for (; itValue != endValue; ++itValue)
3540 const CExpression * pExpression = (*itValue)->getExpressionPtr();
3542 if (pExpression != NULL)
3546 if (Dependencies.find(itParameter->first) != Dependencies.end())
3548 Infix = (*itValue)->getExpression();
3550 (*itValue)->setExpression(Infix);
3554 pExpression = (*itValue)->getInitialExpressionPtr();
3556 if (pExpression != NULL)
3560 if (Dependencies.find(itParameter->first) != Dependencies.end())
3562 Infix = (*itValue)->getInitialExpression();
3564 (*itValue)->setInitialExpression(Infix);
3573 for (; itEvent != endEvent; ++itEvent)
3575 const CExpression * pExpression = (*itEvent)->getTriggerExpressionPtr();
3577 if (pExpression != NULL)
3581 if (Dependencies.find(itParameter->first) != Dependencies.end())
3583 Infix = (*itEvent)->getTriggerExpression();
3585 (*itEvent)->setTriggerExpression(Infix);
3589 pExpression = (*itEvent)->getDelayExpressionPtr();
3591 if (pExpression != NULL)
3595 if (Dependencies.find(itParameter->first) != Dependencies.end())
3597 Infix = (*itEvent)->getDelayExpression();
3599 (*itEvent)->setDelayExpression(Infix);
3606 for (; itAssignment != endAssignment; ++itAssignment)
3608 pExpression = (*itAssignment)->getExpressionPtr();
3610 if (pExpression != NULL)
3614 if (Dependencies.find(itParameter->first) != Dependencies.end())
3616 Infix = (*itAssignment)->getExpression();
3618 (*itAssignment)->setExpression(Infix);
3633 std::set< const CCopasiObject * > Flux;
3635 std::set< const CCopasiObject * > FluxDependents;
3642 std::set< const CCopasiObject * >::iterator it = FluxDependents.begin();
3643 std::set< const CCopasiObject * >::iterator end = FluxDependents.end();
3645 for (; it != end; ++it)
3669 FluxDependents.clear();
3674 it = FluxDependents.begin();
3675 end = FluxDependents.end();
3677 for (; it != end; ++it)
3709 for (; itAssignment != endAssignment; ++itAssignment)
3711 Infix = (*itAssignment)->getExpression();
3715 (*itAssignment)->setExpression(Infix);
3720 FluxDependents.clear();
3734 it = FluxDependents.begin();
3735 end = FluxDependents.end();
3737 for (; it != end; ++it)
3761 FluxDependents.clear();
3766 it = FluxDependents.begin();
3767 end = FluxDependents.end();
3769 for (; it != end; ++it)
3801 for (; itAssignment != endAssignment; ++itAssignment)
3803 Infix = (*itAssignment)->getExpression();
3807 (*itAssignment)->setExpression(Infix);
3813 reactionsToDelete.push_back(reac0);
3816 imax = reactionsToDelete.size();
3818 for (i = 0; i < imax; ++i)
3820 delete reactionsToDelete[i];
3896 for (i = 0; i < imax; ++i)
if (
mSteps[i]->isReversible())
return true;
3909 for (i = 0; i < reactSize; i++)
3915 if (
mSteps[i]->isReversible() != 0)
3916 return "At least one reaction is reversible. That means stochastic simulation is not possible. \nYou can use \"Tools|Convert to irreversible\" which will split the reversible reactions \n into two irreversible reactions. However you should check the kinetics afterwards.";
3925 multInt =
static_cast<C_INT32>(floor(multFloat + 0.5));
3927 if ((multFloat - multInt) > 0.01)
3928 return "Not all stoichiometries are integer numbers. \nThat means that discrete simulation is not possible.";
3935 return "At least one particle number in the initial state is too big.";
3942 void CModel::check()
const
3967 std::set< const CCopasiObject * > TimeDependent;
3975 mIsAutonomous = (TimeDependent.begin() == TimeDependent.end());
3985 if (pObject == NULL)
3996 if (pEntity == NULL)
4001 if (pEntity == NULL)
4009 for (; it != end; ++it)
4018 std::set< const CModelEntity * >::const_iterator itSet = EventTargets.begin();
4019 std::set< const CModelEntity * >::const_iterator endSet = EventTargets.end();
4021 for (; itSet != endSet; ++itSet)
4023 if (*itSet == pEntity)
4039 if (pEntity == NULL)
4044 if (pEntity == NULL)
4049 const CMetab * pMetab =
dynamic_cast< const CMetab *
>(pEntity);
4061 std::vector< const CEvaluationTree * > TreesWithDiscontinuities;
4067 for (; ppEntity != ppEntityEnd; ++ppEntity)
4069 switch ((*ppEntity)->getStatus())
4074 if ((*ppEntity)->getExpressionPtr() &&
4075 (*ppEntity)->getExpressionPtr()->hasDiscontinuity())
4077 TreesWithDiscontinuities.push_back((*ppEntity)->getExpressionPtr());
4091 for (; itReaction != endReaction; ++itReaction)
4093 if ((*itReaction)->getFunction() &&
4094 (*itReaction)->getFunction()->hasDiscontinuity())
4096 TreesWithDiscontinuities.push_back((*itReaction)->getFunction());
4104 for (; itEvent != endEvent; ++itEvent)
4106 if ((*itEvent)->getTriggerExpressionPtr() &&
4107 (*itEvent)->getTriggerExpressionPtr()->hasDiscontinuity())
4109 TreesWithDiscontinuities.push_back((*itEvent)->getTriggerExpressionPtr());
4113 return TreesWithDiscontinuities;
4118 bool success =
true;
4120 std::vector< CCopasiContainer * > ListOfContainer;
4125 for (; it != end; ++ it)
4127 success &= (*it)->compile(ListOfContainer);
4149 std::vector< Refresh * >::iterator it = refreshes.begin(), endIt = refreshes.end();
4158 std::set<const CCopasiObject*> changedObjects;
4159 changedObjects.insert(changedObject);
4163 std::vector< Refresh * >
4168 std::set< const CCopasiObject * >::iterator itSet;
4169 std::set< const CCopasiObject * >::iterator endSet;
4170 std::set< const CCopasiObject * > Objects;
4179 if (changedObjects.size() == 0)
4191 for (; ppEntity != ppEntityEnd; ++ppEntity)
4194 if (((*ppEntity)->getInitialExpression() !=
"" ||
4196 (*ppEntity)->getInitialValueReference()->getDirectDependencies().size() > 0)
4200 if ((pMetab = dynamic_cast< CMetab * >(*ppEntity)) != NULL)
4210 changedObjects.insert((*ppEntity)->getInitialValueReference());
4218 for (; itReaction != endReaction; ++itReaction)
4222 for (i = 0, imax = Group.
size(); i < imax; i++)
4240 itSet = changedObjects.begin();
4241 endSet = changedObjects.end();
4243 for (; itSet != endSet; ++itSet)
4245 if ((pEntity = dynamic_cast< const CModelEntity * >((*itSet)->getObjectParent())) != NULL &&
4249 Objects.insert(*itSet);
4252 for (itSet = Objects.begin(), endSet = Objects.end(); itSet != endSet; ++itSet)
4253 changedObjects.erase(*itSet);
4262 for (; ppEntity != ppEntityEnd; ++ppEntity)
4264 if (((*ppEntity)->getInitialExpression() !=
"" ||
4267 Objects.insert((*ppEntity)->getInitialValueReference());
4273 if ((pMetab = dynamic_cast< CMetab * >(*ppEntity)) != NULL)
4290 for (; itMoiety != endMoiety; ++itMoiety)
4291 Objects.insert((*itMoiety)->getInitialValueReference());
4293 std::set< const CCopasiObject * > DependencySet;
4294 std::set< const CCopasiObject * > VerifiedSet;
4295 std::pair<std::set< const CCopasiObject * >::iterator,
bool> InsertedObject;
4297 assert(Objects.count(NULL) == 0);
4300 for (itSet = Objects.begin(), endSet = Objects.end(); itSet != endSet; ++itSet)
4301 if ((*itSet)->hasCircularDependencies(DependencySet, VerifiedSet, changedObjects))
4305 for (itSet = Objects.begin(); itSet != endSet; ++itSet)
4308 InsertedObject = DependencySet.insert(*itSet);
4311 if (InsertedObject.second)
4312 (*itSet)->getAllDependencies(DependencySet, changedObjects);
4320 for (itSet = DependencySet.begin(), endSet = DependencySet.end(); itSet != endSet; ++itSet)
4323 if ((*itSet)->getRefresh() == NULL)
4324 Objects.insert(*itSet);
4326 else if (changedObjects.count(*itSet) != 0)
4327 Objects.insert(*itSet);
4329 else if (!(*itSet)->dependsOn(changedObjects, changedObjects))
4330 Objects.insert(*itSet);
4333 for (itSet = Objects.begin(), endSet = Objects.end(); itSet != endSet; ++itSet)
4334 DependencySet.erase(*itSet);
4337 std::list< const CCopasiObject * > SortedList =
4340 std::list< const CCopasiObject * >::iterator itList;
4341 std::list< const CCopasiObject * >::iterator endList;
4346 std::vector< Refresh * > UpdateVector;
4347 std::vector< Refresh * >::const_iterator itUpdate;
4348 std::vector< Refresh * >::const_iterator endUpdate;
4350 itList = SortedList.begin();
4351 endList = SortedList.end();
4353 for (; itList != endList; ++itList)
4355 pRefresh = (*itList)->getRefresh();
4356 itUpdate = UpdateVector.begin();
4357 endUpdate = UpdateVector.end();
4359 while (itUpdate != endUpdate && !(*itUpdate)->isEqual(pRefresh)) ++itUpdate;
4361 if (itUpdate == endUpdate)
4362 UpdateVector.push_back(pRefresh);
4365 return UpdateVector;
4386 for (; pAtol != pEnd; ++pAtol, ++ppEntity)
4390 InitialValue = fabs((*ppEntity)->getInitialValue());
4392 if ((pMetab = dynamic_cast< const CMetab * >(*ppEntity)) != NULL)
4397 if (InitialValue != 0.0)
4398 *pAtol *=
std::min(Limit, InitialValue);
4402 else if (InitialValue != 0.0)
4403 *pAtol *=
std::min(1.0, InitialValue);
4413 std::ostringstream oss;
4420 size_t i, imax, j, jmax;
4424 imax = comps.
size();
4428 oss <<
"Initial volumes:\n\n";
4430 for (i = 0; i < imax; ++i)
4431 oss << comps[i]->
getObjectName() <<
" \t" << comps[i]->getInitialValue()
4439 imax = metabs.
size();
4443 oss <<
"Initial concentrations:\n\n";
4445 for (i = 0; i < imax; ++i)
4447 << metabs[i]->getInitialConcentration() <<
" "
4455 imax = params.
size();
4459 oss <<
"Initial values of global quantities:\n\n";
4461 for (i = 0; i < imax; ++i)
4463 << params[i]->getInitialValue() <<
"\n";
4470 imax = reacs.
size();
4474 oss <<
"Reaction parameters:\n\n";
4477 for (i = 0; i < imax; ++i)
4489 units.setChemicalEquation(&reac->
getChemEq());
4493 jmax = params.
size();
4495 for (j = 0; j < jmax; ++j)
4510 << units.getDimensions()[j].getDisplayString(
this) <<
"\n";
4520 <<
" (" << units.getDimensions()[j].getDisplayString(
this) <<
")\n";
4680 const bool & ignoreDiscrete)
4686 const bool & equality,
4693 const bool & equality,
4694 const bool & correct,
4728 #ifdef USE_MATH_CONTAINER
4730 {
return mpMathContainer;}
4733 {
return mpMathContainer;}
4734 #endif // USE_MATH_CONTAINER
std::string unQuote(const std::string &name)
bool stringReplace(std::string &str, const std::string &target, const std::string &replacement)
CCopasiDataModel * getObjectDataModel()
virtual Refresh * getRefresh() const
static const char * LengthUnitNames[]
bool remove(const std::string &key)
CArrayAnnotation * mpRedStoiAnnotation
CModel::AreaUnit getAreaUnitEnum() const
const C_FLOAT64 & getAvogadro() const
void setReversible(bool reversible)
bool build(const CMatrix< C_FLOAT64 > &matrix, size_t maxRank=C_INVALID_INDEX)
const std::string & getFileName() const
const CCopasiVectorN< CEventAssignment > & getAssignments() const
static const char * ModelTypeNames[]
const CModelParameterSet & getModelParameterSet() const
CFunction * addAndAdaptName(CFunction *pFunction)
const C_FLOAT64 & getProcessQueueExecutionTime() const
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
Header file of class CModelEntity and CModelValue.
bool setAreaUnit(const std::string &name)
const CFunctionParameter::DataType & getType() const
CCopasiObjectReference< C_FLOAT64 > * mpIValueReference
CEvent * createEvent(const std::string &name)
void setUserOrder(const CVector< CModelEntity * > &userOrder)
CCopasiObject * getCorrespondingTransientObject(const CCopasiObject *pObject) const
CCopasiObject * getParticleFluxReference()
virtual void load(CReadConfig &configbuffer, size_t size)
CCopasiVectorN< CEvent > & getEvents()
bool setVolumeUnit(const std::string &name)
CCopasiProblem * getProblem()
std::string getTimeUnitsDisplayString() const
virtual CCopasiObjectName getCN() const
bool addSubstrate(const std::string &metabKey, const C_FLOAT64 &multiplicity=1.0)
void setContinueSimultaneousEvents(const bool &continueSimultaneousEvents)
CCopasiVectorN< CEvent > mEvents
const CLinkMatrixView & getL() const
const CMatrix< C_FLOAT64 > & getDependentData() const
const CCopasiVector< CMetab > & getMetabolites() const
std::string getConcentrationRateUnitsDisplayString() const
C_FLOAT64 calculateDivergence() const
const std::string & getObjectName() const
size_t getNumIndependent() const
std::string getFrequencyUnitsDisplayString() const
const CCopasiVectorN< CModelValue > & getModelValues() const
virtual CCopasiObjectName getCN() const =0
void add(CModelEntity *entity)
CModel::QuantityUnit getQuantityUnitEnum() const
size_t mNumMetabolitesReactionIndependent
virtual size_t size() const
std::string getQuantityUnitOldXMLName() const
const CVector< CMathTrigger::CRootFinder * > & getRootFinders() const
bool removeMetabolite(const std::string &key, const bool &recursive=true)
bool setLengthUnit(const std::string &name)
void evaluateRoots(CVectorCore< C_FLOAT64 > &rootValues, const bool &ignoreDiscrete)
CCopasiObject * get(const std::string &key)
void updateNonSimulatedValues(void)
CModelParameterSet mParameterSet
CMatrix< C_FLOAT64 > mElasticities
size_t getNumMetabs() const
const CCopasiMessage & getMessage() const
const CVector< C_FLOAT64 > & getParticleFlux() const
CCopasiObject * getInitialValueReference() const
static CRenameHandler * smpRenameHandler
const std::vector< Refresh * > & getListOfConstantRefreshes() const
virtual bool setName(const std::string &name)
void setInitialState(const CState &state)
bool setTimeUnit(const std::string &name)
void applyActiveParameterSet()
void updateSimulatedValues(const bool &updateMoieties)
virtual size_t numRows() const
void setParameterValue(const std::string ¶meterName, const C_FLOAT64 &value, const bool &updateStatus=true)
void calculateJacobianX(CMatrix< C_FLOAT64 > &jacobianX, const C_FLOAT64 &derivationFactor, const C_FLOAT64 &resolution)
bool removeCompartment(const size_t index, const bool &recursive=true)
virtual void load(CReadConfig &configbuffer, size_t size)
std::string getTimeUnitName() const
void setNotes(const std::string ¬es)
bool buildNonSimulatedSequence()
std::string getQuantityRateUnitsDisplayString() const
CCopasiObject * getValueReference() const
CCopasiVectorNS< CCompartment > mCompartments
const size_t & getNumber() const
const CExpression * getExpressionPtr() const
void setAnnotationCN(size_t d, size_t i, const std::string cn)
void evaluateRoots(CVectorCore< C_FLOAT64 > &rootValues, const bool &ignoreDiscrete)
bool setExpression(const std::string &expression)
#define MNumMetabolitesReactionDependent
bool addProduct(const std::string &metabKey, const C_FLOAT64 &multiplicity=1.0)
bool isLocalParameter(const size_t &index) const
std::string printParameterOverview()
std::string getVolumeRateUnitsDisplayString() const
const CMathModel * getMathModel() const
void resize(size_t size, const bool ©=false)
const std::set< const CCopasiObject * > & getUptoDateObjects() const
bool setInitialExpression(const std::string &expression)
std::string getExpression() const
void applyInitialValues()
std::string getTriggerExpression() const
const CExperimentSet & getExperiementSet() const
const std::map< CCopasiObject *, size_t > & getDependentObjects() const
CExperiment * getExperiment(const size_t &index)
void calculateJacobian(CMatrix< C_FLOAT64 > &jacobian, const C_FLOAT64 &derivationFactor, const C_FLOAT64 &resolution)
void setDescription(const std::string &s)
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
CModelValue * createModelValue(const std::string &name, const C_FLOAT64 &value=0.0)
virtual size_t getIndex(const std::string &name) const
size_t getNumODEMetabs() const
CModelEntity ** endDependent()
CMatrix< C_FLOAT64 > mStoi
CMatrix< C_FLOAT64 > mRedStoi
void setParameterMappingVector(const std::string ¶meterName, const std::vector< std::string > &keys)
bool buildStateTemplate()
void updateMoietyValues()
const size_t & getNumIndependent() const
const size_t & size() const
void applyInitialValues()
void setUseHeuristics(bool flag)
std::vector< Refresh * > mNonSimulatedRefreshes
CCopasiVectorN< CModelValue > mValues
const std::vector< Refresh * > & getListOfSimulatedRefreshes() const
std::vector< Refresh * > DataUpdateSequence
const CMatrix< C_FLOAT64 > & getRedStoi() const
virtual std::set< const CCopasiObject * > getDeletedObjects() const
virtual bool progressItem(const size_t &handle)
CModelEntity ** beginDependent()
virtual std::set< const CCopasiObject * > getDeletedObjects() const
void setTime(const C_FLOAT64 &time)
const CCopasiVector< CMoiety > & getMoieties() const
void calculateRootDerivatives(CVector< C_FLOAT64 > &rootDerivatives)
size_t mNumMetabolitesUnused
std::list< const CCopasiObject * > sortObjectsByDependency(ForwardAccessIterator begin, ForwardAccessIterator end, const CCopasiObject::DataObjectSet &context)
size_t getTotSteps() const
bool hasReversibleReaction() const
virtual const std::string & getKey() const
void setInitialTime(const C_FLOAT64 &time)
CCopasiVector< CMetab > mMetabolites
bool removeModelValue(const CModelValue *pModelValue, const bool &recursive=true)
bool appendDependentReactions(std::set< const CCopasiObject * > candidates, std::set< const CCopasiObject * > &dependents) const
size_t getNumDataRows() const
std::set< const CCopasiObject * > mSimulatedUpToDateObjects
const C_FLOAT64 & getInitialValue() const
const CCopasiVector< CChemEqElement > & getProducts() const
const CFunction * getFunction() const
std::vector< Refresh * > mApplyInitialValuesRefreshes
std::string getLengthUnitsDisplayString() const
void addDirectDependency(const CCopasiObject *pObject)
CStateTemplate mStateTemplate
CArrayAnnotation * mpLinkMatrixAnnotation
std::vector< CType * >::const_iterator const_iterator
bool getInitialUpdateSequence(const CMath::SimulationContextFlag &context, const CCopasiObject::DataObjectSet &changedObjects, const CCopasiObject::DataObjectSet &requestedObjects, CCopasiObject::DataUpdateSequence &updateSequence) const
const C_FLOAT64 & getQuantity2NumberFactor() const
bool appendDependentModelObjects(const std::set< const CCopasiObject * > &candidates, std::set< const CCopasiObject * > &dependentReactions, std::set< const CCopasiObject * > &dependentMetabolites, std::set< const CCopasiObject * > &dependentCompartments, std::set< const CCopasiObject * > &dependentModelValues, std::set< const CCopasiObject * > &dependentEvents) const
CVector< C_FLOAT64 > mParticleFluxes
C_FLOAT64 mNumber2QuantityFactor
const CFunctionParameters & getFunctionParameters() const
const C_FLOAT64 & getNumber2QuantityFactor() const
virtual bool add(const CType &src)
bool doRowPivot(CMatrix< C_FLOAT64 > &matrix) const
size_t getNumVariableMetabs() const
const std::vector< Refresh * > & getListOfNonSimulatedRefreshes() const
size_t getNumDependentReactionMetabs() const
size_t findMetabByName(const std::string &Target) const
std::string getVolumeUnitsDisplayString() const
virtual const std::string & getKey() const
CModelEntity ** endFixed()
void setState(const CState &state)
bool addModifier(const std::string &metabKey, const C_FLOAT64 &multiplicity=1.0)
void removeDependentModelObjects(const std::set< const CCopasiObject * > &deletedObjects)
bool buildDependencyGraphs()
bool applyRowPivot(CVectorCore< CType > &vector) const
const std::string & getNotes() const
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
void determineIsAutonomous()
bool setFunction(const std::string &functionName)
virtual void setStatus(const CModelEntity::Status &status)
size_t mNumMetabolitesAssignment
void processRoots(const C_FLOAT64 &time, const bool &equality, const bool &correct, const CVector< C_INT > &roots)
CReaction * createReaction(const std::string &name)
void refreshActiveParameterSet()
std::pair< CFunction *, CFunction * > splitFunction(const CEvaluationNode *node, const std::string &name1, const std::string &name2) const
const bool & isAutonomous() const
bool setTriggerExpression(const std::string &expression)
CCopasiVector< CMetab > mMetabolitesX
virtual bool add(const CType &src)
std::string getInitialExpression() const
const Value & getValue() const
const C_FLOAT64 & getInitialTime() const
std::vector< Refresh * > mInitialRefreshes
bool appendDependentCompartments(std::set< const CCopasiObject * > candidates, std::set< const CCopasiObject * > &dependents) const
void calculateElasticityMatrix(const C_FLOAT64 &factor, const C_FLOAT64 &resolution)
CCopasiVectorN< CCopasiTask > * getTaskList()
void setUsed(const bool &used)
void initializeMetabolites()
bool getUpdateSequence(const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects, const CObjectInterface::ObjectSet &requestedObjects, CObjectInterface::UpdateSequence &updateSequence)
void appendElementReferences(std::set< const CCopasiObject * > &objects) const
void exportDOTFormat(std::ostream &os, const std::string &name) const
std::string getLengthUnitName() const
QuantityUnit mQuantityUnit
CModel::LengthUnit getLengthUnitEnum() const
std::vector< Refresh * > mSimulatedRefreshes
size_t getNumIndependent() const
bool handleUnusedMetabolites()
void setCopasiVector(size_t d, const CCopasiContainer *v)
bool appendDependentMetabolites(std::set< const CCopasiObject * > candidates, std::set< const CCopasiObject * > &dependents) const
virtual bool finishItem(const size_t &handle)
bool getTransientUpdateSequence(const CMath::SimulationContextFlag &context, const CCopasiObject::DataObjectSet &changedObjects, const CCopasiObject::DataObjectSet &requestedObjects, CCopasiObject::DataUpdateSequence &updateSequence) const
CModelEntity ** beginIndependent()
std::vector< const CEvaluationTree * > getTreesWithDiscontinuities() const
bool buildApplyInitialValuesSequence()
CCopasiVectorN< CModelParameterSet > mParameterSets
const CCopasiVectorN< CModelParameterSet > & getModelParameterSets() const
CCopasiParameter * getParameter(const std::string &name)
bool setPriorityExpression(const std::string &expression)
int dgemm_(char *transa, char *transb, integer *m, integer *n, integer *k, doublereal *alpha, doublereal *a, integer *lda, doublereal *b, integer *ldb, doublereal *beta, doublereal *c, integer *ldc)
CCopasiObjectReference< C_FLOAT64 > * mpValueReference
std::string add(const std::string &prefix, CCopasiObject *pObject)
const CCopasiVector< CChemEqElement > & getSubstrates() const
const std::string & getKey() const
size_t findMoiety(const std::string &Target) const
const bool & isUsed() const
CMathDependencyGraph mTransientDependencies
static CFunctionDB * getFunctionList()
virtual void resize(size_t rows, size_t cols, const bool ©=false)
std::string getDelayExpression() const
virtual std::set< const CCopasiObject * > getDeletedObjects() const
size_t getNumIndependentReactionMetabs() const
const C_FLOAT64 & getTime() const
CType toEnum(const char *attribute, const char **enumNames, const CType &enumDefault)
void setCompileFlag(bool flag=true)
bool processQueue(const C_FLOAT64 &time, const bool &equality, CProcessQueue::resolveSimultaneousAssignments pResolveSimultaneousAssignments)
virtual void resize(const size_t &newSize)
bool mBuildInitialSequence
bool dependsOn(DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
CProcessReport * mpCompileHandler
static const char * AreaUnitNames[]
void setTime(const C_FLOAT64 &time)
virtual void remove(const size_t &index)
virtual const DataObjectSet & getDirectDependencies(const DataObjectSet &context=DataObjectSet()) const
void setMode(size_t d, Mode m)
void calculateDerivativesX(C_FLOAT64 *derivativesX)
std::string getAreaUnitName() const
std::string getConcentrationUnitsDisplayString() const
bool getUpdateSequence(CMathDependencyGraph &dependencyGraph, const CMath::SimulationContextFlag &context, const CCopasiObject::DataObjectSet &changedObjects, const CCopasiObject::DataObjectSet &requestedObjects, CCopasiObject::DataUpdateSequence &updateSequence) const
CCopasiVectorNS< CCompartment > & getCompartments()
void setDimensionDescription(size_t d, const std::string &s)
iterator addObject(const CObjectInterface *pObject)
const CExpression * getTriggerExpressionPtr() const
const CCopasiTask::Type & getExperimentType() const
std::string getQuantityUnitsDisplayString() const
void updateMatrixAnnotations()
const C_FLOAT64 & getValue() const
virtual size_t getIndex(const CCopasiObject *pObject) const
CModel::TimeUnit getTimeUnitEnum() const
virtual std::string getChildObjectUnits(const CCopasiObject *pObject) const
const CVector< C_FLOAT64 > & getTimeData() const
iterator(* resolveSimultaneousAssignments)(const std::multimap< CKey, CAction > &, const C_FLOAT64 &, const bool &, const size_t &)
static CKeyFactory * getKeyFactory()
Header file of class CArrayAnnotation.
void add(C_FLOAT64 value, CMetab *metabolite)
bool setDelayExpression(const std::string &expression)
CMathDependencyGraph mInitialDependencies
size_t mNumMetabolitesReaction
std::string getQuantityUnitName() const
const CState & getInitialState() const
bool compileIfNecessary(CProcessReport *pProcessReport)
std::string mActiveParameterSetKey
const CCopasiParameterGroup & getParameters() const
CMatrix< C_FLOAT64 > mStoiInternal
CFunction * findFunction(CCopasiVectorN< CFunction > &db, const CFunction *func)
size_t getNumAssignmentMetabs() const
const CStateTemplate & getStateTemplate() const
void setParameterMapping(const size_t &index, const std::string &key)
size_t getCompartmentNumber() const
size_t getNumModelValues() const
CCopasiVectorNS< CReaction > mSteps
bool compile(const std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
std::vector< CType * >::iterator iterator
const ModelType & getModelType() const
The class for handling a chemical kinetic function.
CCopasiVectorNS< CReaction > & getReactions()
static std::vector< Refresh * > buildUpdateSequence(const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
bool setQuantityUnit(const std::string &name)
bool appendDependentEvents(std::set< const CCopasiObject * > candidates, std::set< const CCopasiObject * > &dependents) const
const C_FLOAT64 & getProcessQueueExecutionTime() const
bool updateInitialValues()
void calculateDerivatives(C_FLOAT64 *derivatives)
virtual void setInitialValue(const C_FLOAT64 &initialValue)
virtual bool refreshFromModel(const bool &modifyExistence)
const CLinkMatrix & getL0() const
std::string getAreaUnitsDisplayString() const
CVector< C_FLOAT64 > initializeAtolVector(const C_FLOAT64 &baseTolerance, const bool &reducedModel) const
bool convert2NonReversible()
C_INT32 getVariable(const std::string &name, const std::string &type, void *pout, CReadConfig::Mode mode=CReadConfig::NEXT)
const std::vector< Refresh * > & getListOfInitialRefreshes() const
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
const CState & getState() const
static CLocaleString fromUtf8(const std::string &utf8)
void setAvogadro(const C_FLOAT64 &avogadro)
const CModelEntity::Status & getStatus() const
std::string getVolumeUnitName() const
void calculateRootDerivatives(CVector< C_FLOAT64 > &rootDerivatives)
const CCopasiVector< CMetab > & getMetabolitesX() const
CModel::VolumeUnit getVolumeUnitEnum() const
const CMatrix< C_FLOAT64 > & getStoi() const
const CVector< size_t > & getUserOrder() const
static const char * TimeUnitNames[]
const std::vector< std::vector< std::string > > & getParameterMappings() const
virtual size_t numCols() const
std::vector< Refresh * > buildInitialRefreshSequence(std::set< const CCopasiObject * > &changedObjects)
const unsigned C_INT32 & getNumColumns() const
const bool & getContinueSimultaneousEvents() const
C_FLOAT64 * beginDependent()
bool setExpression(const std::string &expression)
bool setObjectName(const std::string &name)