Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
Signed-off-by: Santiago Figueroa Manrique <santiago.figueroa.manrique@alliander.com>
  • Loading branch information
figueroa1395 committed Nov 19, 2024
1 parent 5767a9a commit f7c64c9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,18 @@ template <typename CompType> void process_buffer_span(auto const& all_spans, Upd
if (all_spans.empty()) {
properties.update_ids_match = true;
return;
} else {
// Remember the begin iterator of the first scenario, then loop over the remaining scenarios and
// check the ids
auto const first_span = all_spans[0];
// check the subsequent scenarios
// only return true if all scenarios match the ids of the first batch
properties.update_ids_match =
std::ranges::all_of(all_spans.cbegin() + 1, all_spans.cend(), [&first_span](auto const& current_span) {
return std::ranges::equal(
current_span, first_span,
[](typename CompType::UpdateType const& obj, typename CompType::UpdateType const& first) {
return obj.id == first.id;
});
});
}
// Remember the begin iterator of the first scenario, then loop over the remaining scenarios and
// check the ids
auto const first_span = all_spans[0];
// check the subsequent scenarios
// only return true if all scenarios match the ids of the first batch
properties.update_ids_match =
std::ranges::all_of(all_spans.cbegin() + 1, all_spans.cend(), [&first_span](auto const& current_span) {
return std::ranges::equal(current_span, first_span,
[](typename CompType::UpdateType const& obj,
typename CompType::UpdateType const& first) { return obj.id == first.id; });
});
}

template <class CompType>
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp_unit_tests/test_tap_position_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,8 @@ TEST_CASE("Test Tap position optimizer") {
auto const& transformers_dataset =
update_dataset.get_buffer_span<meta_data::update_getter_s, MockTransformer>();
auto changed_components = std::vector<Idx2D>{};
main_core::update_component<MockTransformer>(state, transformers_dataset.begin(), transformers_dataset.end(),
std::back_inserter(changed_components));
main_core::update::update_component<MockTransformer>(
state, transformers_dataset.begin(), transformers_dataset.end(), std::back_inserter(changed_components));
};

auto twoStatesEqual = [](const MockState& state1, const MockState& state2) {
Expand Down

0 comments on commit f7c64c9

Please sign in to comment.