// virtual bool CConcentrationReference::isPrerequisiteForContext(const CObjectInterface * pObject, const CMath::SimulationContextFlag & /* context */, const CObjectInterface::ObjectSet & changedObjects) const { // If the value is in the context, it does not depend on the object. if (changedObjects.find(this) != changedObjects.end()) return false; // Densities which are not in the context have to be recalculated. return true; }
// virtual bool CParticleReference::isPrerequisiteForContext(const CObjectInterface * pObject, const CMath::SimulationContextFlag & context , const CObjectInterface::ObjectSet & changedObjects) const { const CMetab * pSpecies = static_cast< const CMetab * >(getObjectParent()); if ((context & CMath::UseMoieties) && pSpecies->isDependent()) { return true; } // If the value is changed it must not be recalculated, i.e., it does not depend on the object. if (changedObjects.find(this) != changedObjects.end()) return false; // Amounts which are determine by assignment need to be recalculated. if (pSpecies->getStatus() == CModelEntity::ASSIGNMENT) return true; const CConcentrationReference * pConcentrationReference = NULL; if (getObjectName() != "ParticleNumber") { pConcentrationReference = pSpecies->getInitialConcentrationReference(); } else { pConcentrationReference = pSpecies->getConcentrationReference(); } // If the concentration was changed in the context we need to recalculate. if (changedObjects.find(pConcentrationReference) != changedObjects.end()) return true; return false; }
bool CCopasiObject::isPrerequisiteForContext(const CObjectInterface * pObject, const CMath::SimulationContextFlag & /* context */, const CObjectInterface::ObjectSet & changedObjects) const { // If the object is among the changed objects it does not depend on anything else. if (changedObjects.find(this) != changedObjects.end()) return false; #ifdef COPASI_DEBUG const CObjectInterface::ObjectSet & Prerequisites = getPrerequisites(); // This method should only be called for objects which are prerequisites. // We check for this only in debug mode. assert(Prerequisites.find(pObject) != Prerequisites.end()); #endif // COPASI_DEBUG return true; }
// virtual bool CMathObject::isPrerequisiteForContext(const CObjectInterface * pObject, const CMath::SimulationContextFlag & context, const CObjectInterface::ObjectSet & changedObjects) const { // This method should only be called for objects which are prerequisites. // We check for this only in debug mode. assert(mPrerequisites.find(pObject) != mPrerequisites.end()); switch (mEntityType) { case CMath::Moiety: if ((context & CMath::UpdateMoieties) && mValueType == CMath::TotalMass) { return true; } if ((context & CMath::UseMoieties) && mValueType == CMath::DependentMass) { return true; } return false; break; case CMath::Species: // For species we need to account for the duality of the intensive and extensive value if (mValueType != CMath::Value) return true; if ((context & CMath::UseMoieties) && mSimulationType == CMath::Dependent && !mIsIntensiveProperty) { if (mpCorrespondingProperty != pObject) { return true; } return false; } // If the value is in the context, it does not depend on the object. if (changedObjects.find(this) != changedObjects.end()) return false; if (mIsIntensiveProperty) { // Densities which are not in the context have to be recalculated. return true; } else { // Amount which are determine by assignment need to be recalculated. if (mSimulationType == CMath::Assignment) return true; // If the concentration was changed in the context we need to recalculate. if (changedObjects.find(mpCorrespondingProperty) != changedObjects.end()) return true; // If the concentration is calculated by an assignment we need to recalculate. if (mpCorrespondingProperty->getSimulationType() == CMath::Assignment) return true; return false; } break; case CMath::Event: if ((context & CMath::EventHandling) && mValueType == CMath::Discontinuous) { switch ((int) mpExpression->getRoot()->getType()) { case (CEvaluationNode::CHOICE | CEvaluationNodeChoice::IF): { const CMathObject * pMathObject = dynamic_cast< const CMathObject * >(pObject); if (pMathObject != NULL && pMathObject->mValueType == CMath::EventTrigger) { return false; } return true; } break; case (CEvaluationNode::FUNCTION | CEvaluationNodeFunction::FLOOR): return false; break; case (CEvaluationNode::FUNCTION | CEvaluationNodeFunction::CEIL): return false; break; default: return true; } } return true; break; case CMath::Delay: if (context & CMath::EventHandling) { return true; } return (mValueType == CMath::DelayLag); break; default: return true; } // This should never be reached. return true; }