Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
34ba5b2
change to forward declarations
nitbharambe Sep 29, 2025
f889ae6
change incldues
nitbharambe Oct 19, 2025
9e8c714
change incldues fix
nitbharambe Oct 19, 2025
5cf953d
add component test includes
nitbharambe Oct 20, 2025
be33aef
add common test includes
nitbharambe Oct 20, 2025
ad81da1
add eigen ignore
nitbharambe Oct 20, 2025
473994d
Merge branch 'main' into feature/component-fwd-cleanup
nitbharambe Dec 11, 2025
5418455
remove TODO
nitbharambe Jan 6, 2026
a463032
Merge branch 'main' into feature/component-fwd-cleanup
nitbharambe Jan 6, 2026
b054e9f
add new test file include
nitbharambe Jan 6, 2026
424f032
remove comments
nitbharambe Jan 6, 2026
dffc4f4
fix assert missing
nitbharambe Jan 7, 2026
c3c6f95
rename to checkoptions
nitbharambe Jan 12, 2026
924e928
Merge branch 'main' into feature/component-fwd-cleanup
nitbharambe Jan 12, 2026
4a5b00c
clean pt 2
nitbharambe Jan 13, 2026
529d379
fix include search place
nitbharambe Feb 1, 2026
b32792a
add more includes
nitbharambe Feb 2, 2026
2b6f670
add more includes 2
nitbharambe Feb 2, 2026
c59acaf
add more includes 3
nitbharambe Feb 2, 2026
eee37dd
operator s includes
nitbharambe Feb 2, 2026
21162c0
remove includes
nitbharambe Feb 2, 2026
986e1b2
add definition option
nitbharambe Feb 2, 2026
6ee5cee
round 3
nitbharambe Feb 2, 2026
764373c
round 4
nitbharambe Feb 2, 2026
0160871
round 5
nitbharambe Feb 2, 2026
c8ac05d
round 6
nitbharambe Feb 2, 2026
dbca8bc
Merge branch 'main' into feature/component-fwd-cleanup
nitbharambe Feb 2, 2026
5ea9b17
final includes
nitbharambe Feb 2, 2026
eec172b
final includes 2
nitbharambe Feb 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>

#

# SPDX-License-Identifier: MPL-2.0

---
Checks: '
-*,
Expand Down Expand Up @@ -44,7 +47,6 @@ google-*,
-google-default-arguments,
misc-*,
-misc-confusable-identifiers,
-misc-include-cleaner,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
modernize-*,
Expand All @@ -68,8 +70,10 @@ readability-*,

WarningsAsErrors: '*'


HeaderFilterRegex: '.*'

FormatStyle: file

CheckOptions:
misc-include-cleaner.IgnoreHeaders : 'Eigen/.*'
...
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#pragma once

// define all components
#include "common/common.hpp"
#include "common/component_list.hpp"
// component include
#include "component/appliance.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "meta_data.hpp"

#include "../common/common.hpp"
#include "../common/counting_iterator.hpp"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As pointed out by the CI, add this via Jinja instead of directly editing here.

#include "../common/exception.hpp"
#include "../common/iterator_facade.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
// clang-format off
#pragma once

#include "meta_data.hpp"

#include "../common/common.hpp"
#include "../common/enum.hpp"
Comment on lines 10 to -13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem.

#include "../common/three_phase_tensor.hpp"

namespace power_grid_model {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// eigen properties
#include <Eigen/Dense>

#include <cassert>
#include <cmath>
#include <complex>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

#pragma once

#include "common.hpp"
#include "logging.hpp"

#include <chrono>
#include <sstream>
#include <utility>

namespace power_grid_model {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "../common/enum.hpp"

namespace power_grid_model {

constexpr IntS status_to_int(bool status) { return status ? IntS{1} : IntS{0}; }

class Base {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,16 @@ concept component_c = requires(T t, T const& ct, typename T::UpdateType u, typen
{ ct.inverse(u) } -> std::same_as<typename T::UpdateType>;
};

struct load_appliance_t {};
struct gen_appliance_t {};

template <typename T>
concept appliance_type_tag = std::same_as<T, load_appliance_t> || std::same_as<T, gen_appliance_t>;
template <appliance_type_tag T> constexpr bool is_generator_v = std::same_as<T, gen_appliance_t>;

static_assert(appliance_type_tag<load_appliance_t>);
static_assert(appliance_type_tag<gen_appliance_t>);
static_assert(!is_generator_v<load_appliance_t>);
static_assert(is_generator_v<gen_appliance_t>);

} // namespace power_grid_model
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#pragma once

#include "appliance.hpp"
#include "base.hpp"

#include "../auxiliary/input.hpp"
#include "../auxiliary/output.hpp"
Expand All @@ -17,18 +16,6 @@

namespace power_grid_model {

struct load_appliance_t {};
struct gen_appliance_t {};

template <typename T>
concept appliance_type_tag = std::same_as<T, load_appliance_t> || std::same_as<T, gen_appliance_t>;
template <appliance_type_tag T> constexpr bool is_generator_v = std::same_as<T, gen_appliance_t>;

static_assert(appliance_type_tag<load_appliance_t>);
static_assert(appliance_type_tag<gen_appliance_t>);
static_assert(!is_generator_v<load_appliance_t>);
static_assert(is_generator_v<gen_appliance_t>);

class GenericLoadGen : public Appliance {
public:
using InputType = GenericLoadGenInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#pragma once

#include "appliance.hpp"
#include "base.hpp"

#include "../auxiliary/input.hpp"
#include "../auxiliary/output.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "transformer_utils.hpp"

#include "../auxiliary/input.hpp"
#include "../auxiliary/output.hpp"
#include "../auxiliary/update.hpp"
#include "../calculation_parameters.hpp"
#include "../common/common.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#pragma once

#include "base.hpp"
#include "regulator.hpp"

#include "../auxiliary/input.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
#include "state_queries.hpp"

#include "../calculation_parameters.hpp"
#include "../component/current_sensor.hpp"
#include "../component/fault.hpp"
#include "../component/load_gen.hpp"
#include "../component/node.hpp"
#include "../component/power_sensor.hpp"
#include "../component/shunt.hpp"
#include "../component/source.hpp"
#include "../component/voltage_sensor.hpp"

#include <concepts>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

#pragma once

#include "../all_components.hpp"
#include "../component/base.hpp"
#include "../component/branch.hpp"
#include "../component/branch3.hpp"
#include "../component/regulator.hpp"
#include "../container.hpp"

namespace power_grid_model::main_core {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,23 @@

#pragma once

#include "../all_components.hpp"
#include "state.hpp"
#include "state_queries.hpp"

#include "../component/appliance.hpp"
#include "../component/base.hpp"
#include "../component/branch.hpp"
#include "../component/branch3.hpp"
#include "../component/current_sensor.hpp"
#include "../component/fault.hpp"
#include "../component/node.hpp"
#include "../component/power_sensor.hpp"
#include "../component/regulator.hpp"
#include "../component/transformer_tap_regulator.hpp"
#include "../component/voltage_sensor.hpp"

#include "../common/iterator_facade.hpp"
#include "../component/component.hpp"

#include <unordered_set>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,57 @@

#pragma once

#include "../all_components.hpp"
#include "../component/component.hpp"
#include "../container.hpp"
#include "state.hpp"
#include "update.hpp"

#include <array>
#include <vector>
namespace power_grid_model::main_core {
namespace power_grid_model {

class Base;
class Node;
class Branch;
class Branch3;
class Appliance;
class GenericLoadGen;
class GenericLoad;
class GenericGenerator;
class GenericPowerSensor;
class GenericVoltageSensor;
class GenericCurrentSensor;
class Regulator;
class Line;
class AsymLine;
class Link;
class GenericBranch;
class Transformer;
class ThreeWindingTransformer;
class Shunt;
class Source;

template <symmetry_tag loadgen_symmetry_, appliance_type_tag appliance_type_> class LoadGen;
using SymGenerator = LoadGen<symmetric_t, gen_appliance_t>;
using AsymGenerator = LoadGen<asymmetric_t, gen_appliance_t>;
using SymLoad = LoadGen<symmetric_t, load_appliance_t>;
using AsymLoad = LoadGen<asymmetric_t, load_appliance_t>;

template <symmetry_tag power_sensor_symmetry_> class PowerSensor;
using SymPowerSensor = PowerSensor<symmetric_t>;
using AsymPowerSensor = PowerSensor<asymmetric_t>;

template <symmetry_tag sym> class VoltageSensor;
using SymVoltageSensor = VoltageSensor<symmetric_t>;
using AsymVoltageSensor = VoltageSensor<asymmetric_t>;
template <symmetry_tag sym> class CurrentSensor;
using SymCurrentSensor = CurrentSensor<symmetric_t>;
using AsymCurrentSensor = CurrentSensor<asymmetric_t>;

class Fault;
class TransformerTapRegulator;

namespace main_core {

namespace detail {

Expand Down Expand Up @@ -125,4 +168,5 @@ struct is_main_model_type<MainModelType<ExtraRetrievableTypes<ETs...>, Component

template <typename T> inline constexpr bool is_main_model_type_v = is_main_model_type<T>::value;

} // namespace power_grid_model::main_core
} // namespace main_core
} // namespace power_grid_model
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@

#pragma once

#include "../component/base.hpp"
#include "../component/branch.hpp"
#include "../component/branch3.hpp"
#include "../component/current_sensor.hpp"
#include "../component/fault.hpp"
#include "../component/load_gen.hpp"
#include "../component/node.hpp"
#include "../component/power_sensor.hpp"
#include "../component/shunt.hpp"
#include "../component/source.hpp"
#include "../component/transformer_tap_regulator.hpp"
#include "../component/voltage_regulator.hpp"
#include "../component/voltage_sensor.hpp"
#include "container_queries.hpp"
#include "state.hpp"
#include "state_queries.hpp"

#include "../all_components.hpp"

#include <concepts>

namespace power_grid_model::main_core {
Expand Down Expand Up @@ -115,14 +126,14 @@ constexpr void produce_output(MainModelState<ComponentContainer> const& state, C

// output node
template <std::derived_from<Node> Component, steady_state_solver_output_type SolverOutputType>
constexpr auto output_result(Node const& node, std::vector<SolverOutputType> const& solver_output, Idx2D math_id) {
constexpr auto output_result(Component const& node, std::vector<SolverOutputType> const& solver_output, Idx2D math_id) {
using sym = typename SolverOutputType::sym;

if (math_id.group == -1) {
return node.get_null_output<sym>();
return node.template get_null_output<sym>();
}
return node.get_output<sym>(solver_output[math_id.group].u[math_id.pos],
solver_output[math_id.group].bus_injection[math_id.pos]);
return node.template get_output<sym>(solver_output[math_id.group].u[math_id.pos],
solver_output[math_id.group].bus_injection[math_id.pos]);
}
template <std::derived_from<Node> Component, short_circuit_solver_output_type SolverOutputType>
inline auto output_result(Component const& node, std::vector<SolverOutputType> const& solver_output, Idx2D math_id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

#include "state.hpp"

#include "../all_components.hpp"
#include "../component/branch.hpp"
#include "../component/branch3.hpp"
#include "../component/node.hpp"
#include "../component/regulator.hpp"
#include "../component/transformer.hpp"

namespace power_grid_model::main_core {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@

#include "container_queries.hpp"

#include "../all_components.hpp"
#include "../component/branch.hpp"
#include "../component/branch3.hpp"
#include "../component/current_sensor.hpp"
#include "../component/fault.hpp"
#include "../component/load_gen.hpp"
#include "../component/node.hpp"
#include "../component/power_sensor.hpp"
#include "../component/regulator.hpp"
#include "../component/shunt.hpp"
#include "../component/source.hpp"
#include "../component/voltage_sensor.hpp"

namespace power_grid_model::main_core {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
#include "container_queries.hpp"
#include "core_utils.hpp"

#include "../all_components.hpp"
#include "../auxiliary/dataset.hpp"
#include "../common/iterator_facade.hpp"
#include "../container.hpp"
#include "../component/component.hpp"

#include <map>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#pragma once

#include "all_components.hpp"
#include "job_adapter.hpp"
#include "job_dispatch.hpp"
#include "main_model_impl.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#include "common/timer.hpp"

// component include
#include "all_components.hpp"
#include "auxiliary/dataset.hpp"
#include "auxiliary/input.hpp"
#include "auxiliary/output.hpp"
#include "component/component.hpp"

// math model include
#include "math_solver/math_solver_dispatch.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ Iterative Power Flow
#include "../common/common.hpp"
#include "../common/exception.hpp"
#include "../common/three_phase_tensor.hpp"
#include "../common/timer.hpp"

namespace power_grid_model::math_solver {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ if there are sources
#include "../calculation_parameters.hpp"
#include "../common/common.hpp"
#include "../common/enum.hpp"
#include "../common/exception.hpp"
#include "../common/three_phase_tensor.hpp"
#include "../common/timer.hpp"

Expand Down
Loading
Loading