Skip to content

Commit

Permalink
Revert "Proposed solution for Issue sys-bio#411"
Browse files Browse the repository at this point in the history
This reverts commit ea98bb7.
  • Loading branch information
Kiri Choi committed Sep 21, 2017
1 parent ea98bb7 commit b705c8b
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions source/rrRoadRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1332,8 +1332,8 @@ const DoubleMatrix* RoadRunner::simulate(const Dictionary* dict)

applySimulateOptions();

const double timeEnd = self.simulateOpt.duration;
const double timeStart = 0;
const double timeEnd = self.simulateOpt.duration + self.simulateOpt.start;
const double timeStart = self.simulateOpt.start;

// evalute the model with its current state
self.model->getStateVectorRate(timeStart, 0, 0);
Expand Down Expand Up @@ -1381,8 +1381,6 @@ const DoubleMatrix* RoadRunner::simulate(const Dictionary* dict)

getSelectedValues(row, tout);

int itime = getTimeRowIndex();

// use interpolation to ensure last time point is requested end time
if( tout > timeEnd ) {
if (!getIntegrator())
Expand All @@ -1400,6 +1398,8 @@ const DoubleMatrix* RoadRunner::simulate(const Dictionary* dict)
row.at(n) = results.back().at(n);
}

int itime = getTimeRowIndex();

if (itime >= 0)
{
row.at(itime) = timeEnd;
Expand All @@ -1419,11 +1419,6 @@ const DoubleMatrix* RoadRunner::simulate(const Dictionary* dict)
last_tout = tout;
}

// Add constant value of start time
if (itime >= 0)
{
row.at(itime) = row.at(itime) + self.simulateOpt.start;
}
results.push_back(row);

++n;
Expand Down Expand Up @@ -4054,9 +4049,10 @@ void RoadRunner::applySimulateOptions()
{
get_self();

if (self.simulateOpt.duration < 0 || self.simulateOpt.steps < 0 )
if (self.simulateOpt.duration < 0 || self.simulateOpt.start < 0
|| self.simulateOpt.steps < 0 )
{
throw std::invalid_argument("duration and steps must be non-negative");
throw std::invalid_argument("duration, startTime and steps must be non-negative");
}

// This one creates the list of what we will look at in the result
Expand Down

0 comments on commit b705c8b

Please sign in to comment.