Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle single line input files #538

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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