-
Notifications
You must be signed in to change notification settings - Fork 51
Reduce usage of shared_ptr in the core #1248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Laurynas-Jagutis
wants to merge
9
commits into
main
Choose a base branch
from
feature/reduce-sharedptr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
329d593
remove most of shared ptrs from math solver files
Laurynas-Jagutis 051034d
adjust to reference wrapper
Laurynas-Jagutis 7458b62
changes to sparse lu solver and measured values
Laurynas-Jagutis 4d6f41d
remove test includes
Laurynas-Jagutis a27b70b
add spans, remove multiple shared ptrs for mathmodeltopology, adjust …
Laurynas-Jagutis 44f7020
formatting
Laurynas-Jagutis 01286bf
Merge remote-tracking branch 'origin/main' into feature/reduce-sharedptr
Laurynas-Jagutis 8c714f2
remove space
Laurynas-Jagutis 7779223
remove shared ptr from short circuit solver, adjust tests
Laurynas-Jagutis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,7 @@ template <symmetry_tag sym> class MeasuredValues { | |
| public: | ||
| // construct | ||
| MeasuredValues(std::shared_ptr<MathModelTopology const> topo, StateEstimationInput<sym> const& input) | ||
| : math_topology_{std::move(topo)}, | ||
| : math_topology_{*topo}, | ||
| bus_appliance_injection_(math_topology().n_bus()), | ||
| idx_voltage_(math_topology().n_bus()), | ||
| bus_injection_(math_topology().n_bus()), | ||
|
|
@@ -112,12 +112,12 @@ template <symmetry_tag sym> class MeasuredValues { | |
|
|
||
| LoadGenSourceFlow calculate_load_gen_source(ComplexValueVector<sym> const& u, | ||
| ComplexValueVector<sym> const& s) const { | ||
| std::vector<ApplianceSolverOutput<sym>> load_gen_flow(math_topology_->n_load_gen()); | ||
| std::vector<ApplianceSolverOutput<sym>> source_flow(math_topology_->n_source()); | ||
| std::vector<ApplianceSolverOutput<sym>> load_gen_flow(math_topology_.n_load_gen()); | ||
| std::vector<ApplianceSolverOutput<sym>> source_flow(math_topology_.n_source()); | ||
|
|
||
| // loop all buses | ||
| for (auto const& [bus, load_gens, sources] : | ||
| enumerated_zip_sequence(math_topology_->load_gens_per_bus, math_topology_->sources_per_bus)) { | ||
| enumerated_zip_sequence(math_topology_.load_gens_per_bus, math_topology_.sources_per_bus)) { | ||
| // under-determined or exactly determined | ||
| if (bus_injection_[bus].n_unmeasured_appliances > 0) { | ||
| calculate_non_over_determined_injection(bus_injection_[bus].n_unmeasured_appliances, load_gens, sources, | ||
|
|
@@ -173,7 +173,7 @@ template <symmetry_tag sym> class MeasuredValues { | |
|
|
||
| private: | ||
| // cache topology | ||
| std::shared_ptr<MathModelTopology const> math_topology_; | ||
| MathModelTopology const& math_topology_; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. member types should not be |
||
|
|
||
| // flat arrays of all the relevant measurement for the main calculation | ||
| // branch/shunt flow, bus voltage, injection flow | ||
|
|
@@ -214,7 +214,7 @@ template <symmetry_tag sym> class MeasuredValues { | |
| // the lowest bus index with a voltage measurement | ||
| Idx first_voltage_measurement_{}; | ||
|
|
||
| constexpr MathModelTopology const& math_topology() const { return *math_topology_; } | ||
| constexpr MathModelTopology const& math_topology() const { return math_topology_; } | ||
|
|
||
| void process_bus_related_measurements(StateEstimationInput<sym> const& input) { | ||
| /* | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is no longer a pointer