Skip to content

Commit

Permalink
Interpreter: simplified the construction of our arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Apr 10, 2024
1 parent ffd36bf commit 79df1ec
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@ void Interpreter::InterpreterImpl::setModel(const AnalyserModelPtr &model)
mVoi = 0.0;

if (mModel != nullptr) {
mStates.resize(mModel->stateCount());
mRates.resize(mModel->stateCount());
mVariables.resize(mModel->variableCount());

static const auto NaN = std::numeric_limits<double>::quiet_NaN();

std::fill(mStates.begin(), mStates.end(), NaN);
std::fill(mRates.begin(), mRates.end(), NaN);
std::fill(mVariables.begin(), mVariables.end(), NaN);
mStates = std::vector<double>(mModel->stateCount(), NaN);
mRates = std::vector<double>(mModel->stateCount(), NaN);
mVariables = std::vector<double>(mModel->variableCount(), NaN);
} else {
mStates.clear();
mRates.clear();
Expand Down

0 comments on commit 79df1ec

Please sign in to comment.