Skip to content

Commit

Permalink
[skip ci] solve merge conflicts
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 25, 2024
1 parent e8920cf commit 03dc23e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace power_grid_model::main_core::utils {

constexpr Idx invalid_index{-1};
constexpr Idx invalid_index_v{-1};

template <class... ComponentTypes> constexpr size_t n_types = sizeof...(ComponentTypes);
template <class CompType, class... ComponentTypes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ template <typename T> bool check_id_na(T const& obj) {

namespace independence {
struct UpdateCompProperties {
bool has_any_elements{false}; // whether the component has any elements in the update data
bool ids_all_na{false}; // whether all ids are all NA
bool ids_part_na{false}; // whether some ids are NA but some are not
bool dense{false}; // whether the component is dense
bool uniform{false}; // whether the component is uniform
bool is_columnar{false}; // whether the component is columnar
bool update_ids_match{false}; // whether the ids match
Idx elements_ps_in_update{
main_core::utils::invalid_index}; // count of elements for this component per scenario in update
Idx elements_in_base{main_core::utils::invalid_index}; // count of elements for this component per scenario in input
bool has_any_elements{false}; // whether the component has any elements in the update data
bool ids_all_na{false}; // whether all ids are all NA
bool ids_part_na{false}; // whether some ids are NA but some are not
bool dense{false}; // whether the component is dense
bool uniform{false}; // whether the component is uniform
bool is_columnar{false}; // whether the component is columnar
bool update_ids_match{false}; // whether the ids match
Idx elements_ps_in_update{utils::invalid_index_v}; // count of elements for this component per scenario in update
Idx elements_in_base{utils::invalid_index_v}; // count of elements for this component per scenario in input

constexpr bool no_id() const { return !has_any_elements || ids_all_na; }
constexpr bool qualify_for_optional_id() const {
Expand All @@ -66,7 +65,7 @@ struct UpdateCompProperties {
constexpr bool is_empty_component() const { return !has_any_elements; }
constexpr bool is_independent() const { return qualify_for_optional_id() || provided_ids_valid(); }
constexpr Idx get_n_elements() const {
assert(uniform || elements_ps_in_update == main_core::utils::invalid_index);
assert(uniform || elements_ps_in_update == utils::invalid_index_v);

return qualify_for_optional_id() ? elements_ps_in_update : na_Idx;
}
Expand Down Expand Up @@ -109,10 +108,10 @@ UpdateCompProperties check_component_independence(ConstDataset const& update_dat
properties.is_columnar = update_data.is_columnar(CompType::name);
properties.dense = update_data.is_dense(CompType::name);
properties.uniform = update_data.is_uniform(CompType::name);
properties.has_any_elements = component_idx != main_core::utils::invalid_index &&
update_data.get_component_info(component_idx).total_elements > 0;
properties.elements_ps_in_update = properties.uniform ? update_data.uniform_elements_per_scenario(CompType::name)
: main_core::utils::invalid_index;
properties.has_any_elements =
component_idx != utils::invalid_index_v && update_data.get_component_info(component_idx).total_elements > 0;
properties.elements_ps_in_update =
properties.uniform ? update_data.uniform_elements_per_scenario(CompType::name) : utils::invalid_index_v;
properties.elements_in_base = n_component;

if (properties.is_columnar) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class MainModelImpl<ExtraRetrievableTypes<ExtraRetrievableType...>, ComponentLis
get_components_to_update(ConstDataset const& update_data) const {
return main_core::utils::run_functor_with_all_types_return_array<ComponentType...>(
[&update_data]<typename CompType>() {
return (update_data.find_component(CompType::name, false) != main_core::utils::invalid_index);
return (update_data.find_component(CompType::name, false) != main_core::utils::invalid_index_v);
});
}

Expand Down

0 comments on commit 03dc23e

Please sign in to comment.