Skip to content

Commit

Permalink
Update observe (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
kratman authored Nov 7, 2024
1 parent 8a99bfc commit c1ea747
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/pybammsolvers/idaklu_source/observe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ class TimeSeriesInterpolator {
) {
for (size_t i = 0; i < ts_data_np.size(); i++) {
const auto& t_data = ts_data_np[i].unchecked<1>();
// Continue if there is no data
if (t_data.size() == 0) {
continue;
}

const realtype t_data_final = t_data(t_data.size() - 1);
realtype t_interp_next = t_interp(i_interp);
// Continue if the next interpolation point is beyond the final data point
Expand Down Expand Up @@ -227,6 +232,10 @@ class TimeSeriesProcessor {
int i_entries = 0;
for (size_t i = 0; i < ts.size(); i++) {
const auto& t = ts[i].unchecked<1>();
// Continue if there is no data
if (t.size() == 0) {
continue;
}
const auto& y = ys[i].unchecked<2>();
const auto input = inputs[i].data();
const auto func = *funcs[i];
Expand Down

0 comments on commit c1ea747

Please sign in to comment.