Skip to content
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

Get switches and internal connections from given node (#391) #422

Open
wants to merge 4 commits into
base: integration/v1.6.0
Choose a base branch
from

Conversation

sebalaig
Copy link
Contributor

@sebalaig sebalaig commented Jan 31, 2022

Signed-off-by: Sébastien LAIGRE slaigre@silicom.fr

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem ? If so, link to this issue using '#XXX' and skip the rest
Closes #391

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change or deprecate an API? If yes, check the following:

  • The Breaking Change or Deprecated label has been added
  • The migration guide has been updated in the github wiki (What changes might users need to make in their application due to this PR?)

Other information:

(if any of the questions/checkboxes don't apply, please delete them entirely)

@sebalaig sebalaig self-assigned this Jan 31, 2022
@sebalaig sebalaig linked an issue Jan 31, 2022 that may be closed by this pull request
@sebalaig sebalaig force-pushed the issue391-get-switched-internalConnection branch from 460504f to 8d633cc Compare March 24, 2022 14:56
const_range<unsigned long> getEdges() const;

unsigned long getMaxVertex() const;

unsigned long getVertex1(unsigned long e) const;
const unsigned long& getVertex1(unsigned long e) const;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be discussed: I think it's not wrong, I had to update that in order to return a range in NodeBreakerViewImpl::getNodesInternalConnectedTo (unless it was gardening...). But maybe NodeBreakerViewImpl::getNodesInternalConnectedTo should return a vector instead ?

Choose a reason for hiding this comment

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

I have to think a little bit more about the issue you encountered

@sebalaig sebalaig requested a review from mathbagu March 25, 2022 08:18
@sebalaig sebalaig force-pushed the issue391-get-switched-internalConnection branch from a04401d to 7a18e03 Compare April 13, 2022 16:20
@sebalaig sebalaig changed the title WIP: Get switches and internal connections from given node (#391) Get switches and internal connections from given node (#391) Apr 14, 2022
@@ -54,19 +54,29 @@ class UndirectedGraph {

const stdcxx::Reference<E>& getEdgeObject(unsigned long e) const;

const_range<E> getEdgeObjectsConnectedToVertex(unsigned long vertex) const;

const std::vector<unsigned long>& getEdgeConnectedToVertex(unsigned long vertex) const;

Choose a reason for hiding this comment

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

I'm not sure we have to keep this method. It seems you backport the IntStream getEdgeConnectedToVertexStream(int v); method, but from my point of view, an S is missing in the name of the method.

const_range<E> getEdgeObjects() const;

range<E> getEdgeObjects();

const_range<E> getEdgeObjects(unsigned long v1, unsigned long v2) const;

const unsigned long& getEdgeVertex1(unsigned long edge) const;

const unsigned long& getEdgeVertex2(unsigned long edge) const;

Choose a reason for hiding this comment

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

To be discussed: not sure this is a good idea to return a reference here.

const_range<unsigned long> getEdges() const;

unsigned long getMaxVertex() const;

unsigned long getVertex1(unsigned long e) const;
const unsigned long& getVertex1(unsigned long e) const;

Choose a reason for hiding this comment

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

I have to think a little bit more about the issue you encountered

@@ -12,6 +12,7 @@
#include <set>
#include <string>

#include <powsybl/PowsyblException.hpp>

Choose a reason for hiding this comment

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

I'm not sure you should add this include in a header.


const auto& mapper = [this, node](const unsigned long& edge) -> const unsigned long& {
unsigned long vertex1 = m_voltageLevel.getGraph().getEdgeVertex1(edge);
return vertex1 != node ? m_voltageLevel.getGraph().getEdgeVertex1(edge) : m_voltageLevel.getGraph().getEdgeVertex2(edge);

Choose a reason for hiding this comment

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

We should avoid this useless call to m_voltageLevel.getGraph().getEdgeVertex1(edge)

src/iidm/NodeBreakerVoltageLevelViews.cpp Show resolved Hide resolved
src/iidm/NodeBreakerVoltageLevelViews.cpp Show resolved Hide resolved
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
@sebalaig sebalaig force-pushed the issue391-get-switched-internalConnection branch from 7a18e03 to d7687f2 Compare April 29, 2022 06:13
@sonarcloud
Copy link

sonarcloud bot commented Apr 29, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell B 3 Code Smells

72.0% 72.0% Coverage
0.0% 0.0% Duplication

@sonarcloud
Copy link

sonarcloud bot commented Aug 30, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

72.0% 72.0% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get switches and internal connections from given node
2 participants