28 const bool & isIntensiveProperty,
29 const bool & isInitialValue,
47 mpValue(&InvalidValue),
49 mValueType(
CMath::ValueTypeUndefined),
50 mEntityType(
CMath::EntityTypeUndefined),
51 mSimulationType(
CMath::SimulationTypeUndefined),
52 mIsIntensiveProperty(false),
53 mIsInitialValue(false),
54 mpIntensiveProperty(NULL),
95 for (; it != end; ++it)
170 if ((context & CMath::UseMoieties) &&
183 if (changedObjects.find(
this) != changedObjects.end())
217 if (pMathObject != NULL &&
276 std::cout <<
"NaN Value for: " <<
getCN() << std::endl;
279 #endif // COPASI_DEBUG
327 const bool & isBoolean,
334 success &= Expression.
setInfix(infix);
335 std::vector< CCopasiContainer * > ListOfContainer;
336 ListOfContainer.push_back(&container);
337 success &= Expression.
compile(ListOfContainer);
465 const CMetab * pSpecies =
static_cast< const CMetab *
>(pEntity);
503 const CMetab * pSpecies =
static_cast< const CMetab *
>(pEntity);
563 const CMetab * pSpecies = NULL;
711 std::ostringstream Infix;
712 Infix.imbue(std::locale::classic());
753 if (Compartments.size() == 1)
757 std::string Infix =
"<" + (*Compartments.begin())->getValueReference()->
getCN() +
">*(" +
mpExpression->
getInfix() +
")";
758 success &= Tmp.setInfix(Infix);
759 success &= Tmp.compile();
782 std::ostringstream Infix;
783 Infix.imbue(std::locale::classic());
795 std::ostringstream Divisor;
796 Divisor.imbue(std::locale::classic());
797 Divisor.precision(16);
804 for (; itSubstrate != endSubstrate; ++itSubstrate)
806 const std::string NumberCN = (*itSubstrate)->getMetabolite()->getValueReference()->getCN();
807 C_FLOAT64 Multiplicity = (*itSubstrate)->getMultiplicity();
811 if (Multiplicity > 2.0 - 100.0 * std::numeric_limits< C_FLOAT64 >::epsilon())
819 Divisor <<
"<" << NumberCN <<
">^" << Multiplicity;
821 else if (Multiplicity > 1.0 - 100.0 * std::numeric_limits< C_FLOAT64 >::epsilon())
829 Divisor <<
"<" << NumberCN <<
">";
832 while (Multiplicity > 1.0 - 100.0 * std::numeric_limits< C_FLOAT64 >::epsilon())
834 Infix <<
"*(<" << NumberCN <<
">-" << Multiplicity <<
")";
839 if (Divisor.str() !=
"")
841 Infix <<
"/(" << Divisor.str() <<
")";
872 std::ostringstream Infix;
873 Infix.imbue(std::locale::classic());
876 std::vector< std::pair< C_FLOAT64, CMetab * > >::const_iterator it = pMoiety->
getEquation().begin();
877 std::vector< std::pair< C_FLOAT64, CMetab * > >::const_iterator end = pMoiety->
getEquation().end();
880 for (; it != end; ++it)
882 const C_FLOAT64 & Multiplicity = it->first;
884 if (First || Multiplicity < 0.0)
886 Infix << Multiplicity;
890 Infix <<
"+" << Multiplicity;
896 Infix << it->second->getValueReference()->getCN();
922 std::ostringstream Infix;
923 Infix.imbue(std::locale::classic());
928 std::vector< std::pair< C_FLOAT64, CMetab * > >::const_iterator it = pMoiety->
getEquation().begin();
929 std::vector< std::pair< C_FLOAT64, CMetab * > >::const_iterator end = pMoiety->
getEquation().end();
938 for (; it != end; ++it)
940 const C_FLOAT64 & Multiplicity = it->first;
942 if (First || Multiplicity >= 0.0)
944 Infix <<
"-" << Multiplicity;
948 Infix <<
"+" << fabs(Multiplicity);
954 Infix << it->second->getValueReference()->getCN();
989 assert(pExpression != NULL);
993 bool ReplaceDiscontinousNodes =
1007 bool success =
true;
1024 std::ostringstream Infix;
1025 Infix.imbue(std::locale::classic());
1026 Infix.precision(16);
1030 Infix << pNumber->
getCN();
1032 Infix << pCompartment->
getCN();
1035 CExpression E(
"IntensiveValueExpression", &container);
1037 success &= E.
setInfix(Infix.str());
1048 bool success =
true;
1066 std::ostringstream Infix;
1067 Infix.imbue(std::locale::classic());
1068 Infix.precision(16);
1072 Infix << pDensity->
getCN();
1074 Infix << pCompartment->
getCN();
1077 CExpression E(
"ExtensiveValueExpression", &container);
1079 success &= E.
setInfix(Infix.str());
1090 bool success =
true;
1098 std::ostringstream Infix;
1099 Infix.imbue(std::locale::classic());
1100 Infix.precision(16);
1114 CExpression E(
"IntensiveRateExpression", &container);
1116 success &= E.
setInfix(Infix.str());
1127 bool success =
true;
1134 std::ostringstream Infix;
1135 Infix.imbue(std::locale::classic());
1136 Infix.precision(16);
1144 CExpression E(
"ExtensiveODERateExpression", &container);
1146 success &= E.
setInfix(Infix.str());
1157 bool success =
true;
1159 std::ostringstream Infix;
1160 Infix.imbue(std::locale::classic());
1161 Infix.precision(16);
1163 std::string Key = pSpecies->
getKey();
1169 for (; it != end; ++it)
1172 (*it)->getChemEq().getBalances();
1176 for (; itChem != endChem; ++itChem)
1177 if ((*itChem)->getMetaboliteKey() == Key)
1180 if (itChem != endChem)
1182 const C_FLOAT64 & Multiplicity = (*itChem)->getMultiplicity();
1184 if (First || Multiplicity < 0.0)
1186 if (Multiplicity == std::numeric_limits< C_FLOAT64 >::infinity())
1188 Infix <<
"infinity";
1190 else if (Multiplicity == -std::numeric_limits< C_FLOAT64 >::infinity())
1192 Infix <<
"-infinity";
1196 Infix << Multiplicity;
1201 if (Multiplicity == std::numeric_limits< C_FLOAT64 >::infinity())
1203 Infix <<
"+infinity";
1207 Infix <<
"+" << Multiplicity;
1214 Infix << (*it)->getParticleFluxReference()->getCN();
1219 CExpression E(
"ExtensiveReactionExpression", &container);
1221 success &= E.
setInfix(Infix.str());
1237 os <<
"Data Object = NULL" << std::endl;
1240 os <<
" Pointer: " << &o << std::endl;
1241 os <<
" Value Type: ";
1246 os <<
"ValueTypeUndefined" << std::endl;
1250 os <<
"Value" << std::endl;
1254 os <<
"ValueRate" << std::endl;
1258 os <<
"ParticleFlux" << std::endl;
1262 os <<
"Flux" << std::endl;
1266 os <<
"Propensity" << std::endl;
1270 os <<
"TotalMass" << std::endl;
1274 os <<
"DependentMass" << std::endl;
1278 os <<
"Discontinuous" << std::endl;
1282 os <<
"EventDelay" << std::endl;
1286 os <<
"EventPriority" << std::endl;
1290 os <<
"EventAssignment" << std::endl;
1294 os <<
"EventTrigger" << std::endl;
1298 os <<
"EventRoot" << std::endl;
1302 os <<
"EventRootState" << std::endl;
1306 os <<
" Simulation Type: ";
1311 os <<
"SimulationTypeUndefined" << std::endl;
1315 os <<
"Fixed" << std::endl;
1319 os <<
"EventTarget" << std::endl;
1323 os <<
"Time" << std::endl;
1327 os <<
"ODE" << std::endl;
1331 os <<
"Independent" << std::endl;
1335 os <<
"Dependent" << std::endl;
1339 os <<
"Assignment" << std::endl;
1343 os <<
"Conversion" << std::endl;
1347 os <<
" Entity Type: ";
1352 os <<
"EntityTypeUndefined" << std::endl;
1356 os <<
"Model" << std::endl;
1360 os <<
"Analysis" << std::endl;
1364 os <<
"GlobalQuantity" << std::endl;
1368 os <<
"Compartment" << std::endl;
1372 os <<
"Species" << std::endl;
1376 os <<
"LocalReactionParameter" << std::endl;
1380 os <<
"StoichiometricCoefficients" << std::endl;
1384 os <<
"Reaction" << std::endl;
1388 os <<
"Moiety" << std::endl;
1392 os <<
"Event" << std::endl;
1398 os <<
" Is Initial Value: " << (o.
mIsInitialValue ?
"true" :
"false") << std::endl;
1400 os <<
" Intensive Property: ";
1408 os <<
"NULL" << std::endl;
1411 os <<
" Value: " << *o.
mpValue <<
" (" << o.
mpValue <<
")" << std::endl;
1413 os <<
" Expression: ";
1421 os <<
"NULL" << std::endl;
const CExpression * getExpressionPtr() const
Header file of class CExpression.
const CMathExpression * getExpressionPtr() const
CObjectInterface::ObjectSet mPrerequisites
void setSimulationType(const CMath::SimulationType &simulationType)
const CMath::EntityType & getEntityType() const
virtual bool setInfix(const std::string &infix)
CCopasiObject * getParticleFluxReference()
bool createExtensiveReactionRateExpression(const CMetab *pSpecies, CMathContainer &container)
virtual const CObjectInterface::ObjectSet & getPrerequisites() const
virtual CCopasiObjectName getCN() const
CMathObject * getMathObject(const CObjectInterface *pObject) const
const std::string & getObjectName() const
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
virtual CCopasiObjectName getCN() const =0
void copy(const CMathObject &src, CMathContainer &container, const size_t &valueOffset, const size_t &objectOffset)
CCopasiObject * getInitialValueReference() const
const CMath::SimulationType & getSimulationType() const
bool compilePropensity(CMathContainer &container)
const Type & getType() const
const CMathObject * mpIntensiveProperty
const CCallParameters< C_FLOAT64 > & getCallParameters() const
CCopasiObject * getTotalNumberReference() const
std::string buildInfix() const
virtual CCopasiObjectName getCN() const
bool mIsIntensiveProperty
std::string getExpression() const
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
const std::vector< std::pair< C_FLOAT64, CMetab * > > & getEquation() const
bool compile(CMathContainer &container)
CMath::EntityType mEntityType
void setIsBoolean(const bool &booleanRequired)
virtual const CObjectInterface::ObjectSet & getPrerequisites() const
virtual void * getValuePointer() const
static C_FLOAT64 InvalidValue
bool compileRate(CMathContainer &container)
std::set< const CCompartment * > getCompartments() const
const CFunction * getFunction() const
bool compileTotalMass(CMathContainer &container)
const C_FLOAT64 & getQuantity2NumberFactor() const
const C_FLOAT64 & getNumber2QuantityFactor() const
virtual const std::string & getKey() const
const bool & isInitialValue() const
CMath::ValueType mValueType
bool setExpression(const std::string &infix, const bool &isBoolean, CMathContainer &container)
const C_FLOAT64 & value()
bool compileInitialValue(CMathContainer &container)
const CCopasiVector< CChemEqElement > & getSubstrates() const
bool convertToInitialExpression()
bool isReversible() const
bool createIntensiveValueExpression(const CMetab *pSpecies, CMathContainer &container)
virtual void print(std::ostream *ostream) const
bool compileValue(CMathContainer &container)
std::set< const CObjectInterface * > ObjectSet
static CMathExpression * copy(const CMathExpression &src, CMathContainer &container, const size_t &valueOffset, const size_t &objectOffset)
const CMath::ValueType & getValueType() const
bool compileParticleFlux(CMathContainer &container)
static void initialize(CMathObject *&pObject, C_FLOAT64 *&pValue, const CMath::ValueType &valueType, const CMath::EntityType &entityType, const CMath::SimulationType &simulationType, const bool &isIntensiveProperty, const bool &isInitialValue, const CCopasiObject *pDataObject)
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
const CModel & getModel() const
bool compileDependentMass(CMathContainer &container)
const CCopasiObject * mpDataObject
const bool & isIntensiveProperty() const
const ModelType & getModelType() const
CCopasiVectorNS< CReaction > & getReactions()
bool createIntensiveRateExpression(const CMetab *pSpecies, CMathContainer &container)
CMathExpression * mpExpression
bool compileFlux(CMathContainer &container)
virtual void * getValuePointer() const
bool createExtensiveValueExpression(const CMetab *pSpecies, CMathContainer &container)
bool createExtensiveODERateExpression(const CMetab *pSpecies, CMathContainer &container)
CCopasiObject * getRateReference() const
const CChemEq & getChemEq() const
CEvaluationNode * getRoot()
bool createConvertedExpression(const CExpression *pExpression, CMathContainer &container)
const std::string & getInfix() const
CCopasiObject * getDependentNumberReference() const
CCopasiContainer * getObjectParent() const
const CExpression * getInitialExpressionPtr() const
bool setExpressionPtr(CMathExpression *pMathExpression)
std::ostream & operator<<(std::ostream &os, const CMathObject &o)
const CCopasiObject * getDataObject() const
virtual bool isPrerequisiteForContext(const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
CCopasiObject * getFluxReference()
CMath::SimulationType mSimulationType
CCopasiObject * getValueReference() const