Skip to content

Commit

Permalink
Comment functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysgoldstein committed Mar 20, 2020
1 parent c935a3f commit 94db051
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,3 @@ add_custom_command(TARGET regression_tests PRE_BUILD
${RTESTS_DATA}
regression_test_data/old_data/.)
add_custom_command(TARGET regression_tests POST_BUILD COMMAND regression_tests COMMENT "Running regression tests")


10 changes: 10 additions & 0 deletions src/sydevs/core/arraynd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1164,20 +1164,30 @@ std::ostream& operator<<(std::ostream& os, const arraynd<T, ndims>& rhs)
os << "{";
while (idim >= 0) {
if (indices[idim] < rhs.dims()[idim]) {
// The index is not beyond the last element on the current axis.
// Continue outputting the current sub-array.
if (indices[idim] > 0) {
// This is not the first element on the current axis.
// Output a delimiter.
os << ", ";
}
if (idim == ndims - 1) {
// The current axis is the last one.
// Output the current element and advance the index.
os << rhs.data()[offset];
++indices[idim];
offset += rhs.strides()[idim];
}
else {
// The current axis is not the last one.
// Start outputting a new sub-array.
++idim;
os << "{";
}
}
else {
// The index is beyond the last element on the current axis.
// Finish outputting the current sub-array.
indices[idim] = 0;
offset -= rhs.dims()[idim]*rhs.strides()[idim];
--idim;
Expand Down
4 changes: 4 additions & 0 deletions src/sydevs/systems/simulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,17 +406,21 @@ inline void simulation<Node>::advance_time()
if (!finishing_) {
auto planned_dt = t_queue_.imminent_duration();
if (planned_dt.finite() || !can_end_early_) {
// The event time must advance.
event_time().advance(planned_dt, end_t_);
if (planned_dt > 0_s) {
// The simulated time just advanced.
external_context_.time_printed() = false;
t_queue_.advance_time(event_time().t());
t_cache_.advance_time(event_time().t());
}
if (event_time().t() >= end_t_) {
// The end time has been reached.
finishing_ = true;
}
}
else {
// The simulation must finish at the current event time.
finishing_ = true;
}
}
Expand Down

0 comments on commit 94db051

Please sign in to comment.