From 297d2d7e5cccd0b1ceffedb974c6c99908c1f334 Mon Sep 17 00:00:00 2001 From: Santiago Figueroa Manrique Date: Tue, 19 Nov 2024 10:20:55 +0100 Subject: [PATCH] rename get_comp_seq in state_queries Signed-off-by: Santiago Figueroa Manrique --- .../main_core/state_queries.hpp | 8 ++--- .../power_grid_model/main_core/topology.hpp | 34 +++++++++---------- .../power_grid_model/main_model_impl.hpp | 6 ++-- .../optimizer/tap_position_optimizer.hpp | 6 ++-- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/main_core/state_queries.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/main_core/state_queries.hpp index 04b998373..4d92566c7 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/main_core/state_queries.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/main_core/state_queries.hpp @@ -41,7 +41,7 @@ constexpr Idx get_component_group_idx(MainModelState const& template requires model_component_state_c -inline Idx get_component_sequence(MainModelState const& state, auto const& id_or_index) { +inline Idx get_component_sequence_idx(MainModelState const& state, auto const& id_or_index) { return state.components.template get_seq(id_or_index); } @@ -97,19 +97,19 @@ constexpr auto get_component_citer(MainModelState const& sta template ComponentType, class ComponentContainer> requires model_component_state_c constexpr auto get_topology_index(MainModelState const& state, auto const& id_or_index) { - return get_component_sequence(state, id_or_index); + return get_component_sequence_idx(state, id_or_index); } template ComponentType, class ComponentContainer> requires model_component_state_c constexpr auto get_topology_index(MainModelState const& state, auto const& id_or_index) { - return get_component_sequence(state, id_or_index); + return get_component_sequence_idx(state, id_or_index); } template ComponentType, class ComponentContainer> requires model_component_state_c constexpr auto get_topology_index(MainModelState const& state, auto const& id_or_index) { - return get_component_sequence(state, id_or_index); + return get_component_sequence_idx(state, id_or_index); } template ComponentType, class ComponentContainer> diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/main_core/topology.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/main_core/topology.hpp index 567f2f684..b5bc94188 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/main_core/topology.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/main_core/topology.hpp @@ -40,8 +40,8 @@ template Component, class ComponentContainer> constexpr void register_topology_components(MainModelState const& state, ComponentTopology& comp_topo) { detail::register_topo_components(state, comp_topo.branch_node_idx, [&state](Branch const& branch) { - return BranchIdx{get_component_sequence(state, branch.from_node()), - get_component_sequence(state, branch.to_node())}; + return BranchIdx{get_component_sequence_idx(state, branch.from_node()), + get_component_sequence_idx(state, branch.to_node())}; }); } @@ -50,9 +50,9 @@ template Component, class ComponentContainer> constexpr void register_topology_components(MainModelState const& state, ComponentTopology& comp_topo) { detail::register_topo_components(state, comp_topo.branch3_node_idx, [&state](Branch3 const& branch3) { - return Branch3Idx{get_component_sequence(state, branch3.node_1()), - get_component_sequence(state, branch3.node_2()), - get_component_sequence(state, branch3.node_3())}; + return Branch3Idx{get_component_sequence_idx(state, branch3.node_1()), + get_component_sequence_idx(state, branch3.node_2()), + get_component_sequence_idx(state, branch3.node_3())}; }); } @@ -61,7 +61,7 @@ template Component, class ComponentContainer> constexpr void register_topology_components(MainModelState const& state, ComponentTopology& comp_topo) { detail::register_topo_components(state, comp_topo.source_node_idx, [&state](Source const& source) { - return get_component_sequence(state, source.node()); + return get_component_sequence_idx(state, source.node()); }); } @@ -70,7 +70,7 @@ template Component, class ComponentContainer> constexpr void register_topology_components(MainModelState const& state, ComponentTopology& comp_topo) { detail::register_topo_components(state, comp_topo.shunt_node_idx, [&state](Shunt const& shunt) { - return get_component_sequence(state, shunt.node()); + return get_component_sequence_idx(state, shunt.node()); }); } @@ -80,7 +80,7 @@ constexpr void register_topology_components(MainModelState c ComponentTopology& comp_topo) { detail::register_topo_components( state, comp_topo.load_gen_node_idx, - [&state](GenericLoadGen const& load_gen) { return get_component_sequence(state, load_gen.node()); }); + [&state](GenericLoadGen const& load_gen) { return get_component_sequence_idx(state, load_gen.node()); }); detail::register_topo_components(state, comp_topo.load_gen_type, [](GenericLoadGen const& load_gen) { return load_gen.type(); }); @@ -92,7 +92,7 @@ constexpr void register_topology_components(MainModelState c ComponentTopology& comp_topo) { detail::register_topo_components( state, comp_topo.voltage_sensor_node_idx, [&state](GenericVoltageSensor const& voltage_sensor) { - return get_component_sequence(state, voltage_sensor.measured_object()); + return get_component_sequence_idx(state, voltage_sensor.measured_object()); }); } @@ -110,21 +110,21 @@ constexpr void register_topology_components(MainModelState c case branch_from: [[fallthrough]]; case branch_to: - return get_component_sequence(state, measured_object); + return get_component_sequence_idx(state, measured_object); case source: - return get_component_sequence(state, measured_object); + return get_component_sequence_idx(state, measured_object); case shunt: - return get_component_sequence(state, measured_object); + return get_component_sequence_idx(state, measured_object); case load: [[fallthrough]]; case generator: - return get_component_sequence(state, measured_object); + return get_component_sequence_idx(state, measured_object); case branch3_1: case branch3_2: case branch3_3: - return get_component_sequence(state, measured_object); + return get_component_sequence_idx(state, measured_object); case node: - return get_component_sequence(state, measured_object); + return get_component_sequence_idx(state, measured_object); default: throw MissingCaseForEnumError("Power sensor idx to seq transformation", power_sensor.get_terminal_type()); @@ -144,9 +144,9 @@ constexpr void register_topology_components(MainModelState c state, comp_topo.regulated_object_idx, [&state](Regulator const& regulator) { switch (regulator.regulated_object_type()) { case ComponentType::branch: - return get_component_sequence(state, regulator.regulated_object()); + return get_component_sequence_idx(state, regulator.regulated_object()); case ComponentType::branch3: - return get_component_sequence(state, regulator.regulated_object()); + return get_component_sequence_idx(state, regulator.regulated_object()); default: throw MissingCaseForEnumError("Regulator idx to seq transformation", regulator.regulated_object_type()); } diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp index 3e5ef6677..8a0d2db1b 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp @@ -974,7 +974,7 @@ class MainModelImpl, ComponentLis if constexpr (std::derived_from) { Idx2D const math_idx = state.topo_comp_coup - ->branch[main_core::get_component_sequence(state, changed_component_idx)]; + ->branch[main_core::get_component_sequence_idx(state, changed_component_idx)]; if (math_idx.group == isolated_component) { return; } @@ -983,7 +983,7 @@ class MainModelImpl, ComponentLis } else if constexpr (std::derived_from) { Idx2DBranch3 const math_idx = state.topo_comp_coup - ->branch3[main_core::get_component_sequence(state, changed_component_idx)]; + ->branch3[main_core::get_component_sequence_idx(state, changed_component_idx)]; if (math_idx.group == isolated_component) { return; } @@ -996,7 +996,7 @@ class MainModelImpl, ComponentLis } else if constexpr (std::same_as) { Idx2D const math_idx = state.topo_comp_coup - ->shunt[main_core::get_component_sequence(state, changed_component_idx)]; + ->shunt[main_core::get_component_sequence_idx(state, changed_component_idx)]; if (math_idx.group == isolated_component) { return; } diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/optimizer/tap_position_optimizer.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/optimizer/tap_position_optimizer.hpp index 0cc867dfb..3bbcce84e 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/optimizer/tap_position_optimizer.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/optimizer/tap_position_optimizer.hpp @@ -82,8 +82,8 @@ template inline void add_to_edge(main_core::MainModelState const& state, TrafoGraphEdges& edges, TrafoGraphEdgeProperties& edge_props, ID const& start, ID const& end, TrafoGraphEdge const& edge_prop) { - Idx const start_idx = main_core::get_component_sequence(state, start); - Idx const end_idx = main_core::get_component_sequence(state, end); + Idx const start_idx = main_core::get_component_sequence_idx(state, start); + Idx const end_idx = main_core::get_component_sequence_idx(state, end); edges.emplace_back(start_idx, end_idx); edge_props.emplace_back(edge_prop); } @@ -218,7 +218,7 @@ inline auto build_transformer_graph(State const& state) -> TransformerGraph { // Mark sources for (auto const& source : state.components.template citer()) { // ignore disabled sources - trafo_graph[main_core::get_component_sequence(state, source.node())].is_source = source.status(); + trafo_graph[main_core::get_component_sequence_idx(state, source.node())].is_source = source.status(); } return trafo_graph;