Skip to content

Commit 6411ab0

Browse files
authored
Merge pull request #1114 from PowerGridModel/feature/clang-tidy-bis
Clean-up main model: clang tidy bis
2 parents 8ac0bc6 + e9dea13 commit 6411ab0

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

power_grid_model_c/power_grid_model/include/power_grid_model/math_solver/y_bus.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,8 @@ struct YBusStructure {
261261
// end of y_bus_entry_indptr is same as size of entry
262262
assert(y_bus_entry_indptr.back() == static_cast<Idx>(y_bus_element.size()));
263263

264-
// construct transpose entry
265-
lu_transpose_entry.resize(nnz_counter_lu);
266-
// default transpose_entry[i] = i
267-
std::iota( // NOLINT(modernize-use-ranges) // not yet supported by some compilers
268-
lu_transpose_entry.begin(), lu_transpose_entry.end(), 0);
264+
lu_transpose_entry = IdxRange{nnz_counter_lu} | std::ranges::to<IdxVector>();
265+
269266
// fill off-diagonal, loop all the branches
270267
for (auto const [entry_1, entry_2] : off_diag_map) {
271268
// for each branch entry tf and ft, they are transpose to each other

tests/cpp_unit_tests/test_dataset.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,15 +1067,12 @@ TEST_CASE_TEMPLATE("Test dataset (common)", DatasetType, ConstDataset, MutableDa
10671067
check_get_individual_scenario();
10681068
}
10691069
SUBCASE("columnar") {
1070-
auto a_id_buffer = std::vector<ID>(a_elements_per_scenario * batch_size);
1071-
auto a_a1_buffer = std::vector<double>(a_elements_per_scenario * batch_size);
1070+
auto a_id_buffer =
1071+
std::views::iota(0, a_elements_per_scenario * batch_size) | std::ranges::to<std::vector<ID>>();
1072+
auto a_a1_buffer =
1073+
std::views::iota(0, a_elements_per_scenario * batch_size) | std::ranges::to<std::vector<double>>();
10721074
auto b_indptr = std::vector<Idx>{0, 0, 3};
10731075

1074-
std::iota( // NOLINT(modernize-use-ranges) // not yet supported by some compilers
1075-
a_id_buffer.begin(), a_id_buffer.end(), ID{0});
1076-
std::iota( // NOLINT(modernize-use-ranges) // not yet supported by some compilers
1077-
a_a1_buffer.begin(), a_a1_buffer.end(), 0.0);
1078-
10791076
add_homogeneous_buffer(dataset, A::name, a_elements_per_scenario, nullptr);
10801077
add_attribute_buffer(dataset, A::name, "id", static_cast<void*>(a_id_buffer.data()));
10811078
add_attribute_buffer(dataset, A::name, "a1", static_cast<void*>(a_a1_buffer.data()));

0 commit comments

Comments
 (0)