Skip to content

Commit

Permalink
Handle single-line input files (#538)
Browse files Browse the repository at this point in the history
fixes #534
  • Loading branch information
t-sommer authored Jul 24, 2024
1 parent 6e1d7f9 commit c3a2eee
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions fmusim/FMIStaticInput.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,27 +239,15 @@ FMIStatus FMIApplyInput(FMIInstance* instance, const FMIStaticInput* input, doub

size_t row = 0;

for (size_t i = 1; i < input->nRows; i++) {
while (row < input->nRows - 1) {

const double t = input->time[i];
const double nextTime = input->time[row + 1];

if (t >= time) {
if (afterEvent ? nextTime > time : nextTime >= time) {
break;
}

row = i;
}

if (afterEvent) {

while (row < input->nRows - 2) {

if (input->time[row + 1] > time) {
break;
}

row++;
}
row++;
}

const size_t j = row * input->nVariables + i;
Expand Down

0 comments on commit c3a2eee

Please sign in to comment.