Skip to content

Commit

Permalink
Bug 3219: Fix is applied globally in getUpdateSequence.
Browse files Browse the repository at this point in the history
  • Loading branch information
shoops committed Mar 14, 2024
1 parent 3d75e03 commit 052debe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
20 changes: 18 additions & 2 deletions copasi/math/CMathDependencyGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,24 @@ bool CMathDependencyGraph::getUpdateSequence(CCore::CUpdateSequence & updateSequ
#endif // DEBUG_OUTPUT
}

CObjectInterface::ObjectSet::const_iterator it = changedObjects.begin();
CObjectInterface::ObjectSet::const_iterator end = changedObjects.end();
CObjectInterface::ObjectSet::const_iterator it = requestedObjects.begin();
CObjectInterface::ObjectSet::const_iterator end = requestedObjects.end();
CObjectInterface::ObjectSet Prerequisites;

for (; it != end && success; ++it)
(*it)->appendPrerequisites(Prerequisites);

CObjectInterface::ObjectSet ChangedObjects(changedObjects);

it = Prerequisites.begin();
end = Prerequisites.end();

for (; it != end; ++it)
if ((*it)->getPrerequisites().empty())
ChangedObjects.insert(*it);

it = ChangedObjects.begin();
end = ChangedObjects.end();

// Mark all nodes which are changed or need to be calculated
for (; it != end && success; ++it)
Expand Down
15 changes: 3 additions & 12 deletions copasi/math/CMathEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1388,29 +1388,20 @@ void CMathEvent::createUpdateSequences()
const CObjectInterface::ObjectSet & SimulationValues = mpContainer->getSimulationUpToDateObjects();

CObjectInterface::ObjectSet Requested;

Requested.insert(mpDelay);
mpContainer->getTransientDependencies().getUpdateSequence(mDelaySequence, CCore::SimulationContext::Default, StateValues, Requested, SimulationValues);

Requested.clear();

CObjectInterface::ObjectSet EventTargets;
CObjectInterface::ObjectSet Changed(StateValues);
CAssignment * pAssignment = mAssignments.array();
CAssignment * pAssignmentEnd = pAssignment + mAssignments.size();

for (; pAssignment != pAssignmentEnd; ++pAssignment)
{
Requested.insert(pAssignment->getAssignment());

CObjectInterface::ObjectSet Prerequisites;
pAssignment->getAssignment()->appendPrerequisites(Prerequisites);

CObjectInterface::ObjectSet::const_iterator it = Prerequisites.begin();
CObjectInterface::ObjectSet::const_iterator end = Prerequisites.end();

for (; it != end; ++it)
if ((*it)->getPrerequisites().empty())
Changed.insert(*it);

const CMathObject * pTarget = pAssignment->getTarget();

if (pTarget == NULL) continue;
Expand All @@ -1433,7 +1424,7 @@ void CMathEvent::createUpdateSequences()
}
}

mpContainer->getTransientDependencies().getUpdateSequence(mTargetValuesSequence, CCore::SimulationContext::Default, Changed, Requested, SimulationValues);
mpContainer->getTransientDependencies().getUpdateSequence(mTargetValuesSequence, CCore::SimulationContext::Default, StateValues, Requested, SimulationValues);

// We need to add the total mass of the moieties to the state values.
CObjectInterface::ObjectSet ExtendedStateValues = StateValues;
Expand Down

0 comments on commit 052debe

Please sign in to comment.