From f7b1e08a6262d86accf79ac5b3798f3f1229d84c Mon Sep 17 00:00:00 2001 From: Franziska Wegner <57569315+franziska-wegner@users.noreply.github.com> Date: Sat, 30 Dec 2023 00:53:49 -0800 Subject: [PATCH] Add Pre-Commit Job & Badge (#66) * Add badge for pr-commit check to readme * Remove the argument from pretty-format-json * [pre-commit.ci] auto fixes from pre-commit.com hooks, for more information, see https://pre-commit.ci * Add autofix flag * [pre-commit.ci] auto fixes from pre-commit.com hooks, for more information, see https://pre-commit.ci --- .github/workflows/cmake-multi-platform.yml | 2 +- .github/workflows/synopsys-security-scan.yml | 4 +- .pre-commit-config.yaml | 2 +- CMakeLists.txt | 28 +- DoxyfileConfig.in | 2 +- README.md | 54 +- cmake/Boost.cmake | 10 +- cmake/CompilerConfiguration.cmake | 16 +- cmake/CppAD.cmake | 10 +- cmake/Doxygen.cmake | 8 +- cmake/ExternalProjectConfiguration.cmake | 416 ++--- cmake/FindBonmin.cmake | 18 +- cmake/FindClangTidy.cmake | 8 +- cmake/FindCplex.cmake | 58 +- cmake/FindEigen.cmake | 10 +- cmake/FindGoogleTestFramework.cmake | 6 +- ...FindGoogleTestFrameworkOnlineVersion.cmake | 16 +- cmake/FindGurobi.cmake | 22 +- cmake/FindIpopt.cmake | 24 +- cmake/FindOGDF.cmake | 20 +- cmake/HelperFunctions.cmake | 6 +- cmake/InputProperties.cmake | 10 +- cmake/OpenMP.cmake | 12 +- cmake/SetEnvironmentVariables.cmake | 12 +- .../CableTypes/2017-iti-cable-types.json | 29 +- documentation/includes/EGOA_Colors.tex | 12 +- .../EGOA_DocumentationLatexPreamble.sty | 104 +- .../includes/EGOA_IpeLatexPreamble.tex | 16 +- .../Centralities/BetweennessCentrality.hpp | 50 +- .../GeneratorBasedBetweennessCentrality.hpp | 28 +- .../ArticulationVertexDetection.hpp | 20 +- .../GraphTraversal/BreadthFirstSearch.hpp | 4 +- .../GraphTraversal/CycleDetection.hpp | 4 +- .../GraphTraversal/DepthFirstSearch.hpp | 76 +- .../Algorithms/GraphTraversal/Traversal.hpp | 60 +- .../PathFinding/DominatingThetaPath.hpp | 182 +- include/Algorithms/SpanningTree/Kruskal.hpp | 8 +- include/Algorithms/SpanningTree/MST.hpp | 10 +- include/Algorithms/SpanningTree/Prim.hpp | 12 +- include/Auxiliary/Auxiliary.hpp | 18 +- include/Auxiliary/Comparators.hpp | 2 +- include/Auxiliary/Constants.hpp | 4 +- include/Auxiliary/ContainerLoop.hpp | 10 +- include/Auxiliary/ExecutionPolicy.hpp | 2 +- include/Auxiliary/Timer.hpp | 46 +- include/Auxiliary/Types.hpp | 10 +- include/DataStructures/Bound.hpp | 36 +- .../Container/DominationCriterion.hpp | 1 - .../Container/Queues/BinaryHeap.hpp | 144 +- .../Container/Queues/Bucket.hpp | 316 ++-- .../Container/Queues/PriorityQueue.hpp | 10 +- .../DataStructures/Container/Queues/Queue.hpp | 6 +- .../Container/Queues/StdQueue.hpp | 2 +- .../DataStructures/Container/UnionFind.hpp | 46 +- .../DataStructures/Graphs/BlockCutTree.hpp | 6 +- .../DataStructures/Graphs/DynamicGraph.hpp | 279 ++- include/DataStructures/Graphs/Edges/Edge.hpp | 16 +- .../Graphs/Edges/ElectricalProperties.hpp | 104 +- include/DataStructures/Graphs/Edges/Type.hpp | 37 +- include/DataStructures/Graphs/StaticGraph.hpp | 189 +- include/DataStructures/Graphs/Type.hpp | 8 +- .../Graphs/Vertices/ElectricalProperties.hpp | 260 +-- .../Graphs/Vertices/GeneratorProperties.hpp | 522 +++--- .../Graphs/Vertices/LoadProperties.hpp | 98 +- .../DataStructures/Graphs/Vertices/Type.hpp | 68 +- .../DataStructures/Graphs/Vertices/Vertex.hpp | 12 +- .../Iterators/DynamicGraphIterators.hpp | 26 +- .../Iterators/GraphIterators.hpp | 132 +- .../Iterators/PowerGridIterators.hpp | 1166 ++++++------- .../Iterators/StaticGraphIterators.hpp | 66 +- .../DataStructures/Labels/BucketElement.hpp | 72 +- include/DataStructures/Labels/Label.hpp | 66 +- .../Labels/SusceptanceNormLabel.hpp | 86 +- .../Labels/VoltageAngleDifferenceLabel.hpp | 107 +- .../Networks/GenerationStrategy.hpp | 18 +- include/DataStructures/Networks/PowerGrid.hpp | 1220 ++++++------- include/Exceptions/Assertions.hpp | 20 +- include/Exceptions/Exceptions.hpp | 8 +- include/IO/Appearance/Color.hpp | 20 +- include/IO/Appearance/Stroke.hpp | 12 +- include/IO/Helper/DataValidation.hpp | 82 +- include/IO/Parser/IeeeCdfMatlabParser.hpp | 150 +- include/IO/Parser/PyPsaParser.hpp | 1521 ++++++++--------- include/IO/PowerGridIO.hpp | 176 +- include/IO/Wrapper/Edge.hpp | 8 +- include/IO/Writer/GeojsonWriter.hpp | 90 +- .../Callbacks/CallbackEmpty.hpp | 4 +- include/MathematicalModel/Types.hpp | 92 +- scripts/Build/buildProject.sh | 22 +- scripts/Build/buildUsage.sh | 12 +- scripts/Build/localConfig.sh | 12 +- scripts/Build/serverConfig.sh | 8 +- scripts/Experiments/manageSimulations.sh | 30 +- src/CMakeLists.txt | 6 +- src/IO/Appearance/Color.cpp | 38 +- src/IO/PowerGridIO.cpp | 2 +- src/Runnables/main.cpp | 50 +- .../TestBetweennessCentrality.cpp | 24 +- .../TestBetweennessCentrality.hpp | 156 +- ...estGeneratorBasedBetweennessCentrality.cpp | 10 +- ...estGeneratorBasedBetweennessCentrality.hpp | 118 +- .../PathFinding/TestDominatingThetaPath.cpp | 54 +- .../PathFinding/TestDominatingThetaPath.hpp | 10 +- tests/CMakeLists.txt | 3 +- .../PyPsaExampleJsonWriterExpectedOutput.json | 888 +++++----- .../PyPSAExample/generators-p_max_pu.csv | 2 +- .../PowerGrids/PyPSAExample/loads-p_set.csv | 2 +- .../PyPSAExample/storage_units-inflow.csv | 2 +- .../PowerGrids/PyPSAExample/storage_units.csv | 2 +- .../generators-p_max_pu.csv | 2 +- .../loads-p_set.csv | 2 +- .../storage_units-inflow.csv | 2 +- .../storage_units.csv | 2 +- .../generators-p_max_pu.csv | 2 +- .../loads-p_set.csv | 2 +- .../storage_units-inflow.csv | 2 +- .../storage_units.csv | 2 +- .../generators-p_max_pu.csv | 2 +- .../generators.csv | 2 +- .../loads-p_set.csv | 2 +- .../storage_units-inflow.csv | 2 +- .../storage_units.csv | 2 +- .../generators-p_max_pu.csv | 2 +- .../PyPSAExampleGeoJsonWriter/loads-p_set.csv | 2 +- .../storage_units-inflow.csv | 2 +- .../storage_units.csv | 2 +- ...-Square-Representations-of-Planar-Graphs.m | 2 +- .../ieee_2018_acm_eEnergy_MTSF_Figure4a.m | 2 +- .../ieee_2018_acm_eEnergy_MTSF_Figure4b.m | 2 +- .../Container/TestBinaryHeap.cpp | 214 +-- .../Container/TestBinaryHeap.hpp | 8 +- tests/DataStructures/Container/TestBucket.cpp | 528 +++--- tests/DataStructures/Container/TestBucket.hpp | 8 +- .../Container/TestMappingBinaryHeap.cpp | 28 +- .../DataStructures/Container/TestStdQueue.cpp | 6 +- .../DataStructures/Container/TestStdQueue.hpp | 8 +- .../Graphs/TestDynamicGraph.cpp | 20 +- tests/DataStructures/Graphs/TestGraph.cpp | 178 +- tests/DataStructures/Graphs/TestGraph.hpp | 24 +- tests/DataStructures/Graphs/TestPowerGrid.cpp | 722 ++++---- tests/DataStructures/Graphs/TestPowerGrid.hpp | 54 +- tests/Helper/TestHelper.hpp | 26 +- tests/IO/TestGeojsonWriter.cpp | 2 +- tests/IO/TestGeojsonWriter.hpp | 4 +- tests/IO/TestIeeeCdfMatlabParser.cpp | 2 +- tests/IO/TestIeeeCdfMatlabParser.hpp | 2 +- tests/IO/TestPyPsaParser.cpp | 120 +- tests/IO/TestPyPsaParser.hpp | 14 +- 148 files changed, 6155 insertions(+), 6087 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index b04488f1..1182d0c1 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -292,7 +292,7 @@ jobs: message(FATAL_ERROR "Building documentation failed") endif() - # See https://github.com/marketplace/actions/github-pages-action#%EF%B8%8F-deploy-to-external-repository-external_repository + # See https://github.com/marketplace/actions/github-pages-action#%EF%B8%8F-deploy-to-external-repository-external_repository # for more information on the parameters. - name: Publish Documentation to Github Pages uses: peaceiris/actions-gh-pages@v3 diff --git a/.github/workflows/synopsys-security-scan.yml b/.github/workflows/synopsys-security-scan.yml index 03c644ef..7acf1b0b 100644 --- a/.github/workflows/synopsys-security-scan.yml +++ b/.github/workflows/synopsys-security-scan.yml @@ -99,8 +99,8 @@ jobs: cmake -B ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc - -DEGOA_BUILD_TYPE=Release - -DCMAKE_BUILD_TYPE=Release + -DEGOA_BUILD_TYPE=Release + -DCMAKE_BUILD_TYPE=Release -DBoost_NO_SYSTEM_PATHS=TRUE -DEGOA_DOWNLOAD_CPPAD=OFF -DEGOA_DOWNLOAD_EIGEN=OFF diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1521fe45..d4fb0576 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: - id: no-commit-to-branch args: [--branch, staging, --branch, main] - id: pretty-format-json - args: [--autofix, --indent, 4] + args: [--autofix] # , --indent, 4 - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/psf/black diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e51b973..7e575024 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,13 @@ # CMakeLists.txt -# +# # Created on: 30.01.2019 # Author: Franziska Wegner -# +# # Main cmake configuration file. -# +# -cmake_minimum_required ( VERSION 3.13.1 ) -# Required for CMAKE_MSVC_RUNTIME_LIBRARY +cmake_minimum_required ( VERSION 3.13.1 ) +# Required for CMAKE_MSVC_RUNTIME_LIBRARY # https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html#variable:CMAKE_MSVC_RUNTIME_LIBRARY cmake_policy(SET CMP0091 NEW) @@ -85,7 +85,7 @@ set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1) #################################################################### # Find external libraries ########################################## -#################################################################### +#################################################################### # Initial Configuration include ( SetEnvironmentVariables ) @@ -147,12 +147,12 @@ if ( EGOA_ENABLE_TESTS ) # find_package ( GoogleTestFramework ) # endif () - # Add test coverage + # Add test coverage # -coverage includes -fprofile-arcs -ftest-coverage while compiling and # -lgcov while linking -coverage - # + # # brew install lcov || gcovr (https://gcovr.com/en/stable/) - # + # # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EGOA_COVERAGE_COMPILE_FLAGS}") # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EGOA_COVERAGE_LINK_FLAGS}") endif(EGOA_ENABLE_TESTS) @@ -176,7 +176,7 @@ elseif ( COIN_FOUND ) include_directories(SYSTEM ${COIN_INCLUDE_DIRS} ${GUROBI_INCLUDE_DIRS} ${CPLEX_INCLUDE_DIRS}) include_directories(${PROJECT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include) link_directories(${COIN_LIBRARY_DIR}) -else() +else() message( STATUS "Neither OGDF nor COIN include directory and library are added to the project.") include_directories(SYSTEM ${GUROBI_INCLUDE_DIRS} ${CPLEX_INCLUDE_DIRS}) include_directories(${PROJECT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include) @@ -184,9 +184,9 @@ endif() #################################################################### # Add files, libraries and sources ################################# -#################################################################### +#################################################################### file ( GLOB_RECURSE HEADERS ${PROJECT_INCLUDE_DIR} include/*.hpp ) -file ( GLOB_RECURSE SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp ) +file ( GLOB_RECURSE SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp ) file ( GLOB_RECURSE SOURCES_REMOVE ${PROJECT_SOURCE_DIR}/src/Runnables/*.cpp ) list ( FILTER SOURCES EXCLUDE REGEX ".*Runnables.*" ) @@ -201,7 +201,7 @@ add_subdirectory ( src ) #################################################################### # Testing ########################################################## -#################################################################### +#################################################################### if ( EGOA_ENABLE_TESTS ) add_subdirectory ( tests ) enable_testing() @@ -305,7 +305,7 @@ endif ( ) # Define a macro to get number of configured threads target_compile_definitions ( EGOA PUBLIC EGOA_USER_DEFINED_THREAD_LIMIT=$ENV{OMP_NUM_THREADS} ) -# +# target_compile_definitions ( EGOA PUBLIC EGOA_ENABLE_STATISTIC_DTP ) target_compile_definitions ( EGOA PUBLIC EGOA_ENABLE_STATISTIC_BETWEENNESS_CENTRALITY ) diff --git a/DoxyfileConfig.in b/DoxyfileConfig.in index e706574a..e44966f8 100644 --- a/DoxyfileConfig.in +++ b/DoxyfileConfig.in @@ -1661,7 +1661,7 @@ EXTRA_PACKAGES = {${PROJECT_INCLUDE_DIR}/documentation/includes/EGOA_Doc # to HTML_HEADER. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_HEADER = +LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the # generated LaTeX document. The footer should contain everything after the last diff --git a/README.md b/README.md index b254168b..0b1dc16c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0) [![CMake on multiple platforms](https://github.com/franziska-wegner/egoa/actions/workflows/cmake-multi-platform.yml/badge.svg?branch=master)](https://github.com/franziska-wegner/egoa/actions/workflows/cmake-multi-platform.yml) [![CodeQL](https://github.com/franziska-wegner/egoa/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/franziska-wegner/egoa/actions/workflows/codeql.yml) Coverity Scan Build Status [![codecov](https://codecov.io/gh/franziska-wegner/egoa/graph/badge.svg?token=OL0N2WXV4I)](https://codecov.io/gh/franziska-wegner/egoa) [![cpp-linter](https://github.com/franziska-wegner/egoa/actions/workflows/cpp-linter.yml/badge.svg)](https://github.com/franziska-wegner/egoa/actions/workflows/cpp-linter.yml) +[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0) [![CMake on multiple platforms](https://github.com/franziska-wegner/egoa/actions/workflows/cmake-multi-platform.yml/badge.svg?branch=master)](https://github.com/franziska-wegner/egoa/actions/workflows/cmake-multi-platform.yml) [![CodeQL](https://github.com/franziska-wegner/egoa/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/franziska-wegner/egoa/actions/workflows/codeql.yml) Coverity Scan Build Status [![codecov](https://codecov.io/gh/franziska-wegner/egoa/graph/badge.svg?token=OL0N2WXV4I)](https://codecov.io/gh/franziska-wegner/egoa) [![cpp-linter](https://github.com/franziska-wegner/egoa/actions/workflows/cpp-linter.yml/badge.svg)](https://github.com/franziska-wegner/egoa/actions/workflows/cpp-linter.yml) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/franziska-wegner/egoa/main.svg)](https://results.pre-commit.ci/latest/github/franziska-wegner/egoa/main)

EGOA - Energy Grid Optimization and Analysis

-Energy Grid Optimization and Analysis (EGOA) is a framework for energy grid analysis and planning. This framework is based on the PhD thesis "Combinatorial Problems in Energy Networks -- Graph Theoretic Models and Algorithms". The Git repository of the PhD thesis is available under Combinatorial_Problems_in_Energy_Networks. +Energy Grid Optimization and Analysis (EGOA) is a framework for energy grid analysis and planning. This framework is based on the PhD thesis "Combinatorial Problems in Energy Networks -- Graph Theoretic Models and Algorithms". The Git repository of the PhD thesis is available under Combinatorial_Problems_in_Energy_Networks. Swiss Power Grid Branch with Parameters Swiss Power Grid Bus with Parameters @@ -57,7 +57,7 @@ At the moment this is limited to PyPSA, the IEEE cases, and the windfarm cases; ``` IEEE + 00-Matpower-Data -(+) 02-gml +(+) 02-gml + 03-IEEE-Power_Flow_Test_Cases + 04-IEEE-Dynamic_Test_Cases + 05-IEEE-Reliability_Test_Systems-RTS @@ -167,13 +167,13 @@ The Qt project can be installed on a Mac using brew install qt ``` -and on Ubuntu using +and on Ubuntu using ``` sudo apt-get install qt ``` -The compiler clang and gcc can be installed on a Mac using the following command or you use the Apple clang compiler if necessary. +The compiler clang and gcc can be installed on a Mac using the following command or you use the Apple clang compiler if necessary. ``` brew install llvm @@ -191,7 +191,7 @@ If the tests are enabled `"EGOA_TEST_FRAMEWORK": "OfflineGoogleTestFramework"` t

CMake Parameter Overrides

The repository provides an intial set of parameters in the sublimetext project file that can be found under `egoa.sublime-project`. In addition, there are scripts that support with server and local runs that have a initial CMake parameter configuration and can be adapted to the particular needs under [egoa/scripts/Build](https://github.com/franziska-wegner/egoa/tree/master/scripts/Build) and monitoring scripts under [egoa/scripts/Experiments](https://github.com/franziska-wegner/egoa/tree/master/scripts/Experiments). -An essential CMake setting parameter is the build directory that should be changed according to your file system, e.g., `"build_folder": "/Users/fwegner/Documents/Repositories/Public/EGOA/egoa/build-debug"`. +An essential CMake setting parameter is the build directory that should be changed according to your file system, e.g., `"build_folder": "/Users/fwegner/Documents/Repositories/Public/EGOA/egoa/build-debug"`.
Example CMake Configuration for SublimeText @@ -249,63 +249,63 @@ An essential CMake setting parameter is the build directory that should be chang Most parameters represent flags and can be enabled with `ON` if available and `OFF` if not available. Dependent on the flag the required path to the framework or tool has to be set accordingly (see above). There are flags that enable downloads for data sets and frameworks, and start with `EGOA_DOWNLOAD_`. The recommendation is to start with a minimum of enabled tools and extend if necessary. -This framework provides a set of unittests that uses the Google Test Framework as base. The CMake files allow two different setups of the test framework that are known by online and offline configuration. The CMake parameter for the online version are `"EGOA_TEST_FRAMEWORK": "OnlineGoogleTestFramework"` OR `"EGOA_TEST_FRAMEWORK": "OfflineGoogleTestFramework"` with the pointer to the installation directory of the Google test framework repository, e.g., `"EGOA_TEST_FRAMEWORK_LOCATION": "external/GoogleTestFramework"`. +This framework provides a set of unittests that uses the Google Test Framework as base. The CMake files allow two different setups of the test framework that are known by online and offline configuration. The CMake parameter for the online version are `"EGOA_TEST_FRAMEWORK": "OnlineGoogleTestFramework"` OR `"EGOA_TEST_FRAMEWORK": "OfflineGoogleTestFramework"` with the pointer to the installation directory of the Google test framework repository, e.g., `"EGOA_TEST_FRAMEWORK_LOCATION": "external/GoogleTestFramework"`.
Successful Initial CMake Run ``` --- +-- -- /Users/fwegner/Documents/Repositories/Public/EGOA/egoa --- +-- -- /Users/fwegner/Documents/Repositories/Public/EGOA/egoa/build-debug -- Set OpenMP variables -- OMP_WAIT_POLICY: ACTIVE --- OMP_STACKSIZE: --- OMP_SCHEDULE: +-- OMP_STACKSIZE: +-- OMP_SCHEDULE: -- OMP_PROC_BIND: TRUE -- OMP_THREAD_LIMIT: 0 -- Number of processors: 8 -- OMP_NUM_THREADS: 8 --- --- Compiler extra flags: -pedantic -Werror -Wall -Wextra -Wunused-result -Wno-error=unused-but-set-variable -Wno-error=conversion -Wshadow -Wno-error=zero-length-array --- +-- +-- Compiler extra flags: -pedantic -Werror -Wall -Wextra -Wunused-result -Wno-error=unused-but-set-variable -Wno-error=conversion -Wshadow -Wno-error=zero-length-array +-- -- Download of data sets: -- Download PyPSA Europe data from https://github.com/PyPSA/pypsa-eur.git into /Users/fwegner/Documents/Repositories/Public/EGOA/egoa/data/PowerGrids/PyPSA/pypsa-eur. -- Download PyPSA ITI Collaboration data from https://git.scc.kit.edu/FN/iti-collaboration.git into /Users/fwegner/Documents/Repositories/Public/EGOA/egoa/data/PowerGrids/PyPSA/pypsa-iti-collaboration. -- Download IEEE Power Grid data. --- +-- -- Looking for Qt6 --- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) --- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) --- Found Qt6 Core module in "/opt/homebrew/lib/QtCore.framework/Versions/A/QtCore" --- Found Qt6 Quick module in "/opt/homebrew/lib/QtQuick.framework/Versions/A/QtQuick" --- Found Qt6 Widgets module in "/opt/homebrew/lib/QtWidgets.framework/Versions/A/QtWidgets" --- Found Qt6 Concurrent module in "/opt/homebrew/lib/QtConcurrent.framework/Versions/A/QtConcurrent" +-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) +-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) +-- Found Qt6 Core module in "/opt/homebrew/lib/QtCore.framework/Versions/A/QtCore" +-- Found Qt6 Quick module in "/opt/homebrew/lib/QtQuick.framework/Versions/A/QtQuick" +-- Found Qt6 Widgets module in "/opt/homebrew/lib/QtWidgets.framework/Versions/A/QtWidgets" +-- Found Qt6 Concurrent module in "/opt/homebrew/lib/QtConcurrent.framework/Versions/A/QtConcurrent" SRC=/Users/fwegner/Documents/Repositories/Public/EGOA/egoa and Binary=/Users/fwegner/Documents/Repositories/Public/EGOA/egoa/build-debug -- Doxygen: /opt/homebrew/bin/doxygen -- Google Test Framework -- EGOA_ENABLE_TESTS: ON --- +-- -- Neither OGDF nor COIN include directory and library are added to the project. --- +-- -- Compiler: -- CMAKE_C_COMPILER: /opt/homebrew/opt/llvm/bin/clang -- CMAKE_CXX_COMPILER: /opt/homebrew/opt/llvm/bin/clang++ -- make VERBOSE = 1? : TRUE --- +-- -- Other important targets: -- qt6: add libraries of QT6 -- doc: build doxygen documentation -- EGOA Exceptions: ON -- EGOA Assertions: ON --- +-- -- Build type is set to: Debug -- Build files have been written to: /Users/fwegner/Documents/Repositories/Public/EGOA/egoa/build-debug -- Runtime output directory: /Users/fwegner/Documents/Repositories/Public/EGOA/egoa/build-debug/bin -- Archive output directory: /Users/fwegner/Documents/Repositories/Public/EGOA/egoa/build-debug/lib -- Library output directory: /Users/fwegner/Documents/Repositories/Public/EGOA/egoa/build-debug/lib --- +-- -- Configuring done (3.2s) -- Generating done (0.1s) -- Build files have been written to: /Users/fwegner/Documents/Repositories/Public/EGOA/egoa/build-debug @@ -319,7 +319,7 @@ A general recommendation is CLION and Sublimetext. However, Visual Studio and ot

Documentation

-The repository's public code documentation is available under [Code Documentation by Doxygen](https://franziska-wegner.github.io/egoa). For the purpose of code documentation, the Doxygen framework is used. It provides a simple and well formed way of code documentation for C++. Run +The repository's public code documentation is available under [Code Documentation by Doxygen](https://franziska-wegner.github.io/egoa). For the purpose of code documentation, the Doxygen framework is used. It provides a simple and well formed way of code documentation for C++. Run make doc diff --git a/cmake/Boost.cmake b/cmake/Boost.cmake index 1a8d9d42..e9a5f874 100644 --- a/cmake/Boost.cmake +++ b/cmake/Boost.cmake @@ -1,10 +1,10 @@ # Boost.cmake -# +# # Created on: Nov 04, 2019 # Author: Franziska Wegner -# +# # Find the Boost library. -# +# #################################################################### # Reset variables ################################################## @@ -21,7 +21,7 @@ set( Boost_DIRECTORIES "/usr/local/Cellar/boost/1.71.0/" CACHE STRING set( Boost_LIBRARY_DIRS "" ) set( Boost_INCLUDE_DIRS "" ) set( BOOST_ROOT "" CACHE PATH "Boost library path" ) -# https://stackoverflow.com/questions/58081084/target-boostlibrary-already-has-an-imported-location-link-errors +# https://stackoverflow.com/questions/58081084/target-boostlibrary-already-has-an-imported-location-link-errors # https://stackoverflow.com/questions/3016448/how-can-i-get-cmake-to-find-my-alternative-boost-installation/51904185 set( Boost_NO_SYSTEM_PATHS on CACHE BOOL "Do not search system for Boost" ) set( Boost_NO_BOOST_CMAKE on CACHE INTERNAL "" ) @@ -38,4 +38,4 @@ include_directories(${Boost_INCLUDE_DIRS}) # Output ########################################################### #################################################################### message(STATUS "${MY_SPACE}Boost_LIBRARY_DIRS:\t\t\t${Boost_LIBRARY_DIRS}") -message(STATUS "${MY_SPACE}Boost_INCLUDE_DIRS:\t\t\t${Boost_INCLUDE_DIRS}") \ No newline at end of file +message(STATUS "${MY_SPACE}Boost_INCLUDE_DIRS:\t\t\t${Boost_INCLUDE_DIRS}") diff --git a/cmake/CompilerConfiguration.cmake b/cmake/CompilerConfiguration.cmake index f063434d..915a3e8e 100644 --- a/cmake/CompilerConfiguration.cmake +++ b/cmake/CompilerConfiguration.cmake @@ -6,13 +6,13 @@ # Compiler specific configurations. # -# -ggdb Produce debugging information for use by GDB. This means -# to use the most expressive format available (DWARF, stabs, or -# the native format if neither of those are supported), including +# -ggdb Produce debugging information for use by GDB. This means +# to use the most expressive format available (DWARF, stabs, or +# the native format if neither of those are supported), including # GDB extensions if at all possible. -# -# - Wall This enables all the warnings about constructions that -# some users consider questionable, and that are easy to avoid +# +# - Wall This enables all the warnings about constructions that +# some users consider questionable, and that are easy to avoid # (or modify to prevent the warning), even in conjunction with macros if (CMAKE_BUILD_TYPE MATCHES "Debug" AND CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Linux") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -coverage") @@ -80,7 +80,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug) else() set(extra_flags "${extra_flags} ${EGOA_WARNING_FLAGS_RELEASE}") endif() -# Warning and error +# Warning and error if(EGOA_WARNINGS_AS_ERRORS) set(extra_flags "${EGOA_WARNINGS_AS_ERRORS_FLAG} ${extra_flags}") endif() @@ -92,6 +92,6 @@ if(EGOA_PEDANTIC_MODE) set(extra_flags "${EGOA_PEDANTIC_WARNING_FLAG} ${extra_flags}") endif() endif() -# +# set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS " ${extra_flags} ") message(STATUS "${MY_SPACE}Compiler extra flags:\t\t\t${TARGET_NAME} ${extra_flags}") diff --git a/cmake/CppAD.cmake b/cmake/CppAD.cmake index 67dd3127..d8cf0a38 100644 --- a/cmake/CppAD.cmake +++ b/cmake/CppAD.cmake @@ -1,12 +1,12 @@ # FindCppAD.cmake -# +# # Created on: Jan 26, 2020 # Author: Franziska Wegner -# +# # If EGOA_ENABLE_CPPAD is ON the script searches for CppAD in given and # standard location (see EGOA_DOWNLOAD_CPPAD). If found it adds the library to # the project. -# +# # Environment variable CPPAD_ROOT_DIR of CPPAD should be set, e.g., # /usr/local/include or /external/CppAD/include @@ -28,7 +28,7 @@ unset ( CPPAD_INCLUDE_DIR CACHE ) # CppAD include directory ########################################## #################################################################### find_path ( CPPAD_INCLUDE_DIR - NAMES cppad/cppad.hpp + NAMES cppad/cppad.hpp HINTS /external/CppAD/include ${CPPAD_ROOT_DIR}/include/ ) @@ -53,7 +53,7 @@ mark_as_advanced ( CPPAD_INCLUDE_DIR ) #################################################################### message ( STATUS "" ) if ( EGOA_ENABLE_CPPAD AND NOT CPPAD_FOUND ) - message( FATAL_ERROR + message( FATAL_ERROR "CppAD is enabled, but not available on the system. Please, check the \ CppAD installation, and cmake configuration or disable CppAD by \ setting EGOA_ENABLE_CPPAD to OFF." ) diff --git a/cmake/Doxygen.cmake b/cmake/Doxygen.cmake index d8719056..e58b1198 100644 --- a/cmake/Doxygen.cmake +++ b/cmake/Doxygen.cmake @@ -1,12 +1,12 @@ # Doxygen.cmake -# +# # Created on: 30.01.2019 # Author: Franziska Wegner -# +# # If EGOA_ENABLE_DOCUMENTATION is ON the script add target to generate API # documentation with Doxygen. The documentation can then be generated by the # command "make doc". -# +# #################################################################### # Find Doxygen ##################################################### @@ -21,7 +21,7 @@ if(EGOA_ENABLE_DOCUMENTATION) set(doxyfile ${CMAKE_CURRENT_SOURCE_DIR}/documentation/Doxyfile) configure_file(${doxyfile_in} ${doxyfile} @ONLY) - add_custom_target(doc ALL + add_custom_target(doc ALL COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile_in} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "Generating API documentation with Doxygen" diff --git a/cmake/ExternalProjectConfiguration.cmake b/cmake/ExternalProjectConfiguration.cmake index e6e3a9cc..613b1167 100644 --- a/cmake/ExternalProjectConfiguration.cmake +++ b/cmake/ExternalProjectConfiguration.cmake @@ -1,10 +1,10 @@ # ExternalProjectConfiguration.cmake -# +# # Created on: Jan 10, 2020 # Author: Franziska Wegner -# +# # Download external project if necessary. -# +# include ( ExternalProject ) include ( FetchContent ) @@ -16,7 +16,7 @@ message( STATUS "Download of data sets:") #################################################################### # CppAD ############################################################ #################################################################### -# +# # Website: https://github.com/coin-or/CppAD.git # and https://coin-or.github.io/CppAD/doc/cppad.htm #################################################################### @@ -24,7 +24,7 @@ message( STATUS "Download of data sets:") if ( EGOA_DOWNLOAD_CPPAD ) message( STATUS "${MY_SPACE}Download CppAD from https://github.com/coin-or/CppAD into ${PROJECT_INCLUDE_DIR}/external/CppAD.") file ( MAKE_DIRECTORY "${PROJECT_INCLUDE_DIR}/external/CppAD" ) - + ExternalProject_Add ( CppAD GIT_REPOSITORY https://github.com/coin-or/CppAD SOURCE_DIR "${PROJECT_INCLUDE_DIR}/external/CppAD" @@ -36,7 +36,7 @@ endif ( EGOA_DOWNLOAD_CPPAD ) #################################################################### # Eigen ############################################################ #################################################################### -# +# # Website: https://gitlab.com/libeigen/eigen.git # and http://eigen.tuxfamily.org/index.php #################################################################### @@ -67,14 +67,14 @@ endif ( EGOA_DOWNLOAD_EIGEN ) #################################################################### # Google Test Framework ############################################ #################################################################### -# +# # Website: https://github.com/google/googletest #################################################################### if ( EGOA_DOWNLOAD_GOOGLE_TEST_FRAMEWORK ) message( STATUS "${MY_SPACE}Download Google-Testing Framework from https://github.com/google/googletest.git into ${PROJECT_INCLUDE_DIR}/external/GoogleTestFramework.") file ( MAKE_DIRECTORY "${PROJECT_INCLUDE_DIR}/external/GoogleTestFramework" ) - + ExternalProject_Add ( GoogleTestFramework GIT_REPOSITORY https://github.com/google/googletest.git SOURCE_DIR "${PROJECT_INCLUDE_DIR}/external/GoogleTestFramework" @@ -86,11 +86,11 @@ endif ( EGOA_DOWNLOAD_GOOGLE_TEST_FRAMEWORK ) #################################################################### # PyPSA Europe ##################################################### #################################################################### -# Publication: -# -# PyPSA-Eur: An Open Optimisation Model of the European Transmission +# Publication: +# +# PyPSA-Eur: An Open Optimisation Model of the European Transmission # System -# +# # 2018 # Website: https://doi.org/10.5281/zenodo.3520875 # and https://github.com/PyPSA/pypsa-eur @@ -119,11 +119,11 @@ endif ( EGOA_DOWNLOAD_PYPSA_EUR ) #################################################################### # PyPSA ITI Collaboration ########################################## #################################################################### -# Publication: -# -# PyPSA-Eur: An Open Optimisation Model of the European Transmission +# Publication: +# +# PyPSA-Eur: An Open Optimisation Model of the European Transmission # System -# +# # 2018 # Website: https://doi.org/10.5281/zenodo.3520875 # and https://git.scc.kit.edu/FN/iti-collaboration @@ -151,11 +151,11 @@ endif ( EGOA_DOWNLOAD_PYPSA_ITI_COLLABORATION ) #################################################################### # SciGRID Power v0.1 ############################################### #################################################################### -# Publication: -# -# SciGRID - An Open Source Reference Model for the European +# Publication: +# +# SciGRID - An Open Source Reference Model for the European # Transmission Network (v0.2) -# +# # 2016 # Website: http://www.scigrid.de #################################################################### @@ -166,8 +166,8 @@ if ( EGOA_DOWNLOAD_SCIGRID AND NOT EXISTS "${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/sc message( STATUS "${MY_SPACE}Download SciGRID Power data (version 0.1) from \"https://www.power.scigrid.de/releases_archive/scigrid-0.1-data-only.zip\" into \"${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-0.1-data-only/\".") file ( MAKE_DIRECTORY "${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-0.1-data-only" ) - file ( DOWNLOAD - https://www.power.scigrid.de/releases_archive/scigrid-0.1-data-only.zip + file ( DOWNLOAD + https://www.power.scigrid.de/releases_archive/scigrid-0.1-data-only.zip "${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-0.1-data-only.zip" # URL_HASH SHA512=56c8246eca1142dc9d9487ef1d1bd690af91c0e3716a56adc25c4a218bceb1be7f84cf5361acbaae354fe23cf44be6f479ae3d6026abd7dcb131b89ca5779f26 # SHOW_PROGRESS @@ -184,11 +184,11 @@ endif () #################################################################### # SciGRID Power v0.2 ############################################### #################################################################### -# Publication: -# -# SciGRID - An Open Source Reference Model for the European +# Publication: +# +# SciGRID - An Open Source Reference Model for the European # Transmission Network (v0.2) -# +# # 2016 # Website: http://www.scigrid.de #################################################################### @@ -196,7 +196,7 @@ endif () if ( EGOA_DOWNLOAD_SCIGRID AND NOT EXISTS "${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-0.2-data-only" ) message( STATUS "${MY_SPACE}Download SciGRID Power data (version 0.2) from \"https://www.power.scigrid.de/releases_archive/scigrid-0.2-data-only.zip\" into \"${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-0.2-data-only/\".") - file ( DOWNLOAD + file ( DOWNLOAD https://www.power.scigrid.de/releases_archive/scigrid-0.2-data-only.zip "${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-0.2-data-only.zip" # URL_HASH SHA512=0f6473487cc224e86d73d764b2b9ad5b34fae3c7b9a2a8f3be70846631429f14ddde10fb0a06672955e2725794c1c32fe5fc5fc356219d371ab462ca98bc1d7c @@ -214,11 +214,11 @@ endif () #################################################################### # SciGRID Power Germany ############################################ #################################################################### -# Publication: -# -# SciGRID - An Open Source Reference Model for the European +# Publication: +# +# SciGRID - An Open Source Reference Model for the European # Transmission Network (v0.2) -# +# # 2016 # Website: http://www.scigrid.de #################################################################### @@ -226,7 +226,7 @@ endif () if ( EGOA_DOWNLOAD_SCIGRID AND NOT EXISTS "${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-conference-de-data-only" ) message( STATUS "${MY_SPACE}Download SciGRID Power data (conference version) from \"https://www.power.scigrid.de/releases_archive/scigrid-conference-de-data-only.zip\" into \"${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-conference-de-data-only/\".") - file ( DOWNLOAD + file ( DOWNLOAD https://www.power.scigrid.de/releases_archive/scigrid-conference-de-data-only.zip "${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-conference-de-data-only.zip" # URL_HASH SHA512=a03a69d9f30fca08a7945e9d9acbf4e0da18b639df351024f11df1c4b2d57a15bbc8eb4419b20b97a9741c9641a0aa24c8a3c7b45816380787185e58771ca77f @@ -244,11 +244,11 @@ endif () #################################################################### # SciGRID Power Europe ############################################# #################################################################### -# Publication: -# -# SciGRID - An Open Source Reference Model for the European +# Publication: +# +# SciGRID - An Open Source Reference Model for the European # Transmission Network (v0.2) -# +# # 2016 # Website: http://www.scigrid.de #################################################################### @@ -256,7 +256,7 @@ endif () if ( EGOA_DOWNLOAD_SCIGRID AND NOT EXISTS "${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-conference-eu-data-only" ) message( STATUS "${MY_SPACE}Download SciGRID Power data (conference version) from \"https://www.power.scigrid.de/releases_archive/scigrid-conference-eu-data-only.zip\" into \"${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-conference-eu-data-only/\".") - file ( DOWNLOAD + file ( DOWNLOAD https://www.power.scigrid.de/releases_archive/scigrid-conference-eu-data-only.zip "${EGOA_DOWNLOAD_DIRECTORY_SCIGRID}/scigrid-conference-eu-data-only.zip" # URL_HASH SHA512=b8590cf9c2cea1ef3a096d041a5918a8e9f919236aba898e205ba732dbbab7b0b388bfd521399cfa2460123e16f3b0c1528db5dc8d0da82c097b9f096001f697 @@ -274,9 +274,9 @@ endif () #################################################################### # IEEE Benchmark Cases ############################################# #################################################################### -# Publication: -# -# Website: +# Publication: +# +# Website: # * https://github.com/MATPOWER/matpower/archive/master.zip # * https://labs.ece.uw.edu/pstca # * https://www.maths.ed.ac.uk/optenergy @@ -284,7 +284,7 @@ endif () if ( EGOA_DOWNLOAD_IEEE AND NOT EXISTS "${EGOA_DOWNLOAD_DIRECTORY_IEEE}/IEEE" ) message( STATUS "${MY_SPACE}Download IEEE Power Grid data.") - + # file ( MAKE_DIRECTORY "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/00-Matpower-Data" ) # file ( MAKE_DIRECTORY "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/01-Pypower-Data" ) file ( MAKE_DIRECTORY "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/02-gml" ) @@ -303,10 +303,10 @@ if ( EGOA_DOWNLOAD_IEEE AND NOT EXISTS "${EGOA_DOWNLOAD_DIRECTORY_IEEE}/IEEE" ) file ( MAKE_DIRECTORY "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/15-Synthetic_Power_Grid_Test_Cases" ) file ( MAKE_DIRECTORY "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/16-Literature_Based_Power_Flow_Test_Cases" ) file ( MAKE_DIRECTORY "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/17-Small_Signal_Stability_Test_Cases" ) - + # Matlab ################################################### if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/00-Matpower-Data" ) - file ( DOWNLOAD + file ( DOWNLOAD https://github.com/MATPOWER/matpower/archive/master.zip "${PROJECT_INCLUDE_DIR}/external/Matpower-Master.zip" ) @@ -320,10 +320,10 @@ if ( EGOA_DOWNLOAD_IEEE AND NOT EXISTS "${EGOA_DOWNLOAD_DIRECTORY_IEEE}/IEEE" ) ) file ( REMOVE ${PROJECT_INCLUDE_DIR}/external/Matpower-Master.zip ) endif () - + # PyPower ################################################## if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/01-Pypower-Data" ) - file ( DOWNLOAD + file ( DOWNLOAD https://github.com/rwl/PYPOWER/archive/master.zip "${PROJECT_INCLUDE_DIR}/external/Pypower-Master.zip" ) @@ -343,569 +343,569 @@ if ( EGOA_DOWNLOAD_IEEE AND NOT EXISTS "${EGOA_DOWNLOAD_DIRECTORY_IEEE}/IEEE" ) COMMAND bash -c "rm \"${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/01-Pypower-Data/savecase.py\"" WORKING_DIRECTORY ${PROJECT_INCLUDE_DIR}/external/matpower-master/data/ ) - - file ( REMOVE ${PROJECT_INCLUDE_DIR}/external/PYPOWER-master ) - file ( REMOVE ${PROJECT_INCLUDE_DIR}/external/Pypower-Master.zip ) + + file ( REMOVE ${PROJECT_INCLUDE_DIR}/external/PYPOWER-master ) + file ( REMOVE ${PROJECT_INCLUDE_DIR}/external/Pypower-Master.zip ) endif() - + # 14 Bus System ############################################ if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/014-Bus" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf14/ieee14cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/014-Bus/ieee14cdf.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf14/pg_tca14fig.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/014-Bus/pg_tca14fig.htm" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf14/14bus600.tif "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/014-Bus/14bus600.tif" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/formats/cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/014-Bus/cdf.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf14/pg_tca14bus.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/014-Bus/pg_tca14bus.webarchive" ) endif () - + # 57 Bus System ############################################ if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/057-Bus" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf57/ieee57cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/057-Bus/ieee57cdf.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf57/pg_tca57fig.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/057-Bus/pg_tca57fig.htm" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf57/57bus600.tif "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/057-Bus/57bus600.tif" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/formats/cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/057-Bus/cdf.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf57/pg_tca57bus.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/057-Bus/pg_tca57bus.webarchive" ) endif () - + # 118 Bus System ########################################### if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/118-Bus" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf118/ieee118psp.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/118-Bus/ieee118psp.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf118/ieee118cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/118-Bus/ieee118cdf.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf118/pg_tca118fig.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/118-Bus/pg_tca118fig.htm" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf118/118bus6.tif "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/118-Bus/118bus6.tif" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/formats/cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/118-Bus/cdf.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/formats/psap.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/118-Bus/psap.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf118/pg_tca118bus.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/118-Bus/pg_tca118bus.webarchive" ) endif () - + # 300 Bus System ########################################### if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/300-Bus" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf300/ieee300cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/300-Bus/ieee300cdf.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf300/ieee300pti.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/300-Bus/ieee300pti.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf300/pg_tca300fig.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/300-Bus/pg_tca300fig.htm" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf300/300bus6.tif "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/300-Bus/300bus6.tif" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/formats/cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/300-Bus/cdf.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/formats/pti.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/300-Bus/pti.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/pf300/pg_tca300bus.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/118-Bus/pg_tca300bus.webarchive" ) endif () - + # 17 Generator Dynamic System ############################## if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/17-Generator" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/dyn17/dd17cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/17-Generator/dd17cdf.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/dyn17/dd17cldat.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/17-Generator/dd17cldat.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/Formats/cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/17-Generator/cdf.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/dyn17/pg_tcadd17.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/17-Generator/pg_tcadd17.webarchive" ) endif () - + # 30 Bus Dynamic System #################################### if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/30-Bus" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/dyn30/dyn30dat.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/30-Bus/dyn30dat.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/dyn30/pg_tcadyn30.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/03-IEEE-Power_Flow_Test_Cases/30-Bus/pg_tcadyn30.webarchive" ) endif () - + # 50 Generator Dynamic System ############################## if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/04-IEEE-Dynamic_Test_Cases/50-Generator" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/dyn50/dd50cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/04-IEEE-Dynamic_Test_Cases/50-Generator/dd50cdf.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/dyn50/dd50cldat.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/04-IEEE-Dynamic_Test_Cases/50-Generator/dd50cldat.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/dyn50/dd50exdat.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/04-IEEE-Dynamic_Test_Cases/50-Generator/dd50exdat.txt" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/dyn50/pg_tcadd50.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/04-IEEE-Dynamic_Test_Cases/50-Generator/pg_tcadd50.txt" ) endif () - + # Reliability Test System (RTS) - 1979 ##################### if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1979-RTS" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts79/ieeerts79.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1979-RTS/ieeerts79.txt" ) endif () # Reliability Test System (RTS) - 1996 ##################### - # + # if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS" ) - # - file ( DOWNLOAD + # + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/pg_tcarts.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/pg_tcarts.webarchive" ) - # + # # Bus Data - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-01.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Bus-Data/Table-01.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-01.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Bus-Data/Table-01.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-01.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Bus-Data/Table-01.txt" ) - # + # # Weekly Loads - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-02.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Weekly-Loads/Table-02.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-02.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Weekly-Loads/Table-02.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-02.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Weekly-Loads/Table-02.txt" ) - # + # # Daily Loads - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-03.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Weekly-Loads/Table-03.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-03.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Weekly-Loads/Table-03.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-03.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Weekly-Loads/Table-03.txt" ) - # + # # Hourly Loads - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-04.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Hourly-Loads/Table-04.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-04.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Hourly-Loads/Table-04.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-04.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Hourly-Loads/Table-04.txt" ) - # + # # Bus Loads - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-05.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Bus-Loads/Table-05.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-05.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Bus-Loads/Table-05.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-05.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Bus-Loads/Table-05.txt" ) - # + # # Generator reliability - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-06.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Reliability/Table-06.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-06.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Reliability/Table-06.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-06.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Reliability/Table-06.txt" ) - # + # # Generator parameters - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-07.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Reliability/Table-07.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-07.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Reliability/Table-07.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-07.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Reliability/Table-07.txt" ) - # + # # Generator startup heat input - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-08.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Startup-Heat-Input/Table-08.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-08.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Startup-Heat-Input/Table-08.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-08.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Startup-Heat-Input/Table-08.txt" ) - # + # # Generator heat rates - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-09.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Heat-Rates/Table-09.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-09.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Heat-Rates/Table-09.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-09.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Heat-Rates/Table-09.txt" ) - # + # # Generator cycling and ramp rates - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-10.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Cycling-And-Ramp-Rates/Table-10.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-10.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Cycling-And-Ramp-Rates/Table-10.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-10.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Cycling-And-Ramp-Rates/Table-10.txt" ) - # + # # Emissions - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-11.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Emissions/Table-11.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-11.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Emissions/Table-11.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-11.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Emissions/Table-11.txt" ) - # + # # Branch data - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-12.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Branch-Data/Table-12.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-12.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Branch-Data/Table-12.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-12.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Branch-Data/Table-12.txt" ) - # + # # DC line data - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-13.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/DC-Line-Data/Table-13.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-13.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/DC-Line-Data/Table-13.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-13.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/DC-Line-Data/Table-13.txt" ) - # + # # Breaker reliability data - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-14.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Breaker-Reliability-Data/Table-14.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-14.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Breaker-Reliability-Data/Table-14.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-14.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Breaker-Reliability-Data/Table-14.txt" ) - # + # # Generator dynamic data - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-15.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Dynamic-Data/Table-15.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-15.wpd "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Dynamic-Data/Table-15.wpd" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/rts/rts96/Table-15.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/05-IEEE-Reliability_Test_Systems-RTS/1996-RTS/Generator-Dynamic-Data/Table-15.txt" ) endif () # Voltage Collapse Sensitivities ########################### - # + # if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/06-IEEE-Voltage_Collapse_Sensitivities" ) # 118 bus test case - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/sensitivity/sensreadme.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/06-IEEE-Voltage_Collapse_Sensitivities/sensreadme.txt" ) # k factor values - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/sensitivity/sensk.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/06-IEEE-Voltage_Collapse_Sensitivities/sensk.txt" ) endif () - + # Edinburgh Dynamic Test Cases - Case 39 ################### - # + # if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/39_Bus_Case" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/39buscase/case39_RCost.m "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/39_Bus_Case/case39_RCost.m" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/39buscase/case39.pdf "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/39_Bus_Case/case39.pdf" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/39buscase/ "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/39_Bus_Case/case39.webarchive" ) endif () - + # Edinburgh Dynamic Test Cases - Iceland ################### - # + # if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/Iceland" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/iceland/iceland.m "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/Iceland/iceland.m" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/iceland/iceland.pdf "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/Iceland/iceland.pdf" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/iceland/ "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/Iceland/iceland.webarchive" ) endif () # Edinburgh Dynamic Test Cases - Reduced GB Network ######## - # + # if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/Reduced_GB_Network" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/reducedGB/GBreducednetwork.m "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/Reduced_GB_Network/GBreducednetwork.m" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/reducedGB/GBreducednetwork.pdf "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/Reduced_GB_Network/GBreducednetwork.pdf" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/reducedGB/ "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/Reduced_GB_Network/reducedGB.webarchive" ) endif () - + # Edinburgh Dynamic Test Cases - GB Network ################ - # + # if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/GB_Network" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/fullGB/GBnetwork.m "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/GB_Network/GBnetwork.m" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/fullGB/GB_graph.pdf "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/GB_Network/GB_graph.pdf" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/fullGB/ "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/GB_Network/fullGB.webarchive" ) - # - file ( DOWNLOAD + # + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/introduction.html "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/introduction.webarchive" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/dataformat.html "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/dataformat.webarchive" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/howtouse.html "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/HowToUseThisArchive.webarchive" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/submission.html "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/08-Edinburgh_Power_Flow_Test_Cases/submission.webarchive" ) endif () - + # Edinburgh Dynamic Test Cases - Dynamic Iceland ########### - # + # if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/09-Edinburgh_Dynamic_Test_Cases/Iceland" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/icelandDyn/d_iceland.m "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/09-Edinburgh_Dynamic_Test_Cases/Iceland/d_iceland.m" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/icelandDyn/iceland.pdf "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/09-Edinburgh_Dynamic_Test_Cases/Iceland/iceland.pdf" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/icelandDyn/ "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/09-Edinburgh_Dynamic_Test_Cases/Iceland/icelandDyn.webarchive" ) - # - file ( DOWNLOAD + # + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/introduction.html "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/09-Edinburgh_Dynamic_Test_Cases/introduction.webarchive" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/dataformat.html "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/09-Edinburgh_Dynamic_Test_Cases/dataformat.webarchive" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/howtouse.html "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/09-Edinburgh_Dynamic_Test_Cases/HowToUseThisArchive.webarchive" ) - file ( DOWNLOAD + file ( DOWNLOAD https://www.maths.ed.ac.uk/optenergy/NetworkData/submission.html "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/09-Edinburgh_Dynamic_Test_Cases/submission.webarchive" ) endif () # Data Formats ############################################# - # + # if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/18-IEEE-Data_Formats" ) # IEEE Common Data Format - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/formats/cdf.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/18-IEEE-Data_Formats/cdf.txt" ) # PTI Power Flow Data Format - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/formats/pti.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/18-IEEE-Data_Formats/pti.txt" ) # PECO PSAP Format - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/formats/psap.txt "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/18-IEEE-Data_Formats/psap.txt" ) endif () - + # Power System Application Data Dictionary - PSADD ######### - # + # if ( NOT EXISTS "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/19-Power_System_Application_Data_Dictionary" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/psadd/psadd.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/19-Power_System_Application_Data_Dictionary/psadd.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/psadd/readme.doc "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/19-Power_System_Application_Data_Dictionary/readme.doc" ) - file ( DOWNLOAD + file ( DOWNLOAD https://labs.ece.uw.edu/pstca/psadd/pg_tcapsadd.htm "${PROJECT_INCLUDE_DIR}/data/PowerGrids/IEEE/19-Power_System_Application_Data_Dictionary/pg_tcapsadd.webarchive" ) @@ -915,13 +915,13 @@ endif () #################################################################### # Generated Wind Farm Data from ITI 2017 ########################### #################################################################### -# Publication: -# +# Publication: +# # A Simulated-Annealing-Based Approach for Wind Farm Cabling -# -# e-Energy '17: Proceedings of the Eighth International Conference +# +# e-Energy '17: Proceedings of the Eighth International Conference # on Future Energy Systems -# 2017, Pages 203–215 +# 2017, Pages 203–215 # Website: https://doi.org/10.1145/3077839.3077843 #################################################################### @@ -930,8 +930,8 @@ file ( MAKE_DIRECTORY "${EGOA_DOWNLOAD_DIRECTORY_WINDFARM}/Networks" ) if ( EGOA_DOWNLOAD_WINDFARM AND NOT EXISTS "${EGOA_DOWNLOAD_DIRECTORY_WINDFARM}/Networks/2017-iti-windfarm-benchmarksets" ) message( STATUS "${MY_SPACE}Download generated wind farm data (ITI 2017) from \"https://i11www.iti.kit.edu/_media/projects/windfarmcabling/windfarm-benchmarksets.zip\" into \"${EGOA_DOWNLOAD_DIRECTORY_WINDFARM}/Networks/2017-iti-windfarm-benchmarksets/\".") - - file ( DOWNLOAD + + file ( DOWNLOAD https://i11www.iti.kit.edu/_media/projects/windfarmcabling/windfarm-benchmarksets.zip "${EGOA_DOWNLOAD_DIRECTORY_WINDFARM}/Networks/windfarm-benchmarksets.zip" # URL_HASH SHA512=52eff0790e78e2718e81e4ee2e0fc965180900d236e05822501019c8148a249529f7194e616c28394960a3086911af361165073cdf24195c7e5f1d603e463112 @@ -939,7 +939,7 @@ if ( EGOA_DOWNLOAD_WINDFARM AND NOT EXISTS "${EGOA_DOWNLOAD_DIRECTORY_WINDFARM}/ ) execute_process ( - COMMAND ${CMAKE_COMMAND} -E tar xzf ${EGOA_DOWNLOAD_DIRECTORY_WINDFARM}/Networks/windfarm-benchmarksets.zip + COMMAND ${CMAKE_COMMAND} -E tar xzf ${EGOA_DOWNLOAD_DIRECTORY_WINDFARM}/Networks/windfarm-benchmarksets.zip WORKING_DIRECTORY ${EGOA_DOWNLOAD_DIRECTORY_WINDFARM}/Networks/ ) diff --git a/cmake/FindBonmin.cmake b/cmake/FindBonmin.cmake index f756f7d7..4678544c 100644 --- a/cmake/FindBonmin.cmake +++ b/cmake/FindBonmin.cmake @@ -1,11 +1,11 @@ # FindBonmin.cmake -# +# # Created on: 30.01.2019 # Author: Franziska Wegner -# +# # If EGOA_ENABLE_BONMIN is ON the script searches for Bonmin in given # and standard location. If found it adds the library to the project. -# +# #################################################################### # Unset ############################################################ @@ -29,7 +29,7 @@ message(STATUS "${MY_SPACE}BONMIN_ROOT_DIR:\t\t\t" ${BONMIN_ROOT_DIR}) # Bonmin Include Directory ######################################### #################################################################### find_path(BONMIN_INCLUDE_DIR - NAMES BonTMINLP.hpp + NAMES BonTMINLP.hpp HINTS /usr/local/include/coin ${BONMIN_ROOT_DIR}/include/coin ${BONMIN_ROOT_DIR}/include @@ -40,14 +40,14 @@ message(STATUS "${MY_SPACE}BONMIN_INCLUDE_DIR:\t\t\t" ${BONMIN_INCLUDE_DIR}) # Bonmin Library Directory ######################################### #################################################################### find_path(BONMIN_LIBRARY_DIR - NAMES libbonmin.a + NAMES libbonmin.a HINTS /usr/local/lib ${BONMIN_ROOT_DIR}/lib ) message(STATUS "${MY_SPACE}BONMIN_LIBRARY_DIR:\t\t\t" ${BONMIN_LIBRARY_DIR}) if(APPLE) - find_library(BONMIN_LIBRARY + find_library(BONMIN_LIBRARY NAMES libbonmin.a #.dylib #libCbcSolver.a libCbc.a libCgl.a libOsiClp.a libClpSolver.a libClp.a libcoinasl.a libOsi.a libCoinUtils.a libcoinmumps.a HINTS /usr/local/lib ${BONMIN_ROOT_DIR}/lib @@ -56,7 +56,7 @@ if(APPLE) set(MAC_BONMIN_COMPILER_FLAGS "-fno-common -no-cpp-precomp -fexceptions -arch x86_64 -m64 -DBONMIN_BUILD") elseif(UNIX) - find_library(BONMIN_LIBRARY + find_library(BONMIN_LIBRARY NAMES libbonmin.a #.so #libCbcSolver.a libCbc.a libCgl.a libOsiClp.a libClpSolver.a libClp.a libcoinasl.a libOsi.a libCoinUtils.a libcoinmumps.a HINTS /usr/local/lib ${BONMIN_ROOT_DIR}/lib @@ -110,8 +110,8 @@ mark_as_advanced(BONMIN_LIBRARY BONMIN_INCLUDE_DIR) message(STATUS "") if(EGOA_ENABLE_BONMIN AND NOT BONMIN_FOUND) - message( FATAL_ERROR + message( FATAL_ERROR "Bonmin is enabled, but not available on the system. Please, check the \ Bonmin installation, and cmake configuration for BONMIN_ROOT_DIR or \ disable Bonmin by setting EGOA_ENABLE_BONMIN to OFF." ) -endif(EGOA_ENABLE_BONMIN AND NOT BONMIN_FOUND) \ No newline at end of file +endif(EGOA_ENABLE_BONMIN AND NOT BONMIN_FOUND) diff --git a/cmake/FindClangTidy.cmake b/cmake/FindClangTidy.cmake index 53f65fc3..57b60f90 100644 --- a/cmake/FindClangTidy.cmake +++ b/cmake/FindClangTidy.cmake @@ -1,14 +1,14 @@ # FindClangTidy.cmake -# +# # Created on: Dec 27, 2023 # Author: Franziska Wegner -# +# # This file enables clang tidy for the project. -# +# # Search for clang-tidy -find_program(CLANG_TIDY_PROG +find_program(CLANG_TIDY_PROG HINTS "/opt/homebrew/opt/llvm/bin/" "/usr/local/opt/llvm/bin/" NAMES "clang-tidy" diff --git a/cmake/FindCplex.cmake b/cmake/FindCplex.cmake index dc8b9494..06c04ac5 100644 --- a/cmake/FindCplex.cmake +++ b/cmake/FindCplex.cmake @@ -1,13 +1,13 @@ # FindCplex.cmake -# +# # Created on: May 11, 2019 # Author: Franziska Wegner -# +# # If EGOA_ENABLE_CPLEX is ON the script searches for Cplex in given # and standard location. If found it adds the library to the project. -# +# -# Environment variable CPLEX_ROOT_DIR of CPLEX should be set, e.g., /Applications/CPLEX_Studio128 +# Environment variable CPLEX_ROOT_DIR of CPLEX should be set, e.g., /Applications/CPLEX_Studio128 set(CPLEX_HOME "${CPLEX_HOME}" CACHE PATH "Path to the Cplex home \ directory; default on MacOS \"/Applications/CPLEX_Studio\" \ use \"/Library\". You can find the current directory by using the \ @@ -30,7 +30,7 @@ unset(CPLEX_CONCERT_LIBRARY CACHE) # Cplex Include Directory ########################################## #################################################################### find_path(CPLEX_INCLUDE_DIR - NAMES ilcplex/cplex.h + NAMES ilcplex/cplex.h HINTS /usr/local/include ${CPLEX_HOME}/cplex/include ) @@ -40,7 +40,7 @@ message(STATUS "${MY_SPACE}CPLEX_INCLUDE_DIR:\t\t\t" ${CPLEX_INCLUDE_DIR}) # Find path Cplex concert include directory ######################## #################################################################### find_path(CPLEX_CONCERT_INCLUDE_DIR - NAMES ilconcert/ilobasic.h + NAMES ilconcert/ilobasic.h HINTS /usr/local/include /Applications/CPLEX_Studio128/concert/include ${CPLEX_HOME}/concert/include @@ -54,52 +54,52 @@ if(CPLEX_HOME) file(GLOB dirs ${CPLEX_HOME}*) endif() -find_path(CPLEX_LIBRARY_DIR - libcplex.a libcplexdistmip.a +find_path(CPLEX_LIBRARY_DIR + libcplex.a libcplexdistmip.a HINTS /usr/local/lib /Applications/CPLEX_Studio128/cplex/lib/x86-64_osx/static_pic - ${CPLEX_HOME}/cplex/lib/x86-64_osx/static_pic + ${CPLEX_HOME}/cplex/lib/x86-64_osx/static_pic ${CPLEX_HOME}/cplex/lib/x86-64_darwin/static_pic ${CPLEX_HOME}/cplex/lib/x86-64_debian4.0_4.1/static_pic - ${CPLEX_HOME}/cplex/lib/x86-64_sles10_4.1/static_pic + ${CPLEX_HOME}/cplex/lib/x86-64_sles10_4.1/static_pic ${CPLEX_HOME}/cplex/lib/x86-64_linux/static_pic - ${CPLEX_HOME}/cplex/lib/${CPLEX_WIN_PLATFORM} + ${CPLEX_HOME}/cplex/lib/${CPLEX_WIN_PLATFORM} ) message(STATUS "${MY_SPACE}CPLEX_LIBRARY_DIR:\t\t\t" ${CPLEX_LIBRARY_DIR}) #################################################################### # Find path Cplex concert library directory ######################## #################################################################### -find_path(CPLEX_CONCERT_LIBRARY_DIR +find_path(CPLEX_CONCERT_LIBRARY_DIR libconcert.a HINTS /usr/local/lib /Applications/CPLEX_Studio128/concert/lib/x86-64_osx/static_pic - ${CPLEX_HOME}/concert/lib/x86-64_osx/static_pic + ${CPLEX_HOME}/concert/lib/x86-64_osx/static_pic ${CPLEX_HOME}/concert/lib/x86-64_darwin/static_pic ${CPLEX_HOME}/concert/lib/x86-64_debian4.0_4.1/static_pic ${CPLEX_HOME}/concert/lib/x86-64_sles10_4.1/static_pic - ${CPLEX_HOME}/concert/lib/x86-64_linux/static_pic - ${CPLEX_HOME}/concert/lib/${CPLEX_WIN_PLATFORM} + ${CPLEX_HOME}/concert/lib/x86-64_linux/static_pic + ${CPLEX_HOME}/concert/lib/${CPLEX_WIN_PLATFORM} ) message(STATUS "${MY_SPACE}CPLEX_CONCERT_LIBRARY_DIR:\t" ${CPLEX_CONCERT_LIBRARY_DIR}) -find_library(CPLEX_LIBRARY - NAMES cplex +find_library(CPLEX_LIBRARY + NAMES cplex HINTS /usr/local/lib ${CPLEX_LIBRARY_DIR} ) -find_library(CPLEX_DISTMIP_LIBRARY +find_library(CPLEX_DISTMIP_LIBRARY NAMES cplexdistmip HINTS /usr/local/lib ${CPLEX_LIBRARY_DIR} ) -find_library(ILO_CPLEX_LIBRARY - NAMES ilocplex +find_library(ILO_CPLEX_LIBRARY + NAMES ilocplex HINTS /usr/local/lib ${CPLEX_LIBRARY_DIR} ) -find_library(CPLEX_CONCERT_LIBRARY - NAMES concert +find_library(CPLEX_CONCERT_LIBRARY + NAMES concert HINTS /usr/local/lib ${CPLEX_CONCERT_LIBRARY_DIR} ) @@ -112,17 +112,17 @@ message(STATUS "${MY_SPACE}CPLEX_CONCERT_LIBRARY_DIR:\t" ${CPLEX_CONCERT_LIBRARY if(WIN32) FIND_PATH(CPLEX_BIN_DIR cplex${CPLEX_WIN_VERSION}.dll - HINTS ${CPLEX_HOME}/cplex/bin/${CPLEX_WIN_PLATFORM} + HINTS ${CPLEX_HOME}/cplex/bin/${CPLEX_WIN_PLATFORM} ) else() FIND_PATH(CPLEX_BIN_DIR - cplex + cplex HINTS ${CPLEX_HOME}/cplex/bin/x86-64_osx - ${CPLEX_HOME}/cplex/bin/x86-64_darwin + ${CPLEX_HOME}/cplex/bin/x86-64_darwin ${CPLEX_HOME}/cplex/bin/x86-64_sles10_4.1 - ${CPLEX_HOME}/cplex/bin/x86-64_debian4.0_4.1 + ${CPLEX_HOME}/cplex/bin/x86-64_debian4.0_4.1 ${CPLEX_HOME}/cplex/lib/x86-64_linux - + ) endif() @@ -134,7 +134,7 @@ find_package_handle_standard_args(CPLEX DEFAULT_MSG CPLEX_LIBRARY CPLEX_DISTMIP_ #################################################################### # Output Message ################################################### #################################################################### -if(CPLEX_FOUND) +if(CPLEX_FOUND) set(CPLEX_INCLUDE_DIRS ${CPLEX_INCLUDE_DIR} ${CPLEX_CONCERT_INCLUDE_DIR}) message(STATUS "TEST:${CPLEX_INCLUDE_DIRS}") set(CPLEX_LIBRARIES ${CPLEX_LIBRARY} ${CPLEX_DISTMIP_LIBRARY} ${ILO_CPLEX_LIBRARY} ${CPLEX_CONCERT_LIBRARY}) @@ -150,7 +150,7 @@ mark_as_advanced(CPLEX_LIBRARY CPLEX_DISTMIP_LIBRARY ILO_CPLEX_LIBRARY CPLEX_CON message(STATUS "") if(EGOA_ENABLE_CPLEX AND NOT CPLEX_FOUND) - message( FATAL_ERROR + message( FATAL_ERROR "CPLEX is enabled, but not available on the system. Please, check the \ CPLEX installation, and cmake configuration or disable Cplex by \ setting EGOA_ENABLE_CPLEX to OFF." ) diff --git a/cmake/FindEigen.cmake b/cmake/FindEigen.cmake index 4aa9b2b8..2e8a3418 100644 --- a/cmake/FindEigen.cmake +++ b/cmake/FindEigen.cmake @@ -1,12 +1,12 @@ # FindEigen.cmake -# +# # Created on: Jan 26, 2020 # Author: Franziska Wegner -# +# # If EGOA_ENABLE_EIGEN is ON the script searches for Eigen in given and # standard location (see EGOA_DOWNLOAD_EIGEN). If found it adds the library to # the project. -# +# #################################################################### # Unset ############################################################ @@ -17,7 +17,7 @@ unset ( EIGEN_INCLUDE_DIR CACHE ) # Eigen include directory ########################################## #################################################################### find_path ( EIGEN_INCLUDE_DIR - NAMES Eigen/src/Core/Array.h + NAMES Eigen/src/Core/Array.h HINTS ./external/Eigen ${EIGEN_ROOT_DIR}/Eigen/ ${EIGEN_ROOT_DIR} @@ -44,7 +44,7 @@ mark_as_advanced ( EIGEN_INCLUDE_DIR ) #################################################################### message ( STATUS "" ) if ( EGOA_ENABLE_EIGEN AND NOT EIGEN_FOUND ) - message( FATAL_ERROR + message( FATAL_ERROR "Eigen is enabled, but not available on the system. Please, check the \ Eigen installation, and cmake configuration or disable Eigen by \ setting EGOA_ENABLE_EIGEN to OFF." ) diff --git a/cmake/FindGoogleTestFramework.cmake b/cmake/FindGoogleTestFramework.cmake index 1d2ee518..24f848da 100644 --- a/cmake/FindGoogleTestFramework.cmake +++ b/cmake/FindGoogleTestFramework.cmake @@ -1,11 +1,11 @@ # FindGoogleTestFramework.cmake -# +# # Created on: Jan 30, 2019 # Author: Franziska Wegner -# +# # If EGOA_ENABLE_TESTS is TRUE the necessary directories of the google test # framework are added to the project such as the includes for gtest and gmock. -# +# #################################################################### # Include test framework ########################################### diff --git a/cmake/FindGoogleTestFrameworkOnlineVersion.cmake b/cmake/FindGoogleTestFrameworkOnlineVersion.cmake index f2d84c49..9e26d799 100644 --- a/cmake/FindGoogleTestFrameworkOnlineVersion.cmake +++ b/cmake/FindGoogleTestFrameworkOnlineVersion.cmake @@ -1,21 +1,21 @@ # FindGoogleTestFrameworkOnlineVersion.cmake -# +# # Created on: Jan 30, 2019 -# Source: https://github.com/google/googletest/tree/main/googletest -# -# Requirements -# * CMake 2.8. or later due to the use of ExternalProject_Add(). -# +# Source: https://github.com/google/googletest/tree/main/googletest +# +# Requirements +# * CMake 2.8. or later due to the use of ExternalProject_Add(). +# # CMake Warning (dev): # * Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run # "cmake --help-policy CMP0042" for policy details. Use the cmake_policy # command to set the policy and suppress this warning. MACOSX_RPATH is not # specified for the following targets: gtest_dll # * This warning is for project developers. Use -Wno-dev to suppress it. -# +# # If EGOA_ENABLE_TESTS is TRUE the necessary directories of the google test # framework are added to the project such as the includes for gtest and gmock. -# +# set(CMAKE_MACOSX_RPATH 1) diff --git a/cmake/FindGurobi.cmake b/cmake/FindGurobi.cmake index 63cc50a4..221d567f 100644 --- a/cmake/FindGurobi.cmake +++ b/cmake/FindGurobi.cmake @@ -1,11 +1,11 @@ # FindGurobi.cmake -# +# # Created on: Jan 30, 2019 # Author: Franziska Wegner -# +# # If EGOA_ENABLE_GUROBI is ON the script searches for Gurobi in given # and standard location. If found it adds the library to the project. -# +# #################################################################### # Unset ############################################################ @@ -41,8 +41,8 @@ string(SUBSTRING ${GUROBI_VERSION} 0 2 GUROBI_VERSION_SHORT) #################################################################### # Find gurobi include directory #################################### #################################################################### -find_path(GUROBI_INCLUDE_DIR - gurobi_c++.h +find_path(GUROBI_INCLUDE_DIR + gurobi_c++.h HINTS "${GUROBI_HOME}/include" $ENV{GUROBI_HOME}/include ) @@ -51,8 +51,8 @@ message(STATUS "${MY_SPACE}GUROBI_INCLUDE_DIR:\t\t\t" ${GUROBI_INCLUDE_DIR}) #################################################################### # Find Gurobi library directory #################################### #################################################################### -find_path(GUROBI_LIBRARY_DIR - libgurobi${GUROBI_VERSION_SHORT}.a libgurobi${GUROBI_VERSION_SHORT}.so +find_path(GUROBI_LIBRARY_DIR + libgurobi${GUROBI_VERSION_SHORT}.a libgurobi${GUROBI_VERSION_SHORT}.so HINTS ${GUROBI_HOME}/lib $ENV{GUROBI_HOME}/lib ) @@ -60,7 +60,7 @@ find_path(GUROBI_LIBRARY_DIR #################################################################### # Find Gurobi library ############################################## #################################################################### -find_library(GUROBI_LIBRARY +find_library(GUROBI_LIBRARY libgurobi${GUROBI_VERSION_SHORT}.a libgurobi${GUROBI_VERSION_SHORT}.so HINTS ${GUROBI_HOME}/lib $ENV{GUROBI_HOME}/lib @@ -70,8 +70,8 @@ message(STATUS "${MY_SPACE}GUROBI_LIBRARY:\t\t\t\t" ${GUROBI_LIBRARY}) #################################################################### # Find Gurobi CPP library ########################################## #################################################################### -find_library(GUROBI_CPP_LIBRARY - libgurobi_c++.a libgurobi_c++.so +find_library(GUROBI_CPP_LIBRARY + libgurobi_c++.a libgurobi_c++.so HINTS ${GUROBI_HOME}/lib $ENV{GUROBI_HOME}/lib ) @@ -101,7 +101,7 @@ mark_as_advanced(GUROBI_LIBRARY GUROBI_CPP_LIBRARY GUROBI_INCLUDE_DIR) message(STATUS "") if(EGOA_ENABLE_GUROBI AND NOT GUROBI_FOUND) - message( FATAL_ERROR + message( FATAL_ERROR "Gurobi is enabled, but not available on the system. Please, check the \ Gurobi installation, and cmake configuration for GUROBI_HOME or disable \ Gurobi by setting EGOA_ENABLE_GUROBI to OFF." ) diff --git a/cmake/FindIpopt.cmake b/cmake/FindIpopt.cmake index 79c3f517..98cec086 100644 --- a/cmake/FindIpopt.cmake +++ b/cmake/FindIpopt.cmake @@ -1,13 +1,13 @@ # FindIpopt.cmake -# +# # Created on: Jan 30, 2019 # Author: Franziska Wegner -# +# # If EGOA_ENABLE_IPOPT is ON the script searches for Ipopt in given # and standard location. If found it adds the library to the project. -# +# -# Environment variable IPOPT_ROOT_DIR of IPOPT should be set, e.g., /Users//Documents/CoinIpopt/build +# Environment variable IPOPT_ROOT_DIR of IPOPT should be set, e.g., /Users//Documents/CoinIpopt/build set ( IPOPT_ROOT_DIR "$ENV{IPOPT_ROOT_DIR}" CACHE PATH "Ipopt root directory." ) get_filename_component ( PARENT_DIRECTORY ${PROJECT_SOURCE_DIR} DIRECTORY ) @@ -30,7 +30,7 @@ unset ( IPOPT_LIBRARY CACHE ) # Ipopt include directory ########################################## #################################################################### find_path ( IPOPT_INCLUDE_DIR - NAMES IpNLP.hpp + NAMES IpNLP.hpp HINTS /usr/local/include/coin ${IPOPT_ROOT_DIR}/include/coin ${IPOPT_ROOT_DIR}/include @@ -40,22 +40,22 @@ message ( STATUS "${MY_SPACE}IPOPT_INCLUDE_DIR:\t\t\t" ${IPOPT_INCLUDE_DIR} ) #################################################################### # Ipopt library directory ########################################## #################################################################### -find_path ( IPOPT_LIBRARY_DIR - libipopt.dylib libipopt.so +find_path ( IPOPT_LIBRARY_DIR + libipopt.dylib libipopt.so HINTS /usr/local/lib ${IPOPT_ROOT_DIR}/lib ) message ( STATUS "${MY_SPACE}IPOPT_LIBRARY_DIR:\t\t\t" ${IPOPT_LIBRARY_DIR} ) if(APPLE) - find_library(IPOPT_LIBRARY + find_library(IPOPT_LIBRARY libipopt.dylib HINTS /usr/local/lib ${IPOPT_ROOT_DIR}/lib ) elseif(UNIX) - find_library(IPOPT_LIBRARY - libipopt.so + find_library(IPOPT_LIBRARY + libipopt.so HINTS /usr/local/lib ${IPOPT_ROOT_DIR}/lib ) @@ -84,8 +84,8 @@ mark_as_advanced ( IPOPT_LIBRARY IPOPT_INCLUDE_DIR IPOPT_LIBRARY_DIR ) #################################################################### message ( STATUS "" ) if ( EGOA_ENABLE_IPOPT AND NOT IPOPT_FOUND ) - message ( FATAL_ERROR + message ( FATAL_ERROR "Ipopt is enabled, but not available on the system. Please, check the \ Ipopt installation, and cmake configuration or disable Ipopt by \ setting EGOA_ENABLE_IPOPT to OFF." ) -endif ( EGOA_ENABLE_IPOPT AND NOT IPOPT_FOUND ) \ No newline at end of file +endif ( EGOA_ENABLE_IPOPT AND NOT IPOPT_FOUND ) diff --git a/cmake/FindOGDF.cmake b/cmake/FindOGDF.cmake index a96b76a5..21a02b66 100644 --- a/cmake/FindOGDF.cmake +++ b/cmake/FindOGDF.cmake @@ -1,12 +1,12 @@ # FindOGDF.cmake -# +# # Created on: Jan 30, 2019 # Author: Franziska Wegner -# +# # If EGOA_ENABLE_OGDF is ON the script searches for OGDF and COIN in given and # standard location. If found it adds the library to the project by adding the # include paths and libraries to the project. -# +# set ( OGDF_LIBRARY_DIR ${OGDF_LIBRARY_DIR} CACHE FILEPATH "Path to the OGDF library directory including libOGDF.a or libOGDF.so; please use no snapshot higher than 23th of July 2017" ) set ( OGDF_INCLUDE_DIR ${OGDF_INCLUDE_DIR} CACHE FILEPATH "OGDF include directory" ) @@ -22,7 +22,7 @@ message(STATUS "OGDF:") #################################################################### # find ODGF include directory if not given by input if(NOT OGDF_INCLUDE_DIR) -find_path( OGDF_INCLUDE_DIR +find_path( OGDF_INCLUDE_DIR NAMES ogdf/tree/LCA.h ogdf/basic/Graph.h HINTS /opt/ogdf/include/ /usr/local/include @@ -32,7 +32,7 @@ message(STATUS "${MY_SPACE}OGDF_INCLUDE_DIR:\t\t${OGDF_INCLUDE_DIR}") # find ODGF automatically generated include directory if not given by input if(NOT OGDF_AUTOGEN_INCLUDE_DIR) -find_path( OGDF_AUTOGEN_INCLUDE_DIR +find_path( OGDF_AUTOGEN_INCLUDE_DIR NAMES ogdf/basic/internal/config_autogen.h HINTS ${OGDF_INCLUDE_DIR} ${OGDF_LIBRARY_DIR}/include/ @@ -44,7 +44,7 @@ message(STATUS "${MY_SPACE}OGDF_AUTOGEN_INCLUDE_DIR:\t${OGDF_AUTOGEN_INCLUDE_DIR # find COIN include directory if not given by input if(NOT COIN_INCLUDE_DIR) -find_path( COIN_INCLUDE_DIR +find_path( COIN_INCLUDE_DIR NAMES coin/ClpSimplexNonlinear.hpp HINTS ${OGDF_INCLUDE_DIR} /usr/local/lib/ @@ -58,7 +58,7 @@ message(STATUS "${MY_SPACE}COIN_INCLUDE_DIR: ${COIN_INCLUDE_DIR}") #################################################################### # OGDF Library Directory ########################################### #################################################################### -find_library(OGDF_LIBRARY +find_library(OGDF_LIBRARY libOGDF.a libOGDF.so HINTS ${OGDF_LIBRARY_DIR} /usr/local/lib/ @@ -70,7 +70,7 @@ message(STATUS "${MY_SPACE}OGDF_LIBRARY:\t\t\t${OGDF_LIBRARY}") #################################################################### # COIN Library Directory ########################################### #################################################################### -find_library(COIN_LIBRARY +find_library(COIN_LIBRARY libCOIN.a libCOIN.so HINTS ${COIN_LIBRARY_DIR} ${OGDF_LIBRARY_DIR} @@ -112,8 +112,8 @@ mark_as_advanced(OGDF_LIBRARY) # Output Message ################################################### #################################################################### message(STATUS "${MY_SPACE}OGDF_DEBUG:\t\t\t${OGDF_DEBUG}") -if(EGOA_ENABLE_OGDF AND NOT OGDF_FOUND) -message( FATAL_ERROR +if(EGOA_ENABLE_OGDF AND NOT OGDF_FOUND) +message( FATAL_ERROR "OGDF is enabled, but either not available on the system or the \ installation is demaged. Please, check the installation of OGDF, the OGDF \ paths OGDF_AUTOGEN_INCLUDE_DIR, OGDF_INCLUDE_DIR, and OGDF_LIBRARY_DIR in \ diff --git a/cmake/HelperFunctions.cmake b/cmake/HelperFunctions.cmake index 4cefe56b..07485412 100644 --- a/cmake/HelperFunctions.cmake +++ b/cmake/HelperFunctions.cmake @@ -1,10 +1,10 @@ # HelperFunctions.cmake -# +# # Created on: Jan 30, 2019 # Author: Franziska Wegner -# +# # A collection of function that help to reduce the cmake complexity. -# +# # Link Gurobi if available function(add_gurobi_if_available varName) diff --git a/cmake/InputProperties.cmake b/cmake/InputProperties.cmake index 63af057b..be2462c4 100644 --- a/cmake/InputProperties.cmake +++ b/cmake/InputProperties.cmake @@ -1,11 +1,11 @@ # InputProperties.cmake -# +# # Created on: Jan 30, 2019 # Author: Franziska Wegner -# +# # Create variables and their drop down menus, and mark some variables as # advanced. -# +# #################################################################### # Reset variables ################################################## @@ -103,12 +103,12 @@ set ( EGOA_ENABLE_TESTS ON CACHE BOOL "EGOA_ENABLE_TESTS enables the test framework" ) set_property ( CACHE EGOA_ENABLE_TESTS PROPERTY STRINGS ON OFF ) -# Property exception handling +# Property exception handling set ( EGOA_ENABLE_EXCEPTION_HANDLING ON CACHE BOOL "EGOA_ENABLE_EXCEPTION_HANDLING enables exception handling in the framework" ) set_property ( CACHE EGOA_ENABLE_EXCEPTION_HANDLING PROPERTY STRINGS ON OFF ) -# Property exception handling +# Property exception handling set ( EGOA_ENABLE_ASSERTION ON CACHE BOOL "EGOA_ENABLE_ASSERTION enables assertions in debug mode in the framework" ) set_property ( CACHE EGOA_ENABLE_ASSERTION PROPERTY STRINGS ON OFF ) diff --git a/cmake/OpenMP.cmake b/cmake/OpenMP.cmake index 177601a5..0ceed0d5 100644 --- a/cmake/OpenMP.cmake +++ b/cmake/OpenMP.cmake @@ -1,18 +1,18 @@ # OpenMP.cmake -# +# # Created on: Jan 30, 2019 # Author: Franziska Wegner -# +# # If EGOA_ENABLE_OPENMP is ON the script adds the target to use the # header in the project. -# +# # Installation of OpenMP # * To install OpenMP on Mac use: # * OPENMP: brew install llvm PATH: /usr/local/Cellar/llvm/5.0.1/bin/clang -# * CPP = /usr/local/opt/llvm/bin/clang | CPPFLAGS = -I/usr/local/opt/llvm/include -fopenmp +# * CPP = /usr/local/opt/llvm/bin/clang | CPPFLAGS = -I/usr/local/opt/llvm/include -fopenmp # | LDFLAGS = -L/usr/local/opt/llvm/lib -message(STATUS "OpenMP enabled: " ${EGOA_ENABLE_OPENMP}) +message(STATUS "OpenMP enabled: " ${EGOA_ENABLE_OPENMP}) # ${CMAKE_CXX_COMPILER} --- /usr/local/Cellar/llvm/9.0.0/bin/clang++ # /usr/local/opt/llvm@8/ or /usr/local/Cellar/llvm@8/8.0.1/bin/clang++ @@ -67,7 +67,7 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") # Output Message ################################################### #################################################################### if(EGOA_ENABLE_OPENMP AND NOT OPENMP_FOUND) - message( FATAL_ERROR + message( FATAL_ERROR "OpenMP is enabled, but not available on the system. Please, check the \ specification of your compiler or disable OpenMP by setting \ EGOA_ENABLE_OPENMP to OFF." ) diff --git a/cmake/SetEnvironmentVariables.cmake b/cmake/SetEnvironmentVariables.cmake index 4025a1b3..357c6c9d 100644 --- a/cmake/SetEnvironmentVariables.cmake +++ b/cmake/SetEnvironmentVariables.cmake @@ -1,17 +1,17 @@ # SetEnvironmentVariables.cmake -# +# # Created on: Jan 30, 2019 # Author: Franziska Wegner -# -# Set environment variables that are used for, e.g., +# +# Set environment variables that are used for, e.g., # - OpenMP # - ... -# +# # Set OpenMP variables message( STATUS "Set OpenMP variables" ) -set(ENV{OMP_WAIT_POLICY} "ACTIVE") +set(ENV{OMP_WAIT_POLICY} "ACTIVE") message( STATUS "${MY_SPACE}OMP_WAIT_POLICY:\t\t\t" $ENV{OMP_WAIT_POLICY}) # Stack size of each OpenMP threads @@ -46,4 +46,4 @@ if(NOT EGOA_THREAD_LIMIT EQUAL 0) set(ENV{OMP_NUM_THREADS} ${EGOA_THREAD_LIMIT}) message( STATUS "${MY_SPACE}OMP_NUM_THREADS:\t\t\t" $ENV{OMP_NUM_THREADS} ) endif() -message( STATUS ) \ No newline at end of file +message( STATUS ) diff --git a/data/Windfarms/CableTypes/2017-iti-cable-types.json b/data/Windfarms/CableTypes/2017-iti-cable-types.json index 41a8280d..0d1ef936 100755 --- a/data/Windfarms/CableTypes/2017-iti-cable-types.json +++ b/data/Windfarms/CableTypes/2017-iti-cable-types.json @@ -1,9 +1,24 @@ { - "cableTypes": [ - { "cost": 20, "capacity": 5 }, - { "cost": 25, "capacity": 8 }, - { "cost": 27, "capacity": 12 }, - { "cost": 41, "capacity": 15 }, - { "cost": 10000, "capacity": 1000 } - ] + "cableTypes": [ + { + "capacity": 5, + "cost": 20 + }, + { + "capacity": 8, + "cost": 25 + }, + { + "capacity": 12, + "cost": 27 + }, + { + "capacity": 15, + "cost": 41 + }, + { + "capacity": 1000, + "cost": 10000 + } + ] } diff --git a/documentation/includes/EGOA_Colors.tex b/documentation/includes/EGOA_Colors.tex index ea89fca4..acc52a83 100644 --- a/documentation/includes/EGOA_Colors.tex +++ b/documentation/includes/EGOA_Colors.tex @@ -1,9 +1,9 @@ \usepackage{transparent} -% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % KIT defined colors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% +% % KIT green \definecolor{KITgreen}{rgb}{0 0.588 0.509} \definecolor{KITgreen70}{rgb}{0.3 0.711 0.656} @@ -70,7 +70,7 @@ \definecolor{KITblack50}{rgb}{0.5,0.5,0.5} \definecolor{KITblack30}{rgb}{0.7,0.7,0.7} \definecolor{KITblack15}{rgb}{0.85,0.85,0.85} -% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Power Grid Related Colors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -126,9 +126,9 @@ \colorlet{ColorCircuitProblem} {KITgreen} \colorlet{ColorSubstationProblem} {KITorange} \colorlet{ColorFullWindFarm} {KITred} -% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Other +% Other %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ACM already defined colors \definecolor[named]{ACMBlue}{cmyk}{1,0.1,0,0.1} @@ -147,4 +147,4 @@ \definecolor{orange}{rgb}{1,0.5,0} \definecolor{orange}{RGB}{255,127,0} \definecolor{figChar}{cmyk}{0,0.90,0.86,0} -% \ No newline at end of file +% diff --git a/documentation/includes/EGOA_DocumentationLatexPreamble.sty b/documentation/includes/EGOA_DocumentationLatexPreamble.sty index 2fbaf359..04024467 100644 --- a/documentation/includes/EGOA_DocumentationLatexPreamble.sty +++ b/documentation/includes/EGOA_DocumentationLatexPreamble.sty @@ -1,13 +1,13 @@ -% +% % EGOA-Documentation-Latex-Preamble.sty -% +% % Created on: Jan 30, 2019 % Author: Franziska Wegner -% +% % Macros that are used within the papers and dissertation can used within the % code documentation to provide the possibility to map the theoretical content % with the code. -% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Usepackages @@ -39,10 +39,10 @@ \usepackage{tabularx,environ} \usepackage{paralist} \usepackage{caption,subcaption} -\usepackage{float} +\usepackage{float} \usepackage{pifont} \usepackage{flushend} -\usepackage{xargs} +\usepackage{xargs} \usepackage{xspace} \usepackage{textpos} @@ -53,7 +53,7 @@ \newcommand{\overleftrightsmallarrow}{\mathpalette{\overarrowsmall@\leftrightarrowfill@}} \newcommand{\overrightsmallarrow}{\mathpalette{\overarrowsmall@\rightarrowfill@}} \newcommand{\overleftsmallarrow}{\mathpalette{\overarrowsmall@\leftarrowfill@}} -% +% \newcommand{\overarrowsmall@}[3]{% \vbox{% \ialign{% @@ -76,7 +76,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % New Theorem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% +% \newtheorem{theorem}{Theorem}[section] \newtheorem{lemma}[theorem]{Lemma} \newtheorem{corollary}[theorem]{Corollary} @@ -89,7 +89,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Color %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% +% % ACM defined colors \definecolor[named]{ACMBlue}{cmyk}{1,0.1,0,0.1} \definecolor[named]{ACMYellow}{cmyk}{0,0.16,1,0} @@ -104,10 +104,10 @@ \definecolor{orange}{rgb}{1,0.5,0} \definecolor{orange}{RGB}{255,127,0} \definecolor{figChar}{cmyk}{0,0.90,0.86,0} -% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % KIT defined colors -% +% % KIT green \definecolor{KITgreen}{rgb}{0 0.588 0.509} \definecolor{KITgreen70}{rgb}{0.3 0.711 0.656} @@ -212,7 +212,7 @@ % Edges \newcommandx{\makeUndirected}[1]{\ensuremath{\overleftrightsmallarrow{#1}}\xspace} -% +% \newcommand{\edges}{\ensuremath{E}\xspace} \newcommandx{\foneToOneMap}[1]{\ensuremath{\mathrm{\mu}_{#1}}\xspace} \newcommand{\oneToOneMap}{\ensuremath{\mathrm{\foneToOneMap{dual}}}\xspace} @@ -233,7 +233,7 @@ \newcommand{\flowb}{\ensuremath{\flow_2}\xspace} \newcommand{\netflow}{\ensuremath{\flow_{\mathrm{net}}}\xspace} -% Others +% Others \newcommand{\partition}{\ensuremath{P}\xspace} \newcommand{\neighbor}{\ensuremath{N}\xspace} \newcommand{\inneighbor}{\ensuremath{N^+}\xspace} @@ -254,7 +254,7 @@ \newcommand{\labnew}{\ensuremath{\lab_\mathrm{new}}\xspace} \newcommand{\col}{\ensuremath{c}\xspace} \newcommand{\colorlabels}{\ensuremath{C}\xspace} -\newcommand{\orderedlist}[1]{\ensuremath{\langle #1\rangle}\xspace} +\newcommand{\orderedlist}[1]{\ensuremath{\langle #1\rangle}\xspace} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Power Grid @@ -287,13 +287,13 @@ } \newcommand{\dcnetworktuple}{ \ensuremath{\network = (} - \graph, - \generators, - \consumers, + \graph, + \generators, + \consumers, \ensuremath{\capacity,} \susceptance, - \realpowergenerationmin, - \realpowergenerationmax, + \realpowergenerationmin, + \realpowergenerationmax, \realpowerdemandmin, \realpowerdemandmax \ensuremath{)} @@ -301,12 +301,12 @@ } \newcommand{\flownetworktuple}{ \ensuremath{\network = (} - \graph, - \source, - \sink, + \graph, + \source, + \sink, \ensuremath{\capacity,} - \realpowergenerationmin, - \realpowergenerationmax, + \realpowergenerationmin, + \realpowergenerationmax, \realpowerdemandmin, \realpowerdemandmax \ensuremath{)} @@ -339,7 +339,7 @@ % Branches \newcommand{\factsedge}{\ensuremath{\edges_F}\xspace} \newcommand{\factsbranch}{\ensuremath{\edges_F}\xspace} -% +% \newcommand{\rectangulardissection}{\ensuremath{\mathcal{R}}\xspace} % Resistance @@ -479,7 +479,7 @@ \newcommand{\reactivepowersmax}{\ensuremath{\MAX{\reactivepowers}}\xspace} \newcommand{\reactivepowerbase}{\ensuremath{\reactivepowers_{ \mathrm{base}}}\xspace} -% +% \newcommand{\excess}{\ensuremath{x}\xspace} \newcommand{\excessSet}{\ensuremath{X}\xspace} \newcommand{\minexcess}{\ensuremath{\MIN{\excess}}\xspace} @@ -529,7 +529,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DeclareMathOperator{\len}{\ensuremath{len}\xspace} \DeclareMathOperator{\costsubstation}{\ensuremath{\totalcost_\mathrm{sub}}\xspace} %csub -\newcommand{\totalcost}{\ensuremath{c}\xspace} +\newcommand{\totalcost}{\ensuremath{c}\xspace} \DeclareMathOperator{\flowcost}{\ensuremath{cost}\xspace} \DeclareMathOperator{\degree}{\ensuremath{deg}\xspace} % degree of a vertex @@ -547,8 +547,8 @@ \newcommand{\problems}{\ensuremath{\mathcal{P}}\xspace} % Economic Dispatch Problem (EDP) -\newcommand{\edp}{EDP\xspace} -\newcommand{\EDP}{\textsc{Economic Dispatch Problem}\xspace} +\newcommand{\edp}{EDP\xspace} +\newcommand{\EDP}{\textsc{Economic Dispatch Problem}\xspace} % Alternating Current (AC) \newcommand{\ac}{\ensuremath{\mathsf{AC}}\xspace} @@ -597,7 +597,7 @@ \newcommand{\dcopf}{\ensuremath{\mathsf{\dc\opf}}\xspace} \newcommand{\dcopfbf}{\ensuremath{\mathbfsf{DCOPF}}\xspace} \newcommand{\DCOPF}{\textsc{\DC\ \OPF}\xspace} -% +% \newcommand{\dfs}{\ensuremath{\mathsf{DFS}}\xspace} % Dominating Theta Path (DTP) @@ -614,7 +614,7 @@ \newcommand{\feasbf}{\ensuremath{\mathbfsf{FEAS}}\xspace} \newcommand{\FEAS}{\textsc{Feasibility Problem}\xspace} -% Concerning flows +% Concerning flows \newcommand{\flowvalue}{\ensuremath{F}\xspace} \newcommand{\flowvaluebf}{\ensuremath{\mathbfsf{F}}\xspace} @@ -649,32 +649,32 @@ % Minimum Cost Flow (MCF) \newcommand{\mcf}{\ensuremath{\mathsf{MCF}}\xspace} \newcommand{\mcfbf}{\ensuremath{\mathbfsf{MCF}}\xspace} -\newcommand{\MCF}{\textsc{Minimum Cost Flow}\xspace} +\newcommand{\MCF}{\textsc{Minimum Cost Flow}\xspace} % Minimum Cost Flow Problem (MCFP) \newcommand{\mcfp}{\ensuremath{\mathsf{MCFP}}\xspace} \newcommand{\mcfpbf}{\ensuremath{\mathbfsf{MCFP}}\xspace} -\newcommand{\MCFP}{\textsc{Minimum Cost Flow Problem}\xspace} +\newcommand{\MCFP}{\textsc{Minimum Cost Flow Problem}\xspace} % Maximum Flow (MF) \newcommand{\mf}{\ensuremath{\mathsf{MF}}\xspace} \newcommand{\mfbf}{\ensuremath{\mathbfsf{MF}}\xspace} -\newcommand{\MF}{\text{maximum flow}\xspace} +\newcommand{\MF}{\text{maximum flow}\xspace} % Maximum Flow Problem (MFP) \newcommand{\mfp}{\ensuremath{\mathsf{MFP}}\xspace} \newcommand{\mfpbf}{\ensuremath{\mathbfsf{MFP}}\xspace} -\newcommand{\MFP}{\textsc{Maximum Flow Problem}\xspace} +\newcommand{\MFP}{\textsc{Maximum Flow Problem}\xspace} % Minimum Cut (MC) \newcommand{\mc}{\ensuremath{\mathsf{MC}}\xspace} \newcommand{\mcbf}{\ensuremath{\mathbfsf{MC}}\xspace} -\newcommand{\MC}{\text{minimum cut}\xspace} +\newcommand{\MC}{\text{minimum cut}\xspace} % Minimum Cut Problem (MCP) \newcommand{\mcp}{\ensuremath{\mathsf{MCP}}\xspace} \newcommand{\mcpbf}{\ensuremath{\mathbfsf{MCP}}\xspace} -\newcommand{\MCP}{\textsc{Minimum Cut Problem}\xspace} +\newcommand{\MCP}{\textsc{Minimum Cut Problem}\xspace} % Mixed-integer Linear Program (MILP) \newcommand{\milp}{\ensuremath{\mathsf{MILP}}\xspace} @@ -715,7 +715,7 @@ \newcommand{\kmtsf}{\ensuremath{k}-\mtsf} \newcommand{\kmtsfbf}{\ensuremath{k}-\mtsfbf} \newcommand{\kMTSF}{\ensuremath{k}-\acrlong{mtsf}} -% +% \newcommand{\kmtsfp}{\ensuremath{k}-\mtsfp} \newcommand{\kmtsfpbf}{\ensuremath{k}-\mtsfpbf} \newcommand{\kMTSFP}{\ensuremath{k}-\acrlong{mtsfp}} @@ -870,7 +870,7 @@ Problem}\xspace} % Transmission System Operators (TSO) \newcommand{\tso}{TSO\xspace} \newcommand{\TSO}{Transmission System Operators\xspace} -% +% \newcommand{\twoapprox}{\ensuremath{\mathsf{2-approx}}\xspace} \newcommand{\twoapproxbf}{\ensuremath{\mathbfsf{2-approx}}\xspace} \newcommand{\TWOAPPROX}{\textsc{2-Approximation}\xspace} @@ -879,17 +879,17 @@ Problem}\xspace} \newcommand{\ucp}{\ensuremath{\mathsf{UCP}}\xspace} \newcommand{\ucpbf}{\ensuremath{\mathbfsf{UCP}}\xspace} \newcommand{\UCP}{\textsc{Unit Commitment Problem}\xspace} -% +% \newcommand{\vc}{\ensuremath{\mathsf{VC}}\xspace} \newcommand{\vcp}{\ensuremath{\mathsf{VCP}}\xspace} \newcommand{\vcpbf}{\ensuremath{\mathbfsf{VCP}}\xspace} \newcommand{\VCP}{\textsc{Vertex Cover Problem}\xspace} -% +% \newcommand{\fvs}{\ensuremath{\mathsf{FVS}}\xspace} \newcommand{\fvsp}{\ensuremath{\mathsf{FVSP}}\xspace} \newcommand{\fvspbf}{\ensuremath{\mathbfsf{FVSP}}\xspace} \newcommand{\FVSP}{\textsc{Feedback Vertex Set Problem}\xspace} -% +% \newcommand{\partitionp}{\ensuremath{\mathsf{PP}}\xspace} \newcommand{\partitionpbf}{\ensuremath{\mathbfsf{PP}}\xspace} \newcommand{\PartitionP}{\textsc{Partition Problem}\xspace} @@ -941,7 +941,7 @@ Problem}\xspace} % Complex \newcommand{\complexes}{\ensuremath{\mathbb{C}}\xspace} \newcommand{\imgPart}{\ensuremath{\textbf{j}}\xspace} -% +% \newcommand{\determinant}{\ensuremath{\mathrm{det}}\xspace} \newcommandx{\fdeterminant}[1]{\ensuremath{\determinant\left(#1\right)}\xspace} \newcommandx{\imaginary}[1]{\ensuremath{\mathcal{I}\!\!m\!\left @@ -988,7 +988,7 @@ Problem}\xspace} \newcommand{\locations}{\ensuremath{L}\xspace} \newcommand{\temperature}{\ensuremath{T}} -\newcommand{\energy}{\ensuremath{\totalcost}\xspace} %usually E for energy, but E is already used for the set of edges +\newcommand{\energy}{\ensuremath{\totalcost}\xspace} %usually E for energy, but E is already used for the set of edges % Solutions \newcommand{\solutions}{\ensuremath{S}\xspace} @@ -1012,7 +1012,7 @@ Problem}\xspace} \newcommand{\activity}{\ensuremath{\mu}\xspace} \newcommand{\activitythreshold}{\ensuremath{\overline{\mu}}\xspace} -% Instances +% Instances \newcommand{\instances}{\ensuremath{\mathcal{I}}\xspace} \newcommand{\instance}{\ensuremath{I}\xspace} \newcommand{\instancea}{\ensuremath{\instance_1}\xspace} @@ -1034,7 +1034,7 @@ Problem}\xspace} \newcommand{\ifequals}[3]{\ifthenelse{\equal{#1}{#2}}{#3}{}}% \newcommand{\case}[2]{#1 #2} % Dummy, so \renewcommand has something to overwrite... \newenvironment{switchcase}[1]{\renewcommand{\case}{\ifequals{#1}}}{}% -% +% % Example: Pick case by ID \newcommand{\nestacase}[2]{% \begin{switchcase}{#1}% @@ -1069,7 +1069,7 @@ Problem}\xspace} #2% \end{switchcase}% } -% +% \newcommand{\tablecase}[1]{% % \footnotesize \begin{switchcase}{#1}% @@ -1128,7 +1128,7 @@ Problem}\xspace} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Matrices %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% +% % Adjacency Matrix \newcommand{\adjacencyMatrix}{\ensuremath{\mathbf{A}}\xspace}%A \newcommand{\adjacencyMatrixVector}{\ensuremath{\mathbf{a}}\xspace}%A @@ -1140,7 +1140,7 @@ Problem}\xspace} \newcommand{\admittanceMatrixNode}{\ensuremath{\mathbf{Y_n}}\xspace} \newcommandx{\admittanceMatrixEntry}[2]{\ensuremath{ \mathbf{\admittanceMatrix_{#1,#2}}}\xspace} -% +% \newcommand{\polyhedron}{\ensuremath{P}\xspace}%P \newcommand{\righthandsidevector}{\ensuremath{\realpower}\xspace} \newcommandx{\frighthandsidevector}[1]{\ensuremath{\vv{\righthandsidevector_ @@ -1190,7 +1190,7 @@ Problem}\xspace} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Auxiliary %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% +% \newcommand{\plotscale}{0.8} \newcommand{\plotscaleOne}{0.45} \newcommand\plotsizeAppendix{0.89} @@ -1234,7 +1234,7 @@ Problem}\xspace} \newcommand{\inverse}{{\hspace{0.5pt}\protect\raisebox{0.5pt}{\protect\scalebox{0.6}[1.0]{$\scriptstyle-$}\hspace{-0.6pt}$\scriptscriptstyle1$}\hspace{-1pt}}} \newcommandx{\transpose}[1]{\ensuremath{#1^\intercal}\xspace} -% Others +% Others \newcommand{\distance}{\ensuremath{d}\xspace} \newcommand{\algo}{\ensuremath{\mathcal{A}}\xspace} \newcommand{\solutionmap}{\ensuremath{\mathtt{SolutionMap}}\xspace} @@ -1243,4 +1243,4 @@ Problem}\xspace} \newcommandx{\fmagnitude}[1]{\ensuremath{\lvert{#1}\rvert}\xspace} \newcommand{\tmp}{\mathrm{tmp}} \newcommand{\twodots}{\mathinner {\ldotp \ldotp}} -\newcommand{\parent}{\ensuremath{\mathrm{parent}}} \ No newline at end of file +\newcommand{\parent}{\ensuremath{\mathrm{parent}}} diff --git a/documentation/includes/EGOA_IpeLatexPreamble.tex b/documentation/includes/EGOA_IpeLatexPreamble.tex index 3fbc3847..f2266bd3 100644 --- a/documentation/includes/EGOA_IpeLatexPreamble.tex +++ b/documentation/includes/EGOA_IpeLatexPreamble.tex @@ -1,11 +1,11 @@ % % EGOA_IpeLatexPreamble.tex -% +% % Created on: Nov 11, 2017 % Author: Franziska Wegner -% +% % Usepackages and includes that are used for mainly all ipe presentations. -% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Usepackages @@ -26,7 +26,7 @@ \usepackage{paralist} \DeclareMathOperator{\lef}{\ell} -\DeclareMathOperator{\rig}{r} +\DeclareMathOperator{\rig}{r} \usepackage{amsopn} \usepackage{xargs} % Use more than one optional parameter in a new commands @@ -83,7 +83,7 @@ \newcommand{\overleftrightsmallarrow}{\mathpalette{\overarrowsmall@\leftrightarrowfill@}} \newcommand{\overrightsmallarrow}{\mathpalette{\overarrowsmall@\rightarrowfill@}} \newcommand{\overleftsmallarrow}{\mathpalette{\overarrowsmall@\leftarrowfill@}} -% +% \newcommand{\overarrowsmall@}[3]{% \vbox{% \ialign{% @@ -102,7 +102,7 @@ \fi } \makeatother -% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Includes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -115,7 +115,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Problem Environment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% +% \makeatletter % \renewcommand\arraystretch{1.5} \newenvironment{problem}[2][]{% @@ -161,7 +161,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Algorithm Environment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% +% \usepackage[titlenumbered, ruled, vlined, linesnumbered,resetcount] {algorithm2e}%, dotocloa \SetKwComment{Comment}{\color{KITblack30}$\triangleright$\ }{} diff --git a/include/Algorithms/Centralities/BetweennessCentrality.hpp b/include/Algorithms/Centralities/BetweennessCentrality.hpp index e1e3483c..5409edf3 100644 --- a/include/Algorithms/Centralities/BetweennessCentrality.hpp +++ b/include/Algorithms/Centralities/BetweennessCentrality.hpp @@ -30,7 +30,7 @@ enum class CentralityCounter { * @f$c_{\sbc}\colon\edges\to\posreals@f$ is defined by * @f[ * c_{\sbc} := \frac{1}{m_B}\sum_{\source\in\vertices}\sum_{\sink\in\vertices\setminus\{\source\}} \frac{\sigma_{\dtp}(\source,\sink,\edge)}{\sigma_{\dtp}(\source,\sink)}, - * @f] + * @f] * where @f$\sigma_{\dtp}(\source,\sink,\edge)@f$ is the number of * @f$\dtp{s}@f$ between @f$\source@f$ and @f$\sink@f$ that use the edge * @f$\edge@f$, @f$\sigma_{\dtp}(\source,\sink)@f$ is the total number of @@ -40,7 +40,7 @@ enum class CentralityCounter { * * @pre The template parameter used for GraphType should have an * interface similar to StaticGraph or DynamicGraph. However, the minimum - * requirements on the graph type are + * requirements on the graph type are * - @p for_all_vertex_identifiers, and * - see the minimum requirement of the PathFindingAlgorithm, e.g., * DominatingThetaPath. @@ -53,7 +53,7 @@ enum class CentralityCounter { * such as IO::DtpRuntimeCollection. * @tparam CentralityCounterType The centrality counter decides whether * to count edges or vertices. - * + * * @see StaticGraph * @see DominatingThetaPath * @see IO::DtpRuntimeCollection @@ -61,8 +61,8 @@ enum class CentralityCounter { */ template< typename GraphType = StaticGraph< Vertices::ElectricalProperties , Edges::ElectricalProperties > - , typename PathFindingAlgorithm = DominatingThetaPath - , typename MeasurementCollection = IO::DtpRuntimeCollection + , typename PathFindingAlgorithm = DominatingThetaPath + , typename MeasurementCollection = IO::DtpRuntimeCollection , CentralityCounter CentralityCounterType = CentralityCounter::counterAtEdges > /**< Distinguish between counting edges or vertices. */ class BetweennessCentrality { public: @@ -98,7 +98,7 @@ class BetweennessCentrality { * * @param graph The const graph. */ - BetweennessCentrality ( TGraph const & graph ) + BetweennessCentrality ( TGraph const & graph ) : countersSize_(0) , graph_( graph ) #if defined(OPENMP_AVAILABLE) @@ -107,7 +107,7 @@ class BetweennessCentrality { , algo_( graph_ ) #endif {} - + /** * @brief Destroys the object. */ @@ -118,7 +118,7 @@ class BetweennessCentrality { ///@name Execute the Betweenness Centrality Algorithm ///@{ #pragma mark EXECUTE_ALGORITHM - + /** * @brief Run the betweenness centrality. * @details If OpenMP is available this method will run in @@ -130,7 +130,7 @@ class BetweennessCentrality { * https://en.cppreference.com/w/cpp/container . */ inline void Run () - { + { TNumberOfPaths numberOfPaths; TRelativeNumberOfPaths relativeNumberOfPaths; @@ -147,9 +147,9 @@ class BetweennessCentrality { Algorithm()[omp_get_thread_num()].NumberOfLabels(); TotalNumberOfPaths( numberOfPaths, relativeNumberOfPaths ); #ifdef EGOA_ENABLE_STATISTIC_BETWEENNESS_CENTRALITY // COLLECT RUNTIME INFORMATION - #pragma omp critical - { // More information concerning standard container - // concurrency under "Thread safety": + #pragma omp critical + { // More information concerning standard container + // concurrency under "Thread safety": // https://en.cppreference.com/w/cpp/container Collection() += Algorithm()[omp_get_thread_num()].Statistic(); } @@ -208,7 +208,7 @@ class BetweennessCentrality { * * @return The algorithm. */ - inline TAlgoHandling & Algorithm () + inline TAlgoHandling & Algorithm () { return algo_; } @@ -228,9 +228,9 @@ class BetweennessCentrality { * * @return A vector of measurements. */ - inline TMeasurementCollection const & Collection () const + inline TMeasurementCollection const & Collection () const { - return collection_; + return collection_; } /** @@ -238,7 +238,7 @@ class BetweennessCentrality { * * @return A vector of measurements. */ - inline TMeasurementCollection & Collection () + inline TMeasurementCollection & Collection () { return collection_; } @@ -251,11 +251,11 @@ class BetweennessCentrality { /** * @brief Clears the measurement collection. */ - inline void Clear () + inline void Clear () { collection_.Clear(); - if ( CentralityCounterType == CentralityCounter::counterAtEdges ) + if ( CentralityCounterType == CentralityCounter::counterAtEdges ) { countersSize_ = graph_.NumberOfEdges(); } else { @@ -285,7 +285,7 @@ class BetweennessCentrality { */ inline void JoinThreadBasedResults ( TNumberOfPaths const & numberOfPaths , TRelativeNumberOfPaths const & relativeNumberOfPaths - , Types::real const & m_BNormalization ) + , Types::real const & m_BNormalization ) { #ifdef OPENMP_AVAILABLE ESSENTIAL_ASSERT ( totalRelativeNumberOfPaths_.size() == countersSize_ ); @@ -297,7 +297,7 @@ class BetweennessCentrality { for ( Types::count counterThreads = 0 ; counterThreads < omp_get_max_threads() - ; ++counterThreads ) + ; ++counterThreads ) { for ( Types::count counterEdgesOrVertices = 0 ; counterEdgesOrVertices < countersSize_ @@ -343,7 +343,7 @@ class BetweennessCentrality { , TRelativeNumberOfPaths & relativeNumberOfPaths ) { #ifdef OPENMP_AVAILABLE - if ( CentralityCounterType == CentralityCounter::counterAtEdges ) + if ( CentralityCounterType == CentralityCounter::counterAtEdges ) { Algorithm()[ omp_get_thread_num() ].TotalNumberOfPathsThroughEdge ( numberOfPaths[ omp_get_thread_num() ] , relativeNumberOfPaths[ omp_get_thread_num() ] ); @@ -352,7 +352,7 @@ class BetweennessCentrality { , relativeNumberOfPaths[ omp_get_thread_num() ] ); } #else - if ( CentralityCounterType == CentralityCounter::counterAtEdges ) + if ( CentralityCounterType == CentralityCounter::counterAtEdges ) { Algorithm().TotalNumberOfPathsThroughEdge ( numberOfPaths, relativeNumberOfPaths ); } else { @@ -373,13 +373,13 @@ class BetweennessCentrality { * @param relativeNumberOfPaths The relative number of paths. */ inline void Clear ( TNumberOfPaths & numberOfPaths - , TRelativeNumberOfPaths & relativeNumberOfPaths ) + , TRelativeNumberOfPaths & relativeNumberOfPaths ) { Clear(); #ifdef OPENMP_AVAILABLE numberOfPaths.assign ( omp_get_max_threads(), std::vector ( countersSize_, 0 ) ); relativeNumberOfPaths.assign ( omp_get_max_threads(), std::vector ( countersSize_, 0.0 ) ); -#else +#else numberOfPaths.assign ( countersSize_, 0 ); relativeNumberOfPaths.assign ( countersSize_, 0.0 ); #endif @@ -392,7 +392,7 @@ class BetweennessCentrality { TGraph const & graph_; /**< The graph @f$\graph = (\vertices,\edges)@f$ on which the DTP is calculated. */ TAlgoHandling algo_; /**< Multiple path finding algorithm are used for the parallelization. */ TMeasurementCollection collection_; /**< The collection of measurements. */ - + std::vector totalRelativeNumberOfPaths_; /**< */ std::vector totalNumberOfPaths_; /**< */ }; diff --git a/include/Algorithms/Centralities/GeneratorBasedBetweennessCentrality.hpp b/include/Algorithms/Centralities/GeneratorBasedBetweennessCentrality.hpp index 66610a6d..2e538319 100644 --- a/include/Algorithms/Centralities/GeneratorBasedBetweennessCentrality.hpp +++ b/include/Algorithms/Centralities/GeneratorBasedBetweennessCentrality.hpp @@ -26,7 +26,7 @@ namespace egoa { * @f$c_{\scu}\colon\edges\to\posreals@f$ is defined by * @f[ * c_{\scu} := \frac{1}{m_B}\sum_{\source\in\generators}\sum_{\sink\in\consumers} \frac{\omega_{\dtp}(\source,\sink,\edge)}{\omega_{\dtp}(\source,\sink)}, - * @f] + * @f] * where @f$\omega_{\dtp}(\source,\sink,\edge)@f$ is the number of * @f$\dtp@f$-paths between @f$\source@f$ and @f$\sink@f$ that use the edge * @f$\edge@f$, @f$\omega_{\dtp}(\source,\sink)@f$ is the total number of @@ -36,7 +36,7 @@ namespace egoa { * * @pre The template parameter used for NetworkType should have an * interface similar to the PowerGrid. However, the minimum - * requirements on the network type are + * requirements on the network type are * - for_all_generator_identifiers, and * - for the included graph see the minimum requirement of the * PathFindingAlgorithm, e.g., DominatingThetaPath. @@ -49,7 +49,7 @@ namespace egoa { * such as IO::DtpRuntimeCollection. * @tparam CentralityCounterType The centrality counter decides whether * to count edges or vertices. - * + * * @see BetweennessCentrality * @see PowerGrid * @see DominatingThetaPath @@ -60,13 +60,13 @@ template< typename NetworkType = PowerGrid< StaticGraph< Ve , Edges::ElectricalProperties > , Vertices::GeneratorProperties<> , Vertices::LoadProperties > - , typename PathFindingAlgorithm = DominatingThetaPath - , typename MeasurementCollection = IO::DtpRuntimeCollection + , typename PathFindingAlgorithm = DominatingThetaPath + , typename MeasurementCollection = IO::DtpRuntimeCollection , CentralityCounter CentralityCounterType = CentralityCounter::counterAtEdges > /**< Distinguish between counting edges or vertices. */ class GeneratorBasedBetweennessCentrality final : public BetweennessCentrality < typename NetworkType::TGraph , PathFindingAlgorithm , MeasurementCollection - , CentralityCounterType > + , CentralityCounterType > { public: #pragma mark TYPE_ALIASING @@ -84,11 +84,11 @@ class GeneratorBasedBetweennessCentrality final : public BetweennessCentrality < ///@name Constructors and Destructor ///@{ #pragma mark CONSTRUCTORS_AND_DESTRUCTORS - GeneratorBasedBetweennessCentrality ( TNetwork const & network ) + GeneratorBasedBetweennessCentrality ( TNetwork const & network ) : TBetweennessCentrality( network.Graph() ) , network_( network ) {} - + /** * @brief Destroys the object. */ @@ -99,7 +99,7 @@ class GeneratorBasedBetweennessCentrality final : public BetweennessCentrality < ///@name Execute the Betweenness Centrality Algorithm ///@{ #pragma mark EXECUTE_ALGORITHM - + /** * @brief Run the generator-based betweenness centrality. * @details If OpenMP is available this method will run in @@ -111,13 +111,13 @@ class GeneratorBasedBetweennessCentrality final : public BetweennessCentrality < * https://en.cppreference.com/w/cpp/container . */ inline void Run () - { + { TNumberOfPaths numberOfPaths; TRelativeNumberOfPaths relativeNumberOfPaths; this->Clear ( numberOfPaths, relativeNumberOfPaths ); - network_.template for_all_vertex_identifiers_with_generator ( [ + network_.template for_all_vertex_identifiers_with_generator ( [ this , & numberOfPaths , & relativeNumberOfPaths ] ( TGeneratorId vertexId ) @@ -130,9 +130,9 @@ class GeneratorBasedBetweennessCentrality final : public BetweennessCentrality < this->TotalNumberOfPaths( numberOfPaths, relativeNumberOfPaths ); #ifdef EGOA_ENABLE_STATISTIC_BETWEENNESS_CENTRALITY // COLLECT RUNTIME INFORMATION - #pragma omp critical - { // More information concerning standard container - // concurrency under "Thread safety": + #pragma omp critical + { // More information concerning standard container + // concurrency under "Thread safety": // https://en.cppreference.com/w/cpp/container this->Algorithm()[omp_get_thread_num()].Statistic().NumberOfGenerators = network_.NumberOfGenerators(); this->Algorithm()[omp_get_thread_num()].Statistic().NumberOfLoads = network_.NumberOfLoads(); diff --git a/include/Algorithms/GraphTraversal/ArticulationVertexDetection.hpp b/include/Algorithms/GraphTraversal/ArticulationVertexDetection.hpp index 60269504..7ad56bea 100644 --- a/include/Algorithms/GraphTraversal/ArticulationVertexDetection.hpp +++ b/include/Algorithms/GraphTraversal/ArticulationVertexDetection.hpp @@ -9,7 +9,7 @@ #include "Algorithms/GraphTraversal/DepthFirstSearch.hpp" -namespace egoa { +namespace egoa { /** * @brief Class to find articulation vertices. @@ -66,7 +66,7 @@ class ArticulationVertexDetection : public DepthFirstSearchEntryTimeAt( vertex ); } @@ -125,10 +125,10 @@ class ArticulationVertexDetection : public DepthFirstSearch 1); @@ -151,7 +151,7 @@ class ArticulationVertexDetection : public DepthFirstSearch 1 ) { // root articulation point return true; @@ -173,9 +173,9 @@ class ArticulationVertexDetection : public DepthFirstSearchParentOf ( vertex ) == OldestReachableAncestor ( vertex ) - && !IsRoot ( this->ParentOf( vertex ) ) - ) + if ( this->ParentOf ( vertex ) == OldestReachableAncestor ( vertex ) + && !IsRoot ( this->ParentOf( vertex ) ) + ) { return true; } @@ -198,7 +198,7 @@ class ArticulationVertexDetection : public DepthFirstSearch IsBridgeArticulationVertexAt ( TVertexId const vertex ) const { if ( vertex == OldestReachableAncestor ( vertex ) ) { - if ( TreeOutDegree ( vertex ) > 0 ) + if ( TreeOutDegree ( vertex ) > 0 ) { // The vertex is not a leaf return std::make_pair(true,true); } @@ -235,7 +235,7 @@ class ArticulationVertexDetection : public DepthFirstSearch timeOfOldestReachableAncestor_; /**< Oldest reachable ancestor representing the vertex closest to the root */ std::vector treeOutDegree_; /**< Number of outgoing DFS tree edges per vertex */ std::vector isArticulationVertex_; /**< Whether the vertex is an articulation vertex */ diff --git a/include/Algorithms/GraphTraversal/BreadthFirstSearch.hpp b/include/Algorithms/GraphTraversal/BreadthFirstSearch.hpp index e4710a07..6638d750 100644 --- a/include/Algorithms/GraphTraversal/BreadthFirstSearch.hpp +++ b/include/Algorithms/GraphTraversal/BreadthFirstSearch.hpp @@ -33,7 +33,7 @@ namespace egoa { * @tparam IsDirected If @p true the graph is treated as a directed graph, * if @p false the graph is treated as an undirected graph. */ -template< typename GraphType = StaticGraph,Edges::ElectricalProperties> +template< typename GraphType = StaticGraph,Edges::ElectricalProperties> , typename QueueType = StdQueue , bool IsDirected= false > class BFS final : Traversal { @@ -56,7 +56,7 @@ class BFS final : Traversal { */ virtual inline void Run() { ESSENTIAL_ASSERT ( queue_.Empty() ); - + EnqueueVertexWith ( source_ ); SetVertexVisitedAt ( source_ ); diff --git a/include/Algorithms/GraphTraversal/CycleDetection.hpp b/include/Algorithms/GraphTraversal/CycleDetection.hpp index 53df45c3..afcb4772 100644 --- a/include/Algorithms/GraphTraversal/CycleDetection.hpp +++ b/include/Algorithms/GraphTraversal/CycleDetection.hpp @@ -9,7 +9,7 @@ #include "Algorithms/GraphTraversal/DepthFirstSearch.hpp" -namespace egoa { +namespace egoa { /** * @brief Class to detect a cycle in the graph. @@ -45,7 +45,7 @@ class CycleDetection final : public DFS { virtual inline void ProcessingEdgeWith ( TVertex const source , TVertex const target ) override { - if ( source != ParentOf ( target ) ) { + if ( source != ParentOf ( target ) ) { ExtractPath ( source, target ); SetTerminate(); } diff --git a/include/Algorithms/GraphTraversal/DepthFirstSearch.hpp b/include/Algorithms/GraphTraversal/DepthFirstSearch.hpp index 576bc142..f95d20a6 100644 --- a/include/Algorithms/GraphTraversal/DepthFirstSearch.hpp +++ b/include/Algorithms/GraphTraversal/DepthFirstSearch.hpp @@ -41,7 +41,7 @@ class DepthFirstSearch : public Traversal { ///@name Constructors and destructor ///@{ #pragma mark CONSTRUCTOR_AND_DESTRUCTOR - + /** * @brief Constructs a new DFS instance. * @@ -75,7 +75,7 @@ class DepthFirstSearch : public Traversal { PreprocessingVertexWith ( source ); this->breakable_for_all_edges_at ( source, - [source, &dfs, this]( typename GraphType::TEdge const & edge ) + [source, &dfs, this]( typename GraphType::TEdge const & edge ) { TVertexId target = edge.Other ( source ); @@ -84,11 +84,11 @@ class DepthFirstSearch : public Traversal { bool targetVisited = this->VisitedVertexAt( target ); - if ( !targetVisited ) + if ( !targetVisited ) { this->ParentOf( target ) = source; dfs ( target, dfs ); - } else /* not processed */ + } else /* not processed */ { // Cycle edge ProcessingEdgeWith( source, target, edge.Identifier() ); } @@ -121,35 +121,35 @@ class DepthFirstSearch : public Traversal { * @param[in] target The target identifier. * * @return The DFS edge type. - * + * * @todo Cross edge is only possible in directed case -> check for graph type */ - inline DfsEdgeType TypifyEdge ( TVertexId source, TVertexId target ) + inline DfsEdgeType TypifyEdge ( TVertexId source, TVertexId target ) { // Tree edge - if ( source == this->ParentOf ( target ) ) + if ( source == this->ParentOf ( target ) ) { return DfsEdgeType::tree; } - + // Backward edge - if ( this->VisitedVertexAt ( target ) - && !this->ProcessedVertexAt ( target ) ) + if ( this->VisitedVertexAt ( target ) + && !this->ProcessedVertexAt ( target ) ) { return DfsEdgeType::backward; } - + // Forward edge - if ( this->ProcessedVertexAt ( target ) - && EntryTimeAt ( target ) > EntryTimeAt ( source ) ) + if ( this->ProcessedVertexAt ( target ) + && EntryTimeAt ( target ) > EntryTimeAt ( source ) ) { return DfsEdgeType::forward; } - + // Cross edge - if ( this->ProcessedVertexAt ( target ) + if ( this->ProcessedVertexAt ( target ) && EntryTimeAt ( target ) < EntryTimeAt ( source ) ) return DfsEdgeType::cross; - + // None of them -> should not happening ESSENTIAL_ASSERT( false && "DFS edge type is none." ); } @@ -159,7 +159,7 @@ class DepthFirstSearch : public Traversal { /** * @brief Terminate the DFS * - * @return TRUE if the DFS + * @return TRUE if the DFS */ inline bool Terminate() const { return terminate_; } inline void SetTerminate() { terminate_ = true; } @@ -185,9 +185,9 @@ class DepthFirstSearch : public Traversal { * * @return { description_of_the_return_value } */ - inline TTime EntryTimeAt ( TVertexId vertexId ) const - { - return entryTime_[vertexId]; + inline TTime EntryTimeAt ( TVertexId vertexId ) const + { + return entryTime_[vertexId]; } /** @@ -197,15 +197,15 @@ class DepthFirstSearch : public Traversal { * * @return The exit time for a vertex during the DFS. */ - inline TTime ExitTimeAt ( TVertexId const vertexId ) const - { - return exitTime_[vertexId]; + inline TTime ExitTimeAt ( TVertexId const vertexId ) const + { + return exitTime_[vertexId]; } //exact behavior of the Depth-First Search (DFS) depends on the processing methods #pragma mark FURTHER_PROCESSING - + /** * @brief Preprocessing the vertex with @p vertexId. * @@ -218,9 +218,9 @@ class DepthFirstSearch : public Traversal { */ // template virtual - inline + inline void PreprocessingVertexWith ( TVertexId vertexId - // , FUNCTION function + // , FUNCTION function ) { // function ( vertexId ); @@ -238,22 +238,22 @@ class DepthFirstSearch : public Traversal { */ // template virtual - inline + inline void PostprocessingVertexWith ( TVertexId vertexId - // , FUNCTION function - ) + // , FUNCTION function + ) { // function ( vertexId ); } // template virtual - inline + inline void ProcessingEdgeWith ( TVertexId source , TVertexId target - , Types::edgeId edgeId - // , FUNCTION function - ) + , Types::edgeId edgeId + // , FUNCTION function + ) { // function ( source, target, edgeId ); } @@ -270,12 +270,12 @@ class DepthFirstSearch : public Traversal { */ // template virtual - inline + inline void PostprocessingEdgeWith ( TVertexId source , TVertexId target - , Types::edgeId edgeId - // , FUNCTION function - ) + , Types::edgeId edgeId + // , FUNCTION function + ) { // function ( source, target, edgeId ); } @@ -291,4 +291,4 @@ class DepthFirstSearch : public Traversal { } // namespace egoa -#endif // EGOA__ALGORITHMS__GRAPH_TRAVERSAL__DEPTH_FIRST_SEARCH__HPP \ No newline at end of file +#endif // EGOA__ALGORITHMS__GRAPH_TRAVERSAL__DEPTH_FIRST_SEARCH__HPP diff --git a/include/Algorithms/GraphTraversal/Traversal.hpp b/include/Algorithms/GraphTraversal/Traversal.hpp index 2a513cbf..4e9c66cb 100644 --- a/include/Algorithms/GraphTraversal/Traversal.hpp +++ b/include/Algorithms/GraphTraversal/Traversal.hpp @@ -31,7 +31,7 @@ class GraphTypeLoopDifferentiation; * @tparam IsDirected If @p true the graph is treated as a directed graph, * if @p false the graph is treated as an undirected graph. */ -template< typename GraphType, +template< typename GraphType, bool IsDirected = false > class Traversal { public: @@ -41,7 +41,7 @@ class Traversal { ///@name Constructors and destructor ///@{ #pragma mark CONSTRUCTOR_AND_DESTRUCTOR - + /** * @brief Constructs a new instance. * @@ -70,7 +70,7 @@ class Traversal { ///@} #pragma mark RESULT_EXTRACTION - virtual inline void Result ( std::vector parent ) + virtual inline void Result ( std::vector parent ) { // @todo Implement, see MST throw std::runtime_error("Not implemented yet!"); @@ -86,7 +86,7 @@ class Traversal { * * @param[in] vertexId The vertex identifier. */ - inline void SetVertexVisitedAt ( TVertexId vertexId ) + inline void SetVertexVisitedAt ( TVertexId vertexId ) { USAGE_ASSERT ( graph_.VertexExists ( vertexId ) ); visited_[vertexId] = true; @@ -101,10 +101,10 @@ class Traversal { * * @return @p true if the vertex was visited, otherwise @p false. */ - inline bool VisitedVertexAt ( TVertexId vertexId ) const + inline bool VisitedVertexAt ( TVertexId vertexId ) const { USAGE_ASSERT ( graph_.VertexExists ( vertexId ) ); - return visited_[vertexId]; + return visited_[vertexId]; } ///@} @@ -116,7 +116,7 @@ class Traversal { * * @param[in] vertexId The vertex identifier. */ - inline void SetVertexProcessedAt ( TVertexId vertexId ) + inline void SetVertexProcessedAt ( TVertexId vertexId ) { USAGE_ASSERT ( graph_.VertexExists ( vertexId ) ); processed_[vertexId] = true; @@ -132,10 +132,10 @@ class Traversal { * * @return @p true if the vertex is processed, otherwise @p false. */ - inline bool ProcessedVertexAt ( TVertexId vertexId ) const + inline bool ProcessedVertexAt ( TVertexId vertexId ) const { USAGE_ASSERT ( graph_.VertexExists ( vertexId ) ); - return processed_[vertexId]; + return processed_[vertexId]; } ///@} @@ -149,16 +149,16 @@ class Traversal { * @return The vertex identifier of the parent. */ ///@{ - inline TVertexId & ParentOf ( TVertexId vertexId ) + inline TVertexId & ParentOf ( TVertexId vertexId ) { USAGE_ASSERT ( graph_.VertexExists ( vertexId ) ); - return parent_[vertexId]; + return parent_[vertexId]; } - inline TVertexId ParentOf ( TVertexId vertexId ) const + inline TVertexId ParentOf ( TVertexId vertexId ) const { USAGE_ASSERT ( graph_.VertexExists ( vertexId ) ); - return parent_[vertexId]; + return parent_[vertexId]; } ///@} @@ -178,7 +178,7 @@ class Traversal { /** * @brief Clear and resize all vectors */ - inline void Clear () + inline void Clear () { visited_.clear (); visited_.resize ( graph_.NumberOfVertices(), false ); @@ -190,12 +190,12 @@ class Traversal { parent_.resize ( graph_.NumberOfVertices(), Const::NONE ); } - inline bool VertexExists ( TVertexId vertexId ) + inline bool VertexExists ( TVertexId vertexId ) { return graph_.VertexExists ( vertexId ); } - inline bool NumberOfVertices() + inline bool NumberOfVertices() { return graph_.NumberOfVertices ( ); } @@ -217,8 +217,8 @@ class Traversal { * * @code{.cpp} * breakable_for_all_edges_at( - * []( TEdge const & edge ) - * { + * []( TEdge const & edge ) + * { * // Do something with the edge object. * } * ); @@ -240,16 +240,16 @@ class Traversal { * * @param vertexId The vertex identifier. * @param[in] function The function - * + * * @code{.cpp} * for_all_edges_at ( vertexId - * , []( TEdge const & edge ) - * { + * , []( TEdge const & edge ) + * { * // Do something with the edge object. * } * ); * @endcode - * + * * @tparam FUNCTION The function object that is called for * all incident (outgoing) edges at @p vertexId. */ @@ -288,19 +288,19 @@ class GraphTypeLoopDifferentiation< GraphType, true > { public: template - static inline + static inline void breakable_for_all_edges_at ( TGraph const & graph , TVertexId const & vertex - , FUNCTION function ) + , FUNCTION function ) { graph.template for_out_edges_at ( vertex, function ); } template - static inline + static inline void for_all_edges_at ( TGraph const & graph , TVertexId const & vertex - , FUNCTION function ) + , FUNCTION function ) { graph.template for_out_edges_at ( vertex, function ); } @@ -316,19 +316,19 @@ class GraphTypeLoopDifferentiation< GraphType, false > { public: template - static inline + static inline void breakable_for_all_edges_at ( TGraph const & graph , TVertexId const & vertex - , FUNCTION function ) + , FUNCTION function ) { graph.template for_all_edges_at ( vertex, function ); } template - static inline + static inline void for_all_edges_at ( TGraph & graph , TVertexId const & vertex - , FUNCTION function ) + , FUNCTION function ) { graph.template for_all_edges_at ( vertex, function ); } diff --git a/include/Algorithms/PathFinding/DominatingThetaPath.hpp b/include/Algorithms/PathFinding/DominatingThetaPath.hpp index 1ecca995..15d44d8c 100644 --- a/include/Algorithms/PathFinding/DominatingThetaPath.hpp +++ b/include/Algorithms/PathFinding/DominatingThetaPath.hpp @@ -120,20 +120,20 @@ class DominatingThetaPath final { Auxiliary::Timer dtpTime; - while ( !QueueEmpty() ) + while ( !QueueEmpty() ) { // Q != {} TLabel const label = QueueDeleteMinimum(); const TVertexId u = label.Vertex(); ESSENTIAL_ASSERT ( u < graph_.NumberOfVertices() ); // For all incident edges - graph_.template for_all_edges_at( u, - [&]( TEdge const & edge ) + graph_.template for_all_edges_at( u, + [&]( TEdge const & edge ) { ESSENTIAL_ASSERT ( u < graph_.NumberOfVertices() ); - + TVertexId v = edge.Other(u); - + ESSENTIAL_ASSERT ( v < graph_.NumberOfVertices() ); #ifdef EGOA_ENABLE_STATISTIC_DTP // NUMBER OF SCANNED EDGES -> TOTAL NUMBER @@ -142,7 +142,7 @@ class DominatingThetaPath final { TLabel newlabel; if ( ProduceCycle( newlabel, label + edge ) ) return; - SetParentOf( newlabel, label ); + SetParentOf( newlabel, label ); #ifdef EGOA_ENABLE_STATISTIC_DTP // NUMBER OF EDGES NOT PRODUCING A CYCLE ++dtpRuntimeRow_.NumberOfEdgesProducingNoCycle; @@ -166,7 +166,7 @@ class DominatingThetaPath final { // std::cout << std::endl << dtpRuntimeRow_ << std::endl; std::cout << "Number of relaxed edges: " << dtpRuntimeRow_.NumberOfRelaxedEdges << std::endl; std::cout << "Number of labels: " << dtpRuntimeRow_.NumberOfLabels << std::endl<< std::endl; - // ESSENTIAL_ASSERT ( ( 1 + dtpRuntimeRow_.NumberOfRelaxedEdges ) + // ESSENTIAL_ASSERT ( ( 1 + dtpRuntimeRow_.NumberOfRelaxedEdges ) // == dtpRuntimeRow_.NumberOfLabels ); #endif } @@ -213,22 +213,22 @@ class DominatingThetaPath final { ESSENTIAL_ASSERT ( graph_.VertexExists( vertexId ) ); - if ( !isVertexInSubgraph[vertexId] ) + if ( !isVertexInSubgraph[vertexId] ) { isVertexInSubgraph[vertexId] = true; vertices.push_back(vertexId); } - if ( label.PreviousVertex() != Const::NONE ) + if ( label.PreviousVertex() != Const::NONE ) { // @todo multiple edges? It would be easier if the labels stored edges Types::edgeId edge = graph_.EdgeId ( vertexId, label.PreviousVertex() ); - if ( edge == Const::NONE ) + if ( edge == Const::NONE ) { edge = graph_.EdgeId ( label.PreviousVertex(), vertexId ); ESSENTIAL_ASSERT( edge != Const::NONE ); } - if (!isEdgeInSubgraph[edge]) + if (!isEdgeInSubgraph[edge]) { isEdgeInSubgraph[edge] = true; edges.push_back(edge); @@ -258,9 +258,9 @@ class DominatingThetaPath final { * @return The optimal value. */ inline Types::real Result ( std::vector> & parent - , TVertexId const target ) + , TVertexId const target ) { - USAGE_ASSERT ( graph_.VertexExists( target ) ); + USAGE_ASSERT ( graph_.VertexExists( target ) ); // Iterate over all optima Types::real result = \ @@ -268,17 +268,17 @@ class DominatingThetaPath final { { // Add a row for another label path from target t parent.emplace_back( std::vector() ); - + // Define function pointer for recursive call std::function FindPath; - + // Construct path from the source to the sink - FindPath = [this, &FindPath, & parent = parent] ( TLabel const & label ) + FindPath = [this, &FindPath, & parent = parent] ( TLabel const & label ) { - if ( ( Const::NONE == label.PreviousVertex() ) ) + if ( ( Const::NONE == label.PreviousVertex() ) ) { parent.back().emplace_back ( label.Vertex() ); - } else + } else { TVertexId vertexId = label.Vertex(); @@ -293,15 +293,15 @@ class DominatingThetaPath final { } /** - * @brief Current number of labels + * @brief Current number of labels * * @return Total number of labels */ - inline Types::count NumberOfLabels () + inline Types::count NumberOfLabels () { Types::count numberOfLabels = 0; - for ( TLabelSet const & labelSet : labelSets_ ) + for ( TLabelSet const & labelSet : labelSets_ ) { numberOfLabels += labelSet.Size(); } @@ -318,7 +318,7 @@ class DominatingThetaPath final { * * @param[in] source The source */ - inline void Source ( TVertexId source ) + inline void Source ( TVertexId source ) { USAGE_ASSERT ( source < labelSets_.size() ); Clear(); @@ -333,7 +333,7 @@ class DominatingThetaPath final { /** * @brief Clear all data structures. */ - inline void Clear() + inline void Clear() { labelSets_.clear(); labelSets_.assign( graph_.NumberOfVertices(), TLabelSet() ); @@ -349,7 +349,7 @@ class DominatingThetaPath final { * * @return The current statistic representing a row. */ - inline IO::DtpRuntimeRow & Statistic () + inline IO::DtpRuntimeRow & Statistic () { return dtpRuntimeRow_; } @@ -396,11 +396,11 @@ class DominatingThetaPath final { * @param numberOfPaths The number of paths. (Note that this * field will be resized to the number of vertices in the * graph if not already done.) - * + * * @todo Use DAG property of label paths. */ inline void NumberOfPathsThroughVertex ( TVertexId target - , std::vector & numberOfPathsPerVertex + , std::vector & numberOfPathsPerVertex , std::vector & relativeNumberOfPathsPerVertex ) { //@todo This is inefficient. @@ -409,7 +409,7 @@ class DominatingThetaPath final { numberOfPathsPerVertex.resize( graph_.NumberOfVertices(), 0 ); - labelSets_[target].for_all_optima ( + labelSets_[target].for_all_optima ( [&]( TLabel const & optLabel ) { Types::labelId labelId = optLabel.Index(); @@ -429,7 +429,7 @@ class DominatingThetaPath final { vertexId = label.PreviousVertex(); labelId = label.PreviousLabel(); - } while ( labelId != Const::NONE + } while ( labelId != Const::NONE && vertexId != Const::NONE ); } ); // For all labels in DTP at target vertex @@ -465,12 +465,12 @@ class DominatingThetaPath final { * field will be resized). * @param relativeNumberOfPathsPerEdge The edge score per thread (if we * run the algorithm parallel). - * + * * @todo Use DAG property of label paths. */ inline void NumberOfPathsThroughEdge ( TVertexId target , std::vector & numberOfPathsPerEdge - , std::vector & relativeNumberOfPathsPerEdge ) + , std::vector & relativeNumberOfPathsPerEdge ) { //@todo This is inefficient. Types::count numberOfOptimalLabels = LabelSetAt(target).Optima().size(); // Divide by this value @@ -485,16 +485,16 @@ class DominatingThetaPath final { TLabel & label = LabelAt( vertexId, labelId ); labelId = label.Index(); - if ( ( label.PreviousLabel() == Const::NONE ) - || ( label.PreviousVertex() == Const::NONE ) - || ( vertexId == Const::NONE ) + if ( ( label.PreviousLabel() == Const::NONE ) + || ( label.PreviousVertex() == Const::NONE ) + || ( vertexId == Const::NONE ) ) break; // Label is already on path // Increase number of paths at "edgeId" - TEdgeId edgeId = ( graph_.EdgeId( label.PreviousVertex(), vertexId ) != Const::NONE ) - ? graph_.EdgeId( label.PreviousVertex(), vertexId ) + TEdgeId edgeId = ( graph_.EdgeId( label.PreviousVertex(), vertexId ) != Const::NONE ) + ? graph_.EdgeId( label.PreviousVertex(), vertexId ) : graph_.EdgeId( vertexId, label.PreviousVertex() ); - + ESSENTIAL_ASSERT ( edgeId != Const::NONE ); ++numberOfPathsPerEdge[edgeId]; @@ -505,12 +505,12 @@ class DominatingThetaPath final { vertexId = label.PreviousVertex(); labelId = label.PreviousLabel(); - } while ( labelId != Const::NONE + } while ( labelId != Const::NONE && vertexId != Const::NONE ); }); // For all labels in DTP at target vertex } ///@} - + private: ///@name Accessors ///@{ @@ -523,12 +523,12 @@ class DominatingThetaPath final { * * @return The vertex identifier. */ - inline TVertexId VertexIdOf ( TLabel const & label ) const - { + inline TVertexId VertexIdOf ( TLabel const & label ) const + { USAGE_ASSERT ( !label.Empty() ); - return label.Vertex(); + return label.Vertex(); } - + /** * @brief Getter for the set of labels @f$\labels(\vertex)@f$ of a vertex @f$\vertex@f$. * @@ -536,10 +536,10 @@ class DominatingThetaPath final { * * @return The set of labels @f$\labels(\vertex)@f$ for the @p vertex. */ - inline TLabelSet const & LabelSetAt ( TVertexId const vertexId ) const - { - USAGE_ASSERT ( vertexId < labelSets_.size() ); - return labelSets_[vertexId]; + inline TLabelSet const & LabelSetAt ( TVertexId const vertexId ) const + { + USAGE_ASSERT ( vertexId < labelSets_.size() ); + return labelSets_[vertexId]; } /** @@ -551,10 +551,10 @@ class DominatingThetaPath final { * @return The set of labels @f$\labels(\vertex)@f$ for the @p * vertex. */ - inline TLabelSet & LabelSetAt ( TVertexId const vertexId ) - { - USAGE_ASSERT ( vertexId < labelSets_.size() ); - return labelSets_[vertexId]; + inline TLabelSet & LabelSetAt ( TVertexId const vertexId ) + { + USAGE_ASSERT ( vertexId < labelSets_.size() ); + return labelSets_[vertexId]; } /** @@ -567,10 +567,10 @@ class DominatingThetaPath final { * @return The label @f$\labelu@f$. */ inline TLabel & LabelAt ( TVertexId const vertexId - , Types::labelId const labelId ) + , Types::labelId const labelId ) { - USAGE_ASSERT ( vertexId < labelSets_.size() ); - USAGE_ASSERT ( labelId < Const::NONE ); + USAGE_ASSERT ( vertexId < labelSets_.size() ); + USAGE_ASSERT ( labelId < Const::NONE ); return labelSets_[vertexId].ElementAt ( labelId ); } @@ -585,23 +585,23 @@ class DominatingThetaPath final { * * @return @p True if the main queue is empty, @p False otherwise. */ - inline bool QueueEmpty() const - { - return queue_.Empty(); + inline bool QueueEmpty() const + { + return queue_.Empty(); } /** * @brief Adds a label to the main queue. - * + * * @pre A precondition to that method is that the label set of * the label's @p label vertex was updated. Thus, this method * should only be called by #UpdateLabelSet() or #UpdateLabelSetAt(). * * @param label The label. */ - inline void Insert( TLabel const & label ) - { - queue_.Emplace( label.Vertex(), label ); + inline void Insert( TLabel const & label ) + { + queue_.Emplace( label.Vertex(), label ); } /** @@ -615,12 +615,12 @@ class DominatingThetaPath final { * * @param newLabel The new label @f$\labelu_{\mathrm{new}}@f$. */ - inline void UpdateQueueWith ( TLabel const & newLabel ) + inline void UpdateQueueWith ( TLabel const & newLabel ) { - if ( !queue_.HasKeyOf ( newLabel.Vertex() ) ) + if ( !queue_.HasKeyOf ( newLabel.Vertex() ) ) { // There is no label of vertex v in the queue Insert ( newLabel ); - } else if ( queue_.KeyOf( newLabel.Vertex() ) > newLabel ) + } else if ( queue_.KeyOf( newLabel.Vertex() ) > newLabel ) { // The new label is better than the existing one queue_.ChangeKey ( newLabel.Vertex(), newLabel ); } @@ -633,23 +633,23 @@ class DominatingThetaPath final { * the main queue). * * @return Label that has the minimum key - * + * * @see TQueue */ - inline TLabel QueueDeleteMinimum () - { + inline TLabel QueueDeleteMinimum () + { USAGE_ASSERT ( !queue_.Empty() ); TVertexId vertexId; TLabel label; - std::tie ( vertexId, label ) = queue_.DeleteTop(); - + std::tie ( vertexId, label ) = queue_.DeleteTop(); + ESSENTIAL_ASSERT ( !LabelSetEmptyAt(vertexId) ); label.Index() = UpdateLabelSetAt ( vertexId ); - return label; - } + return label; + } /** * @brief Check if a label set @f$\labels(\vertex)@f$ is @@ -659,10 +659,10 @@ class DominatingThetaPath final { * * @return @p True if the label set is empty, @p False otherwise. */ - inline bool LabelSetEmptyAt( TVertexId const vertexId ) const - { - USAGE_ASSERT ( vertexId < labelSets_.size() ); - return labelSets_[vertexId].EmptyQueue(); + inline bool LabelSetEmptyAt( TVertexId const vertexId ) const + { + USAGE_ASSERT ( vertexId < labelSets_.size() ); + return labelSets_[vertexId].EmptyQueue(); } /** @@ -674,11 +674,11 @@ class DominatingThetaPath final { * @return @p True if the label set @f$\labels(\vertex)@f$ is * empty, @p False otherwise. */ - inline bool LabelSetEmptyAt( TLabel const & label ) const - { + inline bool LabelSetEmptyAt( TLabel const & label ) const + { USAGE_ASSERT ( !label.Empty() ); - return LabelSetEmptyAt( VertexIdOf ( label ) ); - } + return LabelSetEmptyAt( VertexIdOf ( label ) ); + } /** * @brief Update a label set @f$\labels(\vertex)@f$ at a vertex @f$\vertex@f$. @@ -687,19 +687,19 @@ class DominatingThetaPath final { * update (#labelSet.Pop()) of the label set * @f$\labels(\vertex)@f$ at a vertex * @f$\vertex@f$. - * + * * @pre As a precondition #QueueDeleteMinimum() has to be * called. * * @param labelSet The label set @f$\labels(\vertex)@f$ at a * vertex @f$\vertex@f$. */ - inline Types::labelId UpdateLabelSet ( TLabelSet & labelSet ) - { + inline Types::labelId UpdateLabelSet ( TLabelSet & labelSet ) + { USAGE_ASSERT ( !labelSet.Empty() ); Types::labelId labelId = labelSet.Pop(); - + if ( ! labelSet.EmptyQueue() ) { Insert ( labelSet.Top() ); } @@ -713,17 +713,17 @@ class DominatingThetaPath final { * vertex @f$\vertex@f$ from the queue has to trigger an * update (#labelSet.Pop()) of the label bucket at vertex * @f$\vertex@f$. - * + * * @pre As a precondition #QueueDeleteMinimum() has do be * called. * * @param[in] vertexId The vertex identifier of vertex @f$\vertex@f$. - * + * * @see DominatingThetaPath#UpdateBucket */ - inline Types::labelId UpdateLabelSetAt ( TVertexId vertexId ) - { - USAGE_ASSERT ( vertexId < labelSets_.size() ); + inline Types::labelId UpdateLabelSetAt ( TVertexId vertexId ) + { + USAGE_ASSERT ( vertexId < labelSets_.size() ); return UpdateLabelSet ( labelSets_[vertexId] ); } ///@} @@ -740,7 +740,7 @@ class DominatingThetaPath final { * @param previousLabel The previous label @f$\labelu_p@f$ */ inline void SetParentOf ( TLabel & label - , TLabel const & previousLabel ) + , TLabel const & previousLabel ) { label.PreviousVertex() = previousLabel.Vertex(); label.PreviousLabel() = previousLabel.Index(); @@ -763,7 +763,7 @@ class DominatingThetaPath final { * @return @p True if the merging was successful, @p False otherwise. */ inline bool MergeLabelAt( TVertexId vertexId - , TLabel & label ) + , TLabel & label ) { return labelSets_[vertexId].template Merge( label ); } @@ -783,10 +783,10 @@ class DominatingThetaPath final { * @return @p True if the new label produces a cycle, @p False otherwise. */ inline bool ProduceCycle ( TLabel & label - , std::pair && pair ) + , std::pair && pair ) { label = std::get<0>(pair); - return !( std::get<1>(pair) ); + return !( std::get<1>(pair) ); } ///@} diff --git a/include/Algorithms/SpanningTree/Kruskal.hpp b/include/Algorithms/SpanningTree/Kruskal.hpp index ac637a94..ac89bb85 100644 --- a/include/Algorithms/SpanningTree/Kruskal.hpp +++ b/include/Algorithms/SpanningTree/Kruskal.hpp @@ -46,13 +46,13 @@ class Kruskal final : public MST { * @details Kruskal's algorithm runs in O(|E| lg |V|) using binary * heaps and calculates a MST. It uses techniques that are also * common for connected component algorithms. - * + * * Steps: * 1. Increases the MST by exactly one edge in each iteration * 2. It starts with |V| components * 3. In each iteration the number of connected components shrinks by 1 * 4. To manage the connected components it uses a disjoint-set data structure - * + * */ virtual inline void Run() override { UnionFind unionFind( this->Graph().NumberOfVertices() ); @@ -69,7 +69,7 @@ class Kruskal final : public MST { std::vector spanningTreeEdges; - for ( Types::edgeId edge : edges ) + for ( Types::edgeId edge : edges ) { Types::vertexId source = this->Graph().EdgeAt( edge ).Source(); Types::vertexId target = this->Graph().EdgeAt( edge ).Target(); @@ -85,4 +85,4 @@ class Kruskal final : public MST { } // namespace egoa -#endif // EGOA__ALGORITHMS__SPANNING_TREES__KRUSKAL_HPP \ No newline at end of file +#endif // EGOA__ALGORITHMS__SPANNING_TREES__KRUSKAL_HPP diff --git a/include/Algorithms/SpanningTree/MST.hpp b/include/Algorithms/SpanningTree/MST.hpp index 878138bb..90c7a25a 100644 --- a/include/Algorithms/SpanningTree/MST.hpp +++ b/include/Algorithms/SpanningTree/MST.hpp @@ -59,15 +59,15 @@ class MST { * * @return The subgraph representing the calculated spanning tree. */ - inline Subgraph const & Result() const + inline Subgraph const & Result() const { return spanningTree_; } - friend std::ostream & operator<<( std::ostream & os, MST const & rhs ) + friend std::ostream & operator<<( std::ostream & os, MST const & rhs ) { auto & graph = rhs.spanningTree_.Graph(); - for ( auto edgeId : rhs.spanningTree_.Edges() ) + for ( auto edgeId : rhs.spanningTree_.Edges() ) { auto & edge = graph.EdgeAt(edgeId); os << "(" << edge.Source() << ", " << edge.Target() << ");\n"; @@ -83,11 +83,11 @@ class MST { * * @param edges The edges in the spanning tree. */ - void SetResult(std::vector && edges) + void SetResult(std::vector && edges) { std::vector vertices; vertices.reserve(Graph().NumberOfVertices()); - Graph().template for_all_vertex_identifiers( [&vertices](Types::vertexId id) + Graph().template for_all_vertex_identifiers( [&vertices](Types::vertexId id) { vertices.push_back(id); }); diff --git a/include/Algorithms/SpanningTree/Prim.hpp b/include/Algorithms/SpanningTree/Prim.hpp index 8e2426fb..eea1e1fb 100644 --- a/include/Algorithms/SpanningTree/Prim.hpp +++ b/include/Algorithms/SpanningTree/Prim.hpp @@ -22,7 +22,7 @@ namespace egoa { * prim.Run(); * Subgraph spanningTree = prim.Result(); * @endcode - * + * * @tparam GraphType The type of the graph. * @tparam WeightType The type of the edge weights. */ @@ -48,12 +48,12 @@ class Prim final : public MST { * algorithm. Prim runs in O(|E| log |V|) using binary heaps. * While using Fibonacci heaps the running time is then in O(|E| + * |V| log |V|). The latter is an improvement while |V| << |E|. - * + * * Steps: * 1. While not all vertices are in the MST component * 2. Relax the incident edges to u if necessary - * 3. Choose the edge that has the minimum weight between - * the grown MST component and the non-MST component, i.e., + * 3. Choose the edge that has the minimum weight between + * the grown MST component and the non-MST component, i.e., * no cycle will be created * * @pre This algorithm assumes that the vertex identifiers all lie in @@ -85,11 +85,11 @@ class Prim final : public MST { // Ignore edges to vertices that have already been included in the MST if (isVertexInMst[neighbor]) return; - if (!visited[neighbor]) + if (!visited[neighbor]) { // The neighbor has not been visited before heap.Insert(neighbor, edge.Identifier()); visited[neighbor] = true; - } else if ( this->Comparator()( edge.Identifier(), heap.KeyOf(neighbor) ) ) + } else if ( this->Comparator()( edge.Identifier(), heap.KeyOf(neighbor) ) ) { // Better edge to neighbor has been found heap.ChangeKey(neighbor, edge.Identifier()); diff --git a/include/Auxiliary/Auxiliary.hpp b/include/Auxiliary/Auxiliary.hpp index e661ab27..19065d5c 100644 --- a/include/Auxiliary/Auxiliary.hpp +++ b/include/Auxiliary/Auxiliary.hpp @@ -24,7 +24,7 @@ namespace egoa::Auxiliary { * @return The number of allowed threads. */ inline Types::count NumberOfThreads () { return omp_get_num_threads(); } - + /** * @brief Maximum number of possible threads. * @@ -71,7 +71,7 @@ namespace egoa::Auxiliary { * http://realtimecollisiondetection.net/blog/?p= * https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ * https://randomascii.wordpress.com/2012/06/26/doubles-are-not-floats-so-dont-compare-them/ - * + * * The absolute tolerance test fails when x and y become large, and the * relative tolerance test fails when they become small. It is therefore * desired to combine these two tests together in a single test. Over the @@ -86,7 +86,7 @@ namespace egoa::Auxiliary { * * @return TRUE if both doubles are equal with regards to the tolerance, FALSE otherwise. */ -inline bool EQ (double a, double b, double absTol = Const::EPSILON, double relTol = Const::EPSILON) +inline bool EQ (double a, double b, double absTol = Const::EPSILON, double relTol = Const::EPSILON) { if ( fabs(a - b) <= absTol * std::max(1.0, ( relTol/absTol * std::max(fabs(a), fabs(b)) ) ) ) return true; @@ -116,7 +116,7 @@ struct MatchPathSeparator /** * @brief Path separator in Windows systems - * + * * @param ch [description] * @return [description] */ @@ -136,12 +136,12 @@ struct MatchPathSeparator * * @return The filename */ -inline Types::string Basename( Types::string const & pathname ) +inline Types::string Basename( Types::string const & pathname ) { - return std::string( - std::find_if( pathname.rbegin(), + return std::string( + std::find_if( pathname.rbegin(), pathname.rend(), - MatchPathSeparator() + MatchPathSeparator() ).base(), pathname.end() ); } @@ -153,7 +153,7 @@ inline Types::string Basename( Types::string const & pathname ) * * @return The filename without the extension. */ -inline Types::string RemoveExtension( std::string const & filename ) +inline Types::string RemoveExtension( std::string const & filename ) { std::string::const_reverse_iterator pivot = std::find( filename.rbegin(), filename.rend(), '.' ); return pivot == filename.rend() ? filename : std::string( filename.begin(), pivot.base() - 1 ); diff --git a/include/Auxiliary/Comparators.hpp b/include/Auxiliary/Comparators.hpp index 12c2b20e..c977edea 100644 --- a/include/Auxiliary/Comparators.hpp +++ b/include/Auxiliary/Comparators.hpp @@ -34,7 +34,7 @@ class VectorBasedComparator { comparator_(std::move(comparator)) {} - bool operator()(Types::index lhs, Types::index rhs) const + bool operator()(Types::index lhs, Types::index rhs) const { return comparator_(weights_[lhs], weights_[rhs]); } diff --git a/include/Auxiliary/Constants.hpp b/include/Auxiliary/Constants.hpp index 1027e579..a9e19f81 100644 --- a/include/Auxiliary/Constants.hpp +++ b/include/Auxiliary/Constants.hpp @@ -23,8 +23,8 @@ namespace egoa::Const { // 1 ns (for nanosecond) correspond to 1,000,000,000 s (for seconds) constexpr Types::count NSEC_PER_SEC = 1000000000; // pow(10,9) // 1 ns (for nanosecond) correspond to 1,000,000 ms (for milliseconds) - constexpr Types::count NSEC_PER_MILLISEC = 1000000; - constexpr Types::count MILLISEC_PER_SEC = 1000; + constexpr Types::count NSEC_PER_MILLISEC = 1000000; + constexpr Types::count MILLISEC_PER_SEC = 1000; constexpr Types::real EPSILON = std::numeric_limits::epsilon(); constexpr Types::index NONE = std::numeric_limits::max(); diff --git a/include/Auxiliary/ContainerLoop.hpp b/include/Auxiliary/ContainerLoop.hpp index 8e7e3a1d..142583d4 100644 --- a/include/Auxiliary/ContainerLoop.hpp +++ b/include/Auxiliary/ContainerLoop.hpp @@ -44,7 +44,7 @@ struct ContainerLoop { * @tparam FUNCTION The type of the function object. */ template - static void for_each ( Container const & container, FUNCTION function ) + static void for_each ( Container const & container, FUNCTION function ) { using std::begin, std::end; std::for_each(begin(container), end(container), function); @@ -67,7 +67,7 @@ struct ContainerLoop { * @tparam FUNCTION The type of the function object. */ template - static void for_each ( Container const & container, FUNCTION function ) + static void for_each ( Container const & container, FUNCTION function ) { using std::begin, std::end; @@ -75,7 +75,7 @@ struct ContainerLoop { auto last = end(container); for ( auto it = begin(container) ; toContinue && it != last - ; ++it ) + ; ++it ) { toContinue = function(*it); } @@ -100,12 +100,12 @@ struct ContainerLoop { * @tparam FUNCTION The type of the function object. */ template - static void for_each ( Container const & container, FUNCTION function ) + static void for_each ( Container const & container, FUNCTION function ) { #pragma omp parallel for for ( Types::index i = 0 ; i < container.size() - ; ++i ) + ; ++i ) { function(container[i]); } diff --git a/include/Auxiliary/ExecutionPolicy.hpp b/include/Auxiliary/ExecutionPolicy.hpp index d3a784ca..a88f8aac 100644 --- a/include/Auxiliary/ExecutionPolicy.hpp +++ b/include/Auxiliary/ExecutionPolicy.hpp @@ -29,4 +29,4 @@ enum class ExecutionPolicy { } -#endif // EGOA__AUXILIARY__EXECUTION_POLICY_HPP \ No newline at end of file +#endif // EGOA__AUXILIARY__EXECUTION_POLICY_HPP diff --git a/include/Auxiliary/Timer.hpp b/include/Auxiliary/Timer.hpp index 6623999c..831a5065 100644 --- a/include/Auxiliary/Timer.hpp +++ b/include/Auxiliary/Timer.hpp @@ -3,7 +3,7 @@ * * Created on: Jan 29, 2019 * Author: Franziska Wegner - * + * * Sources of discussion: * * https://blog.habets.se/2010/09/gettimeofday-should-never-be-used-to-measure-time.html * * https://linux.die.net/man/2/clock_gettime @@ -20,7 +20,7 @@ #include "Types.hpp" // Linux operation systems such as Debian, Ubuntu, Gentoo, Fedora, openSUSE, RedHat, or Centos -#if defined (__linux__) +#if defined (__linux__) #include #include // Apple and iOS @@ -34,23 +34,23 @@ namespace egoa::Auxiliary { /** * @class Timer - * + * * @details The timer class provides an interface to measure the * performance of the code. If not other set/stated the interface provides * the most robust and accurate timer for the underlying operation system. - * + * * @code{.cpp} * #include // just for sleep * #include // just for sleep - * + * * int main(int argc, char *argv[]) { * egoa::Auxiliary::Timer timer = egoa::Auxiliary::Timer(); - * + * * // Do something * ... * std::this_thread::sleep_for(std::chrono::milliseconds(9999)); // sleep 9999 ms - * - * std::cout << "Timer: " << timer.ElapsedMilliseconds() << std::endl; + * + * std::cout << "Timer: " << timer.ElapsedMilliseconds() << std::endl; * } * @endcode */ @@ -69,7 +69,7 @@ class Timer { * To use linux specific clock measurements the system must be a linux system * such as Debian, Ubuntu, Gentoo, Fedora, openSUSE, RedHat, or Centos. */ -#if defined (__linux__) +#if defined (__linux__) /** * System-wide clock measuring the real time (wall-clock). However, note that * this timer can be influenced by administrative clock changes, adjtime(), and NTP. @@ -121,12 +121,12 @@ class Timer { #elif defined(EGOA_TIMER_CLOCK_THREAD_CPUTIME_ID) clockid_t linuxClockId = CLOCK_THREAD_CPUTIME_ID; // inline void GetTime( struct timespec * ts ) { - // clock_gettime(CLOCK_THREAD_CPUTIME_ID, ts); + // clock_gettime(CLOCK_THREAD_CPUTIME_ID, ts); // } #else - clockid_t linuxClockId = CLOCK_MONOTONIC_RAW; -#endif // Specified clock measurement - struct timespec start_; + clockid_t linuxClockId = CLOCK_MONOTONIC_RAW; +#endif // Specified clock measurement + struct timespec start_; /** * @brief Timestamp @@ -147,7 +147,7 @@ class Timer { /** * @brief Elapsed time - * + * * @details Calculates the difference between the current time and * start time that represents the duration. * @@ -161,7 +161,7 @@ class Timer { /** * @brief Elapsed time in milliseconds - * + * * @details Calculates the difference between the current time and * start time that represents the duration. * @@ -176,7 +176,7 @@ class Timer { /** * @brief Gets the clock resolution representing the granularity. * @details A possible output is - * CLOCK_MONOTONIC has a resolution of 1ns, and + * CLOCK_MONOTONIC has a resolution of 1ns, and * CLOCK_MONOTONIC_COARSE has a resolution of 999848ns (about 1ms). * * @return The clock resolution. @@ -201,7 +201,7 @@ class Timer { } inline void TimespecToMilliseconds ( struct timespec * ts - , Types::largeReal & milliseconds ) + , Types::largeReal & milliseconds ) { milliseconds = ts->tv_sec * Const::MILLISEC_PER_SEC; milliseconds += static_cast( ts->tv_nsec ) / Const::NSEC_PER_MILLISEC; @@ -211,9 +211,9 @@ class Timer { return static_cast( ts->tv_sec * Const::MILLISEC_PER_SEC + ts->tv_nsec ) / Const::NSEC_PER_MILLISEC; } ///@} -// end of defined (__linux__) +// end of defined (__linux__) #elif defined(__APPLE__) && defined(__MACH__) // Apple and iOS - Types::posInteger start_; + Types::posInteger start_; /** * @brief Timestamp @@ -234,7 +234,7 @@ class Timer { /** * @brief Elapsed time - * + * * @details Calculates the difference between the current time and * start time that represents the duration. * @@ -247,7 +247,7 @@ class Timer { /** * @brief Elapsed time in milliseconds - * + * * @details Calculates the difference between the current time and * start time that represents the duration. * @@ -269,7 +269,7 @@ class Timer { /** * @brief Gets the clock resolution representing the granularity. * @details A possible output is - * CLOCK_MONOTONIC has a resolution of 1ns, and + * CLOCK_MONOTONIC has a resolution of 1ns, and * CLOCK_MONOTONIC_COARSE has a resolution of 999848ns (about 1ms). * * @return The clock resolution. @@ -287,4 +287,4 @@ class Timer { } // namespace egoa::Auxiliary -#endif // EGOA__AUXILIARY__TIMER_HPP \ No newline at end of file +#endif // EGOA__AUXILIARY__TIMER_HPP diff --git a/include/Auxiliary/Types.hpp b/include/Auxiliary/Types.hpp index 2ccc7d71..47810da8 100644 --- a/include/Auxiliary/Types.hpp +++ b/include/Auxiliary/Types.hpp @@ -40,7 +40,7 @@ namespace egoa::Types { typedef double real; /**< */ typedef long double largeReal; /**< */ - // String + // String typedef std::string string; /**< */ typedef std::string name; /**< */ @@ -49,7 +49,7 @@ namespace egoa::Types { typedef real loadSnapshot; /**< */ typedef real weightSnapshot; /**< */ typedef string timestampSnapshot; /**< */ - + /** * @brief Convert a string to a double @@ -60,7 +60,7 @@ namespace egoa::Types { * * @return The converted double */ - inline real String2double( std::string str ) + inline real String2double( std::string str ) { QRegularExpression rx("(^-?[0-9]?\\d*(\\.\\d+)?)"); // Filter numbers only QRegularExpressionMatchIterator i = rx.globalMatch(QString::fromStdString(str)); @@ -88,13 +88,13 @@ namespace egoa::Types { * * @return The converted integer */ - inline count String2integer( std::string str ) + inline count String2integer( std::string str ) { QRegularExpression rx("(^-?[0-9]?\\d*(\\.\\d+)?)"); // Filter numbers only QRegularExpressionMatchIterator i = rx.globalMatch(QString::fromStdString(str)); QRegularExpressionMatch match = i.next(); QString t_string = match.captured(1); - + // QString t_string(str.c_str()); bool ok; count number(0); number = QString(t_string).toUInt(&ok); diff --git a/include/DataStructures/Bound.hpp b/include/DataStructures/Bound.hpp index 75a306c5..c4a73172 100644 --- a/include/DataStructures/Bound.hpp +++ b/include/DataStructures/Bound.hpp @@ -38,7 +38,7 @@ class Bound { * @param[in] maximum The maximum representing the upper bound. */ Bound ( TBound const & minimum - , TBound const & maximum ) + , TBound const & maximum ) : minimum_(minimum) , maximum_(maximum) { @@ -48,7 +48,7 @@ class Bound { USAGE_ASSERT ( minimum_ <= maximum_ ); } ///@} - + ///@name Getter and Setter ///@{ #pragma mark GETTER_AND_SETTER @@ -58,23 +58,23 @@ class Bound { * * @return The minimum of the bound, i.e., lower bound. */ - inline TBound Minimum () const - { - return minimum_; + inline TBound Minimum () const + { + return minimum_; } /** * @brief Setter of the minimum of the bound. - * + * * @code{.cpp} * someBound.Minimum() = 9; * @endcode * * @return The minimum of the bound, i.e., lower bound. */ - inline TBound & Minimum () - { - return minimum_; + inline TBound & Minimum () + { + return minimum_; } /** @@ -82,23 +82,23 @@ class Bound { * * @return The maximum of the bound, i.e., upper bound. */ - inline TBound Maximum() const - { - return maximum_; + inline TBound Maximum() const + { + return maximum_; } /** * @brief Setter of the maximum of the bound. - * + * * @code{.cpp} * someBound.Maximum() = 99; * @endcode * * @return The maximum of the bound, i.e., upper bound. */ - inline TBound & Maximum() - { - return maximum_; + inline TBound & Maximum() + { + return maximum_; } ///@} @@ -113,7 +113,7 @@ class Bound { * @param[in] maximum The maximum of the bound, i.e., upper bound. */ inline void Range ( TBound const & minimum - , TBound const & maximum ) + , TBound const & maximum ) { #ifdef PGT_EXCEPTION_HANDLING BoundMismatch::template Check(minimum, maximum); @@ -134,7 +134,7 @@ class Bound { * @brief Comparison operator. * * @param[in] rhs The right hand side Bound. - * + * * @code{.cpp} * if ( Bound(0,0) == Bound(1,0) ) { } * @endcode diff --git a/include/DataStructures/Container/DominationCriterion.hpp b/include/DataStructures/Container/DominationCriterion.hpp index fc1d19b3..d801eb1d 100644 --- a/include/DataStructures/Container/DominationCriterion.hpp +++ b/include/DataStructures/Container/DominationCriterion.hpp @@ -103,4 +103,3 @@ class DominationDifferentiation { } // namespace egoa #endif // EGOA__DATA_STRUCTURES__CONTAINER__DOMINATION_CRITERION_HPP - diff --git a/include/DataStructures/Container/Queues/BinaryHeap.hpp b/include/DataStructures/Container/Queues/BinaryHeap.hpp index 03917830..ff098c7f 100644 --- a/include/DataStructures/Container/Queues/BinaryHeap.hpp +++ b/include/DataStructures/Container/Queues/BinaryHeap.hpp @@ -49,7 +49,7 @@ class BinaryHeapCheck; * pointers such as std::function ( see * https://stackoverflow.com/questions/14677997/stdfunction-vs-template * for more information). This is the reason why the following code is not - * used + * used * inline void for_all_(std::function function) {} * * @tparam HeapType The type of the heap. If the heap type is const, const @@ -134,7 +134,7 @@ class BinaryHeap { * * @return The element with minimum key according to the comparator. */ - inline TElement const & Top() const + inline TElement const & Top() const { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); USAGE_ASSERT ( !Empty() ); @@ -148,7 +148,7 @@ class BinaryHeap { * * @return Index of the element, or if not available Const::none. */ - inline Types::index Search ( TElement const & element ) const + inline Types::index Search ( TElement const & element ) const { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); @@ -171,7 +171,7 @@ class BinaryHeap { * * @return @p *this. */ - inline BinaryHeap & operator+= ( TElement const & rhs ) + inline BinaryHeap & operator+= ( TElement const & rhs ) { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); heap_.emplace_back(rhs); @@ -187,7 +187,7 @@ class BinaryHeap { * * @return @p *this. */ - inline BinaryHeap & operator+= ( TElement && rhs ) + inline BinaryHeap & operator+= ( TElement && rhs ) { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); heap_.emplace_back(std::move(rhs)); @@ -201,7 +201,7 @@ class BinaryHeap { * * @param element The element. */ - inline void Insert ( TElement const & element ) + inline void Insert ( TElement const & element ) { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); *this += element; @@ -212,7 +212,7 @@ class BinaryHeap { * * @param element The element. */ - inline void Insert ( TElement && element ) + inline void Insert ( TElement && element ) { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); *this += std::move(element); @@ -228,12 +228,12 @@ class BinaryHeap { * input iterators. */ template - inline void Insert ( InputIt first, InputIt last) + inline void Insert ( InputIt first, InputIt last) { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); for ( InputIt it = first ; it != last - ; ++it ) + ; ++it ) { *this += *it; } @@ -244,7 +244,7 @@ class BinaryHeap { * * @param elements The elements to insert */ - inline void Insert ( std::vector const & elements) + inline void Insert ( std::vector const & elements) { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); Insert(elements.begin(), elements.end()); @@ -256,7 +256,7 @@ class BinaryHeap { * @param args The arguments of a constructor of @p TElement. */ template - inline void Emplace ( Args&&... args ) + inline void Emplace ( Args&&... args ) { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); heap_.emplace_back ( std::forward(args)... ); @@ -271,7 +271,7 @@ class BinaryHeap { * * @param[in] elements The elements with which to build the heap */ - inline void BuildWith ( std::vector const & elements ) + inline void BuildWith ( std::vector const & elements ) { heap_ = elements; MakeHeapProperty(); @@ -286,7 +286,7 @@ class BinaryHeap { * * @pre The heap is not empty. */ - inline void Pop() + inline void Pop() { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); USAGE_ASSERT ( Size() > 0 ); @@ -300,13 +300,13 @@ class BinaryHeap { * * @return The top element. */ - inline TElement DeleteTop() + inline TElement DeleteTop() { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); USAGE_ASSERT ( Size() > 0 ); TElement top = std::move( Front() ); - if ( Size() > 1 ) + if ( Size() > 1 ) { using std::swap; // enable ADL swap ( Front(), Back() ); @@ -321,7 +321,7 @@ class BinaryHeap { /** * @brief Clears the heap. */ - inline void Clear() + inline void Clear() { heap_.clear(); } @@ -341,7 +341,7 @@ class BinaryHeap { { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); USAGE_ASSERT ( index < Size() ); - + ElementAt( index ) = element; SiftUp( index ); SiftDown( index ); @@ -361,7 +361,7 @@ class BinaryHeap { * @param element The new element. */ inline void DecreaseKey ( Types::index index - , TElement const & element ) + , TElement const & element ) { ESSENTIAL_ASSERT ( ComplyHeapProperty() ); USAGE_ASSERT ( index < Size() ); @@ -380,7 +380,7 @@ class BinaryHeap { * * @return TRUE if empty and FALSE otherwise. */ - inline bool Empty() const + inline bool Empty() const { return heap_.empty(); } @@ -390,7 +390,7 @@ class BinaryHeap { * * @return The size of the heap */ - inline Types::count Size() const + inline Types::count Size() const { return heap_.size(); } @@ -407,9 +407,9 @@ class BinaryHeap { */ inline std::function< bool ( TElement const & , TElement const & ) > - const & Comparator() const + const & Comparator() const { - return comparator_; + return comparator_; } /** @@ -438,7 +438,7 @@ class BinaryHeap { * @details The comparator is set to `std::greater()` and the heap * is updated to respect the new comparator. */ - inline void Maximize() + inline void Maximize() { Comparator ( std::greater() ); } @@ -448,7 +448,7 @@ class BinaryHeap { * @details The comparator is set to `std::less()` and the heap * is updated to respect the new comparator. */ - inline void Minimize() + inline void Minimize() { Comparator ( std::less() ); } @@ -467,7 +467,7 @@ class BinaryHeap { * @return @p true if the heaps are equivalent, @p false if they do not * have the same element. */ - inline bool operator==( BinaryHeap const & rhs ) const + inline bool operator==( BinaryHeap const & rhs ) const { return IsEqualTo( rhs ); } @@ -483,7 +483,7 @@ class BinaryHeap { * @p false if they contain the same elements where the order * does not matter. */ - inline bool operator!=( BinaryHeap const & rhs) const + inline bool operator!=( BinaryHeap const & rhs) const { return !(*this==rhs); } @@ -500,7 +500,7 @@ class BinaryHeap { * @return @p true if equal to @p rhs, @p false otherwise. */ template - inline bool IsEqualTo( BinaryHeap const & rhs ) const + inline bool IsEqualTo( BinaryHeap const & rhs ) const { return internal::BinaryHeapCheck ::IsEqualTo(*this, rhs); @@ -512,7 +512,7 @@ class BinaryHeap { * @param lhs The left hand side BinaryHeaps * @param rhs The right hand side BinaryHeaps */ - friend void swap ( BinaryHeap & lhs, BinaryHeap & rhs ) + friend void swap ( BinaryHeap & lhs, BinaryHeap & rhs ) { // Necessary for the copy and swap idiom using std::swap; // enable ADL swap( lhs.heap_, rhs.heap_ ); @@ -624,7 +624,7 @@ class BinaryHeap { */ template inline - void for_all_elements ( FUNCTION function ) + void for_all_elements ( FUNCTION function ) { internal::BinaryHeapLoopDifferentiation ::for_all_elements ( *this, function); @@ -645,7 +645,7 @@ class BinaryHeap { */ template inline - void for_all_elements ( FUNCTION function ) const + void for_all_elements ( FUNCTION function ) const { internal::BinaryHeapLoopDifferentiation ::for_all_elements ( *this, function); @@ -681,7 +681,7 @@ class BinaryHeap { * * @return The top element, which is at the front of @p heap_. */ - inline TElement & Front() + inline TElement & Front() { ESSENTIAL_ASSERT( !Empty() ); return heap_.front(); @@ -692,7 +692,7 @@ class BinaryHeap { * * @return The top element, which is at the front of @p heap_. */ - inline TElement const & Front() const + inline TElement const & Front() const { ESSENTIAL_ASSERT( !Empty() ); return heap_.front(); @@ -703,7 +703,7 @@ class BinaryHeap { * * @return The last element, which is at the back of @p heap_. */ - inline TElement & Back() + inline TElement & Back() { ESSENTIAL_ASSERT( !Empty() ); return heap_.back(); @@ -714,7 +714,7 @@ class BinaryHeap { * * @return The last element, which is at the back of @p heap_. */ - inline TElement const & Back() const + inline TElement const & Back() const { ESSENTIAL_ASSERT( !Empty() ); return heap_.back(); @@ -725,7 +725,7 @@ class BinaryHeap { * * @return The maximum index. */ - inline Types::index MaximumIndex() const + inline Types::index MaximumIndex() const { ESSENTIAL_ASSERT( !Empty() ); return heap_.size() - 1; @@ -748,7 +748,7 @@ class BinaryHeap { * @f$2^{l-1}@f$. As we start at 0, the value has to * be reduced by 1. */ - inline void MakeHeapProperty() + inline void MakeHeapProperty() { for ( Types::rcount counter = heap_.size() / 2 - 1 ; counter >= 0 @@ -768,7 +768,7 @@ class BinaryHeap { * @return @p true if the heap complies with the heap property * at element @p index and @p false otherwise. */ - inline bool ComplyHeapProperty( Types::index index ) const + inline bool ComplyHeapProperty( Types::index index ) const { ESSENTIAL_ASSERT( index < Size() ); if ( !HasChildren( index ) ) return true; @@ -783,13 +783,13 @@ class BinaryHeap { * @return @p true if the heap complies the heap property, @p * false otherwise. */ - inline bool ComplyHeapProperty() const + inline bool ComplyHeapProperty() const { for ( Types::count counter = 0 ; counter < Size() - ; ++counter ) + ; ++counter ) { - if ( !ComplyHeapProperty( counter ) ) + if ( !ComplyHeapProperty( counter ) ) { return false; } @@ -804,7 +804,7 @@ class BinaryHeap { /** * @brief Sift the last element up. */ - inline void SiftUp () + inline void SiftUp () { ESSENTIAL_ASSERT( !Empty() ); SiftUp( MaximumIndex() ); @@ -816,14 +816,14 @@ class BinaryHeap { * * @param[in] index The index of the element tha shall be sifted up. */ - inline void SiftUp ( Types::index index ) + inline void SiftUp ( Types::index index ) { ESSENTIAL_ASSERT( index < Size() ); if ( !HasParent(index) ) return; Types::index parentIndex = ParentIdOf( index ); - while ( Comparator()( ElementAt( index ), ElementAt( parentIndex ) ) - && index != 0 ) + while ( Comparator()( ElementAt( index ), ElementAt( parentIndex ) ) + && index != 0 ) { using std::swap; // enable ADL swap( ElementAt( index ), ElementAt( parentIndex ) ); @@ -836,7 +836,7 @@ class BinaryHeap { /** * @brief Sift down the element at the root. */ - inline void SiftDown() + inline void SiftDown() { ESSENTIAL_ASSERT( !Empty() ); SiftDown( 0 ); @@ -848,7 +848,7 @@ class BinaryHeap { * * @param[in] index The index of the element that shall be sifted down. */ - inline void SiftDown( Types::index index ) + inline void SiftDown( Types::index index ) { ESSENTIAL_ASSERT( index < Size() ); @@ -856,8 +856,8 @@ class BinaryHeap { if ( !HasChildren( index ) ) return; childIndex = SelectSwappableChildAt ( index ); - while ( Comparator()( ElementAt(childIndex), ElementAt(index) ) - && childIndex < Size() ) + while ( Comparator()( ElementAt(childIndex), ElementAt(index) ) + && childIndex < Size() ) { using std::swap; swap( ElementAt(index), ElementAt(childIndex) ); @@ -881,16 +881,16 @@ class BinaryHeap { * * @return The index of the child that has the best key. */ - inline Types::index SelectSwappableChildAt ( Types::index index ) const + inline Types::index SelectSwappableChildAt ( Types::index index ) const { ESSENTIAL_ASSERT( HasChildren(index) ); - if ( !HasRightChild(index) ) + if ( !HasRightChild(index) ) { return LeftChildIdOf( index ); } ESSENTIAL_ASSERT( HasRightChild(index) ); - if ( Comparator()( LeftElementAt( index ), RightElementAt( index )) ) + if ( Comparator()( LeftElementAt( index ), RightElementAt( index )) ) { return LeftChildIdOf( index ); } @@ -918,11 +918,11 @@ namespace internal { #pragma mark HEAPS_ARE_IDENTICAL_CHECK template class BinaryHeapCheck { - + // Type aliasing using TElement = Type; using THeap = BinaryHeap; - + public: /** * @brief Determines if equal---in sense of order---to the \rhs binary heap. @@ -932,13 +932,13 @@ class BinaryHeapCheck { * @return TRUE if the order of the elements are the same to the \p rhs, FALSE otherwise. */ static inline bool IsEqualTo ( THeap const & lhs - , THeap const & rhs ) + , THeap const & rhs ) { if ( lhs.Size() != rhs.Size() ) return false; for ( Types::count counter = 0 ; counter < lhs.Size() - ; ++counter ) - { + ; ++counter ) + { if ( lhs.ElementAt( counter ) != rhs.ElementAt( counter ) ) return false; } return true; @@ -962,15 +962,15 @@ class BinaryHeapCheck { * @return TRUE if it has the same elements as \p rhs, FALSE otherwise. */ static inline bool IsEqualTo ( THeap const & lhs - , THeap const & rhs ) + , THeap const & rhs ) { if ( lhs.Size() != rhs.Size() ) return false; THeap tempRhs = rhs; std::sort( tempRhs.heap_.begin(), tempRhs.heap_.end() ); THeap tempLhs = lhs; std::sort( tempLhs.heap_.begin(), tempLhs.heap_.end() ); for ( Types::count counter = 0 ; counter < tempLhs.Size() - ; ++counter ) - { + ; ++counter ) + { if ( tempLhs.ElementAt( counter ) != tempRhs.ElementAt( counter ) ) return false; } return true; @@ -998,7 +998,7 @@ class BinaryHeapLoopDifferentiation { * @code{.cpp} * [](TElement element) { Do something with the element object } * @endcode - * + * * @tparam FUNCTION Function */ template @@ -1006,11 +1006,11 @@ class BinaryHeapLoopDifferentiation { void for_all_elements ( THeap & heap , FUNCTION function ) { - for (auto & element : heap.heap_) + for (auto & element : heap.heap_) { function(element); } - if ( !heap.ComplyHeapProperty() ) + if ( !heap.ComplyHeapProperty() ) { heap.MakeHeapProperty(); } @@ -1045,7 +1045,7 @@ class BinaryHeapLoopDifferentiation void for_all_elements ( THeap & heap , FUNCTION function ) { - for (auto & element : heap.heap_) + for (auto & element : heap.heap_) { function(element); } @@ -1071,9 +1071,9 @@ class BinaryHeapLoopDifferentiation { * @code{.cpp} * [](TElement element) -> bool { Do something with the element object } * @endcode - * + * * @note Heap property might be violated in the none const variant - * + * * @tparam FUNCTION Function */ template @@ -1081,12 +1081,12 @@ class BinaryHeapLoopDifferentiation { void for_all_elements ( THeap & heap , FUNCTION function ) { - for ( auto & element : heap.heap_ ) + for ( auto & element : heap.heap_ ) { bool toContinue = function(element); if ( !toContinue ) break; } - if ( !heap.ComplyHeapProperty() ) + if ( !heap.ComplyHeapProperty() ) { heap.MakeHeapProperty(); } @@ -1120,7 +1120,7 @@ class BinaryHeapLoopDifferentiation void for_all_elements ( THeap & heap , FUNCTION function ) { - for ( auto & element : heap.heap_ ) + for ( auto & element : heap.heap_ ) { bool toContinue = function(element); if ( !toContinue ) break; @@ -1149,7 +1149,7 @@ class BinaryHeapLoopDifferentiation { * @code{.cpp} * [](TElement element) { Do something with the element object } * @endcode - * + * * @tparam FUNCTION Function */ template @@ -1160,11 +1160,11 @@ class BinaryHeapLoopDifferentiation { #pragma omp parallel for for ( Types::count counter = 0 ; counter < heap.heap_.size() - ; ++counter ) + ; ++counter ) { function ( heap.heap_[counter] ); } - if ( !heap.ComplyHeapProperty() ) + if ( !heap.ComplyHeapProperty() ) { heap.MakeHeapProperty(); } @@ -1198,7 +1198,7 @@ class BinaryHeapLoopDifferentiation { #pragma omp parallel for for ( Types::count counter = 0 ; counter < heap.heap_.size() - ; ++counter ) + ; ++counter ) { function ( heap.heap_[counter] ); } diff --git a/include/DataStructures/Container/Queues/Bucket.hpp b/include/DataStructures/Container/Queues/Bucket.hpp index bbd9cd83..4899aee3 100644 --- a/include/DataStructures/Container/Queues/Bucket.hpp +++ b/include/DataStructures/Container/Queues/Bucket.hpp @@ -35,7 +35,7 @@ class BucketLoopDifferentiation; /** * @brief Class for bucket data structure. - * + * * @code{.cpp} * egoa::Bucket, int> bucket; * @endcode @@ -43,7 +43,7 @@ class BucketLoopDifferentiation; * @tparam PriorityQueue Type of the priority queue used within the * bucket, e.g., BinaryHeap. The PriorityQueue has to provide the * following interface. - * + * * Function | Description * ------------------------------|--------------------- * Top | Returns the top element. @@ -89,45 +89,45 @@ class Bucket { Comparator( std::less() ); } ///@} - + /** * @name Comparators for Unprocessed Bucket Elements - * + * * @param rhs The right hand side bucket. - * + * * @pre Neither of the bucket queues is allowed to be empty. * Check status of the queue by using #EmptyQueue(). - * + * * @return @p true if the element with an optimal key is <, >, <=, >= than * the rhs bucket, @p false otherwise. - * + * * @see EmptyQueue() */ ///@{ #pragma mark OPERATORS - inline bool operator< ( TBucket const & rhs ) const + inline bool operator< ( TBucket const & rhs ) const { USAGE_ASSERT ( !EmptyQueue() ); USAGE_ASSERT ( !rhs.EmptyQueue() ); return ( Top() < rhs.Top() ); } - inline bool operator> ( TBucket const & rhs ) const + inline bool operator> ( TBucket const & rhs ) const { USAGE_ASSERT ( !EmptyQueue() ); USAGE_ASSERT ( !rhs.EmptyQueue() ); return rhs < *this; } - inline bool operator<= ( TBucket const & rhs ) const + inline bool operator<= ( TBucket const & rhs ) const { USAGE_ASSERT ( !EmptyQueue() ); USAGE_ASSERT ( !rhs.EmptyQueue() ); return !(*this > rhs); } - inline bool operator>= ( TBucket const & rhs ) const + inline bool operator>= ( TBucket const & rhs ) const { USAGE_ASSERT ( !EmptyQueue() ); USAGE_ASSERT ( !rhs.EmptyQueue() ); @@ -146,20 +146,20 @@ class Bucket { * @pre Note that the element will be moved if the return type is true. * * @tparam Domination The domination sense such as weak, strict, or none. - * + * * @return @p true if the @p newElement is added into the bucket, * @p false otherwise (meaning it was dominated in some sense defined * by @p Domination). */ ///@{ #pragma mark MERGE_ELEMENTS - + template - inline bool Merge ( TElement && newElement ) + inline bool Merge ( TElement && newElement ) { newElement.Valid() = true; for_all_elements( - [&](TElement & element) -> bool + [&](TElement & element) -> bool { if ( internal::DominationDifferentiation ::Dominates( element, newElement, Comparator() ) ) { @@ -172,11 +172,11 @@ class Bucket { --numberOfValidUnprocessedElements_; } // also covers DominationCriterion::none - return true; + return true; } ); - if ( !newElement.Valid() ) + if ( !newElement.Valid() ) { PopInvalidUnprocessedElements(); return false; @@ -190,7 +190,7 @@ class Bucket { } template - inline bool Merge ( TElement & newElement ) + inline bool Merge ( TElement & newElement ) { bool valid = Merge( TElement(newElement) ); newElement.Valid() = valid; @@ -198,7 +198,7 @@ class Bucket { } template - inline bool Merge( TElement const & newElement ) + inline bool Merge( TElement const & newElement ) { return Merge( TElement(newElement) ); } @@ -206,15 +206,15 @@ class Bucket { ///@todo Think about it inline bool HasElement ( TElement const & newElement - , TElement & existingElement ) + , TElement & existingElement ) { bool hasElement = false; - for_all_elements( + for_all_elements( [ & newElement , & existingElement - , & hasElement](TElement & element) -> bool + , & hasElement](TElement & element) -> bool { - if ( newElement == element ) + if ( newElement == element ) { existingElement = element; hasElement = true; @@ -239,7 +239,7 @@ class Bucket { * @return @p true if it has an element at that position, @p * false otherwise. */ - inline bool HasElementAt ( Types::index index ) + inline bool HasElementAt ( Types::index index ) { USAGE_ASSERT ( index >= 0 ); return ( index < NumberOfProcessedElements() ); @@ -249,13 +249,13 @@ class Bucket { * @brief Processed element at a certain position @a index. * * @param[in] index The position of a processed element. - * + * * @pre There are processed elements and #HasElementAt( index ) * is true. * * @return The processed element at the position @a index. */ - inline TElement & ElementAt ( Types::index index ) + inline TElement & ElementAt ( Types::index index ) { #ifdef PGT_EXCEPTION_HANDLING throw_out_of_bound( index, NumberOfProcessedElements() ); @@ -268,13 +268,13 @@ class Bucket { * @brief Processed element at a certain position @a index. * * @param[in] index The position of a processed element. - * + * * @pre There are processed elements and #HasElementAt( index ) * is true. * * @return The processed element at the position @a index. */ - inline TElement & operator[] ( Types::index index ) + inline TElement & operator[] ( Types::index index ) { #ifdef PGT_EXCEPTION_HANDLING throw_out_of_bound( index, NumberOfProcessedElements() ); @@ -287,13 +287,13 @@ class Bucket { * @brief Processed element at a certain position @a index. * * @param[in] index The position of a processed element. - * + * * @pre There are processed elements and #HasElementAt( index ) * is true. * * @return The processed element at the position @a index. */ - inline TElement & operator[] ( Types::index index ) const + inline TElement & operator[] ( Types::index index ) const { #ifdef PGT_EXCEPTION_HANDLING throw_out_of_bound( index, NumberOfProcessedElements() ); @@ -307,12 +307,12 @@ class Bucket { * @details Top returns an unprocessed element that has an optimal * key (e.g. for VoltageAngleDifferenceLabel the key would be the * susceptance norm). - * + * * @pre The queue is not empty meaning #EmptyQueue() is false. * * @return The element with an optimal key. */ - inline TElement const & Top () const + inline TElement const & Top () const { USAGE_ASSERT ( !EmptyQueue() ); ESSENTIAL_ASSERT( unprocessedElements_.Top().Valid() ); @@ -324,23 +324,23 @@ class Bucket { * @details Get all elements that have an optimum value, e.g. for the * VoltageAngleDifferenceLabel an optimum corresponds to the minimum * delta theta value of the path. - * + * * @note This function does not change the bucket. All elements * stay in the queue. The equality check depends on the element * equality check. - * + * * @todo Is this loop sufficient for unprocessed labels only? * * @return Vector of elements with optimum value */ - inline std::vector Optima () const + inline std::vector Optima () const { //@todo This is a very bad implementation. Think about it again. auto result = std::min_element( processedElements_.begin(), processedElements_.end(), [](TElement a, TElement b) { return a.Value() < b.Value(); } ); auto result2 = std::min_element( unprocessedElements_.begin(), unprocessedElements_.end(), [](TElement a, TElement b) { return a.Value() < b.Value(); } ); TElement minElement; if ( result != processedElements_.end() ) { - if ( result2 != unprocessedElements_.end() ) + if ( result2 != unprocessedElements_.end() ) { ((*result)<(*result2))?(minElement = *result):(minElement = *result2); } else { @@ -352,12 +352,12 @@ class Bucket { // Extract elements with the same optimum value std::vector optima; - for_all_elements ( + for_all_elements ( [ & minElement , & optima ]( TElement const & element ) { - if ( element.Value() == minElement.Value() ) - { + if ( element.Value() == minElement.Value() ) + { optima.emplace_back( element ); } } @@ -379,10 +379,10 @@ class Bucket { * * @pre The queue---meaning the unprocessed items---is not * allowed to be empty. - * + * * @return The element with a optimal key. */ - inline Types::index Pop () + inline Types::index Pop () { USAGE_ASSERT ( !EmptyQueue() ); @@ -401,13 +401,13 @@ class Bucket { * label is the one with the smallest key (e.g. for * VoltageAngleDifferenceLabel the key would be the susceptance * norm times the minimum capacity). - * + * * @pre The queue---meaning the unprocessed items---is not * allowed to be empty. * * @return The element with a optimal key. */ - inline std::pair DeleteTop () + inline std::pair DeleteTop () { USAGE_ASSERT ( !EmptyQueue() ); Types::index index = Pop(); @@ -420,7 +420,7 @@ class Bucket { /** * @brief Clear the bucket. */ - inline void Clear () noexcept + inline void Clear () noexcept { processedElements_.clear(); unprocessedElements_.Clear(); @@ -447,16 +447,16 @@ class Bucket { #pragma mark COMPARATOR inline std::function - const & Comparator () const - { - return unprocessedElements_.Comparator(); + , TElement const & ) > + const & Comparator () const + { + return unprocessedElements_.Comparator(); } inline void Comparator( std::function comparator ) - { - unprocessedElements_.Comparator ( comparator ); + , TElement const & )> comparator ) + { + unprocessedElements_.Comparator ( comparator ); } ///@} @@ -466,7 +466,7 @@ class Bucket { * * @return @p true if empty, @p false otherwise. */ - inline bool Empty () const + inline bool Empty () const { return ( processedElements_.empty() && unprocessedElements_.Empty() ); } @@ -476,12 +476,12 @@ class Bucket { * * @return @p true if empty, @p false otherwise. */ - inline bool EmptyQueue () const + inline bool EmptyQueue () const { return unprocessedElements_.Empty(); } - inline Types::count Size () const + inline Types::count Size () const { return NumberOfProcessedElements() + NumberOfUnprocessedElements(); } @@ -489,7 +489,7 @@ class Bucket { ///@name Element Loops ///@{ #pragma mark LOOPS - + /** * @brief The @c for loop @c over all elements in the bucket. * @details Loop over all processed and unprocessed elements. @@ -497,19 +497,19 @@ class Bucket { * @param[in] function The function, e.g., lambda function. * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode - * + * * @tparam Policy @p true if the loop is run in parallel using * OpenMP, @p false otherwise. * @tparam FUNCTION The function pointer. */ template inline - void for_all_elements ( FUNCTION function ) + void for_all_elements ( FUNCTION function ) { internal::BucketLoopDifferentiation ::for_all_elements ( *this, function ); @@ -524,9 +524,9 @@ class Bucket { * @param[in] function The function, e.g., lambda function. * * @code{.cpp} - * []( TElement const & element ) - * { - * // Do something with the element object. + * []( TElement const & element ) + * { + * // Do something with the element object. * } * @endcode * @@ -535,8 +535,8 @@ class Bucket { * @tparam FUNCTION The function pointer. */ template - inline - void for_all_elements ( FUNCTION function ) const + inline + void for_all_elements ( FUNCTION function ) const { internal::BucketLoopDifferentiation ::for_all_elements ( *this, function ); @@ -548,9 +548,9 @@ class Bucket { * @param[in] function The function, e.g., lambda function * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode * @@ -559,8 +559,8 @@ class Bucket { * @tparam FUNCTION The function pointer. */ template - inline - void for_all_processed_elements ( FUNCTION function ) + inline + void for_all_processed_elements ( FUNCTION function ) { internal::BucketLoopDifferentiation ::for_all_processed_elements ( *this, function ); @@ -572,9 +572,9 @@ class Bucket { * @param[in] function The function, e.g., lambda function * * @code{.cpp} - * []( TElement const & element ) - * { - * Do something with the element object. + * []( TElement const & element ) + * { + * Do something with the element object. * } * @endcode * @@ -584,7 +584,7 @@ class Bucket { */ template inline - void for_all_processed_elements ( FUNCTION function ) const + void for_all_processed_elements ( FUNCTION function ) const { internal::BucketLoopDifferentiation ::for_all_processed_elements ( *this, function ); @@ -599,19 +599,19 @@ class Bucket { * @param[in] function The function, e.g., lambda function. * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode - * + * * @tparam Policy @p true if the loop is run in parallel using * OpenMP, @p false otherwise. * @tparam FUNCTION The function pointer. */ template inline - void for_all_unprocessed_elements ( FUNCTION function ) + void for_all_unprocessed_elements ( FUNCTION function ) { internal::BucketLoopDifferentiation ::for_all_unprocessed_elements ( *this, function ); @@ -627,19 +627,19 @@ class Bucket { * @param[in] function The function, e.g., lambda function. * * @code{.cpp} - * []( TElement const & element ) - * { - * // Do something with the element object. + * []( TElement const & element ) + * { + * // Do something with the element object. * } * @endcode - * + * * @tparam Policy @p true if the loop is run in parallel using * OpenMP, @p false otherwise. * @tparam FUNCTION The function pointer. */ template inline - void for_all_unprocessed_elements ( FUNCTION function ) const + void for_all_unprocessed_elements ( FUNCTION function ) const { internal::BucketLoopDifferentiation ::for_all_unprocessed_elements ( *this, function ); @@ -652,19 +652,19 @@ class Bucket { * @param[in] function The function, e.g., lambda function. * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode - * + * * @tparam Policy @p true if the loop is run in parallel * using OpenMP, @p false otherwise. * @tparam FUNCTION The function pointer. */ template inline - Types::real for_all_optima ( FUNCTION function ) + Types::real for_all_optima ( FUNCTION function ) { return internal::BucketLoopDifferentiation ::for_all_optima ( *this, function ); @@ -678,26 +678,26 @@ class Bucket { * @param[in] function The function, e.g., lambda function * * @code{.cpp} - * []( TElement const & element ) - * { - * // Do something with the element object. + * []( TElement const & element ) + * { + * // Do something with the element object. * } * @endcode - * + * * @tparam Policy @p true if the loop is run in parallel * using OpenMP, @p false otherwise. * @tparam FUNCTION The function pointer. */ template inline - Types::real for_all_optima ( FUNCTION function ) const + Types::real for_all_optima ( FUNCTION function ) const { return internal::BucketLoopDifferentiation ::for_all_optima ( *this, function ); } ///@} - private: + private: ///@name Add an Element ///@{ #pragma mark ADD_ELEMENTS @@ -711,7 +711,7 @@ class Bucket { * * @pre Function @see Pop(). */ - inline Types::index MoveToProcessed ( TElement && element ) + inline Types::index MoveToProcessed ( TElement && element ) { processedElements_.push_back ( std::move(element) ); processedElements_.back().Index() = processedElements_.size() - 1; @@ -719,7 +719,7 @@ class Bucket { } /** - * @brief Insert an element + * @brief Insert an element * * @param element The element. */ @@ -737,9 +737,9 @@ class Bucket { * * @return The number of processed elements. */ - inline Types::count NumberOfProcessedElements() const noexcept - { - return processedElements_.size(); + inline Types::count NumberOfProcessedElements() const noexcept + { + return processedElements_.size(); } /** @@ -767,7 +767,7 @@ class Bucket { * @return @p true if the @p lhs dominates the @p rhs, @p false otherwise. */ template - inline bool Dominates ( TElement const & lhs, TElement const & rhs ) const + inline bool Dominates ( TElement const & lhs, TElement const & rhs ) const { return internal::DominationDifferentiation ::Dominates( lhs, rhs, Comparator() ); @@ -782,10 +782,10 @@ class Bucket { * @brief Pops invalid unprocessed elements until @p unprocessedElements_ * is empty or the top element is valid. */ - inline void PopInvalidUnprocessedElements() + inline void PopInvalidUnprocessedElements() { - while (!unprocessedElements_.Empty() - && !unprocessedElements_.Top().Valid()) + while (!unprocessedElements_.Empty() + && !unprocessedElements_.Top().Valid()) { unprocessedElements_.Pop(); } @@ -801,7 +801,7 @@ class Bucket { friend internal::BucketLoopDifferentiation; #pragma mark MEMBERS - std::vector processedElements_; /**< The processed elements that do not change their status and stay valid */ + std::vector processedElements_; /**< The processed elements that do not change their status and stay valid */ TPriorityQueue unprocessedElements_; /**< The unprocessed elements that might change their status, e.g., to invalid */ Types::count numberOfValidUnprocessedElements_; /**< The number of valid unprocessed elements. */ }; @@ -825,12 +825,12 @@ class BucketLoopDifferentiation { * @param[in] function The function, e.g., lambda function * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode - * + * * @tparam FUNCTION The function pointer. */ template @@ -848,9 +848,9 @@ class BucketLoopDifferentiation { * @param[in] function The function, e.g., lambda function. * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode * @@ -861,7 +861,7 @@ class BucketLoopDifferentiation { void for_all_processed_elements ( BucketType & bucket , FUNCTION function ) { - for ( auto & element : bucket.processedElements_ ) + for ( auto & element : bucket.processedElements_ ) { function ( element ); } @@ -873,9 +873,9 @@ class BucketLoopDifferentiation { * @param[in] function The function, e.g., lambda function * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode * @@ -887,7 +887,7 @@ class BucketLoopDifferentiation { , FUNCTION function ) { bucket.unprocessedElements_.template for_all_elements( - [&function]( auto & element ) + [&function]( auto & element ) { if (!element.Valid()) return; function(element); @@ -903,23 +903,23 @@ class BucketLoopDifferentiation { * @param[in] function The function, e.g., lambda function * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode - * + * * @tparam Policy @p true if the loop is run in parallel * using OpenMP, @p false otherwise. * @tparam FUNCTION The function pointer. */ template - static inline + static inline Types::real for_all_optima ( BucketType & bucket , FUNCTION function ) { std::vector optima = bucket.Optima(); - for ( TElement const & element : optima ) + for ( TElement const & element : optima ) { function ( element ); } @@ -937,11 +937,11 @@ class BucketLoopDifferentiation { public: template - static inline + static inline void for_all_elements ( BucketType & bucket , FUNCTION function ) { - for ( auto & element : bucket.processedElements_ ) + for ( auto & element : bucket.processedElements_ ) { bool toContinue = function( element ); if (!toContinue) return; @@ -958,21 +958,21 @@ class BucketLoopDifferentiation { * continued, if @p false this emulates a break. * * @code{.cpp} - * []( TElement & element ) -> bool - * { - * // Do something with the element object. + * []( TElement & element ) -> bool + * { + * // Do something with the element object. * } * @endcode * * @tparam FUNCTION The function pointer. */ template - static inline + static inline void for_all_processed_elements ( BucketType & bucket , FUNCTION function ) { bool toContinue = true; - for ( auto & element : bucket.processedElements_ ) + for ( auto & element : bucket.processedElements_ ) { toContinue = function ( element ); if ( !toContinue ) break; @@ -987,21 +987,21 @@ class BucketLoopDifferentiation { * continued, if @p false this emulates a break. * * @code{.cpp} - * []( TElement & element ) -> bool - * { - * // Do something with the element object. + * []( TElement & element ) -> bool + * { + * // Do something with the element object. * } * @endcode - * + * * @tparam FUNCTION The function pointer. */ template - static inline + static inline void for_all_unprocessed_elements ( BucketType & bucket , FUNCTION function ) { bucket.unprocessedElements_.template for_all_elements( - [&function](auto & element) -> bool + [&function](auto & element) -> bool { if (!element.Valid()) return true; return function(element); @@ -1010,12 +1010,12 @@ class BucketLoopDifferentiation { } template - static inline + static inline Types::real for_all_optima ( BucketType & bucket , FUNCTION function ) { std::vector optima = bucket.Optima(); - for ( TElement const & element : optima ) + for ( TElement const & element : optima ) { bool toContinue = function ( element ); if (!toContinue) break; @@ -1047,16 +1047,16 @@ class BucketLoopDifferentiation { * @param[in] function The function, e.g., lambda function * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode - * + * * @tparam FUNCTION The function pointer. */ template - static inline + static inline void for_all_elements ( BucketType & bucket , FUNCTION function ) { @@ -1070,16 +1070,16 @@ class BucketLoopDifferentiation { * @param[in] function The function, e.g., lambda function * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode * * @tparam FUNCTION The function pointer. */ template - static inline + static inline void for_all_processed_elements ( BucketType & bucket , FUNCTION function ) { @@ -1098,21 +1098,21 @@ class BucketLoopDifferentiation { * @param[in] function The function, e.g., lambda function * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode - * + * * @tparam FUNCTION The function pointer. */ template - static inline + static inline void for_all_unprocessed_elements ( BucketType & bucket , FUNCTION function ) { bucket.unprocessedElements_.template for_all_elements( - [&function](auto & element) + [&function](auto & element) { if (!element.Valid()) return; function(element); @@ -1127,18 +1127,18 @@ class BucketLoopDifferentiation { * @param[in] function The function, e.g., lambda function * * @code{.cpp} - * []( TElement & element ) - * { - * // Do something with the element object. + * []( TElement & element ) + * { + * // Do something with the element object. * } * @endcode - * + * * @tparam Policy @p true if the loop is run in parallel * using OpenMP, @p false otherwise. * @tparam FUNCTION The function pointer. */ template - static inline + static inline Types::real for_all_optima ( BucketType & bucket , FUNCTION function ) { diff --git a/include/DataStructures/Container/Queues/PriorityQueue.hpp b/include/DataStructures/Container/Queues/PriorityQueue.hpp index 63c58de0..f2293193 100644 --- a/include/DataStructures/Container/Queues/PriorityQueue.hpp +++ b/include/DataStructures/Container/Queues/PriorityQueue.hpp @@ -18,7 +18,7 @@ template class PriorityQueue : public Queue { // Type aliasing using TElement = Type; - + public: #pragma mark CONSTRUCTORS_AND_DESTRUCTORS PriorityQueue(){} @@ -36,13 +36,13 @@ class PriorityQueue : public Queue { virtual ~PriorityQueue() override {} #pragma mark LOOPS - template + template inline void for_all_elements ( FUNCTION function ) {} template inline void for_all_elements ( FUNCTION function ) const {} - template + template inline void breakable_for_all_elements ( FUNCTION function ) {} template @@ -66,9 +66,9 @@ class PriorityQueue : public Queue { virtual inline TElement DeleteMin () override = 0; virtual inline void Clear () override = 0; - virtual inline void ChangeKey ( Types::index index + virtual inline void ChangeKey ( Types::index index , TElement const & element ) = 0; - virtual inline void DecreaseKey ( Types::index index + virtual inline void DecreaseKey ( Types::index index , TElement const & element ) = 0; ///@} diff --git a/include/DataStructures/Container/Queues/Queue.hpp b/include/DataStructures/Container/Queues/Queue.hpp index 2995f013..139a3cb4 100644 --- a/include/DataStructures/Container/Queues/Queue.hpp +++ b/include/DataStructures/Container/Queues/Queue.hpp @@ -30,15 +30,15 @@ class Queue { Queue ( Compare const & compare, Container const & container ){} virtual ~Queue() {} - + #pragma mark LOOPS - template + template inline void for_all_elements ( FUNCTION function ) {} template inline void for_all_elements ( FUNCTION function ) const {} - template + template inline void breakable_for_all_elements ( FUNCTION function ) {} template diff --git a/include/DataStructures/Container/Queues/StdQueue.hpp b/include/DataStructures/Container/Queues/StdQueue.hpp index eec8a3f2..56765cb0 100644 --- a/include/DataStructures/Container/Queues/StdQueue.hpp +++ b/include/DataStructures/Container/Queues/StdQueue.hpp @@ -47,7 +47,7 @@ class StdQueue { } virtual inline void Push ( TElement && element ) { - queue_.push ( element ); + queue_.push ( element ); } //@todo diff --git a/include/DataStructures/Container/UnionFind.hpp b/include/DataStructures/Container/UnionFind.hpp index 4f332265..afcab43f 100644 --- a/include/DataStructures/Container/UnionFind.hpp +++ b/include/DataStructures/Container/UnionFind.hpp @@ -18,15 +18,15 @@ namespace egoa { */ class UnionFind { public: - UnionFind( Types::count numberOfVertices ) + UnionFind( Types::count numberOfVertices ) : parent_( numberOfVertices, 0 ) - , numberOfVerticesInSubtree_( numberOfVertices, 1 ) + , numberOfVerticesInSubtree_( numberOfVertices, 1 ) , numberOfVertices_( numberOfVertices ) { // Every vertex has itself as parent for ( Types::count counter = 0 ; counter < NumberOfVertices() - ; ++counter ) + ; ++counter ) { Parent ( counter ) = counter; } @@ -41,7 +41,7 @@ class UnionFind { * * @return The root's identifier. */ - inline Types::vertexId Find ( Types::vertexId vertex ) + inline Types::vertexId Find ( Types::vertexId vertex ) { if ( Parent(vertex) == vertex ) return vertex; else return Find ( Parent(vertex) ); @@ -54,14 +54,14 @@ class UnionFind { * @param[in] u The vertex u * @param[in] v The vertex v */ - inline void Union ( Types::vertexId u, Types::vertexId v ) + inline void Union ( Types::vertexId u, Types::vertexId v ) { Types::vertexId root1 = Find(u); Types::vertexId root2 = Find(v); if ( root1 == root2 ) return; - if ( SubtreeSize(root1) > SubtreeSize(root2) ) + if ( SubtreeSize(root1) > SubtreeSize(root2) ) { SubtreeSize(root1) += SubtreeSize(root2); Parent(root2) = root1; @@ -79,45 +79,45 @@ class UnionFind { * * @return If they are in the same component */ - inline bool InSameComponent ( Types::vertexId u, Types::vertexId v ) + inline bool InSameComponent ( Types::vertexId u, Types::vertexId v ) { - return Find(u) == Find(v); + return Find(u) == Find(v); } ///@Name Getter and setter ///@{ - inline Types::count NumberOfVertices() - { - return numberOfVertices_; + inline Types::count NumberOfVertices() + { + return numberOfVertices_; } - inline Types::vertexId & Parent ( Types::vertexId vertex ) - { - USAGE_ASSERT ( vertex < numberOfVertices_ + inline Types::vertexId & Parent ( Types::vertexId vertex ) + { + USAGE_ASSERT ( vertex < numberOfVertices_ || vertex == Const::NONE ); - return parent_[vertex]; + return parent_[vertex]; } - inline Types::vertexId Parent ( Types::vertexId vertex ) const - { - USAGE_ASSERT ( vertex < numberOfVertices_ + inline Types::vertexId Parent ( Types::vertexId vertex ) const + { + USAGE_ASSERT ( vertex < numberOfVertices_ || vertex == Const::NONE ); - return parent_[vertex]; + return parent_[vertex]; } - inline Types::count & SubtreeSize ( Types::vertexId vertex ) + inline Types::count & SubtreeSize ( Types::vertexId vertex ) { USAGE_ASSERT ( vertex < numberOfVertices_ ); return numberOfVerticesInSubtree_[vertex]; } - inline Types::count SubtreeSize ( Types::vertexId vertex ) const + inline Types::count SubtreeSize ( Types::vertexId vertex ) const { USAGE_ASSERT ( vertex < numberOfVertices_ ); return numberOfVerticesInSubtree_[vertex]; } ///@} - + private: std::vector parent_; /*< Parent pointer */ std::vector numberOfVerticesInSubtree_; /*< Number of vertices in subtree i */ @@ -126,4 +126,4 @@ class UnionFind { } // namespace egoa -#endif // EGOA__CONTAINER__UNION_FIND_HPP \ No newline at end of file +#endif // EGOA__CONTAINER__UNION_FIND_HPP diff --git a/include/DataStructures/Graphs/BlockCutTree.hpp b/include/DataStructures/Graphs/BlockCutTree.hpp index a7032317..c757037e 100644 --- a/include/DataStructures/Graphs/BlockCutTree.hpp +++ b/include/DataStructures/Graphs/BlockCutTree.hpp @@ -27,7 +27,7 @@ namespace egoa { /// @defgroup bctree Block-cut tree related classes and functions /// @details This module contains all functions and classes that are related /// to block-cut trees. -/// +/// /// To build a block-cut tree the functions /// buildBlockCutTree(GraphType const &) or /// BlockCutTree::Build(GraphType const &) can be used. @@ -227,7 +227,7 @@ class BlockCutTree final { /** * @brief Whether the block is a bridge. - * + * * @details Bridges are blocks that consist of only one edge. * * @return @c true if the block represents a bridge, @c false otherwise. @@ -311,7 +311,7 @@ class BlockCutTree final { std::vector blocks_; /** * @brief The cut-vertices in the graph. - * + * * @details The cut-vertex with identifier @c id is at position @c id * in the vector. The positions that do not correspond to * cut-vertices contain empty objects. diff --git a/include/DataStructures/Graphs/DynamicGraph.hpp b/include/DataStructures/Graphs/DynamicGraph.hpp index 3ab14502..92e9695c 100644 --- a/include/DataStructures/Graphs/DynamicGraph.hpp +++ b/include/DataStructures/Graphs/DynamicGraph.hpp @@ -4,7 +4,7 @@ * Created on: Nov 04, 2018 * Author: Franziska Wegner, Matthias Wolf */ - + #ifndef EGOA__DATA_STRUCTURES__GRAPHS__DYNAMIC_GRAPH_HPP #define EGOA__DATA_STRUCTURES__GRAPHS__DYNAMIC_GRAPH_HPP @@ -106,7 +106,7 @@ class DynamicGraph { * If the graph is destroyed, all views are invalid and calling * member functions on them has undefined behavior. */ - inline TVerticesView Vertices() + inline TVerticesView Vertices() { return TVerticesView ( & vertices_ , & vertexExists_ @@ -123,7 +123,7 @@ class DynamicGraph { * If the graph is destroyed, all views are invalid and calling * member functions on them has undefined behavior. */ - inline TConstVerticesView Vertices() const + inline TConstVerticesView Vertices() const { return TConstVerticesView ( & vertices_ , & vertexExists_ @@ -138,7 +138,7 @@ class DynamicGraph { * @return @p true if a vertex with identifier @p id exists, * @p false otherwise. */ - inline bool VertexExists ( Types::vertexId id ) const + inline bool VertexExists ( Types::vertexId id ) const { return id < vertexExists_.size() && vertexExists_[id]; } @@ -152,7 +152,7 @@ class DynamicGraph { * * @return The vertex object. */ - inline TVertex & VertexAt ( Types::vertexId id ) + inline TVertex & VertexAt ( Types::vertexId id ) { USAGE_ASSERT ( VertexExists(id) ); return vertices_[id]; @@ -167,7 +167,7 @@ class DynamicGraph { * * @return The vertex object. */ - inline TVertex const & VertexAt ( Types::vertexId id ) const + inline TVertex const & VertexAt ( Types::vertexId id ) const { USAGE_ASSERT ( VertexExists(id) ); return vertices_[id]; @@ -187,7 +187,7 @@ class DynamicGraph { * * @return The vertex identifier. */ - inline Types::vertexId VertexId ( TVertex const & vertex ) const + inline Types::vertexId VertexId ( TVertex const & vertex ) const { return vertex.Identifier(); } @@ -201,7 +201,7 @@ class DynamicGraph { * * @return The identifier of the vertex. */ - inline Types::vertexId AddVertex ( TVertexProperties & properties ) + inline Types::vertexId AddVertex ( TVertexProperties & properties ) { return AddVertex ( TVertexProperties(properties) ); } @@ -213,7 +213,7 @@ class DynamicGraph { * * @return The identifier of the vertex. */ - inline Types::vertexId AddVertex ( TVertexProperties const & properties ) + inline Types::vertexId AddVertex ( TVertexProperties const & properties ) { return AddVertex ( TVertexProperties(properties) ); } @@ -225,7 +225,7 @@ class DynamicGraph { * * @return The identifier of the vertex. */ - inline Types::vertexId AddVertex ( TVertexProperties && properties ) + inline Types::vertexId AddVertex ( TVertexProperties && properties ) { // TODO: Find a free place in the vector if it exists. auto id = vertices_.size(); @@ -250,7 +250,7 @@ class DynamicGraph { * * @param id The identifier of the vertex to remove. */ - inline void RemoveVertexAt ( Types::vertexId id ) + inline void RemoveVertexAt ( Types::vertexId id ) { USAGE_ASSERT ( VertexExists(id) ); @@ -275,13 +275,13 @@ class DynamicGraph { */ template inline auto MapVertices ( FUNCTION function ) const - -> std::vector(), std::declval()))> + -> std::vector(), std::declval()))> { using TResult = decltype(function(std::declval(), std::declval())); std::vector result; for_all_vertex_tuples( - [&]( Types::vertexId id, TVertex const & vertex ) + [&]( Types::vertexId id, TVertex const & vertex ) { result.push_back ( function(id, vertex) ); } @@ -302,7 +302,7 @@ class DynamicGraph { * * @return The vertex identifiers of all neighbors. */ - inline std::vector NeighborsOf ( Types::vertexId id ) const + inline std::vector NeighborsOf ( Types::vertexId id ) const { USAGE_ASSERT ( VertexExists(id) ); @@ -325,7 +325,7 @@ class DynamicGraph { * neighbors are appended. */ inline void NeighborsOf ( Types::vertexId id - , std::vector & vertexIds ) const + , std::vector & vertexIds ) const { USAGE_ASSERT ( VertexExists(id) ); @@ -356,7 +356,7 @@ class DynamicGraph { * * @return The number of incoming edges. */ - inline Types::count InDegreeAt ( Types::vertexId id ) const + inline Types::count InDegreeAt ( Types::vertexId id ) const { USAGE_ASSERT ( VertexExists(id) ); return InEdgeIdsAt(id).size(); @@ -371,7 +371,7 @@ class DynamicGraph { * * @return The number of outgoing edges. */ - inline Types::count OutDegreeAt ( Types::vertexId id ) const + inline Types::count OutDegreeAt ( Types::vertexId id ) const { USAGE_ASSERT ( VertexExists(id) ); return OutEdgeIdsAt(id).size(); @@ -386,7 +386,7 @@ class DynamicGraph { * * @return The number of incident edges. */ - inline Types::count DegreeAt ( Types::vertexId id ) const + inline Types::count DegreeAt ( Types::vertexId id ) const { USAGE_ASSERT ( VertexExists(id) ); return InDegreeAt(id) + OutDegreeAt(id); @@ -401,7 +401,7 @@ class DynamicGraph { * * @return The identifiers of the incoming edges at vertex @p id. */ - inline std::vector const & InEdgeIdsAt ( Types::vertexId id ) const + inline std::vector const & InEdgeIdsAt ( Types::vertexId id ) const { USAGE_ASSERT ( VertexExists(id) ); return inEdgeIds_[id]; @@ -416,7 +416,7 @@ class DynamicGraph { * * @return The identifiers of the outgoing edges at vertex @p id. */ - inline std::vector const & OutEdgeIdsAt ( Types::vertexId id ) const + inline std::vector const & OutEdgeIdsAt ( Types::vertexId id ) const { USAGE_ASSERT ( VertexExists(id) ); return outEdgeIds_[id]; @@ -432,7 +432,7 @@ class DynamicGraph { * * @return The edge identifiers at a vertex @p id. */ - inline std::vector EdgeIdsAt ( Types::vertexId id ) const + inline std::vector EdgeIdsAt ( Types::vertexId id ) const { USAGE_ASSERT ( VertexExists(id) ); @@ -478,7 +478,7 @@ class DynamicGraph { * If the graph is destroyed, all views are invalid and calling * member functions on them has undefined behavior. */ - inline TEdgesView Edges() + inline TEdgesView Edges() { return TEdgesView ( & edges_ , & edgeExists_ @@ -495,7 +495,7 @@ class DynamicGraph { * If the graph is destroyed, all views are invalid and calling * member functions on them has undefined behavior. */ - inline TConstEdgesView Edges() const + inline TConstEdgesView Edges() const { return TConstEdgesView ( & edges_ , & edgeExists_ @@ -511,7 +511,7 @@ class DynamicGraph { * @return @p true if an edge with identifier @p id exists, * @p false otherwise. */ - inline bool EdgeExists ( Types::edgeId id ) const + inline bool EdgeExists ( Types::edgeId id ) const { return id < edgeExists_.size() && edgeExists_[id]; } @@ -525,7 +525,7 @@ class DynamicGraph { * * @return The edge object with identifier @p id. */ - inline TEdge & EdgeAt ( Types::edgeId id ) + inline TEdge & EdgeAt ( Types::edgeId id ) { USAGE_ASSERT ( EdgeExists(id) ); return edges_[id]; @@ -540,7 +540,7 @@ class DynamicGraph { * * @return The edge object with identifier @p id. */ - inline TEdge const & EdgeAt ( Types::edgeId id ) const + inline TEdge const & EdgeAt ( Types::edgeId id ) const { USAGE_ASSERT ( EdgeExists(id) ); return edges_[id]; @@ -562,20 +562,20 @@ class DynamicGraph { * not exist. */ inline Types::edgeId EdgeId ( Types::vertexId source - , Types::vertexId target ) const + , Types::vertexId target ) const { USAGE_ASSERT ( VertexExists(source) ); USAGE_ASSERT ( VertexExists(target) ); - if ( OutDegreeAt(source) <= InDegreeAt(target) ) + if ( OutDegreeAt(source) <= InDegreeAt(target) ) { - for ( Types::edgeId id : outEdgeIds_[source] ) + for ( Types::edgeId id : outEdgeIds_[source] ) { if ( EdgeAt(id).Target() == target ) return id; } } else { - for (Types::edgeId id : inEdgeIds_[target]) + for (Types::edgeId id : inEdgeIds_[target]) { if ( EdgeAt(id).Source() == source ) return id; @@ -600,7 +600,7 @@ class DynamicGraph { * @return The edge @f$(\vertexa, \vertexb)@f$. */ inline TEdge & Edge ( Types::vertexId source - , Types::vertexId target ) + , Types::vertexId target ) { USAGE_ASSERT ( VertexExists(source) ); USAGE_ASSERT ( VertexExists(target) ); @@ -625,7 +625,7 @@ class DynamicGraph { * @return The edge @f$(\vertexa, \vertexb)@f$. */ inline const TEdge & Edge ( Types::vertexId source - , Types::vertexId target ) const + , Types::vertexId target ) const { USAGE_ASSERT ( VertexExists(source) ); USAGE_ASSERT ( VertexExists(target) ); @@ -648,7 +648,7 @@ class DynamicGraph { */ inline Types::edgeId AddEdge ( Types::vertexId source , Types::vertexId target - , TEdgeProperties & properties ) + , TEdgeProperties & properties ) { USAGE_ASSERT( VertexExists( source ) ); USAGE_ASSERT( VertexExists( target ) ); @@ -719,7 +719,7 @@ class DynamicGraph { * * @param id The identifier of the edge. */ - inline void RemoveEdgeAt ( Types::edgeId id ) + inline void RemoveEdgeAt ( Types::edgeId id ) { USAGE_ASSERT( EdgeExists(id) ); // remove edge @@ -744,13 +744,13 @@ class DynamicGraph { * * @param id The identifier of the vertex. */ - inline void RemoveAllIncidentEdgesAt ( Types::vertexId id ) + inline void RemoveAllIncidentEdgesAt ( Types::vertexId id ) { USAGE_ASSERT ( VertexExists(id) ); using std::begin, std::end; - for (Types::edgeId edgeId : inEdgeIds_[id]) + for (Types::edgeId edgeId : inEdgeIds_[id]) { ESSENTIAL_ASSERT( EdgeExists(edgeId) ); @@ -763,7 +763,7 @@ class DynamicGraph { edgeExists_[edgeId] = false; } - for (Types::edgeId edgeId : outEdgeIds_[id]) + for (Types::edgeId edgeId : outEdgeIds_[id]) { ESSENTIAL_ASSERT( EdgeExists(edgeId) ); @@ -784,7 +784,7 @@ class DynamicGraph { /** * @brief Applies @p function to all edges and collects the result in a vector. - * + * * @param[in] function The function that is applied to all edges. * @code * TResult function(Types::edgeId, TEdge) @@ -797,13 +797,13 @@ class DynamicGraph { */ template inline auto MapEdges(FUNCTION function) const - -> std::vector(), std::declval()))> + -> std::vector(), std::declval()))> { using TResult = decltype(function(std::declval(), std::declval())); std::vector result; for_all_edge_tuples( - [&]( Types::edgeId id, TEdge const & edge ) + [&]( Types::edgeId id, TEdge const & edge ) { result.push_back(function(id, edge)); } @@ -839,9 +839,9 @@ class DynamicGraph { * @brief Update vertices * @details Shrink vertex array */ - inline void UpdateVertices() + inline void UpdateVertices() { - if (NumberOfVertices() == vertices_.size()) + if (NumberOfVertices() == vertices_.size()) { // There are no edges marked as deleted return; @@ -851,11 +851,11 @@ class DynamicGraph { for ( Types::vertexId id = 0 ; id < vertices_.size() - ; ++id) + ; ++id) { if (vertexExists_[id]) continue; - while ( !vertexExists_.back() ) + while ( !vertexExists_.back() ) { vertices_.pop_back(); vertexExists_.pop_back(); @@ -863,7 +863,7 @@ class DynamicGraph { outEdgeIds_.pop_back(); } - if ( id == vertices_.size() ) + if ( id == vertices_.size() ) { // All vertices behind the one at position id were marked as // deleted and have been removed. There is nothing left to do. @@ -881,17 +881,17 @@ class DynamicGraph { swap(vertices_[id], vertices_.back()); vertices_.pop_back(); vertices_[id].identifier_ = id; - + swap(inEdgeIds_[id], inEdgeIds_.back()); inEdgeIds_.pop_back(); - for ( auto & edge : inEdgeIds_[id] ) + for ( auto & edge : inEdgeIds_[id] ) { EdgeAt(edge).target_ = id; } swap(outEdgeIds_[id], outEdgeIds_.back()); outEdgeIds_.pop_back(); - for ( auto & edge : outEdgeIds_[id] ) + for ( auto & edge : outEdgeIds_[id] ) { EdgeAt(edge).source_ = id; } @@ -915,9 +915,9 @@ class DynamicGraph { * edges and edges that were marked as * deleted. */ - inline void UpdateEdges() + inline void UpdateEdges() { - if ( NumberOfEdges() == edges_.size() ) + if ( NumberOfEdges() == edges_.size() ) { // There are no edges marked as deleted. return; @@ -928,17 +928,17 @@ class DynamicGraph { // delete all entries where the edges do not exist for ( Types::edgeId id = 0 ; id < edges_.size() - ; ++id) + ; ++id) { if (edgeExists_[id]) continue; - while (!edgeExists_.back()) + while (!edgeExists_.back()) { edgeExists_.pop_back(); edges_.pop_back(); } - if (id == edges_.size()) + if (id == edges_.size()) { // All edges behind the one at id were marked as deleted as well // and have been removed. We have nothing to do anymore. @@ -962,16 +962,16 @@ class DynamicGraph { // Rebuild the vectors containing the incident edges since the IDs may have changed. // TODO: This could be implemented more efficiently by only updating affected vertices. - for ( auto & edges : inEdgeIds_ ) + for ( auto & edges : inEdgeIds_ ) { edges.clear(); } - for ( auto & edges : outEdgeIds_ ) + for ( auto & edges : outEdgeIds_ ) { edges.clear(); } - std::for_each ( Edges().begin(), Edges().end(), + std::for_each ( Edges().begin(), Edges().end(), [this]( TEdge & edge ) { Types::vertexId source = edge.Source(); @@ -1001,17 +1001,17 @@ class DynamicGraph { * * @return The minimum degree. */ - inline Types::count MinDegree ( Types::vertexId & id ) const + inline Types::count MinDegree ( Types::vertexId & id ) const { - if ( NumberOfVertices() == 0 ) + if ( NumberOfVertices() == 0 ) { id = Const::NONE; return 0; } TConstVerticesView vertices = Vertices(); - + auto result = std::min_element ( vertices.begin(), vertices.end(), - [&]( TVertex const & left, TVertex const & right ) + [&]( TVertex const & left, TVertex const & right ) { return DegreeAt( left.Identifier() ) < DegreeAt( right.Identifier() ); } @@ -1028,7 +1028,7 @@ class DynamicGraph { * * @return The minimum degree. */ - inline Types::count MinDegree() const + inline Types::count MinDegree() const { Types::vertexId dummy = 0; return MinDegree(dummy); @@ -1047,17 +1047,17 @@ class DynamicGraph { * * @return The maximum degree. */ - inline Types::count MaxDegree ( Types::vertexId & id ) const + inline Types::count MaxDegree ( Types::vertexId & id ) const { - if ( NumberOfVertices() == 0 ) + if ( NumberOfVertices() == 0 ) { id = Const::NONE; return 0; } TConstVerticesView vertices = Vertices(); - + auto result = std::max_element ( vertices.begin(), vertices.end(), - [&]( TVertex const & left, TVertex const & right ) + [&]( TVertex const & left, TVertex const & right ) { return DegreeAt( left.Identifier() ) < DegreeAt( right.Identifier() ); } @@ -1073,7 +1073,7 @@ class DynamicGraph { * * @return The maximum degree. */ - inline Types::count MaxDegree() const + inline Types::count MaxDegree() const { Types::vertexId dummy = 0; return MaxDegree(dummy); @@ -1092,8 +1092,8 @@ class DynamicGraph { * vertices. It must accept one argument of type * @p Types::vertexId e.g., * @code{.cpp} - * []( Types::vertexId vertexId ) - * { + * []( Types::vertexId vertexId ) + * { * // Do something with the vertex identifier. * } * @endcode @@ -1103,7 +1103,7 @@ class DynamicGraph { */ template inline - void for_all_vertex_identifiers ( FUNCTION function ) const + void for_all_vertex_identifiers ( FUNCTION function ) const { internal::DynamicGraphLoopDifferentiation ::for_all_vertex_identifiers ( *this, function ); @@ -1116,8 +1116,8 @@ class DynamicGraph { * vertices. It must accept one argument of type * @p TVertex e.g., * @code{.cpp} - * []( TVertex & vertex ) - * { + * []( TVertex & vertex ) + * { * // Do something with the vertex object. * } * @endcode @@ -1127,7 +1127,7 @@ class DynamicGraph { */ template inline - void for_all_vertices ( FUNCTION function ) + void for_all_vertices ( FUNCTION function ) { internal::DynamicGraphLoopDifferentiation ::for_all_vertices ( *this, function ); @@ -1140,8 +1140,8 @@ class DynamicGraph { * vertices. It must accept one argument of type * @p TVertex e.g., * @code{.cpp} - * []( TVertex const & vertex ) - * { + * []( TVertex const & vertex ) + * { * // Do something with the vertex object. * } * @endcode @@ -1151,7 +1151,7 @@ class DynamicGraph { */ template inline - void for_all_vertices( FUNCTION function ) const + void for_all_vertices( FUNCTION function ) const { internal::DynamicGraphLoopDifferentiation ::for_all_vertices ( *this, function ); @@ -1166,8 +1166,8 @@ class DynamicGraph { * types @p Types::vertexId and @p TVertex, * e.g., * @code{.cpp} - * []( Types::vertexId id, TVertex const & vertex ) - * { + * []( Types::vertexId id, TVertex const & vertex ) + * { * // Do something with the vertex identifier and object. * } * @endcode @@ -1177,7 +1177,7 @@ class DynamicGraph { */ template inline - void for_all_vertex_tuples ( FUNCTION function ) + void for_all_vertex_tuples ( FUNCTION function ) { internal::DynamicGraphLoopDifferentiation ::for_all_vertex_tuples ( *this, function ); @@ -1192,8 +1192,8 @@ class DynamicGraph { * types @p Types::vertexId and @p TVertex, * e.g., * @code{.cpp} - * []( Types::vertexId id, TVertex const & vertex ) - * { + * []( Types::vertexId id, TVertex const & vertex ) + * { * // Do something with the vertex identifier and object. * } * @endcode @@ -1203,7 +1203,7 @@ class DynamicGraph { */ template inline - void for_all_vertex_tuples ( FUNCTION function ) const + void for_all_vertex_tuples ( FUNCTION function ) const { internal::DynamicGraphLoopDifferentiation ::for_all_vertex_tuples ( *this, function ); @@ -1221,8 +1221,8 @@ class DynamicGraph { * edges. It must accept one argument of type @p * Types::edgeId, e.g., * @code{.cpp} - * []( Types::edgeId edgeId ) - * { + * []( Types::edgeId edgeId ) + * { * // Do something with the edge identifier. * } * @endcode @@ -1232,7 +1232,7 @@ class DynamicGraph { */ template inline - void for_all_edge_identifiers ( FUNCTION function ) const + void for_all_edge_identifiers ( FUNCTION function ) const { internal::DynamicGraphLoopDifferentiation ::for_all_edge_identifiers ( *this, function ); @@ -1245,8 +1245,8 @@ class DynamicGraph { * edges. It must accept one argument of type @p * TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1256,7 +1256,7 @@ class DynamicGraph { */ template inline - void for_all_edges ( FUNCTION function ) + void for_all_edges ( FUNCTION function ) { internal::DynamicGraphLoopDifferentiation ::for_all_edges ( *this, function ); @@ -1269,8 +1269,8 @@ class DynamicGraph { * edges. It must accept one argument of type @p * TEdge, e.g., * @code{.cpp} - * []( TEdge const & edge ) - * { + * []( TEdge const & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1280,7 +1280,7 @@ class DynamicGraph { */ template inline - void for_all_edges ( FUNCTION function ) const + void for_all_edges ( FUNCTION function ) const { internal::DynamicGraphLoopDifferentiation ::for_all_edges ( *this, function ); @@ -1294,8 +1294,8 @@ class DynamicGraph { * edges. It must accept two arguments of types * @p Types::edgeId and @p TEdge, e.g., * @code{.cpp} - * []( Types::edgeId edgeId, TEdge & edge ) - * { + * []( Types::edgeId edgeId, TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1305,7 +1305,7 @@ class DynamicGraph { */ template inline - void for_all_edge_tuples ( FUNCTION function ) + void for_all_edge_tuples ( FUNCTION function ) { internal::DynamicGraphLoopDifferentiation ::for_all_edge_tuples ( *this, function ); @@ -1319,8 +1319,8 @@ class DynamicGraph { * It must accept two arguments of types @p Types::edgeId * and @p TEdge, e.g., * @code{.cpp} - * []( Types::edgeId edgeId, TEdge const & edge ) - * { + * []( Types::edgeId edgeId, TEdge const & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1330,7 +1330,7 @@ class DynamicGraph { */ template inline - void for_all_edge_tuples ( FUNCTION function ) const + void for_all_edge_tuples ( FUNCTION function ) const { internal::DynamicGraphLoopDifferentiation ::for_all_edge_tuples ( *this, function ); @@ -1350,8 +1350,8 @@ class DynamicGraph { * edges at the vertex. It must accept one * argument of type @p TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1361,7 +1361,7 @@ class DynamicGraph { */ template inline - void for_all_edges_at ( TVertex const & vertex, FUNCTION function ) + void for_all_edges_at ( TVertex const & vertex, FUNCTION function ) { internal::DynamicGraphLoopDifferentiation ::for_all_edges_at ( *this, vertex, function ); @@ -1376,8 +1376,8 @@ class DynamicGraph { * edges at the vertex. It must accept one * argument of type @p TEdge, e.g., * @code{.cpp} - * []( TEdge const & edge ) - * { + * []( TEdge const & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1388,7 +1388,7 @@ class DynamicGraph { template inline void for_all_edges_at ( TVertex const & vertex - , FUNCTION function ) const + , FUNCTION function ) const { internal::DynamicGraphLoopDifferentiation ::for_all_edges_at ( *this, vertex, function ); @@ -1405,8 +1405,8 @@ class DynamicGraph { * edges at the vertex. It must accept one * argument of type @p TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1417,7 +1417,7 @@ class DynamicGraph { template inline void for_all_edges_at ( Types::vertexId vertexId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT( VertexExists(vertexId) ); internal::DynamicGraphLoopDifferentiation @@ -1435,8 +1435,8 @@ class DynamicGraph { * the vertex. It must accept one argument of type * @p TEdge, e.g., * @code{.cpp} - * []( TEdge const & edge ) - * { + * []( TEdge const & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1447,7 +1447,7 @@ class DynamicGraph { template inline void for_all_edges_at ( Types::vertexId vertexId - , FUNCTION function ) const + , FUNCTION function ) const { USAGE_ASSERT( VertexExists(vertexId) ); internal::DynamicGraphLoopDifferentiation @@ -1462,8 +1462,8 @@ class DynamicGraph { * incoming edges at the vertex. It must accept * one argument of type @p TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1474,7 +1474,7 @@ class DynamicGraph { */ template inline - void for_in_edges_at( TVertex const & vertex, FUNCTION function ) + void for_in_edges_at( TVertex const & vertex, FUNCTION function ) { internal::DynamicGraphLoopDifferentiation ::for_in_edges_at ( *this, vertex.Identifier(), function ); @@ -1488,8 +1488,8 @@ class DynamicGraph { * incoming edges at the vertex. It must accept * one argument of type @p TEdge, e.g., * @code{.cpp} - * []( TEdge const & edge ) - * { + * []( TEdge const & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1501,7 +1501,7 @@ class DynamicGraph { template inline void for_in_edges_at ( TVertex const & vertex - , FUNCTION function ) const + , FUNCTION function ) const { internal::DynamicGraphLoopDifferentiation ::for_in_edges_at ( *this, vertex.Identifier(), function ); @@ -1517,8 +1517,8 @@ class DynamicGraph { * incoming edges at the vertex. It must accept * one argument of type @p TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1530,7 +1530,7 @@ class DynamicGraph { template inline void for_in_edges_at ( Types::vertexId vertexId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT( VertexExists(vertexId) ); internal::DynamicGraphLoopDifferentiation @@ -1547,8 +1547,8 @@ class DynamicGraph { * incoming edges at the vertex. It must accept * one argument of type @p TEdge, e.g., * @code{.cpp} - * []( TEdge const & edge ) - * { + * []( TEdge const & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1560,7 +1560,7 @@ class DynamicGraph { template inline void for_in_edges_at ( Types::vertexId vertexId - , FUNCTION function ) const + , FUNCTION function ) const { USAGE_ASSERT( VertexExists(vertexId) ); internal::DynamicGraphLoopDifferentiation @@ -1575,8 +1575,8 @@ class DynamicGraph { * outgoing edges at the vertex. It must accept * one argument of type @p TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1588,7 +1588,7 @@ class DynamicGraph { template inline void for_out_edges_at ( TVertex const & vertex - , FUNCTION function ) + , FUNCTION function ) { internal::DynamicGraphLoopDifferentiation ::for_out_edges_at ( *this, vertex, function ); @@ -1602,8 +1602,8 @@ class DynamicGraph { * outgoing edges at the vertex. It must accept * one argument of type @p TEdge, e.g., * @code{.cpp} - * []( TEdge const & edge ) - * { + * []( TEdge const & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1615,7 +1615,7 @@ class DynamicGraph { template inline void for_out_edges_at ( TVertex const & vertex - , FUNCTION function ) const + , FUNCTION function ) const { internal::DynamicGraphLoopDifferentiation ::for_out_edges_at ( *this, vertex, function ); @@ -1631,8 +1631,8 @@ class DynamicGraph { * outgoing edges at the vertex. It must accept * one argument of type @p TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1644,7 +1644,7 @@ class DynamicGraph { template inline void for_out_edges_at ( Types::vertexId vertexId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT ( VertexExists(vertexId) ); internal::DynamicGraphLoopDifferentiation @@ -1661,8 +1661,8 @@ class DynamicGraph { * outgoing edges at the vertex. It must accept * one argument of type @p TEdge, e.g., * @code{.cpp} - * []( TEdge const & edge ) - * { + * []( TEdge const & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1674,7 +1674,7 @@ class DynamicGraph { template inline void for_out_edges_at ( Types::vertexId vertexId - , FUNCTION function ) const + , FUNCTION function ) const { USAGE_ASSERT( VertexExists(vertexId) ); internal::DynamicGraphLoopDifferentiation @@ -1693,7 +1693,7 @@ class DynamicGraph { * @tparam Const { description } */ template - class OmittingVectorView + class OmittingVectorView { using TElement = ElementType; /** @@ -1757,28 +1757,28 @@ class DynamicGraph { counter_(counter) {} - TIterator begin() const noexcept + TIterator begin() const noexcept { return TIterator ( elementVector_->begin() , elementVector_->end() , existsVector_->begin()); } - TIterator end() const noexcept + TIterator end() const noexcept { return TIterator ( elementVector_->end() , elementVector_->end() , existsVector_->end() ); } - TReverseIterator rbegin() const noexcept + TReverseIterator rbegin() const noexcept { return TReverseIterator ( elementVector_->rbegin() , elementVector_->rend() , existsVector_->rbegin() ); } - TReverseIterator rend() const noexcept + TReverseIterator rend() const noexcept { return TReverseIterator ( elementVector_->rend() , elementVector_->rend() @@ -1788,7 +1788,7 @@ class DynamicGraph { bool empty() const noexcept { return size() == 0; } Types::count size() const noexcept { return *counter_; } - TReference operator[] ( Types::index index ) const + TReference operator[] ( Types::index index ) const { USAGE_ASSERT( (*existsVector_)[index] ); return (*elementVector_)[index]; @@ -1823,8 +1823,7 @@ class DynamicGraph { std::vector< std::vector > inEdgeIds_; /**< Ids of the incoming edges per vertex */ std::vector< std::vector > outEdgeIds_; /**< Ids of the outgoing edges per vertex */ }; - + } // namespace egoa #endif // EGOA__DATA_STRUCTURES__GRAPHS__DYNAMIC_GRAPH_HPP - diff --git a/include/DataStructures/Graphs/Edges/Edge.hpp b/include/DataStructures/Graphs/Edges/Edge.hpp index ba52cb77..a3da6ef8 100644 --- a/include/DataStructures/Graphs/Edges/Edge.hpp +++ b/include/DataStructures/Graphs/Edges/Edge.hpp @@ -1,4 +1,4 @@ -/* +/* * Edge.hpp * * Created on: Mar 8, 2019 @@ -61,9 +61,9 @@ class Edge { * * @return The vertex identifier of the adjacent vertex. */ - inline Types::vertexId Other( Types::vertexId vertexId ) const - { - return ( Source() == vertexId )?Target():Source(); + inline Types::vertexId Other( Types::vertexId vertexId ) const + { + return ( Source() == vertexId )?Target():Source(); } /** @@ -92,9 +92,9 @@ class Edge { * * @return @p true if the edges are the same, @p false otherwise. */ - friend bool operator==(Edge const & lhs, Edge const & rhs) + friend bool operator==(Edge const & lhs, Edge const & rhs) { - return ( lhs.Identifier() == rhs.Identifier() ) + return ( lhs.Identifier() == rhs.Identifier() ) && ( lhs.Source() == rhs.Source() ) && ( lhs.Target() == rhs.Target() ) && ( lhs.Properties() == rhs.Properties() ); @@ -108,7 +108,7 @@ class Edge { * * @return @p false if the edges are the same, @p true otherwise. */ - friend bool operator!=(Edge const & lhs, Edge const & rhs) + friend bool operator!=(Edge const & lhs, Edge const & rhs) { return !(lhs == rhs); } @@ -129,4 +129,4 @@ class Edge { } // namespace egoa::Edges -#endif // EGOA__DATA_STRUCTURES__EDGES__EDGE_HPP \ No newline at end of file +#endif // EGOA__DATA_STRUCTURES__EDGES__EDGE_HPP diff --git a/include/DataStructures/Graphs/Edges/ElectricalProperties.hpp b/include/DataStructures/Graphs/Edges/ElectricalProperties.hpp index 852e4a16..9c0972ee 100644 --- a/include/DataStructures/Graphs/Edges/ElectricalProperties.hpp +++ b/include/DataStructures/Graphs/Edges/ElectricalProperties.hpp @@ -1,4 +1,4 @@ -/* +/* * ElectricalProperties.hpp * * Created on: Sep 16, 2018 @@ -17,7 +17,7 @@ namespace egoa::Edges { -template +template class CarrierDifferentiation; /** @@ -32,7 +32,7 @@ class ElectricalProperties { /**@name Constructors and Destructor */ ///@{ #pragma mark CONSTRUCTORS_AND_DESTRUCTORS - + ElectricalProperties() : name_("Branch 0") , status_(true) @@ -50,7 +50,7 @@ class ElectricalProperties { , angleShift_(0.0) , tapRatioCosThetaShift_(0.0) , tapRatioSinThetaShift_(0.0) - // + // , capitalCost_(0.0) , length_(0.0) , numberOfParallelLines_(0) @@ -70,11 +70,11 @@ class ElectricalProperties { /** * @brief Swapping the members of two ElectricalProperties - * + * * @param lhs Left ElectricalProperties * @param rhs Right ElectricalProperties */ - friend void swap ( ElectricalProperties & lhs, ElectricalProperties & rhs ) + friend void swap ( ElectricalProperties & lhs, ElectricalProperties & rhs ) { // Necessary for the copy and swap idiom using std::swap; // enable ADL swap( lhs.name_, rhs.name_ ); @@ -116,9 +116,9 @@ class ElectricalProperties { * @return @p true if the edges are the same, @p false otherwise. */ friend bool operator== ( ElectricalProperties const & lhs - , ElectricalProperties const & rhs) + , ElectricalProperties const & rhs) { - return ( lhs.Name() == rhs.Name() ) + return ( lhs.Name() == rhs.Name() ) && ( lhs.Status() == rhs.Status() ) && ( lhs.Type() == rhs.Type() ) && ( lhs.Resistance() == rhs.Resistance() ) @@ -127,7 +127,7 @@ class ElectricalProperties { && ( lhs.susceptance_ == rhs.susceptance_ ) && ( lhs.Weight() == rhs.Weight() ) && ( lhs.Charge() == rhs.Charge() ) - && ( lhs.ThermalLimit() == rhs.ThermalLimit() ) + && ( lhs.ThermalLimit() == rhs.ThermalLimit() ) && ( lhs.ThermalLimitB() == rhs.ThermalLimitB() ) && ( lhs.ThermalLimitC() == rhs.ThermalLimitC() ) && ( lhs.TapRatio() == rhs.TapRatio() ) @@ -154,11 +154,11 @@ class ElectricalProperties { * @return @p false if the edges are the same, @p true otherwise. */ friend bool operator!=( ElectricalProperties const & lhs - , ElectricalProperties const & rhs) + , ElectricalProperties const & rhs) { return !(lhs == rhs); } - ///@} + ///@} /**@name Getter and setter */ ///@{ @@ -212,12 +212,12 @@ class ElectricalProperties { inline Types::real TapRatioSinThetaShift() const { return tapRatioSinThetaShift_; } inline Types::real & TapRatioSinThetaShift() { return tapRatioSinThetaShift_; } - + // used to be Bound type inline TBound ThetaBound() const { return thetaBound_; } inline TBound & ThetaBound() { return thetaBound_; } ///@} - + // PyPsa inline Types::real CapitalCost() const { return capitalCost_; } inline Types::real & CapitalCost() { return capitalCost_; } @@ -242,8 +242,8 @@ class ElectricalProperties { inline Types::real TerrainFactor() const { return terrainFactor_; } inline Types::real & TerrainFactor() { return terrainFactor_; } - - + + /**@name Output */ ///@{ #pragma mark OUTPUT_METHODS @@ -254,16 +254,16 @@ class ElectricalProperties { * * @param outputStream The stream to write data to, e.g., std::cout. */ - static void HeaderLong ( std::ostream & outputStream ) + static void HeaderLong ( std::ostream & outputStream ) { - outputStream + outputStream << std::setw(15) << "Name" << std::setw(6) << "Source" << std::setw(6) << "Target" << std::setw(10) << "Resistance" << std::setw(10) << "Reactance" - << std::setw(10) << "Susceptance" - << std::setw(10) << "ThermalLineLimitA" + << std::setw(10) << "Susceptance" + << std::setw(10) << "ThermalLineLimitA" << std::setw(10) << "ThermalLineLimitB" << std::setw(10) << "ThermalLineLimitC" << std::setw(10) << "Ratio" @@ -280,15 +280,15 @@ class ElectricalProperties { * * @param outputStream The stream to write data to, e.g., std::cout. */ - static inline void Header ( std::ostream & outputStream) + static inline void Header ( std::ostream & outputStream) { - outputStream + outputStream << std::setw(15) << "name" << std::setw(6) << "fbus" << std::setw(6) << "tbus" << std::setw(10) << "r" << std::setw(10) << "x" - << std::setw(10) << "b" + << std::setw(10) << "b" << std::setw(10) << "rateA" << std::setw(10) << "rateB" << std::setw(10) << "rateC" @@ -312,9 +312,9 @@ class ElectricalProperties { inline void Line ( std::ostream & outputStream , Types::name sourceName , Types::name targetName - , Types::real baseMva = 1 ) const + , Types::real baseMva = 1 ) const { - outputStream + outputStream << std::setprecision(2) << std::fixed << std::setw(15) << Name() @@ -343,7 +343,7 @@ class ElectricalProperties { * @return The output stream. */ friend std::ostream & operator<< ( std::ostream & outputStream - , ElectricalProperties const & rhs ) + , ElectricalProperties const & rhs ) { outputStream << std::setprecision(2) << std::fixed @@ -358,7 +358,7 @@ class ElectricalProperties { << std::setw(30) << "\tcharge: " << std::setw(10) << rhs.Charge() << std::setw(10) << ", " << std::endl << std::setw(30) << "\ttap ratio: " << std::setw(10) << rhs.TapRatio() << std::setw(10) << " (tau)," << std::endl << std::setw(30) << "\tangle shift: " << std::setw(10) << rhs.AngleShift() << std::setw(10) << " theta shift/final angle," << std::endl; - return outputStream; + return outputStream; } ///@} @@ -374,20 +374,20 @@ class ElectricalProperties { TBound thetaBound_; /**< in rad, minimum/maximum angle difference, theta(source) - theta(target) = delta theta; Thermal limit bound */ - /**@name Branch impedance @f$ Z = R + j X @f$ in p.u. - * @note A line with impedance 0 can be removed unless it is a jumper line. + /**@name Branch impedance @f$ Z = R + j X @f$ in p.u. + * @note A line with impedance 0 can be removed unless it is a jumper line. */ //@{ Types::real resistance_; /**< in p.u., resistance r */ Types::real reactance_; /**< in p.u., reactance x */ ///@} Types::real conductance_; /**< in p.u., conductance g, not included in IEEE data */ - Types::real susceptance_; /**< in p.u., susceptance b, not included in IEEE data */ - Types::real charge_; /**< in p.u., total line charging susceptance (b) + Types::real susceptance_; /**< in p.u., susceptance b, not included in IEEE data */ + Types::real charge_; /**< in p.u., total line charging susceptance (b) 0 unless the transmission line has been combined with a transformer then add a line charging */ - /**@name Line MVA ratings + /**@name Line MVA ratings * @brief Three MVA ratings with Rate A being the lowest one. */ ///@{ @@ -399,14 +399,14 @@ class ElectricalProperties { /**@name Transformer */ //@{ Types::real tapRatio_; /**< in -, tap ratio representing final ratio, transformer off nominal turns - ratio, i non-zero (taps at source and impedance at target meaning - @f$ r = x = b = 0 @f$, @f$ tap = |V(source)|/|V(target)|) @f$, tap = 0 + ratio, i non-zero (taps at source and impedance at target meaning + @f$ r = x = b = 0 @f$, @f$ tap = |V(source)|/|V(target)|) @f$, tap = 0 indicates transmission line rather than transformer, i.e., tap = 1 */ Types::real angleShift_; /**< in rad, transformer phase shift angle, known as theta shift (angle shift) representing final angle, if it is positive it represents a delay. */ Types::real tapRatioCosThetaShift_; /**< Tap ratio . cos(theta shift) */ Types::real tapRatioSinThetaShift_; /**< Tap ratio . sin(theta shift) */ - ///@} + ///@} // PyPsa Types::real capitalCost_; /**< in Dollar, capital cost */ @@ -424,7 +424,7 @@ class ElectricalProperties { }; -template<> +template<> class CarrierDifferentiation { typedef ElectricalProperties TEdge; public: @@ -438,7 +438,7 @@ class CarrierDifferentiation { * @return The AC conductance g(u, v) */ static inline Types::real Conductance ( TEdge const & edge ) { - Types::real squareImpedanceMagnitude = ( pow( edge.Resistance(), 2 ) + pow( edge.Reactance(), 2 ) ); + Types::real squareImpedanceMagnitude = ( pow( edge.Resistance(), 2 ) + pow( edge.Reactance(), 2 ) ); if ( squareImpedanceMagnitude != 0 ) return ( edge.Resistance() / squareImpedanceMagnitude ); else { @@ -451,20 +451,20 @@ class CarrierDifferentiation { * @brief Susceptance for the AC network * @details This represents the "standard" susceptance calculated * by @f$x / (r^2 + x^2)@f$. - * - * For more details see - * Zimmerman, R. D., & Murillo-s, C. E. (2011). - * Matpower 4.1 User’s Manual. - * Power Systems Engineering Research Center (Pserc). + * + * For more details see + * Zimmerman, R. D., & Murillo-s, C. E. (2011). + * Matpower 4.1 User’s Manual. + * Power Systems Engineering Research Center (Pserc). * http://doi.org/http://www.pserc.cornell.edu/matpower/manual.pdf * * @param edge The edge * * @return The AC susceptance b(u, v) */ - static inline Types::real Susceptance ( TEdge const & edge ) + static inline Types::real Susceptance ( TEdge const & edge ) { - Types::real squareImpedanceMagnitude = ( pow( edge.Resistance(), 2 ) + pow( edge.Reactance(), 2 ) ); + Types::real squareImpedanceMagnitude = ( pow( edge.Resistance(), 2 ) + pow( edge.Reactance(), 2 ) ); if ( squareImpedanceMagnitude != 0 ) { return ( -edge.Reactance() / squareImpedanceMagnitude ); } else { @@ -480,7 +480,7 @@ class CarrierDifferentiation { * AC carrier. Dependent on the carrier the computation for the * susceptance and conductance changes. */ -template<> +template<> class CarrierDifferentiation { typedef ElectricalProperties TEdge; public: @@ -494,7 +494,7 @@ class CarrierDifferentiation { * * @return Conductance g(u, v) of the DC approximation. */ - static inline Types::real Conductance ( TEdge const & edge ) + static inline Types::real Conductance ( TEdge const & edge ) { return 0.0; } @@ -504,11 +504,11 @@ class CarrierDifferentiation { * @details For the DC-Approximation r = 0. Thus, the term @f$x /(r^2 * + x^2)@f$ becomes @f$1 / x@f$. Note that this is often overseen * in other tools. - * - * For more details see - * Zimmerman, R. D., & Murillo-s, C. E. (2011). - * Matpower 4.1 User’s Manual. - * Power Systems Engineering Research Center (Pserc). + * + * For more details see + * Zimmerman, R. D., & Murillo-s, C. E. (2011). + * Matpower 4.1 User’s Manual. + * Power Systems Engineering Research Center (Pserc). * http://doi.org/http://www.pserc.cornell.edu/matpower/manual.pdf * * @param edge The edge. @@ -530,7 +530,7 @@ class CarrierDifferentiation { * @details Detailed information of the susceptance b and conductance g can * be extracted from the data itself. */ -template<> +template<> class CarrierDifferentiation { typedef ElectricalProperties TEdge; public: @@ -540,7 +540,7 @@ class CarrierDifferentiation { static inline Types::real Susceptance ( TEdge const & edge ) { return edge.susceptance_; - } + } }; } // namespace egoa::Edge diff --git a/include/DataStructures/Graphs/Edges/Type.hpp b/include/DataStructures/Graphs/Edges/Type.hpp index 99a6bdd4..f44a18f9 100644 --- a/include/DataStructures/Graphs/Edges/Type.hpp +++ b/include/DataStructures/Graphs/Edges/Type.hpp @@ -4,7 +4,7 @@ * Created on: Oct 13, 2018 * Author: Franziska Wegner */ - + #ifndef EGOA__DATA_STRUCTURE__EDGES__TYPE_HPP #define EGOA__DATA_STRUCTURE__EDGES__TYPE_HPP @@ -57,10 +57,10 @@ namespace egoa::Edges { * @return The output stream. */ inline std::ostream & operator<< ( std::ostream & outputStream - , CarrierDifferentiationType const & rhs ) + , CarrierDifferentiationType const & rhs ) { - if ( rhs == CarrierDifferentiationType::AC ){ outputStream << "AC"; } - else if ( rhs == CarrierDifferentiationType::DC ){ outputStream << "DC"; } + if ( rhs == CarrierDifferentiationType::AC ){ outputStream << "AC"; } + else if ( rhs == CarrierDifferentiationType::DC ){ outputStream << "DC"; } else { outputStream << "unknown"; } return outputStream; } @@ -74,14 +74,14 @@ namespace egoa::Edges { * @return The output stream. */ inline std::ostream & operator<< ( std::ostream & outputStream - , ElectricalEdgeType const & rhs) + , ElectricalEdgeType const & rhs) { - if ( rhs == ElectricalEdgeType::standard ) { outputStream << "standard"; } - else if ( rhs == ElectricalEdgeType::switched ) { outputStream << "switched"; } - else if ( rhs == ElectricalEdgeType::controller ) { outputStream << "controller"; } - else if ( rhs == ElectricalEdgeType::transformer ) { outputStream << "transformer";} - else if ( rhs == ElectricalEdgeType::facts ) { outputStream << "facts"; } - else if ( rhs == ElectricalEdgeType::overloaded ) { outputStream << "overloaded"; } + if ( rhs == ElectricalEdgeType::standard ) { outputStream << "standard"; } + else if ( rhs == ElectricalEdgeType::switched ) { outputStream << "switched"; } + else if ( rhs == ElectricalEdgeType::controller ) { outputStream << "controller"; } + else if ( rhs == ElectricalEdgeType::transformer ) { outputStream << "transformer";} + else if ( rhs == ElectricalEdgeType::facts ) { outputStream << "facts"; } + else if ( rhs == ElectricalEdgeType::overloaded ) { outputStream << "overloaded"; } else { outputStream << "unknown"; } return outputStream; } @@ -99,7 +99,7 @@ namespace egoa::Edges { * @param stroke The stroke type. */ inline void ElectricalEdge2Stroke ( ElectricalEdgeType const & type - , ogdf::StrokeType & stroke ) + , ogdf::StrokeType & stroke ) { switch (type) { case ElectricalEdgeType::standard: stroke = ogdf::StrokeType::Solid; break; @@ -119,7 +119,7 @@ namespace egoa::Edges { * @param color The ogdf::Color type. */ inline void ElectricalEdge2Color ( ElectricalEdgeType const & type - , ogdf::Color & color ) + , ogdf::Color & color ) { switch (type) { case ElectricalEdgeType::standard: color = ogdf::Color::Name::Black; break; @@ -139,7 +139,7 @@ namespace egoa::Edges { * @param type The electrical edge type. */ inline void Stroke2ElectricalEdge ( ogdf::StrokeType const & stroke - , ElectricalEdgeType & type ) + , ElectricalEdgeType & type ) { switch (stroke) { case ogdf::StrokeType::Solid: type = ElectricalEdgeType::standard; break; @@ -159,7 +159,7 @@ namespace egoa::Edges { * @param type The electrical edge type. */ inline void Color2ElectricalEdge ( ogdf::Color const & color - , ElectricalEdgeType & type ) + , ElectricalEdgeType & type ) { if ( color == ogdf::Color::Name::Black ) { type = ElectricalEdgeType::standard; } else if ( color == ogdf::Color::Name::Gray ) { type = ElectricalEdgeType::switched; } @@ -178,7 +178,7 @@ namespace egoa::Edges { * @param color The color type. */ inline void ElectricalEdge2Color ( ElectricalEdgeType const & type - , Color & color ) + , Color & color ) { switch (type) { case ElectricalEdgeType::standard: color = Color::Name::KITblack; break; @@ -198,7 +198,7 @@ namespace egoa::Edges { * @param stroke The stroke type. */ inline void ElectricalEdge2Stroke ( ElectricalEdgeType const & type - , Stroke::Name & stroke ) + , Stroke::Name & stroke ) { switch (type) { case ElectricalEdgeType::standard: stroke = Stroke::Name::solid; break; @@ -207,7 +207,7 @@ namespace egoa::Edges { case ElectricalEdgeType::transformer: stroke = Stroke::Name::dotted; break; case ElectricalEdgeType::facts: stroke = Stroke::Name::dasheddotted; break; case ElectricalEdgeType::overloaded: stroke = Stroke::Name::bold; break; - default: stroke = Stroke::Name::none; + default: stroke = Stroke::Name::none; } } ///@} @@ -215,4 +215,3 @@ namespace egoa::Edges { } // namespace egoa::Edges #endif // EGOA__DATA_STRUCTURE__EDGES__TYPE_HPP - \ No newline at end of file diff --git a/include/DataStructures/Graphs/StaticGraph.hpp b/include/DataStructures/Graphs/StaticGraph.hpp index 1e0f44c6..92b1349b 100644 --- a/include/DataStructures/Graphs/StaticGraph.hpp +++ b/include/DataStructures/Graphs/StaticGraph.hpp @@ -4,7 +4,7 @@ * Created on: Nov 04, 2018 * Author: Franziska Wegner */ - + #ifndef EGOA__DATA_STRUCTURES__GRAPHS__STATIC_GRAPH_HPP #define EGOA__DATA_STRUCTURES__GRAPHS__STATIC_GRAPH_HPP @@ -70,13 +70,13 @@ class StaticGraph { /**@name Constructors and Destructor */ ///@{ -#pragma mark CONSTRUCTORS_AND_DESTRUCTOR - +#pragma mark CONSTRUCTORS_AND_DESTRUCTOR + StaticGraph() : name_("") {} - explicit StaticGraph ( Types::name name ) + explicit StaticGraph ( Types::name name ) : name_(std::move(name)) {} ///@} @@ -102,9 +102,9 @@ class StaticGraph { */ inline Types::count NumberOfVertices() const { - return vertices_.size(); + return vertices_.size(); } - + /** * @brief Number of edges @f$m = |\edges|@f$. * @@ -112,7 +112,7 @@ class StaticGraph { */ inline Types::count NumberOfEdges() const { - return edges_.size(); + return edges_.size(); } ///@} @@ -244,7 +244,7 @@ class StaticGraph { vertices_.emplace_back( id, std::move(properties) ); inEdgeIds_.emplace_back( std::vector() ); outEdgeIds_.emplace_back( std::vector() ); - + ESSENTIAL_ASSERT ( vertices_.size() == NumberOfVertices() ); ESSENTIAL_ASSERT ( inEdgeIds_.size() == NumberOfVertices() ); ESSENTIAL_ASSERT ( outEdgeIds_.size() == NumberOfVertices() ); @@ -257,7 +257,7 @@ class StaticGraph { /** * @brief Applies @p function to all vertices and collects * the result in a vector. - * + * * @param[in] function The function that is applied to all edges. * @code{.cpp} * TResult function ( Types::vertexId, TVertex ) @@ -270,13 +270,13 @@ class StaticGraph { */ template inline auto MapVertices ( FUNCTION function ) const - -> std::vector(), std::declval()))> + -> std::vector(), std::declval()))> { using TResult = decltype(function(std::declval(), std::declval())); std::vector result; - for_all_vertex_tuples( - [&]( Types::vertexId id, const TVertex & vertex ) + for_all_vertex_tuples( + [&]( Types::vertexId id, const TVertex & vertex ) { result.push_back ( function(id, vertex) ); } @@ -327,19 +327,19 @@ class StaticGraph { std::vector vertexVisited(NumberOfVertices(), false); - for (Types::edgeId edgeId : OutEdgeIdsAt(id)) + for (Types::edgeId edgeId : OutEdgeIdsAt(id)) { Types::vertexId otherVertex = EdgeAt(edgeId).Target(); - if (!vertexVisited[otherVertex]) + if (!vertexVisited[otherVertex]) { vertexIds.push_back(otherVertex); vertexVisited[otherVertex] = true; } } - for (Types::edgeId edgeId : InEdgeIdsAt(id)) + for (Types::edgeId edgeId : InEdgeIdsAt(id)) { Types::vertexId otherVertex = EdgeAt(edgeId).Source(); - if (!vertexVisited[otherVertex]) + if (!vertexVisited[otherVertex]) { vertexIds.push_back(otherVertex); vertexVisited[otherVertex] = true; @@ -572,15 +572,15 @@ class StaticGraph { USAGE_ASSERT ( VertexExists(source) ); USAGE_ASSERT ( VertexExists(target) ); - if ( OutDegreeAt(source) <= InDegreeAt(target) ) + if ( OutDegreeAt(source) <= InDegreeAt(target) ) { - for ( Types::edgeId id : outEdgeIds_[source] ) + for ( Types::edgeId id : outEdgeIds_[source] ) { if ( EdgeAt(id).Target() == target ) return id; } } else { - for (Types::edgeId id : inEdgeIds_[target]) + for (Types::edgeId id : inEdgeIds_[target]) { if ( EdgeAt(id).Source() == source ) return id; @@ -693,7 +693,7 @@ class StaticGraph { /** * @brief Applies @p function to all edges and collects the * result in a vector. - * + * * @param[in] function The function that is applied to all edges. * @code{.cpp} * TResult function(Types::edgeId, TEdge) @@ -711,8 +711,8 @@ class StaticGraph { using TResult = decltype(function(std::declval(), std::declval())); std::vector result; - for_all_edge_tuples( - [&]( Types::edgeId id, TEdge const & edge ) + for_all_edge_tuples( + [&]( Types::edgeId id, TEdge const & edge ) { result.push_back(function(id, edge)); } @@ -757,14 +757,14 @@ class StaticGraph { */ inline Types::count MinDegree ( Types::vertexId & id ) const { - if (NumberOfVertices() == 0) + if (NumberOfVertices() == 0) { id = Const::NONE; return 0; } auto result = std::min_element( vertices_.begin() , vertices_.end() - , [this]( TVertex const & left, TVertex const & right) + , [this]( TVertex const & left, TVertex const & right) { return DegreeAt(left.Identifier()) < DegreeAt(right.Identifier()); } @@ -802,14 +802,14 @@ class StaticGraph { */ inline Types::count MaxDegree ( Types::vertexId & id ) const { - if (NumberOfVertices() == 0) + if (NumberOfVertices() == 0) { id = Const::NONE; return 0; } auto result = std::max_element ( vertices_.begin() , vertices_.end() - , [this](const TVertex & left, TVertex const & right) + , [this](const TVertex & left, TVertex const & right) { return DegreeAt(left.Identifier()) < DegreeAt(right.Identifier()); } @@ -846,8 +846,8 @@ class StaticGraph { TVertexProperties::Header(outputStream); for_all_vertices ( [&]( TVertex const & u ) - { - u.Properties().Line( outputStream ); + { + u.Properties().Line( outputStream ); } ); } @@ -862,10 +862,10 @@ class StaticGraph { TEdgeProperties::Header(outputStream); for_all_edges( [&]( TEdge const & e ) - { + { e.Properties().Line( outputStream , VertexAt(e.Source()).Properties().Name() - , VertexAt(e.Target()).Properties().Name() ); + , VertexAt(e.Target()).Properties().Name() ); } ); } @@ -908,8 +908,8 @@ class StaticGraph { * of type @p Types::vertexId, e.g., * @code{.cpp} * for_all_vertex_identifiers ( - * []( Types::vertexId vertexId ) - * { + * []( Types::vertexId vertexId ) + * { * // Do something with the vertex identifier. * } * ); @@ -919,13 +919,13 @@ class StaticGraph { * @tparam FUNCTION The type of the function object. */ template - inline + inline void for_all_vertex_identifiers ( FUNCTION function ) const { internal::StaticGraphLoopDifferentiation ::for_all_vertex_identifiers ( *this, function ); } - + /** * @brief The @p for loop over all vertex objects in the graph. * @@ -934,8 +934,8 @@ class StaticGraph { * of type @p TVertex, e.g., * @code{.cpp} * for_all_vertices ( - * []( TVertex & vertex ) - * { + * []( TVertex & vertex ) + * { * // Do something with the vertex object. * } * ); @@ -945,7 +945,7 @@ class StaticGraph { * @tparam FUNCTION The type of the function object. */ template - inline + inline void for_all_vertices ( FUNCTION function ) { internal::StaticGraphLoopDifferentiation @@ -960,8 +960,8 @@ class StaticGraph { * of type @p TVertex, e.g., * @code{.cpp} * for_all_vertices ( - * []( TVertex const & vertex ) - * { + * []( TVertex const & vertex ) + * { * // Do something with the vertex object. * } * ); @@ -971,7 +971,7 @@ class StaticGraph { * @tparam FUNCTION The type of the function object. */ template - inline + inline void for_all_vertices ( FUNCTION function ) const { internal::StaticGraphLoopDifferentiation @@ -988,9 +988,9 @@ class StaticGraph { * @p TVertex, e.g., * @code{.cpp} * for_all_vertex_tuples ( - * []( Types::vertexId id, TVertex const & vertex ) - * { - * // Do something with the vertex identifier and object + * []( Types::vertexId id, TVertex const & vertex ) + * { + * // Do something with the vertex identifier and object * } * ); * @endcode @@ -999,7 +999,7 @@ class StaticGraph { * @tparam FUNCTION The type of the function object. */ template - inline + inline void for_all_vertex_tuples ( FUNCTION function ) { internal::StaticGraphLoopDifferentiation @@ -1015,8 +1015,8 @@ class StaticGraph { * and @p TVertex, e.g., * @code{.cpp} * for_all_vertex_tuples ( - * []( Types::vertexId id, TVertex const & vertex ) - * { + * []( Types::vertexId id, TVertex const & vertex ) + * { * // Do something with the vertex identifier and object. * } * ); @@ -1026,8 +1026,8 @@ class StaticGraph { * @tparam FUNCTION The type of the function object. */ template - inline - void for_all_vertex_tuples ( FUNCTION function ) const + inline + void for_all_vertex_tuples ( FUNCTION function ) const { internal::StaticGraphLoopDifferentiation ::for_all_vertex_tuples ( *this, function ); @@ -1046,8 +1046,8 @@ class StaticGraph { * type @p Types::edgeId, e.g., * @code{.cpp} * for_all_edge_identifiers ( - * []( Types::edgeId edgeId ) - * { + * []( Types::edgeId edgeId ) + * { * // Do something with the edge identifier. * } * ); @@ -1072,8 +1072,8 @@ class StaticGraph { * type @p TEdge, e.g., * @code{.cpp} * for_all_edges ( - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * ); @@ -1083,7 +1083,7 @@ class StaticGraph { * @tparam FUNCTION The type of the function object. */ template - inline + inline void for_all_edges ( FUNCTION function ) { internal::StaticGraphLoopDifferentiation @@ -1098,8 +1098,8 @@ class StaticGraph { * e.g., * @code{.cpp} * for_all_edges ( - * []( TEdge const & edge ) - * { + * []( TEdge const & edge ) + * { * // Do something with the edge object. * } * ); @@ -1109,7 +1109,7 @@ class StaticGraph { * @tparam FUNCTION The type of the function object. */ template - inline + inline void for_all_edges ( FUNCTION function ) const { internal::StaticGraphLoopDifferentiation @@ -1126,8 +1126,8 @@ class StaticGraph { * e.g., * @code{.cpp} * for_all_edge_tuples ( - * []( Types::edgeId edgeId, TEdge & edge ) - * { + * []( Types::edgeId edgeId, TEdge & edge ) + * { * // Do something with the edge object. * } * ); @@ -1137,7 +1137,7 @@ class StaticGraph { * @tparam FUNCTION The type of the function object. */ template - inline + inline void for_all_edge_tuples ( FUNCTION function ) { internal::StaticGraphLoopDifferentiation @@ -1153,9 +1153,9 @@ class StaticGraph { * of types @p Types::edgeId and @p TEdge, * e.g., * @code{.cpp} - * for_all_edge_tuples ( - * []( Types::edgeId edgeId, TEdge const & edge ) - * { + * for_all_edge_tuples ( + * []( Types::edgeId edgeId, TEdge const & edge ) + * { * // Do something with the edge object. * } * ); @@ -1165,7 +1165,7 @@ class StaticGraph { * @tparam FUNCTION The type of the function object. */ template - inline + inline void for_all_edge_tuples ( FUNCTION function ) const { internal::StaticGraphLoopDifferentiation @@ -1186,8 +1186,8 @@ class StaticGraph { * @p TEdge, e.g., * @code{.cpp} * for_all_edges_at( vertex - * , []( TEdge & edge ) - * { + * , []( TEdge & edge ) + * { * // Do something with the edge object. * } * ); @@ -1198,7 +1198,7 @@ class StaticGraph { * all incident edges at @p vertexId. */ template - inline + inline void for_all_edges_at ( TVertex const & vertex , FUNCTION function ) { @@ -1216,8 +1216,8 @@ class StaticGraph { * @p TEdge, e.g., * @code{.cpp} * for_all_edges_at( vertex - * , []( TEdge const & edge ) - * { + * , []( TEdge const & edge ) + * { * // Do something with the edge object. * } * ); @@ -1228,7 +1228,7 @@ class StaticGraph { * all incident edges at @p vertexId. */ template - inline + inline void for_all_edges_at ( TVertex const & vertex , FUNCTION function ) const { @@ -1248,8 +1248,8 @@ class StaticGraph { * @p TEdge, e.g., * @code{.cpp} * for_all_edges_at ( vertexId - * , []( TEdge & edge ) - * { + * , []( TEdge & edge ) + * { * // Do something with the edge object. * } * ); @@ -1260,7 +1260,7 @@ class StaticGraph { * all incident edges at @p vertexId. */ template - inline + inline void for_all_edges_at ( Types::vertexId const vertexId , FUNCTION function ) { @@ -1279,11 +1279,11 @@ class StaticGraph { * @param[in] function The function object that is called for all edges at * the vertex. It must accept one argument of type * @p TEdge, e.g., - * + * * @code{.cpp} * for_all_edges_at ( vertexId - * , []( TEdge const & edge ) - * { + * , []( TEdge const & edge ) + * { * // Do something with the edge object. * } * ); @@ -1294,7 +1294,7 @@ class StaticGraph { * all incident edges at @p vertexId. */ template - inline + inline void for_all_edges_at ( Types::vertexId const vertexId , FUNCTION function ) const { @@ -1312,8 +1312,8 @@ class StaticGraph { * type @p TEdge, e.g., * @code{.cpp} * for_all_edges_at ( vertex - * , []( TEdge const & edge ) - * { + * , []( TEdge const & edge ) + * { * // Do something with the edge object. * } * ); @@ -1341,11 +1341,11 @@ class StaticGraph { * type @p TEdge, e.g., * @code{.cpp} * for_in_edges_at ( vertex - * , []( TEdge const & edge ) - * { + * , []( TEdge const & edge ) + * { * // Do something with the edge object. * } - * ); + * ); * @endcode * * @tparam Policy The execution policy. @@ -1372,8 +1372,8 @@ class StaticGraph { * type @p TEdge, e.g., * @code{.cpp} * for_in_edges_at ( vertexId - * , []( TEdge & edge ) - * { + * , []( TEdge & edge ) + * { * // Do something with the edge object. * } * ); @@ -1403,8 +1403,8 @@ class StaticGraph { * type @p TEdge, e.g., * @code{.cpp} * for_in_edges_at ( vertexId - * , []( TEdge const & edge ) - * { + * , []( TEdge const & edge ) + * { * // Do something with the edge object. * } * ); @@ -1432,8 +1432,8 @@ class StaticGraph { * type @p TEdge, e.g., * @code{.cpp} * for_out_edges_at ( vertex - * , []( TEdge & edge ) - * { + * , []( TEdge & edge ) + * { * // Do something with the edge object. * } * ); @@ -1460,8 +1460,8 @@ class StaticGraph { * type @p TEdge, e.g., * @code{.cpp} * for_out_edges_at ( vertex - * , []( TEdge const & edge ) - * { + * , []( TEdge const & edge ) + * { * // Do something with the edge object. * } * ); @@ -1491,8 +1491,8 @@ class StaticGraph { * e.g., * @code{.cpp} * for_out_edges_at ( vertexId - * , []( TEdge & edge ) - * { + * , []( TEdge & edge ) + * { * // Do something with the edge object. * } * ); @@ -1524,8 +1524,8 @@ class StaticGraph { * e.g., * @code{.cpp} * for_out_edges_at ( vertexId - * []( TEdge const & edge ) - * { + * []( TEdge const & edge ) + * { * // Do something with the edge object. * } * ); @@ -1536,7 +1536,7 @@ class StaticGraph { * all outgoing edges of @p vertex. */ template - inline + inline void for_out_edges_at( Types::vertexId vertexId , FUNCTION function ) const { @@ -1561,4 +1561,3 @@ class StaticGraph { } // namespace egoa #endif // EGOA__DATA_STRUCTURES__GRAPHS__STATIC_GRAPH_HPP - diff --git a/include/DataStructures/Graphs/Type.hpp b/include/DataStructures/Graphs/Type.hpp index e2ab7921..df38a600 100644 --- a/include/DataStructures/Graphs/Type.hpp +++ b/include/DataStructures/Graphs/Type.hpp @@ -17,9 +17,9 @@ namespace egoa { ///@{ #pragma mark POWER_GRID_CONVERSION_METHODS inline Types::string BoundTypeToString ( Vertices::BoundType const & boundType ) - { - if ( Vertices::BoundType::exact == boundType ) return "exact"; - else if ( Vertices::BoundType::bounded == boundType ) return "bounded"; + { + if ( Vertices::BoundType::exact == boundType ) return "exact"; + else if ( Vertices::BoundType::bounded == boundType ) return "bounded"; else if ( Vertices::BoundType::unbounded == boundType ) return "unbounded"; else if ( Vertices::BoundType::pureunbounded == boundType ) return "pureunbounded" ; return "unknown"; @@ -28,4 +28,4 @@ namespace egoa { } // namespace egoa -#endif // EGOA__DATA_STRUCTURES__TYPE_HPP \ No newline at end of file +#endif // EGOA__DATA_STRUCTURES__TYPE_HPP diff --git a/include/DataStructures/Graphs/Vertices/ElectricalProperties.hpp b/include/DataStructures/Graphs/Vertices/ElectricalProperties.hpp index 22b4c4ac..39f2774f 100644 --- a/include/DataStructures/Graphs/Vertices/ElectricalProperties.hpp +++ b/include/DataStructures/Graphs/Vertices/ElectricalProperties.hpp @@ -32,7 +32,7 @@ class ElectricalProperties { using TProperties = ElectricalProperties; private: using TBound = Bound; - + public: /**@name Constructors and Destructor */ ///@{ @@ -71,18 +71,18 @@ class ElectricalProperties { /** * @brief Reset values to default. */ - inline void Reset () + inline void Reset () { // BasicVertex specifics Name () = ""; Type () = TVertexType::unknown; X () = 0.0; Y () = 0.0; - + // Admittance specifics ShuntSusceptance () = 0.0; ShuntConductance () = 0.0; - + // Voltage specifics NominalVoltage() = 1.0; VoltageAngle() = 0.0; @@ -91,14 +91,14 @@ class ElectricalProperties { // realVoltage_ = 0.0; // imaginaryVoltage_ = 0.0; voltageBound_ = TBound ( 0.0, Const::REAL_INFTY ); - + // Location specifics Country () = ""; Area () = 0; Zone () = 0; Control () = Vertices::ControlType::PQ; Carrier () = EnergyCarrier::AC; - + // Status specifics Status() = Vertices::BusStatus::active; } @@ -115,9 +115,9 @@ class ElectricalProperties { * @return @p True if both vertices are @p not equal, @p False * otherwise. */ - inline bool operator!=( ElectricalProperties const & rhs ) const - { - return !(this == rhs); + inline bool operator!=( ElectricalProperties const & rhs ) const + { + return !(this == rhs); } /** @@ -128,7 +128,7 @@ class ElectricalProperties { * @return @p True if both vertices are equal, @p False * otherwise. */ - inline bool operator==( ElectricalProperties const & rhs ) const + inline bool operator==( ElectricalProperties const & rhs ) const { if ( Name() != rhs.Name() ) return false; if ( Type() != rhs.Type() ) return false; @@ -154,12 +154,12 @@ class ElectricalProperties { #pragma mark COPY_AND_SWAP_IDIOM /** * @brief Swapping the members of two ElectricalVertices - * + * * @param lhs Left ElectricalProperties * @param rhs Right ElectricalProperties */ friend void swap ( ElectricalProperties & lhs - , ElectricalProperties & rhs ) + , ElectricalProperties & rhs ) { // Necessary for the copy and swap idiom using std::swap; // enable ADL // Basic vertex @@ -200,7 +200,7 @@ class ElectricalProperties { inline Types::real X() const { return xCoordinate_; } inline Types::real & X() { return xCoordinate_; } - + inline Types::real Y() const { return yCoordinate_; } inline Types::real & Y() { return yCoordinate_; } ///@} @@ -219,9 +219,9 @@ class ElectricalProperties { * @return The shunt susceptance @f$\shuntsusceptance(\vertex)@f$ * of @f$\vertex\in\vertices@f$. */ - inline Types::real ShuntSusceptance() const - { - return shuntSusceptance_; + inline Types::real ShuntSusceptance() const + { + return shuntSusceptance_; } /** @@ -241,8 +241,8 @@ class ElectricalProperties { * @f$\vertex\in\vertices@f$. */ inline Types::real & ShuntSusceptance() - { - return shuntSusceptance_; + { + return shuntSusceptance_; } /** @@ -255,9 +255,9 @@ class ElectricalProperties { * @return The shunt conductance @f$\shuntconductance(\vertex)@f$ * of @f$\vertex\in\vertices@f$. */ - inline Types::real ShuntConductance() const - { - return shuntConductance_; + inline Types::real ShuntConductance() const + { + return shuntConductance_; } /** @@ -275,9 +275,9 @@ class ElectricalProperties { * @return The shunt conductance @f$\shuntconductance(\vertex)@f$ * of @f$\vertex\in\vertices@f$. */ - inline Types::real & ShuntConductance () - { - return shuntConductance_; + inline Types::real & ShuntConductance () + { + return shuntConductance_; } ///@} @@ -290,9 +290,9 @@ class ElectricalProperties { * * @return The nominal voltage @f$\voltagenominal@f$ in kV. */ - inline Types::real NominalVoltage () const - { - return nominalVoltage_; + inline Types::real NominalVoltage () const + { + return nominalVoltage_; } /** @@ -302,8 +302,8 @@ class ElectricalProperties { * @return The nominal voltage @f$\voltagenominal@f$ in kV. */ inline Types::real & NominalVoltage () - { - return nominalVoltage_; + { + return nominalVoltage_; } /** @@ -314,9 +314,9 @@ class ElectricalProperties { * * @return The voltage magnitude @f$\voltagenominal@f$. */ - inline Types::real VoltageMagnitude () const - { - return voltageMagnitude_; + inline Types::real VoltageMagnitude () const + { + return voltageMagnitude_; } /** @@ -329,25 +329,25 @@ class ElectricalProperties { * @return The voltage magnitude @f$\vmagnitude@f$. */ inline Types::real & VoltageMagnitude () - { - return voltageMagnitude_; + { + return voltageMagnitude_; } /** * @brief Getter for the voltage angle @f$\vangle(\vertex)@f$. * @details The voltage angle is a function * @f$\vangle\colon\vertices\to\reals@f$. It is measured in - * degree. - * + * degree. + * * @note It is used for the data's snapshot and/or * optimization's result. * * @return The voltage angle @f$\vangle(\vertex)@f$ at vertex * @f$\vertex\in\vertices@f$. */ - inline Types::real VoltageAngle () const - { - return voltageAngle_; + inline Types::real VoltageAngle () const + { + return voltageAngle_; } /** @@ -367,9 +367,9 @@ class ElectricalProperties { * @return The voltage angle @f$\vangle(\vertex)@f$ at vertex * @f$\vertex\in\vertices@f$. */ - inline Types::real & VoltageAngle () - { - return voltageAngle_; + inline Types::real & VoltageAngle () + { + return voltageAngle_; } /** @@ -380,9 +380,9 @@ class ElectricalProperties { * * @return The minimum voltage magnitude @f$\voltagemin@f$. */ - inline Types::real MinimumVoltage () const - { - return voltageBound_.Minimum(); + inline Types::real MinimumVoltage () const + { + return voltageBound_.Minimum(); } /** @@ -390,17 +390,17 @@ class ElectricalProperties { * magnitude @f$\voltagemin@f$. * @details The voltage magnitude is in per unit (p.u.) of the * nominal voltage @f$\voltagenominal@f$. - * + * * @code{.cpp} * ElectricalProperties vertex; * vertex.MinimumVoltage() = 0; * @endcode - * + * * @return The minimum voltage magnitude @f$\voltagemin@f$. */ inline Types::real & MinimumVoltage () - { - return voltageBound_.Minimum(); + { + return voltageBound_.Minimum(); } /** @@ -411,9 +411,9 @@ class ElectricalProperties { * * @return The maximum voltage magnitude @f$\voltagemax@f$. */ - inline Types::real MaximumVoltage () const - { - return voltageBound_.Maximum(); + inline Types::real MaximumVoltage () const + { + return voltageBound_.Maximum(); } /** @@ -429,15 +429,15 @@ class ElectricalProperties { * @return The maximum voltage magnitude @f$\voltagemax@f$. */ inline Types::real & MaximumVoltage () - { - return voltageBound_.Maximum(); + { + return voltageBound_.Maximum(); } ///@} /**@name Type specific information */ ///@{ #pragma mark TYPE_SPECIFIC_INFORMATION - + /** * @brief Getter for the country * @details Used in PyPSA for example to specify the location @@ -445,9 +445,9 @@ class ElectricalProperties { * * @return The country of the vertex. */ - inline Types::name Country () const - { - return country_; + inline Types::name Country () const + { + return country_; } /** @@ -458,8 +458,8 @@ class ElectricalProperties { * @return The country of the vertex. */ inline Types::name & Country () - { - return country_; + { + return country_; } /** @@ -471,17 +471,17 @@ class ElectricalProperties { * one of the two terminal vertices. Tie line it indicates the * ownership or area to which the losses should be assigned. * This area is not related to the meter bus location. - * + * * @note If the value is 0 this means that there is no data * available or there is no area. * * @return The bus area number. */ - inline Types::index Area () const - { - return area_; + inline Types::index Area () const + { + return area_; } - + /** * @brief Getter and setter for the bus area number. * @details Bus area (1 - 99) indicates in which company/region @@ -494,7 +494,7 @@ class ElectricalProperties { * * @note If the value is 0 this means that there is no data * available or there is no area. - * + * * @code{.cpp} * ElectricalProperties vertex; * vertex.Area() = 11; @@ -503,29 +503,29 @@ class ElectricalProperties { * @return The bus area number. */ inline Types::index & Area () - { - return area_; + { + return area_; } /** * @brief Getter for the loss zone. * @details A three digit integer from 0 to 999 for defining - * zones of loss calculation. - * + * zones of loss calculation. + * * @note If the value is 0 this means that there is no zone. * * @return The loss zone. */ - inline Types::index Zone () const - { - return zone_; + inline Types::index Zone () const + { + return zone_; } /** * @brief Getter and setter for the loss zone. * @details A three digit integer from 0 to 999 for defining - * zones of loss calculation. - * + * zones of loss calculation. + * * @note If the value is 0 this means that there is no zone. * * @code{.cpp} @@ -536,8 +536,8 @@ class ElectricalProperties { * @return The loss zone. */ inline Types::index & Zone () - { - return zone_; + { + return zone_; } /** @@ -550,9 +550,9 @@ class ElectricalProperties { * * @return The bus control type strategy. */ - inline Vertices::ControlType Control () const - { - return control_; + inline Vertices::ControlType Control () const + { + return control_; } /** @@ -566,14 +566,14 @@ class ElectricalProperties { * ElectricalProperties vertex; * vertex.Control() = Vertices::ControlType::PQ; * @endcode - * + * * @see Type#Vertices#ControlType * * @return The bus control type strategy. */ inline Vertices::ControlType & Control () - { - return control_; + { + return control_; } /** @@ -585,9 +585,9 @@ class ElectricalProperties { * * @return The energy carrier type. */ - inline Vertices::EnergyCarrier Carrier () const - { - return carrier_; + inline Vertices::EnergyCarrier Carrier () const + { + return carrier_; } /** @@ -607,8 +607,8 @@ class ElectricalProperties { * @return The energy carrier type. */ inline Vertices::EnergyCarrier & Carrier () - { - return carrier_; + { + return carrier_; } ///@} @@ -623,11 +623,11 @@ class ElectricalProperties { * * @return @p True if active (on), @p False otherwise (unknown). */ - inline bool IsActive () const - { + inline bool IsActive () const + { return Vertices::BusStatus::active == Status(); } - + /** * @brief Status of the electrical vertex. * @@ -636,8 +636,8 @@ class ElectricalProperties { * @return The status can have a different status. */ inline Vertices::BusStatus & Status () - { - return status_; + { + return status_; } /** @@ -648,8 +648,8 @@ class ElectricalProperties { * @return The status can have a different status. */ inline Vertices::BusStatus const & Status () const - { - return status_; + { + return status_; } ///@} @@ -662,15 +662,15 @@ class ElectricalProperties { * * @param outputStream The stream to write data to, e.g., std::cout. */ - static void HeaderLong ( std::ostream & outputStream ) + static void HeaderLong ( std::ostream & outputStream ) { - outputStream + outputStream << std::setw(6) << "ID" << std::setw(6) << "Type" // << std::setw(10) << "RealPowerLoad" // << std::setw(20) << "ReactivePowerLoad" - << std::setw(20) << "ShuntSusceptance" - << std::setw(20) << "ShuntConductance" + << std::setw(20) << "ShuntSusceptance" + << std::setw(20) << "ShuntConductance" << std::setw(6) << "Area" << std::setw(10) << "VoltageMagnitude" << std::setw(10) << "VoltageAngle" @@ -687,14 +687,14 @@ class ElectricalProperties { * * @param outputStream The stream to write data to, e.g., std::cout. */ - static inline void Header ( std::ostream & outputStream ) + static inline void Header ( std::ostream & outputStream ) { - outputStream + outputStream << std::setw(6) << "bus_i" << std::setw(6) << "type" // << std::setw(10) << "Pd" // << std::setw(10) << "Qd" - << std::setw(10) << "Gs" + << std::setw(10) << "Gs" << std::setw(10) << "Bs" << std::setw(6) << "area" << std::setw(10) << "Vm" @@ -716,7 +716,7 @@ class ElectricalProperties { inline void Line ( std::ostream & outputStream , Types::real baseMva = 1 ) const { - outputStream + outputStream << std::setprecision(2) << std::fixed << std::setw(6) << Name() @@ -729,7 +729,7 @@ class ElectricalProperties { << std::setw(10) << NominalVoltage() << std::setw(6) << Zone() << std::setw(10) << MaximumVoltage() - << std::setw(10) << MinimumVoltage() + << std::setw(10) << MinimumVoltage() << std::endl; } @@ -745,7 +745,7 @@ class ElectricalProperties { , Types::vertexId identifier , Types::real baseMva = 1 ) const { - outputStream + outputStream << std::setprecision(2) << std::fixed << std::setw(6) << identifier @@ -761,7 +761,7 @@ class ElectricalProperties { << std::setw(10) << NominalVoltage() << std::setw(6) << Zone() << std::setw(10) << MaximumVoltage() - << std::setw(10) << MinimumVoltage() + << std::setw(10) << MinimumVoltage() << std::endl; } @@ -774,15 +774,15 @@ class ElectricalProperties { * @return The output stream. */ friend std::ostream & operator<< ( std::ostream & outputStream - , TProperties const & rhs ) + , TProperties const & rhs ) { - outputStream + outputStream << std::setprecision(2) << std::fixed << std::endl << "Bus " << rhs.Name() << std::endl << std::string(20, '-') << std::endl - << std::setw(30) << "ID: " << std::setw(10) << rhs.Name() + << std::setw(30) << "ID: " << std::setw(10) << rhs.Name() // << std::setw(20) << "load: " << std::setw(10) << rhs.RealPowerLoad() << std::setw(25) << " p.u. (real, MW), " // << std::setw(10) << rhs.ReactivePowerLoad() << std::setw(25) << " p.u. (reactive, MVar), " << std::endl << std::setw(20) << "shunt: " << std::setw(10) << rhs.ShuntSusceptance() << std::setw(25) << " p.u. (susceptance), " @@ -793,7 +793,7 @@ class ElectricalProperties { << std::setw(20) << "area: " << std::setw(10) << rhs.Area() << std::setw(25) << "" << std::endl << std::setw(20) << "zone: " << std::setw(10) << rhs.Zone() << std::setw(25) << "" << std::endl << std::setw(20) << "type: " << std::setw(10) << rhs.Type() << std::setw(25) << "" << std::endl; - return outputStream; + return outputStream; } ///@} @@ -816,47 +816,47 @@ class ElectricalProperties { /**@name Voltage Related Members */ ///@{ - Types::real nominalVoltage_; /**< The nominal voltage also known as base voltage measured - * in kV. + Types::real nominalVoltage_; /**< The nominal voltage also known as base voltage measured + * in kV. */ - Types::real voltageAngle_; /**< The voltage angle @f$\vangle(\vertex)@f$ that represents - * a snapshot of the voltage angle, i.e., final voltage + Types::real voltageAngle_; /**< The voltage angle @f$\vangle(\vertex)@f$ that represents + * a snapshot of the voltage angle, i.e., final voltage * angle from data. */ - Types::real voltageMagnitude_; /**< Voltage magnitude @f$\vmagnitude(\vertex)@f$ including - * a snapshot (p.u. set point), i.e., final voltage - * from data. + Types::real voltageMagnitude_; /**< Voltage magnitude @f$\vmagnitude(\vertex)@f$ including + * a snapshot (p.u. set point), i.e., final voltage + * from data. */ Types::real voltageMagnitudeSq_; /**< Voltage magnitude squared variable */ // Types::real realVoltage_; /**< Real voltage */ // Types::real imaginaryVoltage_; /**< Imaginary voltage */ - TBound voltageBound_; /**< The voltage limits @f$\voltage := [\voltagemin,\voltagemax]@f$ - * in per unit (p.u.) of the nominal voltage @f$\voltagenominal@f$. + TBound voltageBound_; /**< The voltage limits @f$\voltage := [\voltagemin,\voltagemax]@f$ + * in per unit (p.u.) of the nominal voltage @f$\voltagenominal@f$. */ ///@} /**@name Location Specific Members */ ///@{ Types::name country_; /** Country */ - Types::index area_; /**< Bus area (1 - 99) indicates in which company/region - * the station is located, 0 means data unavailable. - * A two digit integer from 0 to 99 indicating the - * company or region in which the line is located. - * This area number should be the same as the area of - * one of the two terminal vertices. - * Tie line it indicates the ownership or area to - * which the losses should be assigned. + Types::index area_; /**< Bus area (1 - 99) indicates in which company/region + * the station is located, 0 means data unavailable. + * A two digit integer from 0 to 99 indicating the + * company or region in which the line is located. + * This area number should be the same as the area of + * one of the two terminal vertices. + * Tie line it indicates the ownership or area to + * which the losses should be assigned. * This area is not related to the meter bus location. */ - Types::index zone_; /**< Three digit integer from 0 to 999 for defining + Types::index zone_; /**< Three digit integer from 0 to 999 for defining * zones of loss calculation. A 0 means no zone. */ Vertices::ControlType control_; /**< The control type such as PV. */ Vertices::EnergyCarrier carrier_; /**< The energy carrier used at this bus such as AC. */ ///@} - + /**@name Status Members */ - ///@{ + ///@{ Vertices::BusStatus status_; /**< Station status: active - true, inactive - false */ ///@} }; diff --git a/include/DataStructures/Graphs/Vertices/GeneratorProperties.hpp b/include/DataStructures/Graphs/Vertices/GeneratorProperties.hpp index ad0a6d7a..21579cdc 100644 --- a/include/DataStructures/Graphs/Vertices/GeneratorProperties.hpp +++ b/include/DataStructures/Graphs/Vertices/GeneratorProperties.hpp @@ -31,7 +31,7 @@ class GeneratorProperties { ///@{ using TBound = Bound; ///@} - + ///@name Type Specific Types ///@{ using TVertexType = VertexType; @@ -60,12 +60,12 @@ class GeneratorProperties { , sign_(TPowerSign::positive) // real power , realPower_(0.0) - , realPowerBound_( TBound(0.0, Const::REAL_INFTY) ) + , realPowerBound_( TBound(0.0, Const::REAL_INFTY) ) , pc1_(0.0) , pc2_(0.0) // reactive power , reactivePower_(0.0) - , reactivePowerBound_( TBound(0.0, Const::REAL_INFTY) ) + , reactivePowerBound_( TBound(0.0, Const::REAL_INFTY) ) , qc1Bound_( TBound(0.0, 0.0) ) , qc2Bound_( TBound(0.0, 0.0) ) // status @@ -97,7 +97,7 @@ class GeneratorProperties { /** * @brief Reset to default values. */ - inline void Reset () + inline void Reset () { // BasicVertex specifics Name () = ""; @@ -160,9 +160,9 @@ class GeneratorProperties { * @return @p true if both vertices are @p not equal, @p false * otherwise. */ - inline bool operator!=( GeneratorProperties const & rhs ) const - { - return !(this == rhs); + inline bool operator!=( GeneratorProperties const & rhs ) const + { + return !(this == rhs); } /** @@ -173,14 +173,14 @@ class GeneratorProperties { * @return @p true if both vertices are equal, @p false * otherwise. */ - inline bool operator==( GeneratorProperties const & rhs ) const + inline bool operator==( GeneratorProperties const & rhs ) const { // Basic Vertex if ( Name() != rhs.Name() ) return false; if ( X() != rhs.X() ) return false; if ( Y() != rhs.Y() ) return false; if ( Type() != rhs.Type() ) return false; - + // Voltage specific information if ( !Auxiliary::EQ ( VoltageMagnitude(), rhs.VoltageMagnitude() ) ) return false; @@ -246,7 +246,7 @@ class GeneratorProperties { * @param rhs The right hand side generator property. */ friend void swap ( GeneratorProperties & lhs - , GeneratorProperties & rhs ) + , GeneratorProperties & rhs ) { // Necessary for the copy and swap idiom using std::swap; // enable ADL // Basic vertex @@ -279,7 +279,7 @@ class GeneratorProperties { // Status specific information swap( lhs.status_, rhs.status_); swap( lhs.committable_, rhs.committable_); - + // Type specific information swap( lhs.control_, rhs.control_); swap( lhs.type_, rhs.type_); @@ -317,7 +317,7 @@ class GeneratorProperties { inline Types::real X() const { return xCoordinate_; } inline Types::real & X() { return xCoordinate_; } - + inline Types::real Y() const { return yCoordinate_; } inline Types::real & Y() { return yCoordinate_; } ///@} @@ -333,9 +333,9 @@ class GeneratorProperties { * * @return The voltage magnitude @f$\vmagnitude@f$. */ - inline Types::real VoltageMagnitude () const - { - return voltageMagnitudeSnapshot_; + inline Types::real VoltageMagnitude () const + { + return voltageMagnitudeSnapshot_; } /** @@ -346,12 +346,12 @@ class GeneratorProperties { * @return The voltage magnitude @f$\vmagnitude@f$. */ inline Types::real & VoltageMagnitude () - { - return voltageMagnitudeSnapshot_; + { + return voltageMagnitudeSnapshot_; } ///@} - /**@name Nominal Power Information */ + /**@name Nominal Power Information */ ///@{ #pragma mark NOMINAL_POWER @@ -364,23 +364,23 @@ class GeneratorProperties { * False. However, in some cases it makes sense to extend * already existing energy sources, too, and the flag might be * @p True, too. - * + * * @pre Default is @p false. - * + * * @note If it is true the extendable generator then the * generator's nominal real power @f$\realpowernominal@f$ lies * between @f$\realpowernominalmin@f$ and * @f$\realpowernominalmax@f$ meaning * @f[ * \realpowernominal := [\realpowernominalmin,\realpowernominalmax]. - * @f] + * @f] * Otherwise, the generator's nominal real power * @f$\realpowernominal@f$ is defined by a fixed value. Thus, use * @f$\realpowernominal@f$ by using @p Mbase when @p * IsExtendable is @p false, and @f$\realpowernominalmin@f$ and * @f$\realpowernominalmax@f$ by using @p NominalRealPower if * @p IsExtendable is @p true. - * + * * @see NominalPower * @see NominalRealPowerBound * @@ -388,9 +388,9 @@ class GeneratorProperties { * @f$\vertex\in\generators@f$ is extendable, @p false * otherwise. */ - inline bool IsExtendable() const - { - return pNomExtendable_; + inline bool IsExtendable() const + { + return pNomExtendable_; } /** @@ -406,15 +406,15 @@ class GeneratorProperties { * @code{.cpp} * generator.IsExtendable() = true; * @endcode - * + * * @pre Default is @p false. - * + * * @note If it is true the extendable generator then the * generator's nominal real power @f$\realpowernominal@f$ lies between * @f$\realpowernominalmin@f$ and @f$\realpowernominalmax@f$ meaning * @f[ * \realpowernominal := [\realpowernominalmin,\realpowernominalmax]. - * @f] + * @f] * Otherwise, the generator's nominal real power * @f$\realpowernominal@f$ is defined by a fixed value. Thus, use * @f$\realpowernominal@f$ by using @p Mbase when @p @@ -431,12 +431,12 @@ class GeneratorProperties { * otherwise. */ inline bool & IsExtendable () - { - return pNomExtendable_; + { + return pNomExtendable_; } /** - * @brief Getter for the nominal power base. + * @brief Getter for the nominal power base. * @details If the generator @f$\vertex\in\generators@f$ is * @p NOT extendable---meaning IsExtendable is @p false---and * thus, fixed the nominal power is used to normalize or @@ -445,7 +445,7 @@ class GeneratorProperties { * @code{.cpp} * GeneratorProperties const & generator; * ... - * if ( !generator.IsExtendable() ) + * if ( !generator.IsExtendable() ) * { // nominal real power is a value and thus, is fixed. * std::cout << "p_nom = " << generator.Mbase() << std::endl; * } @@ -457,20 +457,20 @@ class GeneratorProperties { * * @return The nominal power base. */ - inline Types::real NominalPower () const - { + inline Types::real NominalPower () const + { return nominalPower_; } /** - * @brief Getter and setter for the nominal power base. + * @brief Getter and setter for the nominal power base. * @details If the generator @f$\vertex\in\generators@f$ is * @p NOT extendable---meaning IsExtendable is @p False---and * thus, fixed the nominal power is used to normalize or * to denormalize into/from the p.u. units. * * @code{.cpp} - * if ( !generator.IsExtendable() ) + * if ( !generator.IsExtendable() ) * { // nominal real power is a value and thus, is fixed. * generator.Mbase() = 11.11; * } @@ -483,8 +483,8 @@ class GeneratorProperties { * @return The nominal power base. */ inline Types::real & NominalPower () - { - return nominalPower_; + { + return nominalPower_; } /** @@ -492,31 +492,31 @@ class GeneratorProperties { * @f$\realpowernominal:=[\realpowernominalmin,\realpowernominalmax]@f$ * while the generator * @f$\vertex\in\generators@f$ is extendable. - * + * * @pre Check if the @f$\vertex\in\generators@f$ is * extendable meaning IsExtendable is true. - * + * * @code{.cpp} - * if ( generator.IsExtendable() ) + * if ( generator.IsExtendable() ) * { // nominal real power lies in between a bound and thus, is flexible. * std::cout << "p_nom_min = " << generator.NominalRealPower().Minimum() * << "p_nom_max = " << generator.NominalRealPower().Maximum() << std::endl; - * } else + * } else * { // nominal real power is a value and thus, is fixed. * std::cout << "p_nom = " << generator.Mbase() << std::endl; * } * @endcode - * + * * @see NominalPower * @see IsExtendable * @see NominalRealPowerBound - * + * * @return The nominal real power bound * @f$\realpowernominal:=[\realpowernominalmin,\realpowernominalmax]@f$. */ - inline TBound NominalRealPowerBound () const - { - return nominalRealPowerBound_; + inline TBound NominalRealPowerBound () const + { + return nominalRealPowerBound_; } /** @@ -525,28 +525,28 @@ class GeneratorProperties { * @f$\realpowernominal:=[\realpowernominalmin,\realpowernominalmax]@f$ * while the generator * @f$\vertex\in\generators@f$ is extendable. - * + * * @pre Check if the @f$\vertex\in\generators@f$ is * extendable meaning IsExtendable is true. - * + * * @code{.cpp} - * if ( generator.IsExtendable() ) + * if ( generator.IsExtendable() ) * { // nominal real power lies in between a bound and thus, is flexible. * generator.NominalRealPower().Minimum() = 0.0; * generator.NominalRealPower().Maximum() = 11.11; * } * @endcode - * + * * @see NominalPower * @see IsExtendable * @see NominalRealPowerBound - * + * * @return The nominal real power bound * @f$\realpowernominal:=[\realpowernominalmin,\realpowernominalmax]@f$. */ inline TBound & NominalRealPowerBound () - { - return nominalRealPowerBound_; + { + return nominalRealPowerBound_; } /** @@ -554,11 +554,11 @@ class GeneratorProperties { * * @return The power sign, if 1 the generator produces energy, * otherwise if -1 it consumes energy. - * + * * @todo make enum */ - inline TPowerSign PowerSign () const - { + inline TPowerSign PowerSign () const + { return sign_; } @@ -567,16 +567,16 @@ class GeneratorProperties { * * @return The power sign, if 1 the generator produces energy, * otherwise if -1 it consumes energy. - * + * * @todo make enum */ - inline TPowerSign & PowerSign () - { - return sign_; + inline TPowerSign & PowerSign () + { + return sign_; } ///@} - /**@name Real Power Information */ + /**@name Real Power Information */ ///@{ #pragma mark REAL_POWER_INFORMATION @@ -585,9 +585,9 @@ class GeneratorProperties { * * @return The real power @f$\realpowergeneration@f$. */ - inline Types::real RealPower () const - { - return realPower_; + inline Types::real RealPower () const + { + return realPower_; } /** @@ -597,8 +597,8 @@ class GeneratorProperties { * @return The real power set point @f$\realpowergeneration@f$. */ inline Types::real & RealPower () - { - return realPower_; + { + return realPower_; } /** @@ -609,8 +609,8 @@ class GeneratorProperties { * \realpowergenerationmax]@f$. */ inline TBound RealPowerBound () const - { - return realPowerBound_; + { + return realPowerBound_; } /** @@ -621,8 +621,8 @@ class GeneratorProperties { * \realpowergenerationmax]@f$. */ inline TBound & RealPowerBound () - { - return realPowerBound_; + { + return realPowerBound_; } /** @@ -632,9 +632,9 @@ class GeneratorProperties { * @return The lower real power output of @p PQ capability * curve (MW). */ - inline Types::real Pc1 () const - { - return pc1_; + inline Types::real Pc1 () const + { + return pc1_; } /** @@ -645,8 +645,8 @@ class GeneratorProperties { * curve (MW). */ inline Types::real & Pc1 () - { - return pc1_; + { + return pc1_; } /** @@ -656,9 +656,9 @@ class GeneratorProperties { * @return The upper real power output of @p PQ capability * curve (MW). */ - inline Types::real Pc2 () const - { - return pc2_; + inline Types::real Pc2 () const + { + return pc2_; } /** @@ -669,12 +669,12 @@ class GeneratorProperties { * curve (MW). */ inline Types::real & Pc2 () - { - return pc2_; + { + return pc2_; } ///@} - /**@name Reactive Power Information */ + /**@name Reactive Power Information */ ///@{ #pragma mark REACTIVE_POWER_INFORMATION @@ -685,8 +685,8 @@ class GeneratorProperties { * @return The real power @f$\reactivepowergeneration@f$. */ inline Types::real ReactivePower () const - { - return reactivePower_; + { + return reactivePower_; } /** @@ -696,8 +696,8 @@ class GeneratorProperties { * @return The real power @f$\reactivepowergeneration@f$. */ inline Types::real & ReactivePower () - { - return reactivePower_; + { + return reactivePower_; } /** @@ -708,10 +708,10 @@ class GeneratorProperties { * @f$[\reactivepowergenerationmin,\reactivepowergenerationmax]@f$. */ inline TBound ReactivePowerBound () const - { - return reactivePowerBound_; + { + return reactivePowerBound_; } - + /** * @brief Getter and setter for the reactive power bound * @f$[\reactivepowergenerationmin, \reactivepowergenerationmax]@f$. @@ -720,8 +720,8 @@ class GeneratorProperties { * @f$[\reactivepowergenerationmin,\reactivepowergenerationmax]@f$. */ inline TBound & ReactivePowerBound () - { - return reactivePowerBound_; + { + return reactivePowerBound_; } /** @@ -731,9 +731,9 @@ class GeneratorProperties { * * @return The reactive power output bound at @p PC1. */ - inline TBound Qc1Bound () const - { - return qc1Bound_; + inline TBound Qc1Bound () const + { + return qc1Bound_; } /** @@ -744,8 +744,8 @@ class GeneratorProperties { * @return The reactive power output bound at @p PC1. */ inline TBound & Qc1Bound () - { - return qc1Bound_; + { + return qc1Bound_; } /** @@ -755,9 +755,9 @@ class GeneratorProperties { * * @return The reactive power output bound at @p PC2. */ - inline TBound Qc2Bound () const - { - return qc2Bound_; + inline TBound Qc2Bound () const + { + return qc2Bound_; } /** @@ -768,8 +768,8 @@ class GeneratorProperties { * @return The reactive power output bound at @p PC2. */ inline TBound & Qc2Bound () - { - return qc2Bound_; + { + return qc2Bound_; } ///@} @@ -784,14 +784,14 @@ class GeneratorProperties { * * @return @p true if active (on), @p false otherwise (unknown). */ - inline bool IsActive () const - { + inline bool IsActive () const + { if ( TBusStatus::active == Status() ) return true; - else - return false; + else + return false; } - + /** * @brief Status of the electrical vertex. * @details The status of the generator/machine is described by @@ -802,9 +802,9 @@ class GeneratorProperties { * @return The status can have a different status. */ ///@todo USE DIFFERENT TYPE see bus - inline TBusStatus Status () const - { - return status_; + inline TBusStatus Status () const + { + return status_; } /** @@ -818,38 +818,38 @@ class GeneratorProperties { */ ///@todo USE DIFFERENT TYPE see bus inline TBusStatus & Status () - { - return status_; + { + return status_; } /** * @brief Getter for the unit commitment. - * + * * @pre This can only be @p true if the generator is not * extendable. * * @return @p true if unit commitment, @p false otherwise. */ - inline bool Committable () const - { - return committable_; + inline bool Committable () const + { + return committable_; } /** * @brief Getter and setter for the unit commitment. - * + * * @pre This can only be @p true if the generator is not * extendable. * * @return @p true if unit commitment, @p false otherwise. */ - inline bool & Committable () - { - return committable_; + inline bool & Committable () + { + return committable_; } ///@} - /**@name Type Specific Information*/ + /**@name Type Specific Information*/ ///@{ #pragma mark TYPE_INFORMATION @@ -865,8 +865,8 @@ class GeneratorProperties { * @return The control strategy. */ inline Vertices::ControlType Control () const - { - return control_; + { + return control_; } /** @@ -875,16 +875,16 @@ class GeneratorProperties { * Slack. The slack vertex represents a reference vertex used * to set a voltage angle for example to 0 and thus, determine * the other voltage angle. - * + * * @see Vertices#ControlType * * @return The control strategy. */ inline Vertices::ControlType & Control () - { - return control_; + { + return control_; } - + /** * @brief Getter for the generator type. * @details The generator type determines if it is a @@ -895,8 +895,8 @@ class GeneratorProperties { * @return The generator type. */ inline Vertices::GeneratorType GeneratorType () const - { - return generatorType_; + { + return generatorType_; } /** @@ -909,10 +909,10 @@ class GeneratorProperties { * @return The generator type. */ inline Vertices::GeneratorType & GeneratorType () - { - return generatorType_; + { + return generatorType_; } - + /** * @brief Getter for the efficiency of the generator. * @details The efficiency of a generator is calculated by the @@ -920,9 +920,9 @@ class GeneratorProperties { * * @return The efficiency of the generator. */ - inline Types::real Efficiency () const - { - return efficiency_; + inline Types::real Efficiency () const + { + return efficiency_; } /** @@ -934,12 +934,12 @@ class GeneratorProperties { * @return The efficiency of the generator. */ inline Types::real & Efficiency () - { - return efficiency_; + { + return efficiency_; } ///@} - /**@name Cost Specific Information */ + /**@name Cost Specific Information */ ///@{ #pragma mark COST_SPECIFIC_INFOMRATION @@ -949,9 +949,9 @@ class GeneratorProperties { * * @return The marginal cost. */ - inline Types::real MarginalCost () const - { - return marginalCost_; + inline Types::real MarginalCost () const + { + return marginalCost_; } /** @@ -961,8 +961,8 @@ class GeneratorProperties { * @return The marginal cost. */ inline Types::real & MarginalCost () - { - return marginalCost_; + { + return marginalCost_; } /** @@ -973,8 +973,8 @@ class GeneratorProperties { * @return The capital cost. */ inline Types::real CapitalCost () const - { - return capitalCost_; + { + return capitalCost_; } /** @@ -985,8 +985,8 @@ class GeneratorProperties { * @return The capital cost. */ inline Types::real & CapitalCost () - { - return capitalCost_; + { + return capitalCost_; } /** @@ -996,9 +996,9 @@ class GeneratorProperties { * * @return The startup cost for the generator. */ - inline Types::real StartUpCost () const - { - return startUpCost_; + inline Types::real StartUpCost () const + { + return startUpCost_; } /** @@ -1010,8 +1010,8 @@ class GeneratorProperties { * @return The startup cost for the generator. */ inline Types::real & StartUpCost () - { - return startUpCost_; + { + return startUpCost_; } /** @@ -1022,8 +1022,8 @@ class GeneratorProperties { * @return The shut-down cost for the generator. */ inline Types::real ShutDownCost () const - { - return shutDownCost_; + { + return shutDownCost_; } /** @@ -1035,18 +1035,18 @@ class GeneratorProperties { * @return The shut-down cost for the generator. */ inline Types::real & ShutDownCost () - { - return shutDownCost_; + { + return shutDownCost_; } ///@} /** * @name Ramp Specific Information - * + * * @brief Ramp Limits: The inner dynamic of generators does not * always allow to change the production level, i.e., a maximum * possible change is set by ramp limits. - * + * * Ramp rate: Describes how fast generator outputs can be changed. * There are usually ramping up (increasing) and down * (decreasing), i.e., the unit is in units of power over time @@ -1056,19 +1056,19 @@ class GeneratorProperties { #pragma mark RAMP_SPECIFIC_INFORMATION /** - * @brief Getter for the minimum availability (active) time. + * @brief Getter for the minimum availability (active) time. * @details This is measured in number of snapshots. This * represents the minimum number of snapshots to be in @p * active status until a shutdown is possible, i.e., being in * @p inactive status. - * + * * @pre Only if Committable() is @p true. * * @return The minimum @p active time of the generator. */ inline Types::real MinimumUpTime () const - { - return minUpTime_; + { + return minUpTime_; } /** @@ -1078,30 +1078,30 @@ class GeneratorProperties { * represents the minimum number of snapshots to be in @p * active status until a shutdown is possible, i.e., being in * @p inactive status. - * + * * @pre Only if Committable() is @p true. * * @return The minimum @p active time of the generator. */ inline Types::real & MinimumUpTime () - { - return minUpTime_; + { + return minUpTime_; } /** - * @brief Getter for the minimum time to be @p inactive. + * @brief Getter for the minimum time to be @p inactive. * @details This is measured in number of snapshots. This * represents the minimum number of snapshots to be in @p * inactive status until a startup is possible again, i.e., * being in @p active status. - * + * * @pre Only if Committable() is @p true. * * @return The minimum time to be @p inactive of the generator. */ inline Types::real MinimumDownTime () const - { - return minDownTime_; + { + return minDownTime_; } /** @@ -1117,22 +1117,22 @@ class GeneratorProperties { * @return The minimum time to be @p inactive of the generator. */ inline Types::real & MinimumDownTime () - { - return minDownTime_; + { + return minDownTime_; } /** * @brief Getter for the ramp rate for load following AGC. * @details The ramp rate is measured in MW/min and is part of * the IEEE data. - * + * * @note AGC stands for Automatic Generation Control. * * @return The ramp rate for load following AGC. */ - inline Types::real RampAgc () const - { - return rampAgc_; + inline Types::real RampAgc () const + { + return rampAgc_; } /** @@ -1140,14 +1140,14 @@ class GeneratorProperties { * following AGC. * @details The ramp rate is measured in MW/min and is part of * the IEEE data. - * + * * @note AGC stands for Automatic Generation Control. * * @return The ramp rate for load following AGC. */ inline Types::real & RampAgc () - { - return rampAgc_; + { + return rampAgc_; } /** @@ -1157,9 +1157,9 @@ class GeneratorProperties { * * @return The ramp rate for a 10 minute reserve. */ - inline Types::real Ramp10 () const - { - return ramp10_; + inline Types::real Ramp10 () const + { + return ramp10_; } /** @@ -1171,8 +1171,8 @@ class GeneratorProperties { * @return The ramp rate for a 10 minute reserve. */ inline Types::real & Ramp10 () - { - return ramp10_; + { + return ramp10_; } /** @@ -1182,9 +1182,9 @@ class GeneratorProperties { * * @return The ramp rate for a 30 minute reserve. */ - inline Types::real Ramp30 () const - { - return ramp30_; + inline Types::real Ramp30 () const + { + return ramp30_; } /** @@ -1196,8 +1196,8 @@ class GeneratorProperties { * @return The ramp rate for a 30 minute reserve. */ inline Types::real & Ramp30 () - { - return ramp30_; + { + return ramp30_; } /** @@ -1208,9 +1208,9 @@ class GeneratorProperties { * * @return The ramp rate for the reactive power. */ - inline Types::real RampQ () const - { - return rampQ_; + inline Types::real RampQ () const + { + return rampQ_; } /** @@ -1222,8 +1222,8 @@ class GeneratorProperties { * @return The ramp rate for the reactive power. */ inline Types::real & RampQ () - { - return rampQ_; + { + return rampQ_; } /** @@ -1231,9 +1231,9 @@ class GeneratorProperties { * * @return The area participation factor (APF). */ - inline Types::real Apf () const - { - return apf_; + inline Types::real Apf () const + { + return apf_; } /** @@ -1243,8 +1243,8 @@ class GeneratorProperties { * @return The area participation factor (APF). */ inline Types::real & Apf () - { - return apf_; + { + return apf_; } /** @@ -1257,10 +1257,10 @@ class GeneratorProperties { * @return The maximum increase in power. */ inline Types::real RampLimitUp () const - { - return rampLimitUp_; + { + return rampLimitUp_; } - + /** * @brief Getter and setter for the maximum increase in power. * @details The maximum increase in power is measured in per @@ -1271,8 +1271,8 @@ class GeneratorProperties { * @return The maximum increase in power. */ inline Types::real & RampLimitUp () - { - return rampLimitUp_; + { + return rampLimitUp_; } /** @@ -1285,10 +1285,10 @@ class GeneratorProperties { * @return The maximum decrease in power. */ inline Types::real RampLimitDown () const - { - return rampLimitDown_; + { + return rampLimitDown_; } - + /** * @brief Getter and setter for the maximum decrease in power. * @details The maximum decrease in power is measured in per @@ -1299,8 +1299,8 @@ class GeneratorProperties { * @return The maximum decrease in power. */ inline Types::real & RampLimitDown () - { - return rampLimitDown_; + { + return rampLimitDown_; } /** @@ -1313,10 +1313,10 @@ class GeneratorProperties { * @return The maximum increase in power at startup. */ inline Types::real RampLimitStartUp () const - { - return rampLimitStartUp_; + { + return rampLimitStartUp_; } - + /** * @brief Getter and setter for the maximum increase in power * at start-up. @@ -1328,8 +1328,8 @@ class GeneratorProperties { * @return The maximum increase in power at startup. */ inline Types::real & RampLimitStartUp () - { - return rampLimitStartUp_; + { + return rampLimitStartUp_; } /** @@ -1342,10 +1342,10 @@ class GeneratorProperties { * @return The maximum decrease in power at shutdown. */ inline Types::real RampLimitShutDown () const - { - return rampLimitShutDown_; + { + return rampLimitShutDown_; } - + /** * @brief Getter and setter for the maximum decrease in power * at shut-down. @@ -1357,12 +1357,12 @@ class GeneratorProperties { * @return The maximum decrease in power at shutdown. */ inline Types::real & RampLimitShutDown () - { - return rampLimitShutDown_; + { + return rampLimitShutDown_; } - ///@} + ///@} - /**@name Output */ + /**@name Output */ ///@{ #pragma mark OUTPUT_METHODS /** @@ -1374,14 +1374,14 @@ class GeneratorProperties { * @return The output stream. */ friend std::ostream & operator<< ( std::ostream & outputStream - , GeneratorProperties const & rhs ) + , GeneratorProperties const & rhs ) { outputStream << std::setprecision(2) << std::fixed << std::endl << "Generator at Bus " << rhs.Name() << std::endl << "-------------------" << std::endl - << std::setw(30) << "bus: " << std::setw(10) << rhs.Name() + << std::setw(30) << "bus: " << std::setw(10) << rhs.Name() << std::setw(20) << "generation: " << std::setw(10) << rhs.RealPower() << std::setw(25) << " p.u. (real, MW), " << std::setw(10) << rhs.ReactivePower() << std::setw(25) << " p.u. (reactive, MVar), " << std::endl << std::setw(20) << "real power bound: " << std::setw(10) << rhs.RealPowerBound().Minimum() << std::setw(25) << " p.u. (pmin, MW), " @@ -1399,13 +1399,13 @@ class GeneratorProperties { * * @param outputStream The stream to write data to, e.g., std::cout. */ - static inline void Header ( std::ostream & outputStream) + static inline void Header ( std::ostream & outputStream) { outputStream << std::setw(20) << "bus" << std::setw(10) << "Pg" << std::setw(10) << "Qg" << std::setw(10) << "Qmax" - << std::setw(10) << "Qmin" + << std::setw(10) << "Qmin" << std::setw(10) << "Vg" << std::setw(10) << "mBase" << std::setw(10) << "status" @@ -1425,14 +1425,14 @@ class GeneratorProperties { << std::endl; } - static inline void HeaderBusGeneratorName ( std::ostream & outputStream) + static inline void HeaderBusGeneratorName ( std::ostream & outputStream) { outputStream << std::setw(20) << "bus" << std::setw(20) << "name" << std::setw(10) << "Pg" << std::setw(10) << "Qg" << std::setw(10) << "Qmax" - << std::setw(10) << "Qmin" + << std::setw(10) << "Qmin" << std::setw(10) << "Vg" << std::setw(10) << "mBase" << std::setw(10) << "status" @@ -1578,29 +1578,29 @@ class GeneratorProperties { /**@name Voltage Related Members */ ///@{ - Types::real voltageMagnitudeSnapshot_; /**< The voltage magnitude set point in per unit (p.u.) + Types::real voltageMagnitudeSnapshot_; /**< The voltage magnitude set point in per unit (p.u.) * of the nominal voltage @f$\voltagenominal@f$. */ ///@} - /**@name Nominal Power Members */ + /**@name Nominal Power Members */ ///@{ - Types::real nominalPower_; /**< The total nominal power of machine (also known as + Types::real nominalPower_; /**< The total nominal power of machine (also known as * MVA base or mBase), defaults set to baseMVA. */ - bool pNomExtendable_; /**< Determines if the generator is extendable and thus, - * uses @p nominalRealPowerBound_ bounds. If the - * generator is not extendable @p mBase_ is used. - * Thus, the extension/upgrade level is unknown and - * can be decided by, e.g., a MILP. However, generators - * that are not build are not interesting for standard - * problems such as MTSF or MFF. Note that for PyPsa + bool pNomExtendable_; /**< Determines if the generator is extendable and thus, + * uses @p nominalRealPowerBound_ bounds. If the + * generator is not extendable @p mBase_ is used. + * Thus, the extension/upgrade level is unknown and + * can be decided by, e.g., a MILP. However, generators + * that are not build are not interesting for standard + * problems such as MTSF or MFF. Note that for PyPsa * this are often renewable energies. */ - TBound nominalRealPowerBound_; /**< If the generator is extendable the nominal real power - * @f$\realpowernominal@f$ can be in the interval + TBound nominalRealPowerBound_; /**< If the generator is extendable the nominal real power + * @f$\realpowernominal@f$ can be in the interval * @f$\realpowernominal\coloneqq[\realpowernominalmin, - * \realpowernominalmax]@f$. + * \realpowernominalmax]@f$. */ TPowerSign sign_; /**< The power sign (1 means generation, -1 means load) */ ///@} @@ -1608,55 +1608,55 @@ class GeneratorProperties { /**@name Real Power Members */ ///@{ Types::real realPower_; /**< The real power generation @f$\realpowergeneration@f$ - * in @p MW. + * in @p MW. + */ + TBound realPowerBound_; /**< The real power output bound @f$[\realpowergenerationmin, + * \realpowergenerationmax]@f$ in @p MW. */ - TBound realPowerBound_; /**< The real power output bound @f$[\realpowergenerationmin, - * \realpowergenerationmax]@f$ in @p MW. - */ - Types::real pc1_; /**< The lower real power output of PQ capability curve at - * PC1 in @p MW. + Types::real pc1_; /**< The lower real power output of PQ capability curve at + * PC1 in @p MW. */ - Types::real pc2_; /**< The upper real power output of PQ capability curve at - * PC2 in @p MW. + Types::real pc2_; /**< The upper real power output of PQ capability curve at + * PC2 in @p MW. */ ///@} /**@name Real Power Members */ ///@{ - Types::real reactivePower_; /**< The reactive power generation @f$\reactivepowergeneration@f$ - * in @p MVAr. + Types::real reactivePower_; /**< The reactive power generation @f$\reactivepowergeneration@f$ + * in @p MVAr. */ - TBound reactivePowerBound_; /**< The reactive power output bound @f$[\reactivepowergenerationmin, - * \reactivepowergenerationmax]@f$ in @p MVAr. + TBound reactivePowerBound_; /**< The reactive power output bound @f$[\reactivepowergenerationmin, + * \reactivepowergenerationmax]@f$ in @p MVAr. */ TBound qc1Bound_; /**< The reactive power output bound at @p PC1 in @p MVAr. */ TBound qc2Bound_; /**< The reactive power output bound at @p PC2 in @p MVAr. */ ///@} - + /**@name Status Members */ ///@{ TBusStatus status_; /**< Describes the status of the generator. */ - bool committable_; /**< Decides whether unit commitment is @p active (while - * not being extendable) or @p inactive. + bool committable_; /**< Decides whether unit commitment is @p active (while + * not being extendable) or @p inactive. */ ///@} /**@name Type Members */ ///@{ - TControlType control_; /**< The control strategy, must be either @p PQ, @p PV - * or @p Slack. + TControlType control_; /**< The control strategy, must be either @p PQ, @p PV + * or @p Slack. */ TGeneratorType generatorType_; /**< The generator type, i.e., solar. */ - Types::real efficiency_; /**< The efficiency representing the ratio between primary - * and electrical energy. + Types::real efficiency_; /**< The efficiency representing the ratio between primary + * and electrical energy. */ ///@} - + /**@name Cost Specific Members */ ///@{ Types::real marginalCost_; /**< The marginal cost for production of 1 MW. */ Types::real capitalCost_; /**< The Capital cost of extending p_nom by 1 MW. */ - + Types::real startUpCost_; /**< The startup cost of the generator. */ Types::real shutDownCost_; /**< The shutdown cost of the generator. */ ///@} @@ -1666,7 +1666,7 @@ class GeneratorProperties { * @brief Ramp Limits: The inner dynamic of generators does not * always allow to change the production level, i.e., a maximum * possible change is set by ramp limits. - * + * * Ramp rate: Describes how fast generator outputs can be changed. * There are usually ramping up (increasing) and down * (decreasing), i.e., the unit is in units of power over time @@ -1687,7 +1687,7 @@ class GeneratorProperties { Types::real rampLimitStartUp_; /**< The maximum increase at startup in per unit of nominal power. */ Types::real rampLimitShutDown_; /**< The maximum decrease at shutdown in per unit of nominal power. */ ///@} - + // Types::real MU_P_BOUND /**< in u/MW, Kuhn-Tucker multiplier on lower/upper P_g limit (MU_PMIN / MU_PMAX) */ // Types::real MU_QMAX /**< in u/MVAr, Kuhn-Tucker multiplier on lower/upper Q_g limit (MU_QMIN / MU_QMAX) */ diff --git a/include/DataStructures/Graphs/Vertices/LoadProperties.hpp b/include/DataStructures/Graphs/Vertices/LoadProperties.hpp index a0444825..be766535 100644 --- a/include/DataStructures/Graphs/Vertices/LoadProperties.hpp +++ b/include/DataStructures/Graphs/Vertices/LoadProperties.hpp @@ -17,7 +17,7 @@ namespace egoa::Vertices { * @brief Class having all load properties. * * @tparam VertexType Represents the type specification, e.g., IeeeBusType. - * + * * @pre The vertex type should provide the option @p load. */ template @@ -31,13 +31,13 @@ class LoadProperties { /**@name Constructors and Destructor */ ///@{ #pragma mark CONSTRUCTORS_AND_DESTRUCTORS - + /** * @brief Constructs the object. */ LoadProperties ( ) - : name_("") - , type_(TVertexType::load) + : name_("") + , type_(TVertexType::load) , realPowerLoad_(0.0) , realPowerLoadBound_( TBound( 0.0, 0.0 ) ) , reactivePowerLoad_(0.0) @@ -51,7 +51,7 @@ class LoadProperties { */ LoadProperties ( Types::name name ) : name_(name) - , type_(TVertexType::load) + , type_(TVertexType::load) , realPowerLoad_(0.0) , realPowerLoadBound_( TBound( 0.0, 0.0 ) ) , reactivePowerLoad_(0.0) @@ -69,8 +69,8 @@ class LoadProperties { * @return The name of the vertex. */ inline Types::name & Name () - { - return name_; + { + return name_; } /** @@ -78,9 +78,9 @@ class LoadProperties { * * @return The name of the vertex. */ - inline Types::name Name () const - { - return name_; + inline Types::name Name () const + { + return name_; } /** @@ -89,8 +89,8 @@ class LoadProperties { * @return The type of the vertex. */ inline TVertexType & Type () - { - return type_; + { + return type_; } /** @@ -98,12 +98,12 @@ class LoadProperties { * * @return The type of the vertex. */ - inline TVertexType const & Type () const - { - return type_; + inline TVertexType const & Type () const + { + return type_; } ///@} - + /**@name Real power */ ///@{ #pragma mark REAL_POWER_LOAD @@ -116,9 +116,9 @@ class LoadProperties { * @return The real power demand @f$\realpowerdemand@f$ set * point in per unit (p.u.) nominal power (MW). */ - inline Types::real RealPowerLoad () const - { - return realPowerLoad_; + inline Types::real RealPowerLoad () const + { + return realPowerLoad_; } /** @@ -130,8 +130,8 @@ class LoadProperties { * point in per unit (p.u.) nominal power (MW). */ inline Types::real & RealPowerLoad () - { - return realPowerLoad_; + { + return realPowerLoad_; } /** @@ -143,9 +143,9 @@ class LoadProperties { * @f$[\realpowerdemandmin, \realpowerdemandmax]@f$ in per * unit (p.u.) nominal power (MW). */ - inline TBound RealPowerLoadBound () const - { - return realPowerLoadBound_; + inline TBound RealPowerLoadBound () const + { + return realPowerLoadBound_; } /** @@ -158,8 +158,8 @@ class LoadProperties { * unit (p.u.) nominal power (MW). */ inline TBound & RealPowerLoadBound () - { - return realPowerLoadBound_; + { + return realPowerLoadBound_; } ///@} @@ -176,9 +176,9 @@ class LoadProperties { * @f$\reactivepowerdemand@f$ in per unit (p.u.) nominal power * (MVAr). */ - inline Types::real ReactivePowerLoad () const - { - return reactivePowerLoad_; + inline Types::real ReactivePowerLoad () const + { + return reactivePowerLoad_; } /** @@ -191,8 +191,8 @@ class LoadProperties { * (MVAr). */ inline Types::real & ReactivePowerLoad () - { - return reactivePowerLoad_; + { + return reactivePowerLoad_; } /** @@ -204,9 +204,9 @@ class LoadProperties { * @f$[\reactivepowerdemandmin, \reactivepowerdemandmax]@f$ in * per unit (p.u.) nominal power (MVAr). */ - inline TBound ReactivePowerLoadBound () const - { - return reactivePowerLoadBound_; + inline TBound ReactivePowerLoadBound () const + { + return reactivePowerLoadBound_; } /** @@ -220,15 +220,15 @@ class LoadProperties { * per unit (p.u.) nominal power (MVAr). */ inline TBound & ReactivePowerLoadBound () - { - return reactivePowerLoadBound_; + { + return reactivePowerLoadBound_; } ///@} ///@name Comparators ///@{ #pragma mark COMPARATORS - + /** * @brief Inequality comparator. * @@ -237,9 +237,9 @@ class LoadProperties { * @return @p true if both vertices are @p not equal, @p false * otherwise. */ - inline bool operator!= ( LoadProperties const & rhs ) const - { - return !( this == rhs ); + inline bool operator!= ( LoadProperties const & rhs ) const + { + return !( this == rhs ); } /** @@ -250,11 +250,11 @@ class LoadProperties { * @return @p true if both vertices are equal, @p false * otherwise. */ - inline bool operator== ( LoadProperties const & rhs ) const + inline bool operator== ( LoadProperties const & rhs ) const { if ( Name() != rhs.Name() ) return false; if ( Type() != rhs.Type() ) return false; - + if ( RealPowerLoad() != rhs.RealPowerLoad() ) return false; if ( RealPowerLoadBound().Minimum() != rhs.RealPowerLoadBound().Minimum() ) return false; if ( RealPowerLoadBound().Maximum() != rhs.RealPowerLoadBound().Maximum() ) return false; @@ -262,7 +262,7 @@ class LoadProperties { if ( ReactivePowerLoad() != rhs.ReactivePowerLoad() ) return false; if ( ReactivePowerLoadBound().Minimum() != rhs.ReactivePowerLoadBound().Minimum() ) return false; if ( ReactivePowerLoadBound().Maximum() != rhs.ReactivePowerLoadBound().Maximum() ) return false; - + return true; } ///@} @@ -278,18 +278,18 @@ class LoadProperties { ///@name Real Power Members ///@{ Types::real realPowerLoad_; /**< The real power demand @f$\realpowerdemand@f$. */ - TBound realPowerLoadBound_; /**< The real power demand bound - * @f$[\realpowerdemandmin, \realpowerdemandmax]@f$. + TBound realPowerLoadBound_; /**< The real power demand bound + * @f$[\realpowerdemandmin, \realpowerdemandmax]@f$. */ ///@} ///@name Reactive Power Members ///@{ - Types::real reactivePowerLoad_; /**< The reactive power demand - * @f$\reactivepowerdemand@f$. + Types::real reactivePowerLoad_; /**< The reactive power demand + * @f$\reactivepowerdemand@f$. */ - TBound reactivePowerLoadBound_; /**< The real power demand bound - * @f$[\reactivepowerdemandmin, \reactivepowerdemandmax]@f$. + TBound reactivePowerLoadBound_; /**< The real power demand bound + * @f$[\reactivepowerdemandmin, \reactivepowerdemandmax]@f$. */ ///@} }; diff --git a/include/DataStructures/Graphs/Vertices/Type.hpp b/include/DataStructures/Graphs/Vertices/Type.hpp index 566370dc..e3b08661 100644 --- a/include/DataStructures/Graphs/Vertices/Type.hpp +++ b/include/DataStructures/Graphs/Vertices/Type.hpp @@ -101,7 +101,7 @@ enum class GeneratorType { ror = 13, /**< Run of river power */ ccgt = 14, /**< Combined Cycle Gas Turbines (CCGT) */ ocgt = 15, /**< Open Cycle Gas Turbines (OCGT) */ - biomass = 16, /**< Biomass */ + biomass = 16, /**< Biomass */ battery = 17, /**< Battery */ // ... unknown = 99 /**< unknown */ @@ -379,20 +379,20 @@ enum class PowerSign { #pragma mark OUTPUT_OPERATOR inline std::ostream & operator<< ( std::ostream & os - , BasicVertexType const & rhs ) + , BasicVertexType const & rhs ) { - if ( rhs == BasicVertexType::sink ){ os << "sink"; } - else if ( rhs == BasicVertexType::source ){ os << "source"; } - else if ( rhs == BasicVertexType::intermediate ){ os << "intermediate"; } + if ( rhs == BasicVertexType::sink ){ os << "sink"; } + else if ( rhs == BasicVertexType::source ){ os << "source"; } + else if ( rhs == BasicVertexType::intermediate ){ os << "intermediate"; } else { os << "unknown"; } return os; } inline std::ostream & operator<< ( std::ostream & os - , CdfBusType const & rhs ) + , CdfBusType const & rhs ) { if ( rhs == CdfBusType::load ){ os << "load bus (Type 0)"; } /** unregulated bus also called load bus */ - else if ( rhs == CdfBusType::mvar ){ os << "Mvar generator (Type 1)"; } /** bus holding Mvar generation within voltage limits */ + else if ( rhs == CdfBusType::mvar ){ os << "Mvar generator (Type 1)"; } /** bus holding Mvar generation within voltage limits */ else if ( rhs == CdfBusType::voltage ){ os << "voltage bus (Type 2)"; } /** bus holding bus voltage within Mvar limits, i.e., regulated generator bus */ else if ( rhs == CdfBusType::slack ){ os << "slack bus (Type 3)"; } /** bus holding bus voltage and angle, i.e., swing/reference/slack bus */ else { os << "unknown"; } @@ -400,7 +400,7 @@ enum class PowerSign { } inline std::ostream & operator<< ( std::ostream & os - , IeeeBusType const & rhs ) + , IeeeBusType const & rhs ) { if ( rhs == IeeeBusType::load ){ os << "load bus (Type 1)"; } /** bus with load only */ else if ( rhs == IeeeBusType::generator ){ os << "generator (Type 2)"; } /**@todo Generator, but definition is missing */ @@ -410,48 +410,48 @@ enum class PowerSign { } inline std::ostream & operator<< ( std::ostream & os - , BoundType const & rhs ) + , BoundType const & rhs ) { - if ( rhs == BoundType::unbounded ){ os << "unbounded"; } - else if ( rhs == BoundType::bounded ){ os << "bounded"; } - else if ( rhs == BoundType::exact ){ os << "exact"; } - else if ( rhs == BoundType::pureunbounded ){ os << "pure_unbounded";} + if ( rhs == BoundType::unbounded ){ os << "unbounded"; } + else if ( rhs == BoundType::bounded ){ os << "bounded"; } + else if ( rhs == BoundType::exact ){ os << "exact"; } + else if ( rhs == BoundType::pureunbounded ){ os << "pure_unbounded";} else { os << "unknown"; } return os; } inline std::ostream & operator<< ( std::ostream & os - , BusStatus const & rhs ) + , BusStatus const & rhs ) { - if ( rhs == Vertices::BusStatus::inactive ){ os << "inactive"; } - else if ( rhs == Vertices::BusStatus::active ){ os << "active"; } + if ( rhs == Vertices::BusStatus::inactive ){ os << "inactive"; } + else if ( rhs == Vertices::BusStatus::active ){ os << "active"; } else { os << "unknown"; } return os; } inline std::ostream & operator<< ( std::ostream & os - , EnergyCarrier const & rhs ) + , EnergyCarrier const & rhs ) { - if ( rhs == Vertices::EnergyCarrier::AC ){ os << "AC"; } - else if ( rhs == Vertices::EnergyCarrier::DC ){ os << "DC"; } - else if ( rhs == Vertices::EnergyCarrier::heat ){ os << "heat"; } - else if ( rhs == Vertices::EnergyCarrier::gas ){ os << "gas"; } + if ( rhs == Vertices::EnergyCarrier::AC ){ os << "AC"; } + else if ( rhs == Vertices::EnergyCarrier::DC ){ os << "DC"; } + else if ( rhs == Vertices::EnergyCarrier::heat ){ os << "heat"; } + else if ( rhs == Vertices::EnergyCarrier::gas ){ os << "gas"; } else { os << "unknown"; } return os; } inline std::ostream & operator<< ( std::ostream & os - , ControlType const & rhs ) + , ControlType const & rhs ) { - if ( rhs == Vertices::ControlType::PQ ){ os << "PQ"; } - else if ( rhs == Vertices::ControlType::PV ){ os << "PV"; } - else if ( rhs == Vertices::ControlType::slack ){ os << "slack"; } + if ( rhs == Vertices::ControlType::PQ ){ os << "PQ"; } + else if ( rhs == Vertices::ControlType::PV ){ os << "PV"; } + else if ( rhs == Vertices::ControlType::slack ){ os << "slack"; } else { os << "unknown"; } return os; } inline std::ostream & operator<< ( std::ostream & os - , GeneratorType const & rhs ) + , GeneratorType const & rhs ) { if ( GeneratorType::coal == rhs ) { os << "coal" ; @@ -486,7 +486,7 @@ enum class PowerSign { } ///@} -/**@name Enum conversion */ +/**@name Enum conversion */ ///@{ #pragma mark ENUM_CONVERSION @@ -500,12 +500,12 @@ enum class PowerSign { } template< typename E , typename T> - constexpr - inline - typename - std::enable_if< std::is_enum::value && std::is_integral::value, - E - >::type + constexpr + inline + typename + std::enable_if< std::is_enum::value && std::is_integral::value, + E + >::type to_enum( T value ) noexcept { return static_cast( value ); } @@ -513,4 +513,4 @@ enum class PowerSign { } // namespace egoa::Vertices -#endif // EGOA__DATA_STRUCTURES__VERTICES__TYPE_HPP \ No newline at end of file +#endif // EGOA__DATA_STRUCTURES__VERTICES__TYPE_HPP diff --git a/include/DataStructures/Graphs/Vertices/Vertex.hpp b/include/DataStructures/Graphs/Vertices/Vertex.hpp index 1bfce19e..027d5f5f 100644 --- a/include/DataStructures/Graphs/Vertices/Vertex.hpp +++ b/include/DataStructures/Graphs/Vertices/Vertex.hpp @@ -22,7 +22,7 @@ namespace egoa::Vertices { * * @tparam PropertyType The property of a vertex, e.g., * ElectricalProperties, specialize the vertex. - * + * * @see egoa::Vertices::ElectricalProperties */ template @@ -55,7 +55,7 @@ class Vertex { * @param lhs The left vertex. * @param rhs The right vertex. */ - friend void swap ( Vertex & lhs, Vertex & rhs ) + friend void swap ( Vertex & lhs, Vertex & rhs ) { // Necessary for the copy and swap idiom using std::swap; // enable ADL swap( lhs.identifier_, rhs.identifier_ ); @@ -65,7 +65,7 @@ class Vertex { ///@name Comparators ///@{ #pragma mark COMPARATORS - + /** * @brief Compares two vertices for equality. * @@ -74,7 +74,7 @@ class Vertex { * * @return @p true if the vertex are the same, @p false otherwise. */ - friend bool operator==( Vertex const & lhs, Vertex const & rhs ) + friend bool operator==( Vertex const & lhs, Vertex const & rhs ) { return ( lhs.Identifier() == rhs.Identifier() ) && ( lhs.Properties() == rhs.Properties() ); @@ -88,7 +88,7 @@ class Vertex { * * @return @p false if the vertices are the same, @p true otherwise. */ - friend bool operator!=( Vertex const & lhs, Vertex const & rhs ) + friend bool operator!=( Vertex const & lhs, Vertex const & rhs ) { return !(lhs == rhs); } @@ -109,7 +109,7 @@ class Vertex { #pragma mark MEMBER Types::vertexId identifier_; /**< Unique identifier of the vertex. */ TProperties properties_; /**< Property of the vertex. */ - + }; } // namespace egoa::Vertices diff --git a/include/DataStructures/Iterators/DynamicGraphIterators.hpp b/include/DataStructures/Iterators/DynamicGraphIterators.hpp index 5db1acbf..b484c70a 100644 --- a/include/DataStructures/Iterators/DynamicGraphIterators.hpp +++ b/include/DataStructures/Iterators/DynamicGraphIterators.hpp @@ -62,8 +62,8 @@ class DynamicGraphLoopDifferentiation * It must accept one argument of type @p Types::vertexId * e.g., * @code{.cpp} - * []( Types::vertexId vertexId ) - * { + * []( Types::vertexId vertexId ) + * { * // Do something with the vertex identifier. * } * @endcode @@ -95,9 +95,9 @@ class DynamicGraphLoopDifferentiation * It must accept one argument of type @p TGraph::TVertex, * e.g., * @code{.cpp} - * []( TVertex & vertex ) - * { - * // Do something with the vertex object. + * []( TVertex & vertex ) + * { + * // Do something with the vertex object. * } * @endcode * @@ -127,8 +127,8 @@ class DynamicGraphLoopDifferentiation * It must accept two arguments of types @p Types::vertexId * and @p TGraph::TVertex, e.g., * @code{.cpp} - * []( Types::vertexId vertexId, TVertex & vertex ) - * { + * []( Types::vertexId vertexId, TVertex & vertex ) + * { * // Do something with the vertex identifier and object. * } * @endcode @@ -165,8 +165,8 @@ class DynamicGraphLoopDifferentiation * It must accept one argument of type @p Types::edgeId, * e.g., * @code{.cpp} - * []( Types::edgeId edgeId ) - * { + * []( Types::edgeId edgeId ) + * { * // Do something with the edge identifier. * } * @endcode @@ -198,8 +198,8 @@ class DynamicGraphLoopDifferentiation * It must accept one argument of type @p TGraph::TEdge, * e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -230,8 +230,8 @@ class DynamicGraphLoopDifferentiation * It must accept two arguments of types @p Types::edgeId * and @p TGraph::TEdge, e.g., * @code{.cpp} - * []( Types::edgeId edgeId, TEdge & edge ) - * { + * []( Types::edgeId edgeId, TEdge & edge ) + * { * // Do something with the edge. * } * @endcode diff --git a/include/DataStructures/Iterators/GraphIterators.hpp b/include/DataStructures/Iterators/GraphIterators.hpp index eec61907..2a0a03f6 100644 --- a/include/DataStructures/Iterators/GraphIterators.hpp +++ b/include/DataStructures/Iterators/GraphIterators.hpp @@ -56,8 +56,8 @@ class GraphLoopDifferentiation { * all vertices. It must accept one argument * of type @p TGraph::TVertexId, e.g., * @code{.cpp} - * []( Types::vertexId vertexId ) - * { + * []( Types::vertexId vertexId ) + * { * // Do something with the vertex identifier. * } * @endcode @@ -69,7 +69,7 @@ class GraphLoopDifferentiation { void for_all_vertex_identifiers ( TGraph & graph , FUNCTION function ) { - for ( auto & vertex : graph.Vertices() ) + for ( auto & vertex : graph.Vertices() ) { auto id = vertex.Identifier(); function( id ); @@ -85,8 +85,8 @@ class GraphLoopDifferentiation { * all vertices. It must accept one argument * of type @p TGraph::TVertex, e.g., * @code{.cpp} - * []( TVertex & vertex ) - * { + * []( TVertex & vertex ) + * { * // Do something with the vertex object. * } * @endcode @@ -98,7 +98,7 @@ class GraphLoopDifferentiation { void for_all_vertices ( TGraph & graph , FUNCTION function ) { - for ( auto & vertex : graph.Vertices() ) + for ( auto & vertex : graph.Vertices() ) { function( vertex ); } @@ -114,8 +114,8 @@ class GraphLoopDifferentiation { * arguments of types @p Types::vertexId and * @p TGraph::TVertex, e.g., * @code{.cpp} - * []( Types::vertexId vertexId, TVertex & vertex ) - * { + * []( Types::vertexId vertexId, TVertex & vertex ) + * { * // Do something with the vertex identifier and object. * } * @endcode @@ -127,7 +127,7 @@ class GraphLoopDifferentiation { void for_all_vertex_tuples ( TGraph & graph , FUNCTION function ) { - for ( auto & vertex : graph.Vertices() ) + for ( auto & vertex : graph.Vertices() ) { auto id = vertex.Identifier(); function( id, vertex ); @@ -148,8 +148,8 @@ class GraphLoopDifferentiation { * It must accept one argument of type @p Types::edgeId, * e.g., * @code{.cpp} - * []( Types::edgeId edgeId ) - * { + * []( Types::edgeId edgeId ) + * { * // Do something with the edge identifier. * } * @endcode @@ -161,7 +161,7 @@ class GraphLoopDifferentiation { void for_all_edge_identifiers ( TGraph & graph , FUNCTION function ) { - for ( auto & edge : graph.Edges() ) + for ( auto & edge : graph.Edges() ) { auto id = edge.Identifier(); function( id ); @@ -177,8 +177,8 @@ class GraphLoopDifferentiation { * It must accept one argument of type @p TGraph::TEdge, * e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -190,7 +190,7 @@ class GraphLoopDifferentiation { void for_all_edges ( TGraph & graph , FUNCTION function ) { - for ( auto & edge : graph.Edges() ) + for ( auto & edge : graph.Edges() ) { function( edge ); } @@ -206,8 +206,8 @@ class GraphLoopDifferentiation { * of types @p Types::edgeId and @p * TGraph::TEdge, e.g., * @code{.cpp} - * []( Types::edgeId edgeId, TEdge & edge ) - * { + * []( Types::edgeId edgeId, TEdge & edge ) + * { * // Do something with the edge. * } * @endcode @@ -219,7 +219,7 @@ class GraphLoopDifferentiation { void for_all_edge_tuples ( TGraph & graph , FUNCTION function ) { - for ( auto & edge : graph.Edges() ) + for ( auto & edge : graph.Edges() ) { auto id = edge.Identifier(); function( id, edge ); @@ -241,8 +241,8 @@ class GraphLoopDifferentiation { * @f$\vertex@f$. It must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -269,8 +269,8 @@ class GraphLoopDifferentiation { * @f$\vertex@f$. It must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -283,11 +283,11 @@ class GraphLoopDifferentiation { , TVertexId vertexId , FUNCTION function ) { - for ( auto edgeId : graph.InEdgeIdsAt(vertexId) ) + for ( auto edgeId : graph.InEdgeIdsAt(vertexId) ) { function( graph.EdgeAt(edgeId) ); } - for ( auto edgeId : graph.OutEdgeIdsAt(vertexId) ) + for ( auto edgeId : graph.OutEdgeIdsAt(vertexId) ) { function( graph.EdgeAt(edgeId) ); } @@ -304,8 +304,8 @@ class GraphLoopDifferentiation { * accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -332,8 +332,8 @@ class GraphLoopDifferentiation { * accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -363,8 +363,8 @@ class GraphLoopDifferentiation { * accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -391,8 +391,8 @@ class GraphLoopDifferentiation { * accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -442,8 +442,8 @@ class GraphLoopDifferentiation { * It must accept one argument of type @p Types::vertexId * e.g., * @code{.cpp} - * []( Types::vertexId vertexId ) -> bool - * { + * []( Types::vertexId vertexId ) -> bool + * { * bool whetherToContinue = true; * // Do something with the vertex identifier. * return whetherToContinue; @@ -457,7 +457,7 @@ class GraphLoopDifferentiation { void for_all_vertex_identifiers ( TGraph & graph , FUNCTION function ) { - for ( auto & vertex : graph.Vertices() ) + for ( auto & vertex : graph.Vertices() ) { auto id = vertex.Identifier(); bool toContinue = function( id ); @@ -475,7 +475,7 @@ class GraphLoopDifferentiation { * all vertices. It must accept one argument * of type @p TGraph::TVertex, e.g., * @code{.cpp} - * []( TVertex & vertex ) -> bool + * []( TVertex & vertex ) -> bool * { * bool whetherToContinue = true; * // Do something with the vertex identifier. @@ -490,7 +490,7 @@ class GraphLoopDifferentiation { void for_all_vertices ( TGraph & graph , FUNCTION function ) { - for ( auto & vertex : graph.Vertices() ) + for ( auto & vertex : graph.Vertices() ) { bool toContinue = function( vertex ); if (!toContinue) return; @@ -509,7 +509,7 @@ class GraphLoopDifferentiation { * arguments of types @p Types::vertexId and * @p TGraph::TVertex, e.g., * @code{.cpp} - * []( Types::vertexId vertexId, TVertex vertex ) -> bool + * []( Types::vertexId vertexId, TVertex vertex ) -> bool * { * bool whetherToContinue = true; * // Do something with the vertex identifier and object. @@ -524,7 +524,7 @@ class GraphLoopDifferentiation { void for_all_vertex_tuples ( TGraph & graph , FUNCTION function ) { - for ( auto & vertex : graph.Vertices() ) + for ( auto & vertex : graph.Vertices() ) { auto id = vertex.Identifier(); bool toContinue = function( id, vertex ); @@ -547,7 +547,7 @@ class GraphLoopDifferentiation { * It must accept one argument of type @p Types::edgeId, * e.g., * @code{.cpp} - * []( Types::edgeId edgeId ) -> bool + * []( Types::edgeId edgeId ) -> bool * { * bool whetherToContinue = true; * // Do something with the edge identifier. @@ -562,7 +562,7 @@ class GraphLoopDifferentiation { void for_all_edge_identifiers ( TGraph & graph , FUNCTION function ) { - for ( auto & edge : graph.Edges() ) + for ( auto & edge : graph.Edges() ) { auto id = edge.Identifier(); bool toContinue = function( id ); @@ -573,14 +573,14 @@ class GraphLoopDifferentiation { /** * @brief The breakable @p for loop over all edges @f$\edges@f$ in the * graph @f$\graph@f$. - * @details The loop is aborted if the function returns @p false. + * @details The loop is aborted if the function returns @p false. * * @param graph The graph @f$\graph = (\vertices, \edges)@f$. * @param[in] function The function object that is called for all edges. * It must accept one argument of type @p TGraph::TEdge, * e.g., * @code{.cpp} - * []( TEdge & edge ) + * []( TEdge & edge ) * { * bool whetherToContinue = true; * // Do something with the edge object. @@ -595,7 +595,7 @@ class GraphLoopDifferentiation { void for_all_edges ( TGraph & graph , FUNCTION function ) { - for ( auto & edge : graph.Edges() ) + for ( auto & edge : graph.Edges() ) { bool toContinue = function( edge ); if (!toContinue) return; @@ -612,7 +612,7 @@ class GraphLoopDifferentiation { * It must accept two arguments of types @p Types::edgeId * and @p TGraph::TEdge, e.g., * @code{.cpp} - * []( Types::edgeId edgeId, TEdge & edge ) + * []( Types::edgeId edgeId, TEdge & edge ) * { * bool whetherToContinue = true; * // Do something with the edge. @@ -627,7 +627,7 @@ class GraphLoopDifferentiation { void for_all_edge_tuples ( TGraph & graph , FUNCTION function ) { - for ( auto & edge : graph.Edges() ) + for ( auto & edge : graph.Edges() ) { auto id = edge.Identifier(); bool toContinue = function( id, edge ); @@ -651,7 +651,7 @@ class GraphLoopDifferentiation { * @f$\vertex@f$. It must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) + * []( TEdge & edge ) * { * bool whetherToContinue = true; * // Do something with the edge object. @@ -682,7 +682,7 @@ class GraphLoopDifferentiation { * @f$\vertex@f$. It must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) + * []( TEdge & edge ) * { * bool whetherToContinue = true; * // Do something with the edge object. @@ -698,12 +698,12 @@ class GraphLoopDifferentiation { , TVertexId vertexId , FUNCTION function ) { - for ( auto edgeId : graph.InEdgeIdsAt(vertexId) ) + for ( auto edgeId : graph.InEdgeIdsAt(vertexId) ) { bool toContinue = function( graph.EdgeAt(edgeId) ); if (!toContinue) return; } - for ( auto edgeId : graph.OutEdgeIdsAt(vertexId) ) + for ( auto edgeId : graph.OutEdgeIdsAt(vertexId) ) { bool toContinue = function( graph.EdgeAt(edgeId) ); if (!toContinue) return; @@ -721,7 +721,7 @@ class GraphLoopDifferentiation { * of @f$\vertex@f$. It must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) + * []( TEdge & edge ) * { * bool whetherToContinue = true; * // Do something with the edge object. @@ -751,7 +751,7 @@ class GraphLoopDifferentiation { * of @f$\vertex@f$. It must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge edge ) + * []( TEdge edge ) * { * bool whetherToContinue = true; * // Do something with the edge object. @@ -785,7 +785,7 @@ class GraphLoopDifferentiation { * of @f$\vertex@f$. It must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) + * []( TEdge & edge ) * { * bool whetherToContinue = true; * // Do something with the edge object. @@ -815,7 +815,7 @@ class GraphLoopDifferentiation { * of @f$\vertex@f$. It must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) + * []( TEdge & edge ) * { * bool whetherToContinue = true; * // Do something with the edge object. @@ -871,8 +871,8 @@ class GraphLoopDifferentiation { * @f$\vertex@f$. It must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -899,8 +899,8 @@ class GraphLoopDifferentiation { * @f$\vertex@f$. It must accept one * argument of type @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -945,8 +945,8 @@ class GraphLoopDifferentiation { * must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -973,8 +973,8 @@ class GraphLoopDifferentiation { * accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1008,8 +1008,8 @@ class GraphLoopDifferentiation { * must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode @@ -1036,8 +1036,8 @@ class GraphLoopDifferentiation { * must accept one argument of type * @p TGraph::TEdge, e.g., * @code{.cpp} - * []( TEdge & edge ) - * { + * []( TEdge & edge ) + * { * // Do something with the edge object. * } * @endcode diff --git a/include/DataStructures/Iterators/PowerGridIterators.hpp b/include/DataStructures/Iterators/PowerGridIterators.hpp index 46cd8754..aa7c8b60 100644 --- a/include/DataStructures/Iterators/PowerGridIterators.hpp +++ b/include/DataStructures/Iterators/PowerGridIterators.hpp @@ -24,7 +24,7 @@ namespace egoa::internal { * @details Implementations for the loops are defined in the * template specializations for the different execution * policies. - * + * * * @tparam PowerGridType The type of a power grid, e.g., PowerGrid. * @tparam Policy The execution policy. @@ -33,8 +33,8 @@ template class PowerGridLoopDifferentiation; template -class PowerGridLoopDifferentiation { - +class PowerGridLoopDifferentiation { + using TNetwork = PowerGridType; using TVertex = typename TNetwork::TVertex; using TGeneratorProperties = typename TNetwork::TGeneratorProperties; @@ -50,7 +50,7 @@ class PowerGridLoopDifferentiation { /** * @brief The sequential @p for loop over all @p generators * (vertex independent). - * + * * @param network The network @f$\network = ( \graph, * \generators, \consumers, \capacity, \susceptance, \dots * )@f$. @@ -58,9 +58,9 @@ class PowerGridLoopDifferentiation { * that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties & generatorProperties ) - * { - * Do something with the generator properties. + * []( TGeneratorProperties & generatorProperties ) + * { + * Do something with the generator properties. * } * @endcode * @@ -70,9 +70,9 @@ class PowerGridLoopDifferentiation { template inline static void for_all_generators ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { - for ( TGeneratorProperties & generator : network.generators_ ) + for ( TGeneratorProperties & generator : network.generators_ ) { function( generator ); } @@ -81,7 +81,7 @@ class PowerGridLoopDifferentiation { /** * @brief The sequential @p for loop over all @p generators (vertex * independent). - * + * * @param network The const network @f$\network = ( \graph, * \generators, \consumers, \capacity, \susceptance, \dots * )@f$. @@ -89,9 +89,9 @@ class PowerGridLoopDifferentiation { * that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties const & generatorProperties ) - * { - * Do something with the generator properties. + * []( TGeneratorProperties const & generatorProperties ) + * { + * Do something with the generator properties. * } * @endcode * @@ -101,9 +101,9 @@ class PowerGridLoopDifferentiation { template inline static void for_all_generators ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { - for ( TGeneratorProperties const & generator : network.generators_ ) + for ( TGeneratorProperties const & generator : network.generators_ ) { function( generator ); } @@ -118,11 +118,11 @@ class PowerGridLoopDifferentiation { * )@f$. * @param[in] function The function pointer, e.g., lambda function * that has a vertex identifier @p Types::vertexId as input. - * + * * @code{.cpp} - * []( Types::vertexId vertexId ) - * { - * Do something with the vertex identifier that has generators. + * []( Types::vertexId vertexId ) + * { + * Do something with the vertex identifier that has generators. * } * @endcode * @@ -132,14 +132,14 @@ class PowerGridLoopDifferentiation { template inline static void for_all_vertex_identifiers_with_generator ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { - if ( network.HasGeneratorAt(vertexId) + if ( network.HasGeneratorAt(vertexId) && network.Graph().VertexExists(vertexId) ) { vertexIdSafeguard = vertexId; function( vertexIdSafeguard ); @@ -158,11 +158,11 @@ class PowerGridLoopDifferentiation { * @param[in] function The function pointer, e.g., lambda * function that has a generator identifier @p * Types::generatorId as input. - * + * * @code{.cpp} - * []( Types::generatorId generatorId ) - * { - * Do something with the generator identifier at the @p vertexId. + * []( Types::generatorId generatorId ) + * { + * Do something with the generator identifier at the @p vertexId. * } * @endcode * @@ -173,13 +173,13 @@ class PowerGridLoopDifferentiation { inline static void for_all_generator_identifiers_at ( Types::vertexId vertexId , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::loadId generatorIdSafeguard = 0; - if ( network.HasGeneratorAt ( vertexId ) - && network.Graph().VertexExists ( vertexId ) ) + if ( network.HasGeneratorAt ( vertexId ) + && network.Graph().VertexExists ( vertexId ) ) { - for ( Types::generatorId generatorId : network.generatorsAtVertex_[vertexId] ) + for ( Types::generatorId generatorId : network.generatorsAtVertex_[vertexId] ) { generatorIdSafeguard = generatorId; function ( generatorIdSafeguard ); @@ -198,11 +198,11 @@ class PowerGridLoopDifferentiation { * @param[in] function The function pointer, e.g., lambda * function that has a generator identifier @p generatorId as * input. - * + * * @code{.cpp} - * []( Types::generatorId generatorId ) - * { - * Do something with the generator identifier at the @p vertex. + * []( Types::generatorId generatorId ) + * { + * Do something with the generator identifier at the @p vertex. * } * @endcode * @@ -213,13 +213,13 @@ class PowerGridLoopDifferentiation { inline static void for_all_generator_identifiers_at ( TVertex const & vertex , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_generator_identifiers_at ( vertexId, network, function ); } - + /** * @brief The sequential @p for loop over all generator objects * at a @p vertex. @@ -232,9 +232,9 @@ class PowerGridLoopDifferentiation { * function that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties & generator ) - * { - * Do something with the generator object at the @p vertex. + * []( TGeneratorProperties & generator ) + * { + * Do something with the generator object at the @p vertex. * } * @endcode * @@ -245,7 +245,7 @@ class PowerGridLoopDifferentiation { inline static void for_all_generators_at ( TVertex const & vertex , TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_generators_at ( vertexId, network, function ); @@ -263,9 +263,9 @@ class PowerGridLoopDifferentiation { * function that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties const & generator ) - * { - * Do something with the generator object at the @p vertex. + * []( TGeneratorProperties const & generator ) + * { + * Do something with the generator object at the @p vertex. * } * @endcode * @@ -276,7 +276,7 @@ class PowerGridLoopDifferentiation { inline static void for_all_generators_at ( TVertex const & vertex , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_generators_at ( vertexId, network, function ); @@ -294,9 +294,9 @@ class PowerGridLoopDifferentiation { * function that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties & generator ) - * { - * Do something with the generator object at the @p vertexId. + * []( TGeneratorProperties & generator ) + * { + * Do something with the generator object at the @p vertexId. * } * @endcode * @@ -307,9 +307,9 @@ class PowerGridLoopDifferentiation { inline static void for_all_generators_at ( Types::vertexId const vertexId , TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { - for_all_generator_identifiers_at ( vertexId, network, + for_all_generator_identifiers_at ( vertexId, network, [ &network, &function ]( Types::generatorId generatorId ) { function ( network.generators_[generatorId] ); @@ -329,9 +329,9 @@ class PowerGridLoopDifferentiation { * function that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties const & generator ) - * { - * Do something with the generator object at the @p vertexId. + * []( TGeneratorProperties const & generator ) + * { + * Do something with the generator object at the @p vertexId. * } * @endcode * @@ -342,9 +342,9 @@ class PowerGridLoopDifferentiation { inline static void for_all_generators_at ( Types::vertexId const vertexId , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { - for_all_generator_identifiers_at ( vertexId, network, + for_all_generator_identifiers_at ( vertexId, network, [ &network, &function ]( Types::generatorId generatorId ) { function ( network.generators_[generatorId] ); @@ -362,11 +362,11 @@ class PowerGridLoopDifferentiation { * @param[in] function The function pointer, e.g., lambda * function that has a vertex identifier @p vertexId and a * @c generator object@c as input. - * + * * @code{.cpp} - * []( Types::vertexId vertexId, TGeneratorProperties & generatorProperties ) - * { - * Do something with the vertexId and the generator object. + * []( Types::vertexId vertexId, TGeneratorProperties & generatorProperties ) + * { + * Do something with the vertexId and the generator object. * } * @endcode * @@ -376,14 +376,14 @@ class PowerGridLoopDifferentiation { template inline static void for_all_generator_tuple ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { - if ( network.HasGeneratorAt(vertexId) ) + if ( network.HasGeneratorAt(vertexId) ) { for ( Types::generatorId generatorId : network.generatorsAtVertex_[vertexId] ) { @@ -404,11 +404,11 @@ class PowerGridLoopDifferentiation { * @param[in] function The function pointer, e.g., lambda * function that has a vertex identifier @p vertexId and a * @c generator object@c as input. - * + * * @code{.cpp} - * []( Types::vertexId vertexId, TGeneratorProperties const & generator ) - * { - * Do something with the vertexId and the generator object. + * []( Types::vertexId vertexId, TGeneratorProperties const & generator ) + * { + * Do something with the vertexId and the generator object. * } * @endcode * @@ -418,14 +418,14 @@ class PowerGridLoopDifferentiation { template inline static void for_all_generator_tuple ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { - if ( network.HasGeneratorAt(vertexId) ) + if ( network.HasGeneratorAt(vertexId) ) { for ( Types::generatorId generatorId : network.generatorsAtVertex_[vertexId] ) { @@ -448,9 +448,9 @@ class PowerGridLoopDifferentiation { * @c generator objects@c as input. * * @code{.cpp} - * []( Types::vertexId vertexId, std::vector const & generators ) - * { - * Do something with the set of generators at the vertexId + * []( Types::vertexId vertexId, std::vector const & generators ) + * { + * Do something with the set of generators at the vertexId * and identifier of the vertex that has generators. * } * @endcode @@ -461,12 +461,12 @@ class PowerGridLoopDifferentiation { template inline static void for_all_generators_tuple ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { if ( network.HasGeneratorAt(vertexId) ) { @@ -490,9 +490,9 @@ class PowerGridLoopDifferentiation { * @c generator objects@c as input. * * @code{.cpp} - * []( Types::vertexId vertexId, std::vector const & generators ) - * { - * // Do something with the set of generators at the vertexId + * []( Types::vertexId vertexId, std::vector const & generators ) + * { + * // Do something with the set of generators at the vertexId * // and identifier of the vertex that has generators. * } * @endcode @@ -503,12 +503,12 @@ class PowerGridLoopDifferentiation { template inline static void for_all_generators_tuple ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { if ( network.HasGeneratorAt ( vertexId ) ) { @@ -529,13 +529,13 @@ class PowerGridLoopDifferentiation { * @param network The network @f$\network = ( \graph, * \generators, \consumers, \capacity, \susceptance, \dots)@f$. * @param[in] function The function, e.g., lambda function. - * + * * @code{.cpp} * for_all_real_power_generator_snapshots( * network, * []( Types::index snapshotId - * , Types::generatorSnapshot snapshot ) - * { + * , Types::generatorSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); @@ -545,28 +545,28 @@ class PowerGridLoopDifferentiation { * all real power generator snapshots. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { for ( Types::index generatorId = 0 ; generatorId < network.generatorRealPowerSnapshots_.size() - ; ++generatorId ) - { + ; ++generatorId ) + { for_all_real_power_generator_snapshots_of ( network, generatorId, function ); } } - template + template inline static void for_all_real_power_generator_snapshots ( TNetwork const & network , FUNCTION function ) { for ( Types::index generatorId = 0 ; generatorId < network.generatorRealPowerSnapshots_.size() - ; ++generatorId ) - { + ; ++generatorId ) + { for_all_real_power_generator_snapshots_of ( network, generatorId, function ); } } @@ -579,20 +579,20 @@ class PowerGridLoopDifferentiation { * @param network The network @f$\network = ( \graph, * \generators, \consumers, \capacity, \susceptance, \dots)@f$. * @param generatorId The identifier of the generator. - * @param[in] function The function, e.g., lambda function. - * + * @param[in] function The function, e.g., lambda function. + * * @pre Check if the generator identifier @p generatorId of the * generatorProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasGenerator ( generatorId ) ) * { - * for_all_real_power_generator_snapshots_of ( + * for_all_real_power_generator_snapshots_of ( * network, * generatorId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); @@ -603,34 +603,34 @@ class PowerGridLoopDifferentiation { * all real power generator snapshots at @p generatorId. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_of ( TNetwork & network , Types::generatorId generatorId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT ( network.HasGenerator ( generatorId ) ); for ( Types::index snapshotId = 0 ; snapshotId < network.generatorRealPowerSnapshots_[generatorId].size() - ; ++snapshotId ) - { + ; ++snapshotId ) + { function( snapshotId, network.generatorRealPowerSnapshots_[generatorId][snapshotId] ); } } - template + template inline static void for_all_real_power_generator_snapshots_of ( TNetwork const & network , Types::generatorId generatorId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT ( network.HasGenerator ( generatorId ) ); for ( Types::index snapshotId = 0 ; snapshotId < network.generatorRealPowerSnapshots_[generatorId].size() - ; ++snapshotId ) - { + ; ++snapshotId ) + { function( snapshotId, network.generatorRealPowerSnapshots_[generatorId][snapshotId] ); } } @@ -644,18 +644,18 @@ class PowerGridLoopDifferentiation { * \generators, \consumers, \capacity, \susceptance, \dots)@f$. * @param generatorProperties The generator properties. * @param[in] function The function, e.g. , lambda function. - * + * * @pre Check if the generator's properties @p * generatorProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasGenerator ( network.GeneratorId ( generatorProperties ) ) ) * { * for_all_real_power_generator_snapshots_of ( * network, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); @@ -666,29 +666,29 @@ class PowerGridLoopDifferentiation { * all real power generator snapshots of @p generatorProperties. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_of ( TNetwork & network , TGeneratorProperties generatorProperties - , FUNCTION function ) + , FUNCTION function ) { Types::generatorId generatorId = network.GeneratorId( generatorProperties ); USAGE_ASSERT ( network.HasGenerator ( generatorId ) ); - + for_all_real_power_generator_snapshots_of ( network, generatorId, function ); } - template + template inline static void for_all_real_power_generator_snapshots_of ( TNetwork const & network , TGeneratorProperties generatorProperties - , FUNCTION function ) + , FUNCTION function ) { Types::generatorId generatorId = network.GeneratorId( generatorProperties ); USAGE_ASSERT ( network.HasGenerator ( generatorId ) ); - + for_all_real_power_generator_snapshots_of ( network, generatorId, function ); } ///@} @@ -701,10 +701,10 @@ class PowerGridLoopDifferentiation { * \generators, \consumers, \capacity, \susceptance, \dots)@f$. * @param vertexId The identifier of a vertex. * @param[in] function The function, e.g. , lambda function. - * + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -712,8 +712,8 @@ class PowerGridLoopDifferentiation { * network, * vertexId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); @@ -724,24 +724,24 @@ class PowerGridLoopDifferentiation { * all real power generator snapshots at @p vertexId. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork & network , Types::vertexId vertexId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT ( network.Graph().VertexExists( vertexId ) ); std::vector generatorIds; network.GeneratorsAt( vertexId, generatorIds ); - + for ( Types::generatorId generatorId : generatorIds ) { for_all_real_power_generator_snapshots_of ( network, generatorId, function ); } } - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork const & network , Types::vertexId vertexId @@ -751,7 +751,7 @@ class PowerGridLoopDifferentiation { std::vector generatorIds; network.GeneratorsAt( vertexId, generatorIds ); - + for ( Types::generatorId generatorId : generatorIds ) { @@ -768,10 +768,10 @@ class PowerGridLoopDifferentiation { * \generators, \consumers, \capacity, \susceptance, \dots)@f$. * @param vertex The vertex. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the vertex @p vertex exists before using * this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( network.Graph().VertexId( vertex ) ) ) * { @@ -779,8 +779,8 @@ class PowerGridLoopDifferentiation { * network, * vertex, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); @@ -791,35 +791,35 @@ class PowerGridLoopDifferentiation { * all real power generator snapshots at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork & network , TVertex const & vertex - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); - + USAGE_ASSERT ( network.Graph().VertexExists( vertexId ) ); std::vector generatorIds; network.GeneratorAt( vertexId, generatorIds ); - + for_all_real_power_generator_snapshots_at ( network, vertexId, function ); } - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork const & network , TVertex const & vertex , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); - + USAGE_ASSERT ( network.Graph().VertexExists( vertexId ) ); std::vector generatorIds; network.GeneratorAt( vertexId, generatorIds ); - + for_all_real_power_generator_snapshots_at ( network, vertexId, function ); } ///@} @@ -834,11 +834,11 @@ class PowerGridLoopDifferentiation { * @param vertexId The identifier of a vertex * @param timestampPosition The position of the snapshot * (timestamp of the snapshot). - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -847,37 +847,37 @@ class PowerGridLoopDifferentiation { * vertexId, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); - * } + * } * @endcode * * @tparam FUNCTION The function object that is called for * all real power generator at @p timestamp at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork & network , Types::vertexId vertexId , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT( network.Graph().VertexExists( vertexId ) ); std::vector generatorIds; network.GeneratorIds ( vertexId, generatorIds ); - for ( Types::generatorId generatorId : generatorIds ) - { + for ( Types::generatorId generatorId : generatorIds ) + { function ( network.GeneratorSnapshotOf( generatorId, timestampPosition ) ); } } - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork const & network , Types::vertexId vertexId @@ -889,8 +889,8 @@ class PowerGridLoopDifferentiation { std::vector generatorIds; network.GeneratorIds ( vertexId, generatorIds ); - for ( Types::generatorId generatorId : generatorIds ) - { + for ( Types::generatorId generatorId : generatorIds ) + { function ( network.GeneratorSnapshotOf( generatorId, timestampPosition ) ); } } @@ -917,24 +917,24 @@ class PowerGridLoopDifferentiation { * vertex, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * // Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * // Do something with the snapshotId and load snapshot object * } * ); - * } + * } * @endcode * * @tparam FUNCTION The function object that is called for * all real power load at @p timestamp at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork & network , TVertex const & vertex , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); @@ -943,12 +943,12 @@ class PowerGridLoopDifferentiation { for_all_real_power_generator_snapshots_at ( network, vertexId, timestampPosition, function ); } - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork const & network , TVertex const & vertex , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); @@ -974,9 +974,9 @@ class PowerGridLoopDifferentiation { * that has a load object as input. * * @code{.cpp} - * []( TLoadProperties & load ) - * { - * Do something with the load object. + * []( TLoadProperties & load ) + * { + * Do something with the load object. * } * @endcode * @@ -986,9 +986,9 @@ class PowerGridLoopDifferentiation { template inline static void for_all_loads ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { - for ( TLoadProperties & load : network.loads_ ) + for ( TLoadProperties & load : network.loads_ ) { function ( load ); } @@ -1005,9 +1005,9 @@ class PowerGridLoopDifferentiation { * that has a const load object as input. * * @code{.cpp} - * []( TLoadProperties const & load ) - * { - * Do something with the load object. + * []( TLoadProperties const & load ) + * { + * Do something with the load object. * } * @endcode * @@ -1017,9 +1017,9 @@ class PowerGridLoopDifferentiation { template inline static void for_all_loads ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { - for ( TLoadProperties const & load : network.loads_ ) + for ( TLoadProperties const & load : network.loads_ ) { function ( load ); } @@ -1037,9 +1037,9 @@ class PowerGridLoopDifferentiation { * as input. * * @code{.cpp} - * []( Types::vertexId vertexId ) - * { - * Do something with the vertex identifier that has loads. + * []( Types::vertexId vertexId ) + * { + * Do something with the vertex identifier that has loads. * } * @endcode * @@ -1049,15 +1049,15 @@ class PowerGridLoopDifferentiation { template inline static void for_all_vertex_identifiers_with_load ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { - if ( network.HasLoadAt(vertexId) - && network.Graph().VertexExists(vertexId) ) + if ( network.HasLoadAt(vertexId) + && network.Graph().VertexExists(vertexId) ) { vertexIdSafeguard = vertexId; function ( vertexIdSafeguard ); @@ -1076,11 +1076,11 @@ class PowerGridLoopDifferentiation { * @param[in] function The function pointer, e.g., lambda * function that has a load identifier @p Types::loadId as * input. - * + * * @code{.cpp} - * []( Types::loadId loadId ) - * { - * Do something with the load identifier at the @p vertex. + * []( Types::loadId loadId ) + * { + * Do something with the load identifier at the @p vertex. * } * @endcode * @@ -1091,12 +1091,12 @@ class PowerGridLoopDifferentiation { inline static void for_all_load_identifiers_at ( Types::vertexId vertexId , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::loadId loadIdSafeguard = 0; - if ( network.HasLoadAt ( vertexId ) + if ( network.HasLoadAt ( vertexId ) && network.Graph().VertexExists ( vertexId ) ) { - for ( Types::loadId loadId : network.loadsAtVertex_[vertexId] ) + for ( Types::loadId loadId : network.loadsAtVertex_[vertexId] ) { loadIdSafeguard = loadId; function ( loadIdSafeguard ); @@ -1116,9 +1116,9 @@ class PowerGridLoopDifferentiation { * function that has a load identifier as input. * * @code{.cpp} - * []( Types::loadId loadId ) - * { - * Do something with the load identifier at the @p vertex. + * []( Types::loadId loadId ) + * { + * Do something with the load identifier at the @p vertex. * } * @endcode * @@ -1129,7 +1129,7 @@ class PowerGridLoopDifferentiation { inline static void for_all_load_identifiers_at ( TVertex const & vertex , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_load_identifiers_at ( vertexId, network, function ); @@ -1145,11 +1145,11 @@ class PowerGridLoopDifferentiation { * )@f$. * @param[in] function The function pointer, e.g., lambda * function that has a load object as input. - * + * * @code{.cpp} - * []( TLoadProperties & loadProperties ) - * { - * Do something with the load object at the @p vertex. + * []( TLoadProperties & loadProperties ) + * { + * Do something with the load object at the @p vertex. * } * @endcode * @@ -1160,7 +1160,7 @@ class PowerGridLoopDifferentiation { inline static void for_all_loads_at ( TVertex const & vertex , TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_loads_at ( vertexId, network, function ); @@ -1176,11 +1176,11 @@ class PowerGridLoopDifferentiation { * )@f$. * @param[in] function The function pointer, e.g., lambda * function that has a load object as input. - * + * * @code{.cpp} - * []( TLoadProperties const & load ) - * { - * Do something with the load object at the @p vertex. + * []( TLoadProperties const & load ) + * { + * Do something with the load object at the @p vertex. * } * @endcode * @@ -1191,7 +1191,7 @@ class PowerGridLoopDifferentiation { inline static void for_all_loads_at ( TVertex const & vertex , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_loads_at ( vertexId, network, function ); @@ -1209,9 +1209,9 @@ class PowerGridLoopDifferentiation { * function that has a load object as input. * * @code{.cpp} - * []( TLoadProperties & load ) - * { - * Do something with the load object at the @p vertexId. + * []( TLoadProperties & load ) + * { + * Do something with the load object at the @p vertexId. * } * @endcode * @@ -1222,9 +1222,9 @@ class PowerGridLoopDifferentiation { inline static void for_all_loads_at ( Types::vertexId const vertexId , TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { - for_all_load_identifiers_at ( vertexId, network, + for_all_load_identifiers_at ( vertexId, network, [ &network, &function ]( Types::loadId loadId ) { function ( network.loads_[loadId] ); @@ -1244,9 +1244,9 @@ class PowerGridLoopDifferentiation { * function that has a load object as input. * * @code{.cpp} - * []( TLoadProperties const & load ) - * { - * Do something with the load object at the @p vertexId. + * []( TLoadProperties const & load ) + * { + * Do something with the load object at the @p vertexId. * } * @endcode * @@ -1257,9 +1257,9 @@ class PowerGridLoopDifferentiation { inline static void for_all_loads_at ( Types::vertexId const vertexId , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { - for_all_load_identifiers_at ( vertexId, network, + for_all_load_identifiers_at ( vertexId, network, [ &network, &function ]( Types::loadId loadId ) { function ( network.loads_[loadId] ); @@ -1279,9 +1279,9 @@ class PowerGridLoopDifferentiation { * @c load object@c as input. * * @code{.cpp} - * []( Types::vertexId vertexId, TLoadProperties & loadProperties ) - * { - * Do something with the vertexId and load object. + * []( Types::vertexId vertexId, TLoadProperties & loadProperties ) + * { + * Do something with the vertexId and load object. * } * @endcode * @@ -1291,16 +1291,16 @@ class PowerGridLoopDifferentiation { template inline static void for_all_load_tuples ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { - if ( network.HasLoadAt(vertexId) ) + if ( network.HasLoadAt(vertexId) ) { - for ( Types::loadId loadId : network.loadsAtVertex_[vertexId] ) + for ( Types::loadId loadId : network.loadsAtVertex_[vertexId] ) { vertexIdSafeguard = vertexId; function( vertexIdSafeguard, network.loads_[loadId] ); @@ -1321,9 +1321,9 @@ class PowerGridLoopDifferentiation { * @c load object@c as input. * * @code{.cpp} - * []( Types::vertexId vertexId, TLoadProperties const & loadProperties ) - * { - * Do something with the vertexId and load object. + * []( Types::vertexId vertexId, TLoadProperties const & loadProperties ) + * { + * Do something with the vertexId and load object. * } * @endcode * @@ -1333,16 +1333,16 @@ class PowerGridLoopDifferentiation { template inline static void for_all_load_tuples ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { - if ( network.HasLoadAt(vertexId) ) + if ( network.HasLoadAt(vertexId) ) { - for ( Types::loadId loadId : network.loadsAtVertex_[vertexId] ) + for ( Types::loadId loadId : network.loadsAtVertex_[vertexId] ) { vertexIdSafeguard = vertexId; function( vertexIdSafeguard, network.loads_[loadId] ); @@ -1363,10 +1363,10 @@ class PowerGridLoopDifferentiation { * @c load objects@c as input. * * @code{.cpp} - * []( Types::vertexId vertexId, std::vector & loads ) - * { - * Do something with the set of loads at the vertexId - * and identifier of the vertex that has loads. + * []( Types::vertexId vertexId, std::vector & loads ) + * { + * Do something with the set of loads at the vertexId + * and identifier of the vertex that has loads. * } * @endcode * @@ -1376,12 +1376,12 @@ class PowerGridLoopDifferentiation { template inline static void for_all_loads_tuple ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { if ( network.HasLoadAt(vertexId) ) { @@ -1403,14 +1403,14 @@ class PowerGridLoopDifferentiation { * * @param network The network * @param[in] function The function, e.g., lambda function. - * + * * @code{.cpp} * for_all_real_power_load_snapshots( * network, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); * @endcode @@ -1419,14 +1419,14 @@ class PowerGridLoopDifferentiation { * all real power load snapshots. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { for ( Types::loadId loadId = 0 ; loadId < network.loadSnapshots_.size() - ; ++loadId ) + ; ++loadId ) { for_all_real_power_load_snapshots_of ( network , loadId @@ -1434,14 +1434,14 @@ class PowerGridLoopDifferentiation { } } - template + template inline static void for_all_real_power_load_snapshots ( TNetwork const & network , FUNCTION function ) { for ( Types::loadId loadId = 0 ; loadId < network.loadSnapshots_.size() - ; ++loadId ) + ; ++loadId ) { for_all_real_power_load_snapshots_of ( network , loadId @@ -1449,7 +1449,7 @@ class PowerGridLoopDifferentiation { } } ///@} - + /** * @brief The sequential @c for loop @c over all real power * snapshots of a load with @p loadId. @@ -1457,20 +1457,20 @@ class PowerGridLoopDifferentiation { * @param network The network. * @param loadId The identifier of the load. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the load identifier @p loadId of the * loadProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasLoad ( loadId ) ) * { - * for_all_real_power_load_snapshots_of ( + * for_all_real_power_load_snapshots_of ( * network, * loadId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); * } @@ -1480,24 +1480,24 @@ class PowerGridLoopDifferentiation { * all real power load snapshots at @p loadId. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_of ( TNetwork & network , Types::loadId loadId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT ( network.HasLoad ( loadId ) ); for ( Types::index timestampPosition = 0 ; timestampPosition < network.loadSnapshots_.size() - ; ++timestampPosition ) - { + ; ++timestampPosition ) + { function ( timestampPosition , network.LoadSnapshotOf( loadId, timestampPosition ) ); } } - template + template inline static void for_all_real_power_load_snapshots_of ( TNetwork const & network , Types::loadId loadId @@ -1507,8 +1507,8 @@ class PowerGridLoopDifferentiation { for ( Types::index timestampPosition = 0 ; timestampPosition < network.loadSnapshots_.size() - ; ++timestampPosition ) - { + ; ++timestampPosition ) + { function ( timestampPosition , network.LoadSnapshotOf( loadId, timestampPosition ) ); } @@ -1522,20 +1522,20 @@ class PowerGridLoopDifferentiation { * * @param network The network. * @param loadProperties The load properties. - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the load's properties @p loadProperties exists * before using this method. - * + * * @code{.cpp} * if ( network.HasLoad ( network.LoadId ( loadProperties ) ) ) * { * for_all_real_power_load_snapshots_of ( * network, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); * } @@ -1545,27 +1545,27 @@ class PowerGridLoopDifferentiation { * all real power load snapshots at @p loadProperties. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_of ( TNetwork & network , TLoadProperties const & loadProperties - , FUNCTION function ) + , FUNCTION function ) { Types::loadId loadId = network.LoadId ( loadProperties ); - + USAGE_ASSERT ( network.HasLoad ( loadId ) ); for_all_real_power_load_snapshots_of ( network, loadId, function ); } - template + template inline static void for_all_real_power_load_snapshots_of ( TNetwork const & network , TLoadProperties const & loadProperties , FUNCTION function ) { Types::loadId loadId = network.LoadId ( loadProperties ); - + USAGE_ASSERT ( network.HasLoad ( loadId ) ); for_all_real_power_load_snapshots_of ( network, loadId, function ); @@ -1578,11 +1578,11 @@ class PowerGridLoopDifferentiation { * * @param network The network * @param vertexId The identifier of a vertex - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -1590,8 +1590,8 @@ class PowerGridLoopDifferentiation { * network, * vertexId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * Do something with the snapshotId and load snapshot object } * } * ); @@ -1602,24 +1602,24 @@ class PowerGridLoopDifferentiation { * all real power load snapshots at @p vertexId. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork & network , Types::vertexId vertexId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT( network.Graph().VertexExists( vertexId ) ); std::vector loadIds; network.LoadIds ( vertexId, loadIds ); - for ( Types::loadId loadId : loadIds ) - { + for ( Types::loadId loadId : loadIds ) + { for_all_real_power_load_snapshots_of ( network, loadId, function ); } } - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork const & network , Types::vertexId vertexId @@ -1630,8 +1630,8 @@ class PowerGridLoopDifferentiation { std::vector loadIds; network.LoadIds ( vertexId, loadIds ); - for ( Types::loadId loadId : loadIds ) - { + for ( Types::loadId loadId : loadIds ) + { for_all_real_power_load_snapshots_of ( network, loadId, function ); } } @@ -1643,10 +1643,10 @@ class PowerGridLoopDifferentiation { * * @param network The network * @param vertex The vertex - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the @p vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( network.Graph().VertexId( vertex ) ) ) * { @@ -1654,9 +1654,9 @@ class PowerGridLoopDifferentiation { * network, * vertex, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); * } @@ -1666,11 +1666,11 @@ class PowerGridLoopDifferentiation { * all real power load snapshots at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork & network , TVertex const & vertex - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); @@ -1679,7 +1679,7 @@ class PowerGridLoopDifferentiation { for_all_real_power_load_snapshots_at ( network, vertexId, function ); } - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork const & network , TVertex const & vertex @@ -1702,11 +1702,11 @@ class PowerGridLoopDifferentiation { * @param vertexId The identifier of a vertex * @param timestampPosition The position of the snapshot * (timestamp of the snapshot). - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -1715,9 +1715,9 @@ class PowerGridLoopDifferentiation { * vertexId, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); * } @@ -1727,25 +1727,25 @@ class PowerGridLoopDifferentiation { * all real power load at @p timestamp at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork & network , Types::vertexId vertexId , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT( network.Graph().VertexExists( vertexId ) ); std::vector loadIds; network.LoadIds ( vertexId, loadIds ); - for ( Types::loadId loadId : loadIds ) - { + for ( Types::loadId loadId : loadIds ) + { function ( network.LoadSnapshotOf( loadId, timestampPosition ) ); } } - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork const & network , Types::vertexId vertexId @@ -1757,8 +1757,8 @@ class PowerGridLoopDifferentiation { std::vector loadIds; network.LoadIds ( vertexId, loadIds ); - for ( Types::loadId loadId : loadIds ) - { + for ( Types::loadId loadId : loadIds ) + { function ( network.LoadSnapshotOf( loadId, timestampPosition ) ); } } @@ -1783,24 +1783,24 @@ class PowerGridLoopDifferentiation { * vertex, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); - * } + * } * @endcode * * @tparam FUNCTION The function object that is called for * all real power load at @p timestamp at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork & network , TVertex const & vertex , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); @@ -1809,12 +1809,12 @@ class PowerGridLoopDifferentiation { for_all_real_power_load_snapshots_at ( network, vertexId, timestampPosition, function ); } - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork const & network , TVertex const & vertex , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); @@ -1834,7 +1834,7 @@ class PowerGridLoopDifferentiation { * @tparam PowerGridType The type of the power grid. */ template -class PowerGridLoopDifferentiation { +class PowerGridLoopDifferentiation { // Template type aliasing using TNetwork = PowerGridType; using TVertex = typename TNetwork::TVertex; @@ -1954,9 +1954,9 @@ class PowerGridLoopDifferentiation { * that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties & generator ) - * { - * Do something with the generator object. + * []( TGeneratorProperties & generator ) + * { + * Do something with the generator object. * } * @endcode * @@ -1966,12 +1966,12 @@ class PowerGridLoopDifferentiation { template inline static void for_all_generators ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { #pragma omp parallel for for ( Types::index generatorId = 0 ; generatorId < network.generators_.size() - ; ++generatorId ) + ; ++generatorId ) { function( network.generators_[generatorId] ); } @@ -1988,9 +1988,9 @@ class PowerGridLoopDifferentiation { * that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties & generator ) - * { - * Do something with the generator object. + * []( TGeneratorProperties & generator ) + * { + * Do something with the generator object. * } * @endcode * @@ -2000,12 +2000,12 @@ class PowerGridLoopDifferentiation { template inline static void for_all_generators ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { #pragma omp parallel for for ( Types::index generatorId = 0 ; generatorId < network.generators_.size() - ; ++generatorId ) + ; ++generatorId ) { function( network.generators_[generatorId] ); } @@ -2020,11 +2020,11 @@ class PowerGridLoopDifferentiation { * )@f$. * @param[in] function The function pointer, e.g., lambda function * that has a vertex identifier @p Types::vertexId as input. - * + * * @code{.cpp} - * []( Types::vertexId vertexId ) - * { - * Do something with the vertex identifier that has generators. + * []( Types::vertexId vertexId ) + * { + * Do something with the vertex identifier that has generators. * } * @endcode * @@ -2033,14 +2033,14 @@ class PowerGridLoopDifferentiation { template inline static void for_all_vertex_identifiers_with_generator ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { #pragma omp parallel for for ( Types::vertexId index = 0 ; index < network.Graph().Vertices().size() - ; ++index ) + ; ++index ) { - if ( network.HasGeneratorAt(index) + if ( network.HasGeneratorAt(index) && network.Graph().VertexExists(index) ) { function( index ); @@ -2059,11 +2059,11 @@ class PowerGridLoopDifferentiation { * @param[in] function The function pointer, e.g., lambda * function that has a generator identifier @p * Types::generatorId as input. - * + * * @code{.cpp} - * []( Types::generatorId generatorId ) - * { - * Do something with the generator identifier at the @p vertexId. + * []( Types::generatorId generatorId ) + * { + * Do something with the generator identifier at the @p vertexId. * } * @endcode * @@ -2074,9 +2074,9 @@ class PowerGridLoopDifferentiation { inline static void for_all_generator_identifiers_at ( Types::vertexId vertexId , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { - if ( network.HasGeneratorAt ( vertexId ) + if ( network.HasGeneratorAt ( vertexId ) && network.Graph().VertexExists ( vertexId ) ) { #pragma omp parallel for for ( Types::count counter = 0 @@ -2099,11 +2099,11 @@ class PowerGridLoopDifferentiation { * @param[in] function The function pointer, e.g., lambda * function that has a generator identifier @p * Types::generatorId as input. - * + * * @code{.cpp} - * []( Types::generatorId generatorId ) - * { - * Do something with the generator identifier at the @p vertexId. + * []( Types::generatorId generatorId ) + * { + * Do something with the generator identifier at the @p vertexId. * } * @endcode * @@ -2114,7 +2114,7 @@ class PowerGridLoopDifferentiation { inline static void for_all_generator_identifiers_at ( TVertex const & vertex , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_generator_identifiers_at ( vertexId, network, function ); @@ -2132,9 +2132,9 @@ class PowerGridLoopDifferentiation { * function that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties & generator ) - * { - * Do something with the generator object at the @p vertexId. + * []( TGeneratorProperties & generator ) + * { + * Do something with the generator object at the @p vertexId. * } * @endcode * @@ -2145,9 +2145,9 @@ class PowerGridLoopDifferentiation { inline static void for_all_generators_at ( Types::vertexId const vertexId , TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { - for_all_generator_identifiers_at ( vertexId, + for_all_generator_identifiers_at ( vertexId, [ &network, &function ]( Types::generatorId generatorId ) { function ( network.generators_[generatorId] ); @@ -2167,9 +2167,9 @@ class PowerGridLoopDifferentiation { * function that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties const & generator ) - * { - * Do something with the generator object at the @p vertexId. + * []( TGeneratorProperties const & generator ) + * { + * Do something with the generator object at the @p vertexId. * } * @endcode * @@ -2180,9 +2180,9 @@ class PowerGridLoopDifferentiation { inline static void for_all_generators_at ( Types::vertexId const vertexId , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { - for_all_generator_identifiers_at ( vertexId, + for_all_generator_identifiers_at ( vertexId, [ &network, &function ]( Types::generatorId generatorId ) { function ( network.generators_[generatorId] ); @@ -2202,9 +2202,9 @@ class PowerGridLoopDifferentiation { * function that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties & generator ) - * { - * Do something with the generator object at the @p vertex. + * []( TGeneratorProperties & generator ) + * { + * Do something with the generator object at the @p vertex. * } * @endcode * @@ -2215,7 +2215,7 @@ class PowerGridLoopDifferentiation { inline static void for_all_generators_at ( TVertex const & vertex , TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_generators_at ( vertexId, network, function ); @@ -2233,9 +2233,9 @@ class PowerGridLoopDifferentiation { * function that has a generator object as input. * * @code{.cpp} - * []( TGeneratorProperties const & generator ) - * { - * Do something with the generator object at the @p vertex. + * []( TGeneratorProperties const & generator ) + * { + * Do something with the generator object at the @p vertex. * } * @endcode * @@ -2245,7 +2245,7 @@ class PowerGridLoopDifferentiation { inline static void for_all_generators_at ( TVertex const & vertex , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_generators_at ( vertexId, network, function ); @@ -2261,12 +2261,12 @@ class PowerGridLoopDifferentiation { * @param[in] function The function pointer, e.g., lambda * function that has a vertex identifier @p vertexId and a * @c generator object@c as input. - * + * * @code{.cpp} * []( Types::vertexId vertexId - * , TGeneratorProperties & generatorProperties ) - * { - * Do something with the vertexId and the generator object. + * , TGeneratorProperties & generatorProperties ) + * { + * Do something with the vertexId and the generator object. * } * @endcode * @@ -2274,20 +2274,20 @@ class PowerGridLoopDifferentiation { * all generator tuple (vertexId, generatorProperties). */ template - inline static + inline static void for_all_generator_tuple ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { #pragma omp parallel for for ( Types::vertexId index = 0 ; index < network.Graph().Vertices().size() - ; ++index ) + ; ++index ) { if ( network.HasGeneratorAt(index) ) { std::vector generators; network.GeneratorsAt(index, generators); - for ( TGeneratorProperties & generator : generators ) + for ( TGeneratorProperties & generator : generators ) { function( index, generator); } @@ -2305,11 +2305,11 @@ class PowerGridLoopDifferentiation { * @param[in] function The function pointer, e.g., lambda * function that has a vertex identifier @p vertexId and a * @c generator object@c as input. - * + * * @code{.cpp} - * []( Types::vertexId vertexId, TGeneratorProperties const & generator ) - * { - * Do something with the vertexId and the generator object. + * []( Types::vertexId vertexId, TGeneratorProperties const & generator ) + * { + * Do something with the vertexId and the generator object. * } * @endcode * @@ -2319,12 +2319,12 @@ class PowerGridLoopDifferentiation { template inline static void for_all_generator_tuple ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { #pragma omp parallel for for ( Types::vertexId index = 0 ; index < network.Graph().Vertices().size() - ; ++index ) + ; ++index ) { if ( network.HasGeneratorAt(index) ) { @@ -2350,9 +2350,9 @@ class PowerGridLoopDifferentiation { * * @code{.cpp} * []( Types::vertexId vertexId - * , std::vector & generators ) - * { - * Do something with the set of generators at the vertexId + * , std::vector & generators ) + * { + * Do something with the set of generators at the vertexId * and identifier of the vertex that has generators. * } * @endcode @@ -2363,12 +2363,12 @@ class PowerGridLoopDifferentiation { template inline static void for_all_generators_tuple ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { #pragma omp parallel for for ( Types::vertexId index = 0 ; index < network.Graph().Vertices().size() - ; ++index ) + ; ++index ) { if ( network.HasGeneratorAt(index) ) { @@ -2388,13 +2388,13 @@ class PowerGridLoopDifferentiation { * @param network The network @f$\network = ( \graph, * \generators, \consumers, \capacity, \susceptance, \dots)@f$. * @param[in] function The function, e.g., lambda function. - * + * * @code{.cpp} * for_all_real_power_generator_snapshots( * network, * []( Types::index snapshotId - * , Types::generatorSnapshot snapshot ) - * { + * , Types::generatorSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); @@ -2404,30 +2404,30 @@ class PowerGridLoopDifferentiation { * all real power generator snapshots. */ ///@{ - template - inline + template + inline void for_all_real_power_generator_snapshots ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { #pragma omp parallel for for ( Types::index generatorId = 0 ; generatorId < network.generatorRealPowerSnapshots_.size() - ; ++generatorId ) - { + ; ++generatorId ) + { for_all_real_power_generator_snapshots_of ( network, generatorId, function ); } } - template - inline + template + inline void for_all_real_power_generator_snapshots ( TNetwork const & network - , FUNCTION function ) const + , FUNCTION function ) const { #pragma omp parallel for for ( Types::index generatorId = 0 ; generatorId < network.generatorRealPowerSnapshots_.size() - ; ++generatorId ) - { + ; ++generatorId ) + { for_all_real_power_generator_snapshots_of ( network, generatorId, function ); } } @@ -2440,20 +2440,20 @@ class PowerGridLoopDifferentiation { * @param network The network @f$\network = ( \graph, * \generators, \consumers, \capacity, \susceptance, \dots)@f$. * @param generatorId The identifier of the generator. - * @param[in] function The function, e.g., lambda function. - * + * @param[in] function The function, e.g., lambda function. + * * @pre Check if the generator identifier @p generatorId of the * generatorProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasGenerator ( generatorId ) ) * { - * for_all_real_power_generator_snapshots_of ( + * for_all_real_power_generator_snapshots_of ( * network, * generatorId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); @@ -2464,35 +2464,35 @@ class PowerGridLoopDifferentiation { * all real power generator snapshots at @p generatorId. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_of ( TNetwork & network , Types::generatorId generatorId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT ( network.HasGenerator ( generatorId ) ); #pragma omp parallel for for ( Types::index snapshotId = 0 ; snapshotId < network.generatorRealPowerSnapshots_[generatorId].size() - ; ++snapshotId ) + ; ++snapshotId ) { // snapshotId corresponds to row function( snapshotId, network.generatorRealPowerSnapshots_[generatorId][snapshotId] ); } } - template + template inline static void for_all_real_power_generator_snapshots_of ( TNetwork const & network , Types::generatorId generatorId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT ( network.HasGenerator ( generatorId ) ); #pragma omp parallel for for ( Types::index snapshotId = 0 ; snapshotId < network.generatorRealPowerSnapshots_[generatorId].size() - ; ++snapshotId ) + ; ++snapshotId ) { // snapshotId corresponds to row function( snapshotId, network.generatorRealPowerSnapshots_[generatorId][snapshotId] ); } @@ -2507,51 +2507,51 @@ class PowerGridLoopDifferentiation { * \generators, \consumers, \capacity, \susceptance, \dots)@f$. * @param generatorProperties The generator properties. * @param[in] function The function, e.g. , lambda function. - * + * * @pre Check if the generator identifier @p generatorId of the * generatorProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasGenerator ( network.GeneratorId ( generatorProperties ) ) ) * { * for_all_real_power_generator_snapshots_of ( * network, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); * } - * @endcode + * @endcode * * @tparam FUNCTION The function object that is called for * all real power generator snapshots of @p generatorProperties. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_of ( TNetwork & network , TGeneratorProperties const & generatorProperties - , FUNCTION function ) + , FUNCTION function ) { Types::generatorId generatorId = network.GeneratorId( generatorProperties ); USAGE_ASSERT ( network.HasGenerator ( generatorId ) ); - + for_all_real_power_generator_snapshots_of ( network, generatorId, function ); } - template + template inline static void for_all_real_power_generator_snapshots_of ( TNetwork const & network , TGeneratorProperties const & generatorProperties - , FUNCTION function ) + , FUNCTION function ) { Types::generatorId generatorId = network.GeneratorId( generatorProperties ); USAGE_ASSERT ( network.HasGenerator ( generatorId ) ); - + for_all_real_power_generator_snapshots_of ( network, generatorId, function ); } ///@} @@ -2564,10 +2564,10 @@ class PowerGridLoopDifferentiation { * \generators, \consumers, \capacity, \susceptance, \dots)@f$. * @param vertexId The identifier of a vertex. * @param[in] function The function, e.g. , lambda function. - * + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -2575,8 +2575,8 @@ class PowerGridLoopDifferentiation { * network, * vertexId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); @@ -2587,17 +2587,17 @@ class PowerGridLoopDifferentiation { * all real power generator snapshots at @p vertexId. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork & network , Types::vertexId vertexId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT ( network.Graph().VertexExists( vertexId ) ); std::vector generatorIds; network.GeneratorAt( vertexId, generatorIds ); - + #pragma omp parallel for for ( Types::index index = 0 ; index < generatorIds.size() @@ -2607,7 +2607,7 @@ class PowerGridLoopDifferentiation { } } - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork const & network , Types::vertexId vertexId @@ -2617,7 +2617,7 @@ class PowerGridLoopDifferentiation { std::vector generatorIds; network.GeneratorAt( vertexId, generatorIds ); - + #pragma omp parallel for for ( Types::index index = 0 ; index < generatorIds.size() @@ -2636,10 +2636,10 @@ class PowerGridLoopDifferentiation { * \generators, \consumers, \capacity, \susceptance, \dots)@f$. * @param vertex The vertex. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( network.Graph().VertexId( vertex ) ) ) * { @@ -2647,8 +2647,8 @@ class PowerGridLoopDifferentiation { * network, * vertex, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); @@ -2659,35 +2659,35 @@ class PowerGridLoopDifferentiation { * all real power generator snapshots at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork & network , TVertex vertex - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); - + USAGE_ASSERT ( network.Graph().VertexExists( vertexId ) ); std::vector generatorIds; network.GeneratorAt( vertexId, generatorIds ); - + for_all_real_power_generator_snapshots_at ( network, vertexId, function ); } - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork const & network , TVertex vertex , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); - + USAGE_ASSERT ( network.Graph().VertexExists( vertexId ) ); std::vector generatorIds; network.GeneratorAt( vertexId, generatorIds ); - + for_all_real_power_generator_snapshots_at ( network, vertexId, function ); } ///@} @@ -2702,11 +2702,11 @@ class PowerGridLoopDifferentiation { * @param vertexId The identifier of a vertex * @param timestampPosition The position of the snapshot * (timestamp of the snapshot). - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -2714,24 +2714,24 @@ class PowerGridLoopDifferentiation { * network, * vertexId, * timestampPosition, - * []( Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * []( Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); - * } + * } * @endcode * * @tparam FUNCTION The function object that is called for * all real power generator at @p timestamp at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork & network , Types::vertexId vertexId , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT( network.Graph().VertexExists( vertexId ) ); @@ -2747,7 +2747,7 @@ class PowerGridLoopDifferentiation { } } - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork const & network , Types::vertexId vertexId @@ -2789,24 +2789,24 @@ class PowerGridLoopDifferentiation { * network, * vertex, * timestampPosition, - * []( Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * []( Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); - * } + * } * @endcode * * @tparam FUNCTION The function object that is called for * all real power load at @p timestamp at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork & network , TVertex const & vertex , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); @@ -2815,12 +2815,12 @@ class PowerGridLoopDifferentiation { for_all_real_power_generator_snapshots_at ( network, vertexId, timestampPosition, function ); } - template + template inline static void for_all_real_power_generator_snapshots_at ( TNetwork const & network , TVertex const & vertex , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); @@ -2845,9 +2845,9 @@ class PowerGridLoopDifferentiation { * that has a load object as input. * * @code{.cpp} - * []( TLoadProperties & load ) - * { - * Do something with the load object. + * []( TLoadProperties & load ) + * { + * Do something with the load object. * } * @endcode * @@ -2857,11 +2857,11 @@ class PowerGridLoopDifferentiation { template inline static void for_all_loads ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { #pragma omp parallel for for ( Types::loadId loadId = 0 - ; loadId < network.loads_.size() + ; loadId < network.loads_.size() ; ++loadId ) { function ( network.loads_[loadId] ); @@ -2879,9 +2879,9 @@ class PowerGridLoopDifferentiation { * that has a const load object as input. * * @code{.cpp} - * []( TLoadProperties const & load ) - * { - * Do something with the load object. + * []( TLoadProperties const & load ) + * { + * Do something with the load object. * } * @endcode * @@ -2891,11 +2891,11 @@ class PowerGridLoopDifferentiation { template inline static void for_all_loads ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { #pragma omp parallel for for ( Types::loadId loadId = 0 - ; loadId < network.loads_.size() + ; loadId < network.loads_.size() ; ++loadId ) { function ( network.loads_[loadId] ); @@ -2914,9 +2914,9 @@ class PowerGridLoopDifferentiation { * as input. * * @code{.cpp} - * []( Types::vertexId vertexId ) - * { - * Do something with the vertex identifier that has loads. + * []( Types::vertexId vertexId ) + * { + * Do something with the vertex identifier that has loads. * } * @endcode * @@ -2926,16 +2926,16 @@ class PowerGridLoopDifferentiation { template inline static void for_all_vertex_identifiers_with_load ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; #pragma omp parallel for for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { - if ( network.HasLoadAt(vertexId) - && network.Graph().VertexExists(vertexId) ) + if ( network.HasLoadAt(vertexId) + && network.Graph().VertexExists(vertexId) ) { vertexIdSafeguard = vertexId; function ( vertexIdSafeguard ); @@ -2954,11 +2954,11 @@ class PowerGridLoopDifferentiation { * @param[in] function The function pointer, e.g., lambda * function that has a load identifier @p Types::loadId as * input. - * + * * @code{.cpp} - * []( Types::loadId loadId ) - * { - * Do something with the load identifier at the @p vertex. + * []( Types::loadId loadId ) + * { + * Do something with the load identifier at the @p vertex. * } * @endcode * @@ -2969,10 +2969,10 @@ class PowerGridLoopDifferentiation { inline static void for_all_load_identifiers_at ( Types::vertexId vertexId , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { - if ( network.HasLoadAt ( vertexId ) - && network.Graph().VertexExists ( vertexId ) ) + if ( network.HasLoadAt ( vertexId ) + && network.Graph().VertexExists ( vertexId ) ) { #pragma omp parallel for for ( Types::index index = 0 @@ -2996,9 +2996,9 @@ class PowerGridLoopDifferentiation { * function that has a load identifier as input. * * @code{.cpp} - * []( Types::loadId loadId ) - * { - * Do something with the load identifier at the @p vertex. + * []( Types::loadId loadId ) + * { + * Do something with the load identifier at the @p vertex. * } * @endcode * @@ -3009,7 +3009,7 @@ class PowerGridLoopDifferentiation { inline static void for_all_load_identifiers_at ( TVertex const & vertex , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_load_identifiers_at ( vertexId, network, function ); @@ -3025,11 +3025,11 @@ class PowerGridLoopDifferentiation { * )@f$. * @param[in] function The function pointer, e.g., lambda * function that has a load object as input. - * + * * @code{.cpp} - * []( TLoadProperties & load ) - * { - * Do something with the load object at the @p vertex. + * []( TLoadProperties & load ) + * { + * Do something with the load object at the @p vertex. * } * @endcode * @@ -3040,7 +3040,7 @@ class PowerGridLoopDifferentiation { inline static void for_all_loads_at ( TVertex const & vertex , TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_loads_at ( vertexId, network, function ); @@ -3056,11 +3056,11 @@ class PowerGridLoopDifferentiation { * )@f$. * @param[in] function The function pointer, e.g., lambda * function that has a load object as input. - * + * * @code{.cpp} - * []( TLoadProperties const & load ) - * { - * Do something with the load object at the @p vertex. + * []( TLoadProperties const & load ) + * { + * Do something with the load object at the @p vertex. * } * @endcode * @@ -3071,7 +3071,7 @@ class PowerGridLoopDifferentiation { inline static void for_all_loads_at ( TVertex const & vertex , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); for_all_loads_at ( vertexId, network, function ); @@ -3089,9 +3089,9 @@ class PowerGridLoopDifferentiation { * function that has a load object as input. * * @code{.cpp} - * []( TLoadProperties & load ) - * { - * Do something with the load object at the @p vertexId. + * []( TLoadProperties & load ) + * { + * Do something with the load object at the @p vertexId. * } * @endcode * @@ -3102,9 +3102,9 @@ class PowerGridLoopDifferentiation { inline static void for_all_loads_at ( Types::vertexId const vertexId , TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { - for_all_load_identifiers_at ( vertexId, network, + for_all_load_identifiers_at ( vertexId, network, [ &network, &function ]( Types::loadId loadId ) { function ( network.loads_[loadId] ); @@ -3124,9 +3124,9 @@ class PowerGridLoopDifferentiation { * function that has a load object as input. * * @code{.cpp} - * []( TLoadProperties const & load ) - * { - * Do something with the load object at the @p vertexId. + * []( TLoadProperties const & load ) + * { + * Do something with the load object at the @p vertexId. * } * @endcode * @@ -3137,9 +3137,9 @@ class PowerGridLoopDifferentiation { inline static void for_all_loads_at ( Types::vertexId const vertexId , TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { - for_all_load_identifiers_at ( vertexId, network, + for_all_load_identifiers_at ( vertexId, network, [ &network, &function ]( Types::loadId loadId ) { function ( network.loads_[loadId] ); @@ -3159,9 +3159,9 @@ class PowerGridLoopDifferentiation { * @c load object@c as input. * * @code{.cpp} - * []( Types::vertexId vertexId, TLoadProperties & load ) - * { - * Do something with the vertexId and load object. + * []( Types::vertexId vertexId, TLoadProperties & load ) + * { + * Do something with the vertexId and load object. * } * @endcode * @@ -3171,17 +3171,17 @@ class PowerGridLoopDifferentiation { template inline static void for_all_load_tuples ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; #pragma omp parallel for for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { - if ( network.HasLoadAt(vertexId) ) + if ( network.HasLoadAt(vertexId) ) { - for ( Types::loadId loadId : network.loadsAtVertex_[vertexId] ) + for ( Types::loadId loadId : network.loadsAtVertex_[vertexId] ) { vertexIdSafeguard = vertexId; function( vertexIdSafeguard, network.loads_[loadId] ); @@ -3202,9 +3202,9 @@ class PowerGridLoopDifferentiation { * @c load object@c as input. * * @code{.cpp} - * []( Types::vertexId vertexId, TLoadProperties const & load ) - * { - * Do something with the vertexId and load object. + * []( Types::vertexId vertexId, TLoadProperties const & load ) + * { + * Do something with the vertexId and load object. * } * @endcode * @@ -3214,17 +3214,17 @@ class PowerGridLoopDifferentiation { template inline static void for_all_load_tuples ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; #pragma omp parallel for for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { - if ( network.HasLoadAt(vertexId) ) + if ( network.HasLoadAt(vertexId) ) { - for ( Types::loadId loadId : network.loadsAtVertex_[vertexId] ) + for ( Types::loadId loadId : network.loadsAtVertex_[vertexId] ) { vertexIdSafeguard = vertexId; function( vertexIdSafeguard, network.loads_[loadId] ); @@ -3245,10 +3245,10 @@ class PowerGridLoopDifferentiation { * @c load objects@c as input. * * @code{.cpp} - * []( Types::vertexId vertexId, std::vector & loads ) - * { - * Do something with the set of loads at the vertexId - * and identifier of the vertex that has loads. + * []( Types::vertexId vertexId, std::vector & loads ) + * { + * Do something with the set of loads at the vertexId + * and identifier of the vertex that has loads. * } * @endcode * @@ -3258,13 +3258,13 @@ class PowerGridLoopDifferentiation { template inline static void for_all_loads_tuple ( TNetwork const & network - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexIdSafeguard = 0; #pragma omp parallel for for ( Types::vertexId vertexId = 0 ; vertexId < network.Graph().Vertices().size() - ; ++vertexId ) + ; ++vertexId ) { if ( network.HasLoadAt(vertexId) ) { @@ -3285,14 +3285,14 @@ class PowerGridLoopDifferentiation { * * @param network The network * @param[in] function The function, e.g., lambda function. - * + * * @code{.cpp} * for_all_real_power_load_snapshots( * network, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); * @endcode @@ -3301,15 +3301,15 @@ class PowerGridLoopDifferentiation { * all real power load snapshots. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots ( TNetwork & network - , FUNCTION function ) + , FUNCTION function ) { #pragma omp parallel for for ( Types::loadId loadId = 0 ; loadId < network.loadSnapshots_.size() - ; ++loadId ) + ; ++loadId ) { for_all_real_power_load_snapshots_of ( network , loadId @@ -3317,7 +3317,7 @@ class PowerGridLoopDifferentiation { } } - template + template inline static void for_all_real_power_load_snapshots ( TNetwork const & network , FUNCTION function ) @@ -3325,7 +3325,7 @@ class PowerGridLoopDifferentiation { #pragma omp parallel for for ( Types::loadId loadId = 0 ; loadId < network.loadSnapshots_.size() - ; ++loadId ) + ; ++loadId ) { for_all_real_power_load_snapshots_of ( network , loadId @@ -3333,7 +3333,7 @@ class PowerGridLoopDifferentiation { } } ///@} - + /** * @brief The parallel @c for loop @c over all real power * snapshots of a load with @p loadId. @@ -3341,20 +3341,20 @@ class PowerGridLoopDifferentiation { * @param network The network. * @param loadId The identifier of the load. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the load identifier @p loadId of the * loadProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasLoad ( loadId ) ) * { - * for_all_real_power_load_snapshots_of ( + * for_all_real_power_load_snapshots_of ( * network, * loadId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); * } @@ -3364,25 +3364,25 @@ class PowerGridLoopDifferentiation { * all real power load snapshots at @p loadId. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_of ( TNetwork & network , Types::loadId loadId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT ( network.HasLoad ( loadId ) ); #pragma omp parallel for for ( Types::index timestampPosition = 0 ; timestampPosition < network.loadSnapshots_.size() - ; ++timestampPosition ) - { + ; ++timestampPosition ) + { function ( timestampPosition , network.LoadSnapshotOf( loadId, timestampPosition ) ); } } - template + template inline static void for_all_real_power_load_snapshots_of ( TNetwork const & network , Types::loadId loadId @@ -3391,8 +3391,8 @@ class PowerGridLoopDifferentiation { #pragma omp parallel for for ( Types::index timestampPosition = 0 ; timestampPosition < network.loadSnapshots_.size() - ; ++timestampPosition ) - { + ; ++timestampPosition ) + { function ( timestampPosition , network.LoadSnapshotOf( loadId, timestampPosition ) ); } @@ -3406,20 +3406,20 @@ class PowerGridLoopDifferentiation { * * @param network The network. * @param loadProperties The load properties. - * @param[in] function The function, e.g. , lambda function. - * + * @param[in] function The function, e.g. , lambda function. + * * @pre Check if the load identifier @p loadId of the * loadProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasLoad ( network.LoadId ( loadProperties ) ) ) * { * for_all_real_power_load_snapshots_of ( * network, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); * } @@ -3429,27 +3429,27 @@ class PowerGridLoopDifferentiation { * all real power load snapshots at @p load. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_of ( TNetwork & network , TLoadProperties loadProperties - , FUNCTION function ) + , FUNCTION function ) { Types::loadId loadId = network.LoadId ( loadProperties ); - + USAGE_ASSERT ( network.HasLoad ( loadId ) ); for_all_real_power_load_snapshots_of ( network, loadId, function ); } - template + template inline static void for_all_real_power_load_snapshots_of ( TNetwork const & network , TLoadProperties loadProperties , FUNCTION function ) { Types::loadId loadId = network.LoadId ( loadProperties ); - + USAGE_ASSERT ( network.HasLoad ( loadId ) ); for_all_real_power_load_snapshots_of ( network, loadId, function ); @@ -3462,11 +3462,11 @@ class PowerGridLoopDifferentiation { * * @param network The network * @param vertexId The identifier of a vertex - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -3474,8 +3474,8 @@ class PowerGridLoopDifferentiation { * network, * vertexId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * Do something with the snapshotId and load snapshot object } * } * ); @@ -3486,11 +3486,11 @@ class PowerGridLoopDifferentiation { * all real power load snapshots at @p vertexId. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork & network , Types::vertexId vertexId - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT( network.Graph().VertexExists( vertexId ) ); @@ -3500,13 +3500,13 @@ class PowerGridLoopDifferentiation { #pragma omp parallel for for ( Types::index loadId = 0 ; loadId < loadIds.size() - ; ++loadId ) - { + ; ++loadId ) + { for_all_real_power_load_snapshots_of ( network, loadId, function ); } } - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork const & network , Types::vertexId vertexId @@ -3520,8 +3520,8 @@ class PowerGridLoopDifferentiation { #pragma omp parallel for for ( Types::index loadId = 0 ; loadId < loadIds.size() - ; ++loadId ) - { + ; ++loadId ) + { for_all_real_power_load_snapshots_of ( network, loadId, function ); } } @@ -3533,11 +3533,11 @@ class PowerGridLoopDifferentiation { * * @param network The network * @param vertex The vertex - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( network.Graph().VertexId( vertex ) ) ) * { @@ -3545,9 +3545,9 @@ class PowerGridLoopDifferentiation { * network, * vertex, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); * } @@ -3557,11 +3557,11 @@ class PowerGridLoopDifferentiation { * all real power load at @p timestamp at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork & network , TVertex vertex - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); @@ -3570,7 +3570,7 @@ class PowerGridLoopDifferentiation { for_all_real_power_load_snapshots_at ( network, vertexId, function ); } - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork const & network , TVertex vertex @@ -3593,11 +3593,11 @@ class PowerGridLoopDifferentiation { * @param vertexId The identifier of a vertex * @param timestampPosition The position of the snapshot * (timestamp of the snapshot). - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -3606,24 +3606,24 @@ class PowerGridLoopDifferentiation { * vertexId, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); - * } + * } * @endcode * * @tparam FUNCTION The function object that is called for * all real power load at @p timestamp at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork & network , Types::vertexId vertexId , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { USAGE_ASSERT( network.Graph().VertexExists( vertexId ) ); @@ -3633,13 +3633,13 @@ class PowerGridLoopDifferentiation { #pragma omp parallel for for ( Types::index loadId = 0 ; loadId < loadIds.size() - ; ++loadId ) - { + ; ++loadId ) + { function ( network.LoadSnapshotOf( loadId, timestampPosition ) ); } } - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork const & network , Types::vertexId vertexId @@ -3654,8 +3654,8 @@ class PowerGridLoopDifferentiation { #pragma omp parallel for for ( Types::index loadId = 0 ; loadId < loadIds.size() - ; ++loadId ) - { + ; ++loadId ) + { function ( network.LoadSnapshotOf( loadId, timestampPosition ) ); } } @@ -3681,24 +3681,24 @@ class PowerGridLoopDifferentiation { * vertex, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { - * Do something with the snapshotId and load snapshot object + * , Types::loadSnapshot snapshot ) + * { + * Do something with the snapshotId and load snapshot object * } * ); - * } + * } * @endcode * * @tparam FUNCTION The function object that is called for * all real power load at @p timestamp at @p vertex. */ ///@{ - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork & network , TVertex const & vertex , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); @@ -3707,12 +3707,12 @@ class PowerGridLoopDifferentiation { for_all_real_power_load_snapshots_at ( network, vertexId, timestampPosition, function ); } - template + template inline static void for_all_real_power_load_snapshots_at ( TNetwork const & network , TVertex const & vertex , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { Types::vertexId vertexId = network.Graph().VertexId( vertex ); diff --git a/include/DataStructures/Iterators/StaticGraphIterators.hpp b/include/DataStructures/Iterators/StaticGraphIterators.hpp index ce7bec59..f53b6457 100644 --- a/include/DataStructures/Iterators/StaticGraphIterators.hpp +++ b/include/DataStructures/Iterators/StaticGraphIterators.hpp @@ -24,9 +24,9 @@ namespace egoa::internal { * pointers such as std::function ( see * https://stackoverflow.com/questions/14677997/stdfunction-vs-template * for more information). This is the reason why the following code is not - * used + * used * inline void for_all_(std::function function) {} - * + * * * @tparam GraphType The type of the graph, e.g., @p StaticGraph. * If the graph type is @p const, const references to the vertices @@ -69,9 +69,9 @@ class StaticGraphLoopDifferentiation * It must accept one argument of type @p TGraph::TVertexId, * e.g., * @code{.cpp} - * []( Types::vertexId vertexId ) - * { - * // Do something with the vertex identifier + * []( Types::vertexId vertexId ) + * { + * // Do something with the vertex identifier * } * @endcode * @@ -84,7 +84,7 @@ class StaticGraphLoopDifferentiation { for ( TVertexId vertexId = 0 ; vertexId < graph.NumberOfVertices() - ; ++vertexId ) + ; ++vertexId ) { auto copy = vertexId; function( copy ); @@ -100,9 +100,9 @@ class StaticGraphLoopDifferentiation * It must accept two arguments of types @p Types::vertexId * and @p TGraph::TVertex, e.g., * @code{.cpp} - * []( Types::vertexId vertexId, TVertex & vertex ) - * { - * // Do something with the vertex identifier and object. + * []( Types::vertexId vertexId, TVertex & vertex ) + * { + * // Do something with the vertex identifier and object. * } * @endcode * @@ -115,7 +115,7 @@ class StaticGraphLoopDifferentiation { for ( TVertexId vertexId = 0 ; vertexId < graph.NumberOfVertices() - ; ++vertexId ) + ; ++vertexId ) { auto copy = vertexId; function( copy, graph.VertexAt(vertexId) ); @@ -136,8 +136,8 @@ class StaticGraphLoopDifferentiation * It must accept one argument of type @p Types::edgeId, * e.g., * @code{.cpp} - * []( Types::edgeId edgeId ) - * { + * []( Types::edgeId edgeId ) + * { * // Do something with the edge identifier. * } * @endcode @@ -145,7 +145,7 @@ class StaticGraphLoopDifferentiation * @tparam FUNCTION The type of the function object. */ template - static inline + static inline void for_all_edge_identifiers ( TGraph & graph , FUNCTION function ) { @@ -167,8 +167,8 @@ class StaticGraphLoopDifferentiation * It must accept two arguments of types @p Types::edgeId * and @p TGraph::TEdge, e.g., * @code{.cpp} - * []( Types::edgeId edgeId, TEdge & edge ) - * { + * []( Types::edgeId edgeId, TEdge & edge ) + * { * // Do something with the edge. * } * @endcode @@ -176,7 +176,7 @@ class StaticGraphLoopDifferentiation * @tparam FUNCTION The type of the function object. */ template - static inline + static inline void for_all_edge_tuples ( TGraph & graph , FUNCTION function ) { @@ -204,7 +204,7 @@ class StaticGraphLoopDifferentiation using TVertexId = typename GraphType::TVertexId; using TVertex = typename GraphType::TVertex; using TEdgeId = typename GraphType::TEdgeId; - + public: /// @name Breakable Vertex Loops /// @{ @@ -219,7 +219,7 @@ class StaticGraphLoopDifferentiation * It must accept one argument of type @p Types::vertexId * e.g., * @code{.cpp} - * []( Types::vertexId vertexId ) -> bool + * []( Types::vertexId vertexId ) -> bool * { * bool whetherToContinue = true; * // Do something with the vertex identifier. @@ -254,7 +254,7 @@ class StaticGraphLoopDifferentiation * It must accept two arguments of types @p Types::vertexId * and @p TGraph::TVertex, e.g., * @code{.cpp} - * []( Types::vertexId vertexId, TVertex & vertex ) -> bool + * []( Types::vertexId vertexId, TVertex & vertex ) -> bool * { * bool whetherToContinue = true; * // Do something with the vertex identifier and object. @@ -296,7 +296,7 @@ class StaticGraphLoopDifferentiation * It must accept one argument of type @p Types::edgeId, * e.g., * @code{.cpp} - * []( Types::edgeId edgeId ) -> bool + * []( Types::edgeId edgeId ) -> bool * { * bool whetherToContinue = true; * // Do something with the edge identifier @@ -391,8 +391,8 @@ class StaticGraphLoopDifferentiation * It must accept one argument of type @p Types::vertexId * e.g., * @code{.cpp} - * []( Types::vertexId vertexId ) - * { + * []( Types::vertexId vertexId ) + * { * // Do something with the vertex identifier. * } * @endcode @@ -423,8 +423,8 @@ class StaticGraphLoopDifferentiation * It must accept one argument of type @p TGraph::TVertex, * e.g., * @code{.cpp} - * []( TVertex & vertex ) - * { + * []( TVertex & vertex ) + * { * // Do something with the vertex object. * } * @endcode @@ -454,8 +454,8 @@ class StaticGraphLoopDifferentiation * It must accept two arguments of types @p Types::vertexId * and @p TGraph::TVertex, e.g., * @code{.cpp} - * []( Types::vertexId vertexId, TVertex & vertex ) - * { + * []( Types::vertexId vertexId, TVertex & vertex ) + * { * // Do something with the vertex identifier and object. * } * @endcode @@ -491,9 +491,9 @@ class StaticGraphLoopDifferentiation * It must accept one argument of type @p Types::edgeId, * e.g., * @code{.cpp} - * []( Types::edgeId edgeId ) - * { - * // Do something with the edge identifier + * []( Types::edgeId edgeId ) + * { + * // Do something with the edge identifier * } * @endcode * @@ -523,8 +523,8 @@ class StaticGraphLoopDifferentiation * It must accept one argument of type @p TGraph::TEdge, * e.g., * @code{.cpp} - * []( TEdge edge ) - * { + * []( TEdge edge ) + * { * // Do something with the edge object. * } * @endcode @@ -554,8 +554,8 @@ class StaticGraphLoopDifferentiation * It must accept two arguments of types @p Types::edgeId * and @p TGraph::TEdge, e.g., * @code{.cpp} - * []( Types::edgeId edgeId, TEdge edge ) - * { + * []( Types::edgeId edgeId, TEdge edge ) + * { * // Do something with the edge. * } * @endcode diff --git a/include/DataStructures/Labels/BucketElement.hpp b/include/DataStructures/Labels/BucketElement.hpp index 8186f84d..27fa0ec3 100644 --- a/include/DataStructures/Labels/BucketElement.hpp +++ b/include/DataStructures/Labels/BucketElement.hpp @@ -19,7 +19,7 @@ namespace egoa { * * @tparam ElementType Atomic or complex element implementing comparison * operators. - * + * * @see Label representing a label interface. * @see Bucket representing a bucket. */ @@ -34,7 +34,7 @@ class BucketElement { ///@{ #pragma mark CONSTRUCTORS_AND_DESTRUCTORS - BucketElement () + BucketElement () : BucketElement(TElement(),true) {} @@ -46,7 +46,7 @@ class BucketElement { * element. */ BucketElement ( TElement value - , bool valid ) + , bool valid ) : index_(Const::NONE) , valid_(valid) , value_(value) @@ -57,7 +57,7 @@ class BucketElement { * * @param[in] element The element. */ - BucketElement( TElement element ) + BucketElement( TElement element ) : BucketElement( element, true ) {} @@ -66,7 +66,7 @@ class BucketElement { */ ~BucketElement() {} ///@} - + ///@name Domination Operators ///@{ #pragma mark DOMINATION_OPERATORS @@ -77,7 +77,7 @@ class BucketElement { * * @return True if lhs < rhs, False otherwise. */ - inline bool operator<( BucketElement const & rhs ) const + inline bool operator<( BucketElement const & rhs ) const { return value_ < rhs.value_; } @@ -89,9 +89,9 @@ class BucketElement { * * @return True if lhs <= rhs, False otherwise. */ - inline bool operator<=( BucketElement const & rhs ) const - { - return !(*this > rhs); + inline bool operator<=( BucketElement const & rhs ) const + { + return !(*this > rhs); } /** @@ -101,9 +101,9 @@ class BucketElement { * * @return True if lhs > rhs, False otherwise. */ - inline bool operator> ( BucketElement const & rhs ) const - { - return rhs < *this; + inline bool operator> ( BucketElement const & rhs ) const + { + return rhs < *this; } /** @@ -113,9 +113,9 @@ class BucketElement { * * @return True if lhs >= rhs, False otherwise. */ - inline bool operator>=( BucketElement const & rhs ) const - { - return !(rhs > *this); + inline bool operator>=( BucketElement const & rhs ) const + { + return !(rhs > *this); } ///@} @@ -130,7 +130,7 @@ class BucketElement { * * @return True if lhs == rhs, False otherwise. */ - inline bool operator==( BucketElement const & rhs ) const + inline bool operator==( BucketElement const & rhs ) const { return value_ == rhs.value_; } @@ -142,13 +142,13 @@ class BucketElement { * * @return True if lhs != rhs, False otherwise. */ - inline bool operator!=( BucketElement const & rhs ) const + inline bool operator!=( BucketElement const & rhs ) const { return !(*this==rhs); } ///@} - ///@name Concatenation Operators + ///@name Concatenation Operators ///@{ #pragma mark CONCATENATION_OPERATORS /** @@ -158,7 +158,7 @@ class BucketElement { * * @return The BucketElement with added TElement. */ - inline BucketElement & operator+=( TElement const & rhs ) + inline BucketElement & operator+=( TElement const & rhs ) { this->Value() += rhs.Value(); return *this; @@ -171,7 +171,7 @@ class BucketElement { * * @return The BucketElement with added TElement. */ - inline BucketElement operator+ ( TElement const & rhs ) const + inline BucketElement operator+ ( TElement const & rhs ) const { BucketElement temp ( *this ); return temp += rhs; @@ -189,9 +189,9 @@ class BucketElement { * * @return The BucketElement's identifier. */ - inline Types::labelId Index() const - { - return index_; + inline Types::labelId Index() const + { + return index_; } /** @@ -207,8 +207,8 @@ class BucketElement { * @return The BucketElement's identifier. */ inline Types::labelId & Index() - { - return index_; + { + return index_; } /** @@ -216,9 +216,9 @@ class BucketElement { * * @return @p True if the BucketElement is valid, @p false otherwise. */ - inline bool Valid() const - { - return valid_; + inline bool Valid() const + { + return valid_; } /** @@ -231,8 +231,8 @@ class BucketElement { * @return @p True if the BucketElement is valid, @p false otherwise. */ inline bool & Valid() - { - return valid_; + { + return valid_; } /** @@ -240,9 +240,9 @@ class BucketElement { * * @return The value of the BucketElement. */ - inline TElement Value() const - { - return value_; + inline TElement Value() const + { + return value_; } /** @@ -255,8 +255,8 @@ class BucketElement { * @return The value of the BucketElement. */ inline TElement & Value() - { - return value_; + { + return value_; } ///@} @@ -270,7 +270,7 @@ class BucketElement { * @return The output stream. */ friend std::ostream & operator<< ( std::ostream & os - , BucketElement const & rhs ) + , BucketElement const & rhs ) { return os << "(" << rhs.Value() << "," << rhs.Valid() << ")"; } diff --git a/include/DataStructures/Labels/Label.hpp b/include/DataStructures/Labels/Label.hpp index 260d4a46..ebe56f98 100644 --- a/include/DataStructures/Labels/Label.hpp +++ b/include/DataStructures/Labels/Label.hpp @@ -24,7 +24,7 @@ namespace egoa { * @tparam ElementType Some element type, e.g., an electrical edge. * @tparam VertexSetContainer Container, e.g., unordered set to extract vertex conflicts, loops. * @tparam PointerType E.g., Types::vertexId. - * + * * @see Edge::ElectricalEdge representing an ElementType interface. * @see BucketElement representing an minimum interface requirement for a bucket. */ @@ -56,7 +56,7 @@ class Label { * * @param[in] vertexId The vertex identifier. */ - Label( Types::vertexId vertexId ) + Label( Types::vertexId vertexId ) : index_(Const::NONE) , vertexId_(vertexId) , valid_(true) @@ -71,7 +71,7 @@ class Label { * the other label. * * @param label The label. - * + * */ Label ( Label const & label ) = default; @@ -97,10 +97,10 @@ class Label { // inline bool operator!=( Label const & rhs ) const { return true; } ///@} - ///@name Concatenation Operators + ///@name Concatenation Operators ///@{ #pragma mark CONCATENATION_OPERATORS - + /** * @brief In place addition. * @@ -129,8 +129,8 @@ class Label { * @return The label's identifier. */ inline Types::labelId Index () const - { - return index_; + { + return index_; } /** @@ -145,9 +145,9 @@ class Label { * * @return The label's identifier. */ - inline Types::labelId & Index () - { - return index_; + inline Types::labelId & Index () + { + return index_; } /** @@ -156,13 +156,13 @@ class Label { * @return @p True if the label is valid, @p False otherwise. */ inline bool Valid () const - { - return valid_; + { + return valid_; } /** * @brief Setter for the valid flag. - * + * * @code * this->Valid() = false; * @endcode @@ -170,8 +170,8 @@ class Label { * @return @p True if the label is valid, @p False otherwise. */ inline bool & Valid() - { - return valid_; + { + return valid_; } /** @@ -188,9 +188,9 @@ class Label { * * @return Vertex identifier. */ - inline Types::vertexId Vertex() const - { - return vertexId_; + inline Types::vertexId Vertex() const + { + return vertexId_; } /** @@ -203,8 +203,8 @@ class Label { * @return Vertex identifier. */ inline Types::vertexId & Vertex() - { - return vertexId_; + { + return vertexId_; } /** @@ -213,8 +213,8 @@ class Label { * @return Identifier of the previous vertex. */ inline TPointer PreviousVertex() const - { - return previousVertexId_; + { + return previousVertexId_; } /** @@ -227,8 +227,8 @@ class Label { * @return Identifier of the previous vertex. */ inline TPointer & PreviousVertex() - { - return previousVertexId_; + { + return previousVertexId_; } /** @@ -236,9 +236,9 @@ class Label { * * @return Identifier of the previous label. */ - inline TPointer PreviousLabel() const - { - return previousLabelId_; + inline TPointer PreviousLabel() const + { + return previousLabelId_; } /** @@ -259,8 +259,8 @@ class Label { * @return Identifier of the previous label. */ inline TPointer & PreviousLabel() - { - return previousLabelId_; + { + return previousLabelId_; } ///@} @@ -274,7 +274,7 @@ class Label { * @return The output stream. */ friend std::ostream & operator<< ( std::ostream & os - , Label const & rhs ) + , Label const & rhs ) { return os << "(" << rhs.Value() << "," << rhs.Valid() << ")"; } @@ -282,15 +282,15 @@ class Label { #pragma mark MEMBERS private: Types::labelId index_; /**< The identifier of the label that is bucket dependent. */ - Types::vertexId vertexId_; /**< The identifier of the vertex to which the label belongs. */ + Types::vertexId vertexId_; /**< The identifier of the vertex to which the label belongs. */ bool valid_; /**< The valid flag that is @p True if the label is valid, @p False otherwise. */ TPointer previousVertexId_; /**< The identifier of the previous vertex. */ TPointer previousLabelId_; /**< The identifier of the previous label. */ - + }; } // namespace egoa -#endif // EGOA__DATA_STRUCTURES__LABELS__LABEL_HPP \ No newline at end of file +#endif // EGOA__DATA_STRUCTURES__LABELS__LABEL_HPP diff --git a/include/DataStructures/Labels/SusceptanceNormLabel.hpp b/include/DataStructures/Labels/SusceptanceNormLabel.hpp index f4a55f4a..67e7feb0 100644 --- a/include/DataStructures/Labels/SusceptanceNormLabel.hpp +++ b/include/DataStructures/Labels/SusceptanceNormLabel.hpp @@ -14,10 +14,10 @@ namespace egoa { /** * @brief Class for Susceptance norm label. - * @details The susceptance norm is defined by - * @f[ + * @details The susceptance norm is defined by + * @f[ * \bnorm{\fpath{}{\vertexa}{\vertexb}} := \sum_{\edge\in\fpath{}{\vertexa}{\vertexb}}\susceptance(\edge)^{-1}, - * @f] + * @f] * where @f$\susceptance(\vertexa,\vertexb)\in\reals@f$ is the * susceptance defined for all @f$(\vertexa,\vertexb)\in\edges@f$. * For more information see Section 3 in the paper SusceptanceNorm() < rhs.SusceptanceNorm(); } @@ -186,9 +186,9 @@ class SusceptanceNormLabel : public Label rhs); + inline bool operator<= ( SusceptanceNormLabel const & rhs ) const + { + return !(*this > rhs); } /** @@ -198,11 +198,11 @@ class SusceptanceNormLabel : public Label rhs, @p false otherwise. */ - inline bool operator> ( SusceptanceNormLabel const & rhs ) const - { - return rhs < *this; + inline bool operator> ( SusceptanceNormLabel const & rhs ) const + { + return rhs < *this; } - + /** * @brief Weak domination using greater or equal than. * @@ -210,9 +210,9 @@ class SusceptanceNormLabel : public Label= rhs, @p false otherwise. */ - inline bool operator>= ( SusceptanceNormLabel const & rhs ) const - { - return !(rhs > *this); + inline bool operator>= ( SusceptanceNormLabel const & rhs ) const + { + return !(rhs > *this); } ///@} @@ -227,7 +227,7 @@ class SusceptanceNormLabel : public LabelSusceptanceNorm() == rhs.SusceptanceNorm(); } @@ -239,16 +239,16 @@ class SusceptanceNormLabel : public Label operator+( TVertexId const & vertexId - , SusceptanceNormLabel const & rhs ) + , SusceptanceNormLabel const & rhs ) { USAGE_ASSERT ( rhs.SusceptanceNorm() != Const::NONE ); USAGE_ASSERT ( vertexId != Const::NONE ); bool isInsert = false; TVertexSet newSet = rhs.VertexSet(); - + std::tie( std::ignore, isInsert ) = newSet.emplace( vertexId ); - + return std::make_pair ( newSet, isInsert ); } @@ -306,7 +306,7 @@ class SusceptanceNormLabel : public Label operator+( TElement const & edge - , SusceptanceNormLabel const & rhs ) + , SusceptanceNormLabel const & rhs ) { USAGE_ASSERT ( rhs.SusceptanceNorm() != Const::NONE ); USAGE_ASSERT ( edge.Properties().template Susceptance() != 0 ); @@ -316,7 +316,7 @@ class SusceptanceNormLabel : public Label operator+( SusceptanceNormLabel const & lhs - , TElement const & edge ) + , TElement const & edge ) { USAGE_ASSERT ( lhs.SusceptanceNorm() != Const::NONE ); USAGE_ASSERT ( edge.Properties().template Susceptance() != 0 ); @@ -373,9 +373,9 @@ class SusceptanceNormLabel : public LabelThe Maximum Transmission Switching Flow Problem. - * + * * @I{The formula in readable format: delta = b(path(s,u)) . mincapacity(path(s,u)) } * * @tparam ElementType An edge providing access to the susceptance, e.g., an electrical edge. - * + * * @see Edge::ElectricalEdge representing an ElementType interface. * @see BucketElement representing an minimum interface requirement for a bucket. * @see Label representing the base's base class. @@ -64,7 +64,7 @@ class VoltageAngleDifferenceLabel : public SusceptanceNormLabel rhs, @p false otherwise. */ - inline bool operator> ( VoltageAngleDifferenceLabel const & rhs ) const - { + inline bool operator> ( VoltageAngleDifferenceLabel const & rhs ) const + { USAGE_ASSERT ( TLabel::SusceptanceNorm() != Const::NONE ); USAGE_ASSERT ( MinimumCapacity() != Const::NONE ); return ( *this >= rhs ) // Weak domination w.r.t. >= - && ( *this != rhs ); // Only false if both elements are equal + && ( *this != rhs ); // Only false if both elements are equal } - + /** * @brief Weak domination using greater or equal than. * @@ -206,12 +206,12 @@ class VoltageAngleDifferenceLabel : public SusceptanceNormLabel= rhs, @p false otherwise. */ - inline bool operator>=( VoltageAngleDifferenceLabel const & rhs ) const - { + inline bool operator>=( VoltageAngleDifferenceLabel const & rhs ) const + { USAGE_ASSERT ( TLabel::SusceptanceNorm() != Const::NONE ); USAGE_ASSERT ( MinimumCapacity() != Const::NONE ); - return ( TLabel::SusceptanceNorm() >= rhs.TLabel::SusceptanceNorm() ) + return ( TLabel::SusceptanceNorm() >= rhs.TLabel::SusceptanceNorm() ) && ( MinimumCapacity() >= rhs.MinimumCapacity() ); } ///@} @@ -227,12 +227,12 @@ class VoltageAngleDifferenceLabel : public SusceptanceNormLabel operator+( TVertexId const & vertexId - , VoltageAngleDifferenceLabel const & rhs ) + , VoltageAngleDifferenceLabel const & rhs ) { USAGE_ASSERT ( rhs.SusceptanceNorm() != Const::NONE ); USAGE_ASSERT ( rhs.MinimumCapacity() != Const::NONE ); @@ -298,9 +298,9 @@ class VoltageAngleDifferenceLabel : public SusceptanceNormLabel operator+( TElement const & edge - , VoltageAngleDifferenceLabel const & rhs ) + , VoltageAngleDifferenceLabel const & rhs ) { USAGE_ASSERT ( rhs.SusceptanceNorm() != Const::NONE ); USAGE_ASSERT ( rhs.MinimumCapacity() != Const::NONE ); @@ -326,7 +326,7 @@ class VoltageAngleDifferenceLabel : public SusceptanceNormLabel operator+( VoltageAngleDifferenceLabel const & lhs - , TElement const & edge ) + , TElement const & edge ) { USAGE_ASSERT ( lhs.SusceptanceNorm() != Const::NONE ); USAGE_ASSERT ( lhs.MinimumCapacity() != Const::NONE ); @@ -366,7 +366,7 @@ class VoltageAngleDifferenceLabel : public SusceptanceNormLabel() != 0); - + TLabel::SusceptanceNorm() += fabs( 1 / rhs.Properties().template Susceptance() ); MinimumCapacity() = std::min( MinimumCapacity(), rhs.Properties().ThermalLimit() ); TLabel::Vertex() = rhs.Other( TLabel::Vertex() ); @@ -383,9 +383,9 @@ class VoltageAngleDifferenceLabel : public SusceptanceNormLabel Vertices::GenerationStrategyDifferentiationType::totalVertexRealPowerGenerationPerSnapshot * specialization. - * + * * @see Vertices::GenerationStrategyDifferentiationType::totalVertexRealPowerGenerationPerSnapshot * * @tparam NetworkType The type of the network. */ template class GenerationStrategyDifferentiation { - + using TNetwork = NetworkType; using TGeneratorProperties = typename TNetwork::TGeneratorProperties; @@ -61,18 +61,18 @@ class GenerationStrategyDifferentiation ( vertexId, + network.template for_all_generators_at ( vertexId, [ &network, &pg, ×tampPosition ]( TGeneratorProperties const & generator ) { - if ( generator.IsActive() ) + if ( generator.IsActive() ) { pg += network.GeneratorRealPowerSnapshotAt ( generator, timestampPosition ); } @@ -113,12 +113,12 @@ class GenerationStrategyDifferentiation ( vertexId, + network.template for_all_generators_at ( vertexId, [&network, &qg, ×tampPosition ]( TGeneratorProperties const & generator ) { - if ( generator.IsActive() ) + if ( generator.IsActive() ) { qg += network.GeneratorReactivePowerSnapshotAt ( generator , timestampPosition ); diff --git a/include/DataStructures/Networks/PowerGrid.hpp b/include/DataStructures/Networks/PowerGrid.hpp index f57a2aa6..fb529e79 100644 --- a/include/DataStructures/Networks/PowerGrid.hpp +++ b/include/DataStructures/Networks/PowerGrid.hpp @@ -60,7 +60,7 @@ class PowerGrid { ///@name Constructors and destructor ///@{ #pragma mark CONSTRUCTORS_AND_DESTRUCTOR - + /** * @brief Constructs the object. */ @@ -75,7 +75,7 @@ class PowerGrid { , graph_() {} ///@} - + public: /**@name Getter and Setter */ ///@{ @@ -86,9 +86,9 @@ class PowerGrid { * * @return The underlying graph. */ - inline TGraph const & Graph() const - { - return graph_; + inline TGraph const & Graph() const + { + return graph_; } /** @@ -97,8 +97,8 @@ class PowerGrid { * @return The underlying graph. */ inline TGraph & Graph() - { - return graph_; + { + return graph_; } /** @@ -106,8 +106,8 @@ class PowerGrid { * * @return The power grid's base MVA. */ - inline Types::real BaseMva() const - { + inline Types::real BaseMva() const + { return baseMva_; } @@ -117,7 +117,7 @@ class PowerGrid { * @return The power grid's base MVA. */ inline Types::real & BaseMva() - { + { return baseMva_; } @@ -126,8 +126,8 @@ class PowerGrid { * * @return The voltage angle bound. */ - inline TBound ThetaBound () const - { + inline TBound ThetaBound () const + { return thetaBound_; } @@ -136,8 +136,8 @@ class PowerGrid { * * @return The voltage angle bound. */ - inline TBound & ThetaBound () - { + inline TBound & ThetaBound () + { return thetaBound_; } ///@} @@ -152,8 +152,8 @@ class PowerGrid { * * @return The generator vertex bound type. */ - inline Vertices::BoundType const & GeneratorBoundType () const - { + inline Vertices::BoundType const & GeneratorBoundType () const + { return generatorBoundType_; } @@ -163,8 +163,8 @@ class PowerGrid { * * @return The generator vertex bound type. */ - inline Vertices::BoundType & GeneratorBoundType () - { + inline Vertices::BoundType & GeneratorBoundType () + { return generatorBoundType_; } @@ -175,7 +175,7 @@ class PowerGrid { * @return The load vertex bound type. */ inline Vertices::BoundType const & LoadBoundType () const - { + { return loadBoundType_; } @@ -185,8 +185,8 @@ class PowerGrid { * * @return The load vertex bound type. */ - inline Vertices::BoundType & LoadBoundType () - { + inline Vertices::BoundType & LoadBoundType () + { return loadBoundType_; } @@ -197,26 +197,26 @@ class PowerGrid { * possible generation. (see https://doi.org/10.1145/3208903.3208910 * Page 343 Equations 11 and 12 for the definition) - * + * * @f[ - * -\maxdemand\leq\netflow(\vertexa)\leq-\mindemand\qquad\forall\vertexa\in\consumers + * -\maxdemand\leq\netflow(\vertexa)\leq-\mindemand\qquad\forall\vertexa\in\consumers * @f] * @f[ * \maxexcess\leq\netflow(\vertexa)\leq \minexcess\qquad\forall\vertexa\in\generators * @f] - * + * * @pre All loads are set to @p bounded and all generators * to @p bounded. - * + * * @I{ In short and easy to read formulation } * @I{ -dmax(u) <= fnet(u) <= -dmin(u) for all u in Vc (Loads) } * @I{ xmin(u) <= fnet(u) <= xmax(u) for all u in Vg (Generators) } - * + * * @note Note that since the data does not provide a proper * load lower bound we use @p maxbound and thus, set the lower * bound to zero. */ - inline void MakeBounded () + inline void MakeBounded () { generatorBoundType_ = Vertices::BoundType::bounded; loadBoundType_ = Vertices::BoundType::bounded; @@ -229,22 +229,22 @@ class PowerGrid { * maximum are 0 and infinity, respectively. (see https://doi.org/10.1145/3208903.3208910 * Page 342 Equations 2 and 3 for the definition) - * + * * @f[ - * -\infty\leq\netflow(\vertexa)\leq 0\qquad\forall\vertexa\in\consumers + * -\infty\leq\netflow(\vertexa)\leq 0\qquad\forall\vertexa\in\consumers * @f] * @f[ * 0\leq\netflow(\vertexa)\leq\infty\qquad\forall\vertexa\in\generators * @f] - * + * * @pre All loads are set to @p unbounded and all * generators to @p unbounded. - * + * * @I{ In short and easy to read formulation } * @I{ -infty <= fnet(u) <= 0 for all u in Vc (Loads) } * @I{ 0 <= fnet(u) <= infty for all u in Vg (Generators) } */ - inline void MakeUnbounded () + inline void MakeUnbounded () { generatorBoundType_ = Vertices::BoundType::unbounded; loadBoundType_ = Vertices::BoundType::unbounded; @@ -258,31 +258,31 @@ class PowerGrid { * * https://doi.org/10.1145/3208903.3208910 Page 342 * Equations 2 and 3 for the definition). - * + * * @f[ - * -\infty\leq\netflow(\vertexa)\leq 0\qquad\forall\vertexa\in\consumers + * -\infty\leq\netflow(\vertexa)\leq 0\qquad\forall\vertexa\in\consumers * @f] * @f[ * 0\leq\netflow(\vertexa)\leq\infty\qquad\forall\vertexa\in\generators * @f] - * + * * @I{ In short and easy to read formulation } * @I{ -infty <= fnet(u) <= 0 for all u in Vc (Loads) } * @I{ 0 <= fnet(u) <= infty for all u in Vg (Generators) } - * + * * @note Note that unbounded generators get bounded demands * as defined in * https://doi.org/10.1145/3208903.3208910 Page 348 * Section 7. Note that pure unbounded focuses on the demands * only. - * + * * @pre All loads are set to @p pureunbounded and * all generators to @p unbounded. - * - * @see Vertices#BoundType + * + * @see Vertices#BoundType */ - inline void MakePureUnbounded () + inline void MakePureUnbounded () { generatorBoundType_ = Vertices::BoundType::unbounded; loadBoundType_ = Vertices::BoundType::pureunbounded; @@ -293,26 +293,26 @@ class PowerGrid { * @details This is especially useful when running the ordinary * power flow (PF) program as PF just checks if the generator * and load values produce feasible power flow. - * + * * A network has exact bounds if the following holds * @f[ * -\demand(\vertexa)\leq\netflow(\vertexa)\leq -\demand(\vertexa)\qquad\forall\vertexa\in\consumers, * @f] - * @f[ + * @f[ * \excess(\vertexa)\leq\netflow(\vertexa)\leq\excess(\vertexa)\qquad\forall\vertexa\in\generators, - * @f] where the netflow is defined by + * @f] where the netflow is defined by * @f$\netflow:=\sum_{ \{ \vertexa,\vertexb \} \in \undirectededges } \flow ( \vertexa,\vertexb ) @f$, * and the set of generators and and consumers is denoted by * @f$\generators@f$ and @f$\consumers@f$, respectively. - * + * * @pre All loads are set to @p exact and all generators to * @p exact. - * + * * @I{ In short and easy to read formulation } * @I{ -d(u) <= fnet(u) <= -d(u) for all u in Vc (Loads) } * @I{ x(u) <= fnet(u) <= x(u) for all u in Vg (Generators) } */ - inline void MakeExact () + inline void MakeExact () { generatorBoundType_ = Vertices::BoundType::exact; loadBoundType_ = Vertices::BoundType::exact; @@ -323,12 +323,12 @@ class PowerGrid { * * @return @p true if bounded, @p false otherwise. */ - inline bool IsBounded () const + inline bool IsBounded () const { return ( (generatorBoundType_ == Vertices::BoundType::bounded) && (loadBoundType_ == Vertices::BoundType::bounded) ); } - + /** * @brief Determines if unbounded. * @@ -349,7 +349,7 @@ class PowerGrid { { return ( ( (generatorBoundType_ == Vertices::BoundType::unbounded) || (generatorBoundType_ == Vertices::BoundType::pureunbounded) - ) && + ) && ( loadBoundType_ == Vertices::BoundType::pureunbounded) ); } @@ -361,7 +361,7 @@ class PowerGrid { */ inline bool IsExact () const { - return ( ( generatorBoundType_ == Vertices::BoundType::exact ) + return ( ( generatorBoundType_ == Vertices::BoundType::exact ) && ( loadBoundType_ == Vertices::BoundType::exact ) ); } @@ -370,10 +370,10 @@ class PowerGrid { * * @return The network bound type. */ - inline Vertices::BoundType NetworkBoundType () const - { - if ( IsExact() ) return Vertices::BoundType::exact; - else if ( IsBounded() ) return Vertices::BoundType::bounded; + inline Vertices::BoundType NetworkBoundType () const + { + if ( IsExact() ) return Vertices::BoundType::exact; + else if ( IsBounded() ) return Vertices::BoundType::bounded; else if ( IsUnbounded() ) return Vertices::BoundType::unbounded; else if ( IsPureUnbounded() ) return Vertices::BoundType::pureunbounded; return Vertices::BoundType::unknown; @@ -385,7 +385,7 @@ class PowerGrid { * @return The network bound type string. */ inline Types::name NetworkType () const - { + { std::ostringstream temp; temp << NetworkBoundType(); return temp.str(); @@ -405,29 +405,29 @@ class PowerGrid { * @return Output stream */ friend std::ostream & operator<< ( std::ostream & os - , PowerGrid const & rhs ) + , PowerGrid const & rhs ) { os << std::string(20, '-'); os << "\nBuses\n" << std::string(7, '-') << "\n"; TVertexProperties::Header(os); rhs.Graph().template for_all_vertices([&rhs, &os]( TVertex u ) - { - u.Properties().Line( os, rhs.BaseMva() ); + { + u.Properties().Line( os, rhs.BaseMva() ); }); os << "\nGenerators\n" << std::string(11, '-') << "\n"; TGeneratorProperties::HeaderBusGeneratorName(os); rhs.template for_all_generator_tuple( [&rhs, &os]( Types::vertexId vertexId, TGeneratorProperties u ) - { - u.Line( os, rhs.Graph().VertexAt(vertexId).Properties().Name(), rhs.BaseMva() ); + { + u.Line( os, rhs.Graph().VertexAt(vertexId).Properties().Name(), rhs.BaseMva() ); }); os << "\nBranches\n" << std::string(9, '-') << "\n"; TEdgeProperties::Header(os); rhs.Graph().template for_all_edges([&rhs, &os]( TEdge e ) - { - e.Properties().Line( os, rhs.Graph().VertexAt(e.Source()).Properties().Name(), rhs.Graph().VertexAt(e.Target()).Properties().Name(), rhs.BaseMva() ); + { + e.Properties().Line( os, rhs.Graph().VertexAt(e.Source()).Properties().Name(), rhs.Graph().VertexAt(e.Target()).Properties().Name(), rhs.BaseMva() ); }); os << "\nMinDegree: " << rhs.Graph().MinDegree() << "\n"; @@ -445,13 +445,13 @@ class PowerGrid { * @brief Adds a generator @f$g\in\generators@f$ at * a vertex @f$\vertex\in\vertices@f$ with vertex identifier * @p vertexId. - * + * * @I{ Using copy-and-swap idiom. } * * @param[in] vertexId The vertex identifier @p vertexId. * @param[in] generatorProperty The generator object * @f$\vertex\in\generators@f$. - * + * * @return The generator identifier. */ inline Types::generatorId AddGeneratorAt ( Types::vertexId vertexId @@ -470,7 +470,7 @@ class PowerGrid { { generatorsAtVertex_.resize ( Graph().NumberOfVertices() ); } - ESSENTIAL_ASSERT ( generatorsAtVertex_.size() > vertexId ); + ESSENTIAL_ASSERT ( generatorsAtVertex_.size() > vertexId ); //@TODO reuse empty slots Types::generatorId newId = generators_.size() - 1; @@ -483,7 +483,7 @@ class PowerGrid { * @brief Adds a generator @f$g\in\generators@f$ at * a vertex @f$\vertex\in\vertices@f$ with vertex identifier * @p vertexId. - * + * * @I{ Using universal references => type deduction. See the * article of Scott Meyers * https://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers. @@ -536,7 +536,7 @@ class PowerGrid { * @return The generator identifier. */ inline Types::generatorId AddGeneratorAt ( TVertex const & vertex - , TGeneratorProperties const & generatorProperty ) + , TGeneratorProperties const & generatorProperty ) { Types::vertexId vertexId = vertex.Identifier(); @@ -561,7 +561,7 @@ class PowerGrid { * @return The generator identifier. */ inline Types::generatorId AddGeneratorAt ( TVertex const & vertex - , TGeneratorProperties && generatorProperty ) + , TGeneratorProperties && generatorProperty ) { Types::vertexId vertexId = vertex.Identifier(); @@ -578,11 +578,11 @@ class PowerGrid { * @param[in] generatorId The generator identifier. */ inline void RemoveGeneratorAt ( Types::vertexId vertexId - , Types::generatorId generatorId ) + , Types::generatorId generatorId ) { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); USAGE_ASSERT ( HasGenerator ( generatorId ) ); - + // Remove generator object from V_G implicitly generatorExists_[ generatorId ] = false; @@ -594,13 +594,13 @@ class PowerGrid { , generatorsAtVertex_[vertexId].end() , generatorId ); - if ( result != generatorsAtVertex_[vertexId].end() ) + if ( result != generatorsAtVertex_[vertexId].end() ) { std::swap ( *result , generatorsAtVertex_[vertexId].back() ); generatorsAtVertex_[vertexId].pop_back(); - } else { - USAGE_ASSERT ( false + } else { + USAGE_ASSERT ( false && "The generatorId does not exist in generatorsAtVertex_[vertexId]!" ); } } @@ -624,7 +624,7 @@ class PowerGrid { * @param generatorProperty The generator property. */ inline void RemoveGeneratorAt ( Types::vertexId vertexId - , TGeneratorProperties & generatorProperty ) + , TGeneratorProperties & generatorProperty ) { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); @@ -654,9 +654,9 @@ class PowerGrid { * @return @p true if the generator identifier exists, @p * false otherwise. */ - inline bool HasGenerator ( Types::generatorId generatorId ) const + inline bool HasGenerator ( Types::generatorId generatorId ) const { - return ( generatorId < generators_.size() + return ( generatorId < generators_.size() && generatorExists_[generatorId] ); } @@ -673,7 +673,7 @@ class PowerGrid { * @return @p true if the generator exists, @p false * otherwise. */ - inline bool HasGenerator ( TGeneratorProperties const & generatorProperty ) const + inline bool HasGenerator ( TGeneratorProperties const & generatorProperty ) const { return HasGenerator ( GeneratorId ( generatorProperty ) ); } @@ -687,10 +687,10 @@ class PowerGrid { * @return @p true if there is a generator at vertex @p * vertexId, @p false otherwise. */ - inline bool HasGeneratorAt ( Types::vertexId vertexId ) const + inline bool HasGeneratorAt ( Types::vertexId vertexId ) const { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); - return ( generatorsAtVertex_.size() > vertexId + return ( generatorsAtVertex_.size() > vertexId && !( generatorsAtVertex_[vertexId].empty() ) ); } @@ -707,7 +707,7 @@ class PowerGrid { * @return @p true if there is a generator at vertex @p * vertexId, @p false otherwise. */ - inline bool HasGeneratorAt ( TVertex const & vertex ) const + inline bool HasGeneratorAt ( TVertex const & vertex ) const { Types::vertexId vertexId = Graph().VertexId ( vertex ); USAGE_ASSERT( Graph().VertexExists ( vertexId ) ); @@ -729,10 +729,10 @@ class PowerGrid { * @return If the generator exists the generator's identifier * @p generatorId is returned, @p Const::NONE otherwise. */ - inline Types::generatorId GeneratorId ( TGeneratorProperties const & generatorProperty ) const + inline Types::generatorId GeneratorId ( TGeneratorProperties const & generatorProperty ) const { Types::generatorId generatorId = FindGenerator ( generatorProperty, generators_ ); - return generatorId; + return generatorId; } /** @@ -743,11 +743,11 @@ class PowerGrid { * @param generatorIds The generator identifiers. */ inline void GeneratorIds ( Types::vertexId vertexId - , std::vector & generatorIds ) const + , std::vector & generatorIds ) const { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); - - if ( HasGeneratorAt( vertexId ) ) + + if ( HasGeneratorAt( vertexId ) ) { generatorIds = generatorsAtVertex_[ vertexId ]; } @@ -771,7 +771,7 @@ class PowerGrid { * * @return The generator properties @f$\vertex\in\generators@f$. */ - inline TGeneratorProperties & GeneratorAt ( Types::generatorId generatorId ) + inline TGeneratorProperties & GeneratorAt ( Types::generatorId generatorId ) { USAGE_ASSERT ( HasGenerator ( generatorId ) ); return generators_[generatorId]; @@ -798,13 +798,13 @@ class PowerGrid { * @param[in] vertexId The vertex identifier. * @param generator identifiers The generator identifiers * at vertex with @p vertexId. - * + * * @pre Check if the vertex identifier @p vertexId exists * before using this method. - * + * * @see StaticGraph#VertexExists * @see DynamicGraph#VertexExists - * + * * @code{.cpp} * std::vector generatorIds; * if ( this->Graph().VertexExists ( vertexId ) ) @@ -812,17 +812,17 @@ class PowerGrid { * GeneratorsAt ( vertex, generatorIds ); * } * @endcode - * + * * @note If the vertex @f$\vertex\in\vertices@f$ has no * generator @f$\{\vertex\}\cap\generators = \emptyset@f$ then * the generatorIds vectors returns empty. */ inline void GeneratorsAt ( Types::vertexId vertexId - , std::vector & generatorIds ) const + , std::vector & generatorIds ) const { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); - for_all_generator_identifiers_at ( vertexId, + for_all_generator_identifiers_at ( vertexId, [this, &generatorIds](Types::generatorId generatorId) { generatorIds.emplace_back( generatorId ); @@ -835,29 +835,29 @@ class PowerGrid { * * @param[in] vertexId The vertex identifier. * @param generators The generators at vertex with @p vertexId. - * + * * @pre Check if the vertex identifier @p vertexId exists * before using this method. - * + * * @see StaticGraph#VertexExists * @see DynamicGraph#VertexExists - * + * * @code{.cpp} * std::vector generators; * if ( this->Graph().VertexExists ( vertexId ) ) * GeneratorsAt ( vertex, generators ); * @endcode - * + * * @note If the vertex @f$\vertex\in\vertices@f$ has no * generator @f$\{\vertex\}\cap\generators = \emptyset@f$ then * the generators vectors returns empty. */ inline void GeneratorsAt ( Types::vertexId vertexId - , std::vector & generators ) const + , std::vector & generators ) const { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); - for_all_generator_identifiers_at ( vertexId, + for_all_generator_identifiers_at ( vertexId, [this, &generators](Types::generatorId generatorId) { generators.emplace_back( generators_[generatorId] ); @@ -874,25 +874,25 @@ class PowerGrid { * * @param vertex The vertex object. * @param generators The generators at a @p vertex. - * + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @see StaticGraph#VertexExists * @see DynamicGraph#VertexExists - * + * * @code{.cpp} * std::vector generatorIds; * if ( this->Graph().VertexExists ( this->Graph().VertexId ( vertexId ) ) ) * GeneratorsAt ( vertex, generatorIds ); * @endcode - * + * * @note If the vertex @f$\vertex\in\vertices@f$ has no * generator @f$\{\vertex\}\cap\generators = \emptyset@f$ then * the generatorIds vectors returns empty. */ inline void GeneratorsAt ( TVertex const & vertex - , std::vector & generatorIds ) const + , std::vector & generatorIds ) const { Types::vertexId vertexId = Graph().VertexId( vertex ); USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); @@ -905,25 +905,25 @@ class PowerGrid { * * @param vertex The vertex object. * @param generators The generators at a @p vertex. - * + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @see StaticGraph#VertexExists * @see DynamicGraph#VertexExists - * + * * @code{.cpp} * std::vector generators; * if ( this->Graph().VertexExists ( this->Graph().VertexId ( vertexId ) ) ) * GeneratorsAt ( vertex, generators ); * @endcode - * + * * @note If the vertex @f$\vertex\in\vertices@f$ has no * generator @f$\{\vertex\}\cap\generators = \emptyset@f$ then * the generators vectors returns empty. */ inline void GeneratorsAt ( TVertex const & vertex - , std::vector & generators ) const + , std::vector & generators ) const { Types::vertexId vertexId = Graph().VertexId( vertex ); USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); @@ -936,7 +936,7 @@ class PowerGrid { * * @param[in] generatorProperty The generator vertex. * @param[in] generators The generators. - * + * * @note If the @p generator @f$\vertex\in\generators@f$ * does not exist the method returns @p Const::NONE equivalent * to @f$\emptyset@f$. However, for duplicate generators @@ -946,7 +946,7 @@ class PowerGrid { * @return The generator's identifier. */ inline Types::generatorId FindGenerator ( TGeneratorProperties const & generatorProperty - , std::vector const & generators ) const + , std::vector const & generators ) const { auto result = std::find ( generators.begin() , generators.end() @@ -960,7 +960,7 @@ class PowerGrid { } ///@} - + /**@name Accessors for the Total Power Generation at a Vertex */ ///@{ #pragma mark TOTAL_POWER_GENERATION_AT_VERTEX @@ -972,18 +972,18 @@ class PowerGrid { * at the vertex @p index. This depends also on if the power * grid is set to (1) exact, (2) bounded, or (3) * unbounded/pureunbounded. - * + * * (1) Uses the sum of the generators real power generation - * (pg) snapshot, - * + * (pg) snapshot, + * * (2) Uses the sum of the minimum * (@f$\realpowergenerationmin@f$) and the sum of the * maximum (@f$\realpowergenerationmax@f$) real power * generation of the data, - * + * * (3) Uses 0 and infinity for the minimum and maximum, * respectively. - * + * * @param[in] vertexId The vertex identifier. * * @pre The timestamp position is used for @p @@ -999,7 +999,7 @@ class PowerGrid { */ template inline TBound TotalRealPowerGenerationBoundAt ( Types::vertexId vertexId - , Types::index timestampPosition = 0 ) const + , Types::index timestampPosition = 0 ) const { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); @@ -1013,10 +1013,10 @@ class PowerGrid { else if ( generatorBoundType_ == Vertices::BoundType::bounded ) { // BOUNDED TBound pg ( 0.0, 0.0 ); - for_all_generators_at ( vertexId, + for_all_generators_at ( vertexId, [ &pg ]( TGeneratorProperties const & generatorProperty ) { - if ( generatorProperty.IsActive() ) + if ( generatorProperty.IsActive() ) { pg.Maximum() += generatorProperty.RealPowerBound().Maximum(); pg.Minimum() += generatorProperty.RealPowerBound().Minimum(); @@ -1024,7 +1024,7 @@ class PowerGrid { } ); return pg; - } else + } else { // EXACT ESSENTIAL_ASSERT ( generatorBoundType_ == Vertices::BoundType::exact ); auto gen = TotalRealPowerGenerationAt ( vertexId, timestampPosition ); @@ -1057,8 +1057,8 @@ class PowerGrid { * vertex @f$\vertex@f$ with @p vertexId. */ template - inline Types::real TotalRealPowerGenerationAt ( Types::vertexId vertexId - , Types::index timestampPosition = 0 ) const + inline Types::real TotalRealPowerGenerationAt ( Types::vertexId vertexId + , Types::index timestampPosition = 0 ) const { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); @@ -1079,15 +1079,15 @@ class PowerGrid { * \reactivepowergenerationmax]@f$ at the vertex @p vertexId. * This depends also on if the power grid is set to (1) exact, * (2) bounded, or (3) unbounded/pureunbounded. - * + * * (1) Uses the sum of the generators reactive power * generation (@f$\reactivepowergeneration@f$) snapshot, - * + * * (2) Uses the sum of the minimum * (@f$\reactivepowergenerationmin@f$) and the sum of the * maximum (@f$\reactivepowergenerationmax@f$) reactive * power generation of the data, - * + * * (3) Uses 0 and infinity for the minimum and maximum, * respectively. * @@ -1099,31 +1099,31 @@ class PowerGrid { */ template inline TBound TotalReactivePowerGenerationBoundAt ( Types::vertexId vertexId - , Types::index timestampPosition = 0 ) const + , Types::index timestampPosition = 0 ) const { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); TBound qg( 0.0, 0.0 ); - if ( HasGeneratorAt( vertexId ) + if ( HasGeneratorAt( vertexId ) && ( ( generatorBoundType_ == Vertices::BoundType::unbounded ) || ( generatorBoundType_ == Vertices::BoundType::pureunbounded ) ) - ) + ) { // PUREUNBOUNDED || UNBOUNDED return TBound( 0, Const::REAL_INFTY ); - } else if ( HasGeneratorAt( vertexId ) + } else if ( HasGeneratorAt( vertexId ) && ( generatorBoundType_ == Vertices::BoundType::bounded ) ) { // BOUNDED - for_all_generators_at ( vertexId, + for_all_generators_at ( vertexId, [ &qg ]( TGeneratorProperties const & generator ) { - if ( generator.IsActive() ) + if ( generator.IsActive() ) { qg.Maximum() += generator.ReactivePowerBound().Maximum(); qg.Minimum() += generator.ReactivePowerBound().Minimum(); } } ); - } else if ( HasGeneratorAt( vertexId ) + } else if ( HasGeneratorAt( vertexId ) && ( generatorBoundType_ == Vertices::BoundType::exact ) ) { // EXACT qg.Maximum() = TotalReactivePowerGenerationAt ( vertexId @@ -1154,12 +1154,12 @@ class PowerGrid { * @return The total reactive power generation * @f$\reactivepowergeneration@f$ of all generatorsnapshots at a * vertex @f$\vertex\in\vertices@f$ with identifier @p vertexId. - * + * * @todo Use the same logic as in Real Power using snapshot -> GeneratorRealPowerSnapshotAt( generator, timestampPosition ); */ template inline Types::real TotalReactivePowerGenerationAt ( Types::vertexId vertexId - , Types::index timestampPosition = 0 ) const + , Types::index timestampPosition = 0 ) const { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); @@ -1188,7 +1188,7 @@ class PowerGrid { * @return The identifier of the load. */ inline Types::loadId AddLoadAt ( Types::vertexId vertexId - , TLoadProperties load ) + , TLoadProperties load ) { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); @@ -1222,7 +1222,7 @@ class PowerGrid { * @return The load identifier. */ inline Types::loadId AddLoadAt ( TVertex const & vertex - , TLoadProperties const & load ) + , TLoadProperties const & load ) { Types::vertexId vertexId = Graph().VertexId( vertex ); @@ -1241,7 +1241,7 @@ class PowerGrid { * @return The load identifier. */ inline Types::loadId AddLoadAt ( TVertex const & vertex - , TLoadProperties && load ) + , TLoadProperties && load ) { Types::vertexId vertexId = Graph().VertexId ( vertex ); @@ -1274,13 +1274,13 @@ class PowerGrid { , loadsAtVertex_[vertexId].end() , loadId ); - if ( result != loadsAtVertex_[vertexId].end() ) + if ( result != loadsAtVertex_[vertexId].end() ) { std::swap ( *result , loadsAtVertex_[vertexId].back() ); loadsAtVertex_[vertexId].pop_back(); - } else { - USAGE_ASSERT ( false + } else { + USAGE_ASSERT ( false && "The loadId does not exist in loadsAtVertex_[vertexId]!" ); } } @@ -1331,7 +1331,7 @@ class PowerGrid { * @return @p true if the load identifier exists, @p false * otherwise. */ - inline bool HasLoad ( Types::loadId loadId ) const + inline bool HasLoad ( Types::loadId loadId ) const { return ( loadId < loads_.size() ) && loadExists_[ loadId ] ; @@ -1348,7 +1348,7 @@ class PowerGrid { * * @return @p true if the load exists, @p false otherwise. */ - inline bool HasLoad ( TLoadProperties const & load ) const + inline bool HasLoad ( TLoadProperties const & load ) const { return ( Const::NONE != LoadId ( load ) ); } @@ -1362,10 +1362,10 @@ class PowerGrid { * @return @p true if the load identifier exists, @p false * otherwise. */ - inline bool HasLoadAt ( Types::vertexId vertexId ) const + inline bool HasLoadAt ( Types::vertexId vertexId ) const { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); - return ( loadsAtVertex_.size() > vertexId + return ( loadsAtVertex_.size() > vertexId && !( loadsAtVertex_[vertexId].empty() ) ); } @@ -1382,7 +1382,7 @@ class PowerGrid { * @return @p true if there are loads at the vertex, @p false * otherwise. */ - inline bool HasLoadAt ( TVertex const & vertex ) const + inline bool HasLoadAt ( TVertex const & vertex ) const { Types::vertexId vertexId = Graph().VertexId ( vertex ); USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); @@ -1397,7 +1397,7 @@ class PowerGrid { * @return If the load object exists it returns the unique * identifier of a load object, otherwise it returns @p Const::NONE. */ - inline Types::loadId LoadId ( TLoadProperties const & load ) const + inline Types::loadId LoadId ( TLoadProperties const & load ) const { auto result = std::find ( loads_.begin() , loads_.end() @@ -1417,7 +1417,7 @@ class PowerGrid { * @return A set of load identifiers. */ inline void LoadIds ( Types::vertexId vertexId - , std::vector & loadIds ) const + , std::vector & loadIds ) const { USAGE_ASSERT ( Graph().VertexExists( vertexId ) ); USAGE_ASSERT ( vertexId < loadsAtVertex_.size() ); @@ -1445,10 +1445,10 @@ class PowerGrid { * @param[in/out] loadIds The load identifiers. */ inline void LoadIds ( TVertex const & vertex - , std::vector & loadIds ) const + , std::vector & loadIds ) const { Types::vertexId vertexId = Graph().VertexId ( vertex ); - + USAGE_ASSERT( vertexId < Graph().Vertices().size() ); USAGE_ASSERT( vertexId < loadsAtVertex_.size() ); @@ -1469,7 +1469,7 @@ class PowerGrid { * * @return The load properties. */ - inline TLoadProperties & LoadAt ( Types::loadId loadId ) + inline TLoadProperties & LoadAt ( Types::loadId loadId ) { USAGE_ASSERT ( HasLoad ( loadId ) ); return loads_[loadId]; @@ -1499,11 +1499,11 @@ class PowerGrid { { USAGE_ASSERT( Graph().VertexExists( vertexId ) ); - if ( HasLoadAt( vertexId ) ) + if ( HasLoadAt( vertexId ) ) { - std::vector loadIds; + std::vector loadIds; LoadIds( vertexId, loadIds ); - for ( auto id : loadIds ) + for ( auto id : loadIds ) { loads.emplace_back( loads_[id] ); } @@ -1522,11 +1522,11 @@ class PowerGrid { Types::vertexId vertexId = Graph().VertexId ( vertex ); USAGE_ASSERT ( Graph().VertexExists( vertexId ) ); - if ( HasLoadAt( vertexId ) ) + if ( HasLoadAt( vertexId ) ) { std::vector loadIds; LoadIds ( vertexId, loadIds ); - for ( auto id : loadIds ) + for ( auto id : loadIds ) { loads.emplace_back( loads_[id] ); } @@ -1553,8 +1553,8 @@ class PowerGrid { USAGE_ASSERT( Graph().VertexExists( vertexId ) ); Types::loadSnapshot result = 0; - for_all_real_power_load_snapshots_at ( - vertexId, + for_all_real_power_load_snapshots_at ( + vertexId, snapshotId, [&result](Types::loadSnapshot load ) { @@ -1599,13 +1599,13 @@ class PowerGrid { if ( loadBoundType_ == Vertices::BoundType::pureunbounded ) { // PUREUNBOUNDED - if ( HasGeneratorAt ( vertexId ) ) + if ( HasGeneratorAt ( vertexId ) ) { //@todo use when implemented the breakable loop to break after infty was found Types::real loadMax = 0.0; - for_all_loads_at ( vertexId, - [ &loadMax ]( TLoadProperties const & load ) + for_all_loads_at ( vertexId, + [ &loadMax ]( TLoadProperties const & load ) { - if ( load.RealPowerLoadBound().Maximum() < Const::REAL_INFTY + if ( load.RealPowerLoadBound().Maximum() < Const::REAL_INFTY && loadMax < Const::REAL_INFTY ) { loadMax += load.RealPowerLoadBound().Maximum(); @@ -1629,18 +1629,18 @@ class PowerGrid { //@todo use when implemented the breakable loop to break after infty was found Types::real loadMin = 0.0; Types::real loadMax = 0.0; - for_all_loads_at ( vertexId, - [ &loadMin, &loadMax ]( TLoadProperties const & load ) + for_all_loads_at ( vertexId, + [ &loadMin, &loadMax ]( TLoadProperties const & load ) { - if ( load.RealPowerLoadBound().Minimum() < Const::REAL_INFTY + if ( load.RealPowerLoadBound().Minimum() < Const::REAL_INFTY && loadMin < Const::REAL_INFTY ) { loadMin += load.RealPowerLoadBound().Minimum(); } else { loadMin = Const::REAL_INFTY; } - - if ( load.RealPowerLoadBound().Maximum() < Const::REAL_INFTY + + if ( load.RealPowerLoadBound().Maximum() < Const::REAL_INFTY && loadMax < Const::REAL_INFTY ) { loadMax += load.RealPowerLoadBound().Maximum(); @@ -1674,7 +1674,7 @@ class PowerGrid { [ this, &total, timestampPosition ]( Types::loadId loadId ) { auto myLoad = LoadSnapshotOf(loadId, timestampPosition); - if ( myLoad >= Const::REAL_INFTY ) + if ( myLoad >= Const::REAL_INFTY ) { total = Const::REAL_INFTY; return false; @@ -1693,24 +1693,24 @@ class PowerGrid { * * @return The reactive power load bound at a vertex @p vertexId. */ - inline TBound TotalReactivePowerLoadBoundAt( Types::vertexId vertexId ) const + inline TBound TotalReactivePowerLoadBoundAt( Types::vertexId vertexId ) const { USAGE_ASSERT ( Graph().VertexExists ( vertexId ) ); if ( loadBoundType_ == Vertices::BoundType::pureunbounded ) { // PUREUNBOUNDED - if ( HasGeneratorAt( vertexId ) ) + if ( HasGeneratorAt( vertexId ) ) { - return TBound( 0, Graph().VertexAt( vertexId ).ReactivePowerLoadBound().Maximum() ); + return TBound( 0, Graph().VertexAt( vertexId ).ReactivePowerLoadBound().Maximum() ); } - return TBound( 0, Const::REAL_INFTY ); + return TBound( 0, Const::REAL_INFTY ); } else if ( loadBoundType_ == Vertices::BoundType::unbounded ) { // UNBOUNDED - return TBound( 0, Const::REAL_INFTY ); + return TBound( 0, Const::REAL_INFTY ); } else if ( loadBoundType_ == Vertices::BoundType::exact ) { // EXACT: For power flow (PF) calculation return TBound ( Graph().VertexAt( vertexId ).ReactivePowerLoad() - , Graph().VertexAt( vertexId ).ReactivePowerLoad() ); + , Graph().VertexAt( vertexId ).ReactivePowerLoad() ); } return TBound ( Graph().VertexAt( vertexId ).ReactivePowerLoadBound().Minimum() , Graph().VertexAt( vertexId ).ReactivePowerLoadBound().Maximum() ); @@ -1726,7 +1726,7 @@ class PowerGrid { * @p generatorId. * @details These values represent the maximum possible production * of a generator at a certain timestamp. - * + * * @param[in] generatorId The identifier of * the generator. * @param[in] maximumRealPowerGenerationPu The generator @@ -1734,13 +1734,13 @@ class PowerGrid { * representing the * maximum real power * generation in p.u. - * + * * @pre The generator @f$\vertex\in\generators@f$ with * the @p generatorId has to exist and the maximum real power * generation p.u. has not to be @p Const::NONE. */ inline void AddGeneratorRealPowerSnapshotAt ( Types::generatorId generatorId - , Types::generatorSnapshot maximumRealPowerGenerationPu ) + , Types::generatorSnapshot maximumRealPowerGenerationPu ) { USAGE_ASSERT ( HasGenerator ( generatorId ) ); // USAGE_ASSERT ( maximumRealPowerGenerationPu != Const::NONE ); @@ -1757,7 +1757,7 @@ class PowerGrid { * @brief Update generator snapshot size. * @details There can be more generators than buses. */ - inline void UpdateGeneratorSnapshotSize () + inline void UpdateGeneratorSnapshotSize () { generatorRealPowerSnapshots_.resize( generators_.size() ); } @@ -1766,7 +1766,7 @@ class PowerGrid { * @brief Update load snapshot * @details Currently we assume that there is one load per bus */ - inline void UpdateLoadSnapshotSize( ) + inline void UpdateLoadSnapshotSize( ) { loadSnapshots_.resize( loads_.size() ); } @@ -1774,7 +1774,7 @@ class PowerGrid { /** * @brief Output generation snapshots. */ - void OutputGeneratorSnaps() + void OutputGeneratorSnaps() { for ( Types::count counter = 0 ; counter < timestamps_.size() @@ -1785,8 +1785,8 @@ class PowerGrid { ; generatorId < generatorRealPowerSnapshots_.size() ; ++generatorId ) { - if ( generatorRealPowerSnapshots_[generatorId].size() == 0 - || GeneratorRealPowerSnapshotAt ( generatorId, counter ) == Const::NONE ) + if ( generatorRealPowerSnapshots_[generatorId].size() == 0 + || GeneratorRealPowerSnapshotAt ( generatorId, counter ) == Const::NONE ) { continue; // If the generator has no snapshot available } @@ -1799,7 +1799,7 @@ class PowerGrid { /** * @brief Output load snapshots. */ - void OutputLoadSnaps() + void OutputLoadSnaps() { for ( Types::count counter = 0 ; counter < timestamps_.size() @@ -1826,17 +1826,17 @@ class PowerGrid { * real power load at a timestamp in p.u. */ inline void AddLoadSnapshotAt ( Types::loadId loadId - , Types::loadSnapshot snapshot ) + , Types::loadSnapshot snapshot ) { USAGE_ASSERT ( HasLoad ( loadId ) ); USAGE_ASSERT ( snapshot < Const::NONE ); - if ( loadSnapshots_.size() <= loadId - || loadSnapshots_.empty() ) + if ( loadSnapshots_.size() <= loadId + || loadSnapshots_.empty() ) { - UpdateLoadSnapshotSize(); + UpdateLoadSnapshotSize(); } - + loadSnapshots_[loadId].emplace_back( snapshot ); } @@ -1845,7 +1845,7 @@ class PowerGrid { * * @param[in] weight The @p weight of a snapshot */ - inline void AddSnapshotWeighting( Types::weightSnapshot weight ) + inline void AddSnapshotWeighting( Types::weightSnapshot weight ) { USAGE_ASSERT( weight != Const::NONE ); snapshotWeights_.emplace_back( weight ); @@ -1859,7 +1859,7 @@ class PowerGrid { * * @param[in] timestamp The timestamp, e.g., "2019-09-19 19:19:19" */ - inline void AddSnapshotTimestamp( Types::timestampSnapshot timestamp ) + inline void AddSnapshotTimestamp( Types::timestampSnapshot timestamp ) { USAGE_ASSERT ( !timestamp.empty() ); timestamps_.emplace_back( timestamp ); @@ -1871,7 +1871,7 @@ class PowerGrid { * @param[in] timestamp The timestamp. * * @return The position of a @p timestamp. - * + * * @note Implementation is very inefficient. */ inline Types::index PositionOf ( Types::timestampSnapshot timestamp ) const @@ -1894,7 +1894,7 @@ class PowerGrid { * * @return The timestamp at the @p position. */ - inline Types::timestampSnapshot TimestampAt ( Types::index timestampPosition ) const + inline Types::timestampSnapshot TimestampAt ( Types::index timestampPosition ) const { USAGE_ASSERT ( timestampPosition < timestamps_.size() ); return timestamps_[timestampPosition]; @@ -1930,9 +1930,9 @@ class PowerGrid { if ( position != Const::NONE ) { return GeneratorRealPowerSnapshotAt ( generatorId, position ); - } else + } else { // No snapshot available - return Const::NONE; + return Const::NONE; } } @@ -1964,9 +1964,9 @@ class PowerGrid { * @details If the generator has no generation value assigned for * the given timestamp, the method returns * @p Const::NONE. - * + * * @pre Check for a valid generatorId and timestamp position. - * + * * @param generatorId The generator identifier. * @param[in] timestampPosition The timestamp position. * @@ -2017,13 +2017,13 @@ class PowerGrid { * @details Some generators might not have snapshots over time. * In this case this method returns a vector with @p * Const::NONE at these generators. - * + * * @pre The vector @p snapshotsAtTimestamp has to be empty * and @p snapshotsAtTimestamp have to be empty. - * + * * @param[in] timestamp The timestamp. * @param snapshotsAtTimestamp The snapshots at the timestamp. - * + * * @todo Add the same for reactive power? */ inline void GeneratorRealPowerSnapshotsAt ( Types::timestampSnapshot timestamp @@ -2033,13 +2033,13 @@ class PowerGrid { USAGE_ASSERT ( snapshotsAtTimestamp.empty() ); Types::index position = PositionOf( timestamp ); - if ( position != Const::NONE ) + if ( position != Const::NONE ) { for ( Types::vertexId generatorId = 0 ; generatorId < generatorRealPowerSnapshots_.size() - ; ++generatorId ) + ; ++generatorId ) { // if there is a snapshot at a generator there should be at least position many - ESSENTIAL_ASSERT ( generatorRealPowerSnapshots_[generatorId].size() > position ); + ESSENTIAL_ASSERT ( generatorRealPowerSnapshots_[generatorId].size() > position ); if ( generatorRealPowerSnapshots_[generatorId].size() == 0 ) { // No snapshots available at the generator with generatorId snapshotsAtTimestamp.emplace_back( Const::NONE ); @@ -2049,7 +2049,7 @@ class PowerGrid { } // if position } ///@} - + ///@name Generator Reactive Power Snapshot ///@todo Not fully supported ///@{ @@ -2067,7 +2067,7 @@ class PowerGrid { * * @return The generation at a @p timestamp (maximum real power * generation in p.u.). - * + * * @todo Reactive power is not supported in that way. */ inline Types::generatorSnapshot GeneratorReactivePowerSnapshotAt ( Types::generatorId generatorId @@ -2080,9 +2080,9 @@ class PowerGrid { if ( position != Const::NONE ) { return GeneratorReactivePowerSnapshotAt ( generatorId, position ); - } else + } else { // No snapshot available - return Const::NONE; + return Const::NONE; } } @@ -2114,7 +2114,7 @@ class PowerGrid { * @details If the generator has no generation value assigned for * the given timestamp, the method returns * @p Const::NONE. - * + * * @note Timestamp is not supported for reactive power currently! * * @param generatorId The generator identifier. @@ -2122,7 +2122,7 @@ class PowerGrid { * * @return The generation at a @p timestamp (maximum real power * generation in p.u.). - * + * * @todo Logic for reactive power if data allows it. This is not clean. */ inline Types::generatorSnapshot GeneratorReactivePowerSnapshotAt ( Types::generatorId generatorId @@ -2178,7 +2178,7 @@ class PowerGrid { * @return The load at the timestamp. */ inline Types::loadSnapshot LoadSnapshotOf ( Types::loadId loadId - , Types::timestampSnapshot timestamp ) + , Types::timestampSnapshot timestamp ) { USAGE_ASSERT ( loadId != Const::NONE ); USAGE_ASSERT ( loadId < loads_.size() ); @@ -2219,21 +2219,21 @@ class PowerGrid { * timestampPosition. */ inline Types::loadSnapshot LoadSnapshotOf ( Types::loadId loadId - , Types::index timestampPosition ) + , Types::index timestampPosition ) { USAGE_ASSERT ( loadId != Const::NONE ); USAGE_ASSERT ( loadId < loads_.size() ); USAGE_ASSERT ( timestampPosition != Const::NONE ); USAGE_ASSERT ( loadSnapshots_[loadId].size() <= timestamps_.size()); - USAGE_ASSERT ( timestampPosition <= loadSnapshots_[loadId].size() + USAGE_ASSERT ( timestampPosition <= loadSnapshots_[loadId].size() || loadSnapshots_[loadId].size() == 0 ); if ( loadSnapshots_[loadId].size() != 0 ) { return loadSnapshots_[loadId][timestampPosition]; - } else + } else { // No snapshot available at the load with loadId - return Const::NONE; + return Const::NONE; } } @@ -2254,7 +2254,7 @@ class PowerGrid { USAGE_ASSERT ( loadId < loads_.size() ); USAGE_ASSERT ( timestampPosition != Const::NONE ); USAGE_ASSERT ( loadSnapshots_[loadId].size() <= timestamps_.size()); - USAGE_ASSERT ( timestampPosition <= loadSnapshots_[loadId].size() + USAGE_ASSERT ( timestampPosition <= loadSnapshots_[loadId].size() || loadSnapshots_[loadId].size() == 0 ); if ( loadSnapshots_[loadId].size() != 0 ) @@ -2262,7 +2262,7 @@ class PowerGrid { return loadSnapshots_[loadId][timestampPosition]; } else { // No snapshot available at the load with loadId - return Const::NONE; + return Const::NONE; } } @@ -2278,7 +2278,7 @@ class PowerGrid { */ inline void LoadSnapshotsAt ( Types::vertexId vertexId , Types::index timestampPosition - , std::vector & loadSnapshots ) + , std::vector & loadSnapshots ) { USAGE_ASSERT ( vertexId < Graph().Vertices().size() ); USAGE_ASSERT ( timestampPosition != Const::NONE ); @@ -2306,13 +2306,13 @@ class PowerGrid { */ inline void LoadSnapshotsAt ( TVertex const & vertex , Types::index timestampPosition - , std::vector & loadSnapshots ) + , std::vector & loadSnapshots ) { USAGE_ASSERT( loadSnapshots.empty() ); Types::vertexId vertexId = VertexId( vertex ); ESSENTIAL_ASSERT( vertexId < Graph().Vertices().size() ); - + LoadSnapshotsAt ( vertexId, timestampPosition, loadSnapshots ); } @@ -2326,19 +2326,19 @@ class PowerGrid { * @param loadSnapshotsAtTimestamp The load snapshots at the timestamp. */ inline void LoadSnapshotsAt ( Types::timestampSnapshot timestamp - , std::vector & loadSnapshotsAtTimestamp ) + , std::vector & loadSnapshotsAtTimestamp ) { USAGE_ASSERT ( !timestamps_.empty() ); USAGE_ASSERT ( loadSnapshotsAtTimestamp.empty() ); Types::index position = PositionOf( timestamp ); - if ( position != Const::NONE ) + if ( position != Const::NONE ) { for ( Types::loadId loadId = 0 ; loadId < loadSnapshots_.size() - ; ++loadId ) + ; ++loadId ) { - if ( loadSnapshots_[loadId].size() == 0 ) + if ( loadSnapshots_[loadId].size() == 0 ) { // No snapshot available loadSnapshotsAtTimestamp.emplace_back( Const::NONE ); } @@ -2357,23 +2357,23 @@ class PowerGrid { * * @param[in] function The function pointer, e.g., lambda function * that has a generator object as input. - * + * * @code{.cpp} * for_all_generators ( - * []( TGeneratorProperties & generatorProperty ) - * { + * []( TGeneratorProperties & generatorProperty ) + * { * // Do something with the generator object. * } * ); * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all generators. */ - template - inline - void for_all_generators ( FUNCTION function ) + template + inline + void for_all_generators ( FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_generators ( *this @@ -2385,23 +2385,23 @@ class PowerGrid { * * @param[in] function The function pointer, e.g., lambda function * that has a generator object as input - * + * * @code{.cpp} * for_all_generators ( - * []( TGeneratorProperties const & generatorProperty ) - * { + * []( TGeneratorProperties const & generatorProperty ) + * { * // Do something with the generator object. * } * ); * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all generators of a @c power grid. @c */ - template - inline - void for_all_generators ( FUNCTION function ) const + template + inline + void for_all_generators ( FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_generators ( *this @@ -2414,12 +2414,12 @@ class PowerGrid { * * @param vertex The vertex @f$\vertex\in\vertices@f$. * @param[in] function The function. - * + * * @code{.cpp} - * for_all_generators_at ( vertex, - * []( TGeneratorProperties & generatorProperty ) - * { - * // Do something with the generator vertex. + * for_all_generators_at ( vertex, + * []( TGeneratorProperties & generatorProperty ) + * { + * // Do something with the generator vertex. * } * ); * @endcode @@ -2428,8 +2428,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generators of @p vertex. */ - template - inline + template + inline void for_all_generators_at ( TVertex const & vertex , FUNCTION function ) { @@ -2445,12 +2445,12 @@ class PowerGrid { * * @param vertex The vertex @f$\vertex\in\vertices@f$. * @param[in] function The function. - * + * * @code{.cpp} - * for_all_generators_at ( vertex, - * []( TGeneratorProperties const & generatorProperty ) - * { - * // Do something with the generator vertex. + * for_all_generators_at ( vertex, + * []( TGeneratorProperties const & generatorProperty ) + * { + * // Do something with the generator vertex. * } * ); * @endcode @@ -2459,8 +2459,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generators of @p vertex. */ - template - inline + template + inline void for_all_generators_at ( TVertex const & vertex , FUNCTION function ) const { @@ -2476,12 +2476,12 @@ class PowerGrid { * * @param vertexId The vertex identifier. * @param[in] function The function. - * + * * @code{.cpp} * for_all_generators_at ( - * []( TGeneratorProperties & generatorProperty ) - * { - * // Do something with the generator vertex. + * []( TGeneratorProperties & generatorProperty ) + * { + * // Do something with the generator vertex. * } * ); * @endcode @@ -2490,8 +2490,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generators of @p vertexId. */ - template - inline + template + inline void for_all_generators_at ( Types::vertexId vertexId , FUNCTION function ) { @@ -2507,12 +2507,12 @@ class PowerGrid { * * @param vertexId The vertex identifier. * @param[in] function The function. - * + * * @code{.cpp} * for_all_generators_at ( vertexId, - * []( TGeneratorProperties const & generatorProperty ) - * { - * // Do something with the generator vertex. + * []( TGeneratorProperties const & generatorProperty ) + * { + * // Do something with the generator vertex. * } * ); * @endcode @@ -2521,8 +2521,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generators of @p vertexId. */ - template - inline + template + inline void for_all_generators_at ( Types::vertexId vertexId , FUNCTION function ) const { @@ -2537,11 +2537,11 @@ class PowerGrid { * * @param[in] function The function pointer, e.g., lambda function * that has a vertexId as input. - * + * * @code{.cpp} * for_all_vertex_identifiers_with_generator ( - * []( Types::vertexId vertexId ) - * { + * []( Types::vertexId vertexId ) + * { * // Do something with the identifier of a vertex. * } * ); @@ -2551,9 +2551,9 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all vertex identifiers having a generator. */ - template - inline - void for_all_vertex_identifiers_with_generator ( FUNCTION function ) + template + inline + void for_all_vertex_identifiers_with_generator ( FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_vertex_identifiers_with_generator ( *this @@ -2565,11 +2565,11 @@ class PowerGrid { * * @param[in] function The function pointer, e.g., lambda function * that has a vertexId as input. - * + * * @code{.cpp} * for_all_vertex_identifiers_with_generator ( - * []( Types::vertexId vertexId ) - * { + * []( Types::vertexId vertexId ) + * { * // Do something with the identifier of a vertex. * } * ); @@ -2579,9 +2579,9 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all vertex identifiers having a generator. */ - template - inline - void for_all_vertex_identifiers_with_generator ( FUNCTION function ) const + template + inline + void for_all_vertex_identifiers_with_generator ( FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_vertex_identifiers_with_generator ( *this @@ -2594,11 +2594,11 @@ class PowerGrid { * @param[in] vertex The vertex object @f$\vertex\in\vertices@f$. * @param[in] function The function pointer, e.g., lambda function * that has a generatorId as input. - * + * * @code{.cpp} - * for_all_generator_identifiers_at ( vertex, - * []( Types::generatorId generatorId ) - * { + * for_all_generator_identifiers_at ( vertex, + * []( Types::generatorId generatorId ) + * { * // Do something with the identifier of the generator. * } * ); @@ -2608,8 +2608,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generator identifiers at @p vertex. */ - template - inline + template + inline void for_all_generator_identifiers_at ( TVertex const & vertex , FUNCTION function ) { @@ -2625,11 +2625,11 @@ class PowerGrid { * @param[in] vertex The vertex object @f$\vertex\in\vertices@f$. * @param[in] function The function pointer, e.g., lambda function * that has a generatorId as input. - * + * * @code{.cpp} - * for_all_generator_identifiers_at ( vertex, - * []( Types::generatorId generatorId ) - * { + * for_all_generator_identifiers_at ( vertex, + * []( Types::generatorId generatorId ) + * { * // Do something with the identifier of the generator. * } * ); @@ -2639,8 +2639,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generator identifiers at @p vertex. */ - template - inline + template + inline void for_all_generator_identifiers_at ( TVertex const & vertex , FUNCTION function ) const { @@ -2656,11 +2656,11 @@ class PowerGrid { * @param[in] vertexId The vertex identifier. * @param[in] function The function pointer, e.g., lambda function * that has a generatorId as input. - * + * * @code{.cpp} - * for_all_generator_identifiers_at ( vertexId, - * []( Types::generatorId generatorId ) - * { + * for_all_generator_identifiers_at ( vertexId, + * []( Types::generatorId generatorId ) + * { * // Do something with the identifier of the generator. * } * ); @@ -2670,8 +2670,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generator identifiers at @p vertexId. */ - template - inline + template + inline void for_all_generator_identifiers_at ( Types::vertexId vertexId , FUNCTION function ) { @@ -2687,11 +2687,11 @@ class PowerGrid { * @param[in] vertexId The vertex identifier. * @param[in] function The function pointer, e.g., lambda function * that has a generatorId as input. - * + * * @code{.cpp} - * for_all_generator_identifiers_at ( vertexId, - * []( Types::generatorId generatorId ) - * { + * for_all_generator_identifiers_at ( vertexId, + * []( Types::generatorId generatorId ) + * { * // Do something with the identifier of the generator. * } * ); @@ -2701,8 +2701,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generator identifiers at @p vertexId. */ - template - inline + template + inline void for_all_generator_identifiers_at ( Types::vertexId vertexId , FUNCTION function ) const { @@ -2718,12 +2718,12 @@ class PowerGrid { * * @param[in] function The function pointer, e.g., lambda function * that has a vertexId and a generator object as input. - * + * * @code{.cpp} * for_all_generator_tuple ( * []( Types::vertexId vertexId - * , TGeneratorProperties & generator ) - * { + * , TGeneratorProperties & generator ) + * { * // Do something with ?. * } * ); @@ -2733,9 +2733,9 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generator tuple of the from (vertexId, generator). */ - template - inline - void for_all_generator_tuple ( FUNCTION function ) + template + inline + void for_all_generator_tuple ( FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_generator_tuple ( *this @@ -2748,12 +2748,12 @@ class PowerGrid { * * @param[in] function The function pointer, e.g., lambda function * that has a vertexId and a generator object as input. - * + * * @code{.cpp} * for_all_generator_tuple ( * []( Types::vertexId vertexId - * , TGeneratorProperties generator ) - * { + * , TGeneratorProperties generator ) + * { * // Do something with ?. * } * ); @@ -2763,9 +2763,9 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generator tuple of the from (vertexId, generator). */ - template - inline - void for_all_generator_tuple ( FUNCTION function ) const + template + inline + void for_all_generator_tuple ( FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_generator_tuple ( *this @@ -2778,12 +2778,12 @@ class PowerGrid { * * @param[in] function The function pointer, e.g., lambda function * that has a vertexId and a vector of generator objects as input. - * + * * @code{.cpp} * for_all_generators_tuple ( * []( Types::vertexId vertexId - * , std::vector generators ) - * { + * , std::vector generators ) + * { * // Do something with ?. * } * ); @@ -2793,9 +2793,9 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generator tuple of the from (vertexId, generators). */ - template - inline - void for_all_generators_tuple ( FUNCTION function ) + template + inline + void for_all_generators_tuple ( FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_generators_tuple ( *this @@ -2808,12 +2808,12 @@ class PowerGrid { * * @param[in] function The function pointer, e.g., lambda function * that has a vertexId and a vector of generator objects as input. - * + * * @code{.cpp} * for_all_generators_tuple( * []( Types::vertexId vertexId - * , std::vector generators ) - * { + * , std::vector generators ) + * { * // Do something with ?. * } * ); @@ -2823,9 +2823,9 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all generator tuple of the from (vertexId, generators). */ - template - inline - void for_all_generators_tuple ( FUNCTION function ) const + template + inline + void for_all_generators_tuple ( FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_generators_tuple ( *this @@ -2844,8 +2844,8 @@ class PowerGrid { * @code{.cpp} * for_all_real_power_generator_snapshots( * []( Types::index snapshotId - * , Types::generatorSnapshot snapshot ) - * { + * , Types::generatorSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); @@ -2855,9 +2855,9 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all real power generator snapshots. */ - template - inline - void for_all_real_power_generator_snapshots ( FUNCTION function ) + template + inline + void for_all_real_power_generator_snapshots ( FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots ( *this @@ -2874,8 +2874,8 @@ class PowerGrid { * @code{.cpp} * for_all_real_power_generator_snapshots( * []( Types::index snapshotId - * , Types::generatorSnapshot snapshot ) - * { + * , Types::generatorSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); @@ -2885,9 +2885,9 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all real power generator snapshots. */ - template - inline - void for_all_real_power_generator_snapshots( FUNCTION function ) const + template + inline + void for_all_real_power_generator_snapshots( FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots ( *this @@ -2899,33 +2899,33 @@ class PowerGrid { * snapshots of a generator with @p generatorId. * * @param generatorId The identifier of the generator. - * @param[in] function The function, e.g., lambda function - * + * @param[in] function The function, e.g., lambda function + * * @pre Check if the generator identifier @p generatorId of the * generatorProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasGenerator ( generatorId ) ) * { - * for_all_real_power_generator_snapshots_of ( + * for_all_real_power_generator_snapshots_of ( * generatorId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power generator snapshots of @p generatorId. */ - template - inline + template + inline void for_all_real_power_generator_snapshots_of ( Types::generatorId generatorId - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots_of ( *this @@ -2945,25 +2945,25 @@ class PowerGrid { * @code{.cpp} * if ( network.HasGenerator ( generatorId ) ) * { - * for_all_real_power_generator_snapshots_of ( + * for_all_real_power_generator_snapshots_of ( * generatorId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power generator snapshots of @p generatorId. */ - template - inline + template + inline void for_all_real_power_generator_snapshots_of ( Types::vertexId generatorId - , FUNCTION function ) const + , FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots_of ( *this @@ -2977,31 +2977,31 @@ class PowerGrid { * * @param generatorProperties The generator properties. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the generator's properties @p * generatorProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasGenerator ( network.GeneratorId ( generatorProperties ) ) ) * { * for_all_real_power_generator_snapshots_of ( * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); * } - * @endcode - * + * @endcode + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power generator snapshots of @p generator. */ - template - inline + template + inline void for_all_real_power_generator_snapshots_of ( TGeneratorProperties const & generatorProperties - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots_of ( *this @@ -3015,31 +3015,31 @@ class PowerGrid { * * @param generatorProperties The generator properties. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the generator's properties @p * generatorProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasGenerator ( network.GeneratorId ( generatorProperties ) ) ) * { * for_all_real_power_generator_snapshots_of ( * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); * } - * @endcode - * + * @endcode + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power generator snapshots of @p generator. */ - template - inline + template + inline void for_all_real_power_generator_snapshots_of ( TGeneratorProperties const & generatorProperties - , FUNCTION function ) const + , FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots_of ( *this @@ -3053,32 +3053,32 @@ class PowerGrid { * * @param vertexId The identifier of a vertex. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { * for_all_real_power_generator_snapshots_at ( * vertexId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power generator snapshots at @p vertexId. */ - template - inline + template + inline void for_all_real_power_generator_snapshots_at ( Types::vertexId vertexId - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots_at ( *this @@ -3092,32 +3092,32 @@ class PowerGrid { * * @param vertexId The identifier of a vertex. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { * for_all_real_power_generator_snapshots_at ( * vertexId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power generator snapshots at @p vertexId. */ - template - inline + template + inline void for_all_real_power_generator_snapshots_at ( Types::vertexId vertexId - , FUNCTION function ) const + , FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots_at ( *this @@ -3131,32 +3131,32 @@ class PowerGrid { * * @param vertex The vertex. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the vertex @p vertex exists before using * this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( network.Graph().VertexId( vertex ) ) ) * { * for_all_real_power_generator_snapshots_at ( * vertex, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power generator snapshots at @p vertex. */ - template - inline + template + inline void for_all_real_power_generator_snapshots_at ( TVertex const & vertex - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots_at ( *this @@ -3170,32 +3170,32 @@ class PowerGrid { * * @param vertex The vertex. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the vertex @p vertex exists before using * this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( network.Graph().VertexId( vertex ) ) ) * { * for_all_real_power_generator_snapshots_at ( * vertex, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and generator snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power generator snapshots at @p vertex. */ - template - inline + template + inline void for_all_real_power_generator_snapshots_at ( TVertex const & vertex - , FUNCTION function ) const + , FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots_at ( *this @@ -3211,11 +3211,11 @@ class PowerGrid { * @param vertexId The identifier of a vertex. * @param timestampPosition The position of the snapshot. * (timestamp of the snapshot). - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -3223,23 +3223,23 @@ class PowerGrid { * vertexId, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); - * } + * } * @endcode * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power generator at @p timestamp at @p vertex. */ - template + template inline void for_all_real_power_generator_snapshots_at ( Types::vertexId vertexId , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots_at ( *this @@ -3257,10 +3257,10 @@ class PowerGrid { * @param timestampPosition The position of the snapshot * (timestamp of the snapshot). * @param[in] function The function, e.g. , lambda function. - * + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -3268,19 +3268,19 @@ class PowerGrid { * vertexId, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); - * } + * } * @endcode * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power generator at @p timestamp at @p vertex. */ - template + template inline void for_all_real_power_generator_snapshots_at ( Types::vertexId vertexId , Types::index timestampPosition @@ -3311,23 +3311,23 @@ class PowerGrid { * vertex, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); - * } + * } * @endcode * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load at @p timestamp at @p vertex. */ - template + template inline void for_all_real_power_generator_snapshots_at ( TVertex const & vertex , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_generator_snapshots_at ( *this @@ -3355,19 +3355,19 @@ class PowerGrid { * vertex, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); - * } + * } * @endcode * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load at @p timestamp at @p vertex. */ - template + template inline void for_all_real_power_generator_snapshots_at ( TVertex const & vertex , Types::index timestampPosition @@ -3384,7 +3384,7 @@ class PowerGrid { ///@name Seriell Load Loops ///@{ #pragma mark SERIELL_LOAD_LOOPS - + /** * @brief The @p for loop over all @p loads (vertex * independent). @@ -3394,9 +3394,9 @@ class PowerGrid { * * @code{.cpp} * for_all_loads ( - * []( TLoadProperties & load ) - * { - * // Do something with the load object. + * []( TLoadProperties & load ) + * { + * // Do something with the load object. * } * ); * @endcode @@ -3405,9 +3405,9 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all loads. */ - template - inline - void for_all_loads ( FUNCTION function ) + template + inline + void for_all_loads ( FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_loads ( *this @@ -3423,9 +3423,9 @@ class PowerGrid { * * @code{.cpp} * for_all_loads ( - * []( TLoadProperties const & load ) - * { - * // Do something with the load object. + * []( TLoadProperties const & load ) + * { + * // Do something with the load object. * } * ); * @endcode @@ -3434,8 +3434,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all loads. */ - template - inline + template + inline void for_all_loads ( FUNCTION function ) const { internal::PowerGridLoopDifferentiation @@ -3453,9 +3453,9 @@ class PowerGrid { * * @code{.cpp} * for_all_vertex_identifiers_with_load ( - * []( Types::vertexId vertexId ) - * { - * // Do something with the vertex identifier that has loads. + * []( Types::vertexId vertexId ) + * { + * // Do something with the vertex identifier that has loads. * } * ); * @endcode @@ -3464,9 +3464,9 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all vertex identifier that have a load. */ - template + template inline - void for_all_vertex_identifiers_with_load ( FUNCTION function ) const + void for_all_vertex_identifiers_with_load ( FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_vertex_identifiers_with_load ( *this @@ -3484,9 +3484,9 @@ class PowerGrid { * * @code{.cpp} * for_all_load_identifiers_at( vertexId - * , []( Types::loadId loadId ) - * { - * // Do something with the load identifier at the @p vertex. + * , []( Types::loadId loadId ) + * { + * // Do something with the load identifier at the @p vertex. * } * ); * @endcode @@ -3495,7 +3495,7 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all load identifier at @p vertexId. */ - template + template inline void for_all_load_identifiers_at ( Types::vertexId vertexId , FUNCTION function ) const @@ -3516,9 +3516,9 @@ class PowerGrid { * * @code{.cpp} * for_all_load_identifiers_at ( vertex - * , []( Types::loadId loadId ) - * { - * // Do something with the load identifier at the @p vertex. + * , []( Types::loadId loadId ) + * { + * // Do something with the load identifier at the @p vertex. * } * ); * @endcode @@ -3527,10 +3527,10 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all load identifier at @p vertex. */ - template + template inline void for_all_load_identifiers_at ( TVertex const & vertex - , FUNCTION function ) const + , FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_load_identifiers_at ( vertex @@ -3543,14 +3543,14 @@ class PowerGrid { * @p vertex. * * @param vertex The vertex object. - * @param[in] function The function pointer, e.g., lambda + * @param[in] function The function pointer, e.g., lambda * function that has a load object as input. * * @code{.cpp} * for_all_loads_at ( vertex - * , []( TLoadProperties & load ) - * { - * // Do something with the load object at the @p vertex. + * , []( TLoadProperties & load ) + * { + * // Do something with the load object at the @p vertex. * } * ); * @endcode @@ -3559,10 +3559,10 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all loads at @p vertex. */ - template - inline + template + inline void for_all_loads_at ( TVertex const & vertex - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_loads_at ( vertex @@ -3580,9 +3580,9 @@ class PowerGrid { * * @code{.cpp} * for_all_loads_at ( vertex - * , []( TLoadProperties const & load ) - * { - * // Do something with the load object at the @p vertex. + * , []( TLoadProperties const & load ) + * { + * // Do something with the load object at the @p vertex. * } * ); * @endcode @@ -3591,8 +3591,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all loads at @p vertex. */ - template - inline + template + inline void for_all_loads_at ( TVertex const & vertex , FUNCTION function ) const { @@ -3612,9 +3612,9 @@ class PowerGrid { * * @code{.cpp} * for_all_loads_at ( vertexId - * , []( TLoadProperties & load ) - * { - * // Do something with the load object at the @p vertexId. + * , []( TLoadProperties & load ) + * { + * // Do something with the load object at the @p vertexId. * } * ); * @endcode @@ -3623,15 +3623,15 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all loads at @p vertexId. */ - template - inline + template + inline void for_all_loads_at ( Types::vertexId const vertexId - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_loads_at ( vertexId , *this - , function ); + , function ); } /** @@ -3644,9 +3644,9 @@ class PowerGrid { * * @code{.cpp} * for_all_loads_at ( vertexId - * , []( TLoadProperties const & load ) - * { - * // Do something with the load object at the @p vertexId. + * , []( TLoadProperties const & load ) + * { + * // Do something with the load object at the @p vertexId. * } * @endcode * @@ -3654,8 +3654,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all loads at @p vertexId. */ - template - inline + template + inline void for_all_loads_at ( Types::vertexId vertexId , FUNCTION function ) const { @@ -3676,9 +3676,9 @@ class PowerGrid { * @code{.cpp} * for_all_load_tuples ( * []( Types::vertexId vertexId - * , TLoadProperties & load ) - * { - * // Do something with the vertexId and load object. + * , TLoadProperties & load ) + * { + * // Do something with the vertexId and load object. * } * ); * @endcode @@ -3687,13 +3687,13 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all load tuples (vertexId, load). */ - template - inline - void for_all_load_tuples ( FUNCTION function ) + template + inline + void for_all_load_tuples ( FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_load_tuples ( *this - , function ); + , function ); } /** @@ -3707,9 +3707,9 @@ class PowerGrid { * @code{.cpp} * for_all_load_tuples ( * []( Types::vertexId vertexId - * , TLoadProperties const & load ) - * { - * // Do something with the vertexId and load object. + * , TLoadProperties const & load ) + * { + * // Do something with the vertexId and load object. * } * ); * @endcode @@ -3718,8 +3718,8 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all load tuples (vertexId, load). */ - template - inline + template + inline void for_all_load_tuples ( FUNCTION function ) const { internal::PowerGridLoopDifferentiation @@ -3738,9 +3738,9 @@ class PowerGrid { * @code{.cpp} * for_all_loads_tuple ( * []( Types::vertexId vertexId - * , std::vector & loads ) - * { - * // Do something with the vertexId and load object. + * , std::vector & loads ) + * { + * // Do something with the vertexId and load object. * } * ); * @endcode @@ -3749,9 +3749,9 @@ class PowerGrid { * @tparam FUNCTION The function object that is called for * all loads tuple (vertexId, load). */ - template - inline - void for_all_loads_tuple ( FUNCTION function ) + template + inline + void for_all_loads_tuple ( FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_loads_tuple ( *this @@ -3767,24 +3767,24 @@ class PowerGrid { * @brief The @c for loop @c over all load real power snapshots. * * @param[in] function The function, e.g., lambda function. - * + * * @code{.cpp} * for_all_real_power_load_snapshots( * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots. */ - template - inline - void for_all_real_power_load_snapshots( FUNCTION function ) + template + inline + void for_all_real_power_load_snapshots( FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots ( *this @@ -3795,24 +3795,24 @@ class PowerGrid { * @brief The @c for loop @c over all load real power snapshots. * * @param[in] function The function, e.g., lambda function. - * + * * @code{.cpp} * for_all_real_power_load_snapshots( * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots. */ - template - inline - void for_all_real_power_load_snapshots( FUNCTION function ) const + template + inline + void for_all_real_power_load_snapshots( FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots ( *this @@ -3825,32 +3825,32 @@ class PowerGrid { * * @param[in] loadId The load identifier. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the load identifier @p loadId of the * loadProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasLoad ( loadId ) ) * { - * for_all_real_power_load_snapshots_of ( + * for_all_real_power_load_snapshots_of ( * loadId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots of @p loadId. */ - template - inline + template + inline void for_all_real_power_load_snapshots_of ( Types::loadId loadId - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_of ( *this @@ -3864,32 +3864,32 @@ class PowerGrid { * * @param[in] loadId The load identifier. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the load identifier @p loadId of the * loadProperties exists before using this method. - * + * * @code{.cpp} * if ( network.HasLoad ( loadId ) ) * { - * for_all_real_power_load_snapshots_of ( + * for_all_real_power_load_snapshots_of ( * loadId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots of @p loadId. */ - template - inline + template + inline void for_all_real_power_load_snapshots_of ( Types::vertexId loadId - , FUNCTION function ) const + , FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_of ( *this @@ -3903,31 +3903,31 @@ class PowerGrid { * * @param[in] load The load object. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the load's properties @p loadProperties exists * before using this method. - * + * * @code{.cpp} * if ( network.HasLoad ( network.LoadId ( loadProperties ) ) ) * { * for_all_real_power_load_snapshots_of ( * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots of @p load. */ - template - inline + template + inline void for_all_real_power_load_snapshots_of ( TLoadProperties load - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_of ( *this @@ -3941,31 +3941,31 @@ class PowerGrid { * * @param[in] load The load object. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the load's properties @p loadProperties exists * before using this method. - * + * * @code{.cpp} * if ( network.HasLoad ( network.LoadId ( loadProperties ) ) ) * { * for_all_real_power_load_snapshots_of ( * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots of @p load. */ - template - inline + template + inline void for_all_real_power_load_snapshots_of ( TLoadProperties const & load - , FUNCTION function ) const + , FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_of ( *this @@ -3979,32 +3979,32 @@ class PowerGrid { * * @param[in] vertexId The vertex identifier. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { * for_all_real_power_load_snapshots_at ( * vertexId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots at @p vertexId. */ - template - inline + template + inline void for_all_real_power_load_snapshots_at ( Types::vertexId vertexId - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_at ( *this @@ -4018,32 +4018,32 @@ class PowerGrid { * * @param[in] vertexId The vertex identifier. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { * for_all_real_power_load_snapshots_at ( * vertexId, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots at @p vertexId. */ - template - inline + template + inline void for_all_real_power_load_snapshots_at ( Types::vertexId vertexId - , FUNCTION function ) const + , FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_at ( *this @@ -4057,31 +4057,31 @@ class PowerGrid { * * @param vertex The vertex object. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the @p vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( network.Graph().VertexId( vertex ) ) ) * { * for_all_real_power_load_snapshots_at ( * vertex, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots at @p vertex. */ - template - inline + template + inline void for_all_real_power_load_snapshots_at( TVertex const & vertex - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_at ( *this @@ -4096,31 +4096,31 @@ class PowerGrid { * @param vertex The vertex object. * @param[in] timestampPosition The timestamp position * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the @p vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( network.Graph().VertexId( vertex ) ) ) * { * for_all_real_power_load_snapshots_at ( * vertex, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots at @p vertex. */ - template - inline + template + inline void for_all_real_power_load_snapshots_at ( TVertex const & vertex - , FUNCTION function ) const + , FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_at ( *this @@ -4135,11 +4135,11 @@ class PowerGrid { * @param vertexId The identifier of a vertex * @param timestampPosition The position of the snapshot * (timestamp of the snapshot). - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -4147,23 +4147,23 @@ class PowerGrid { * vertexId, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots at @p vertexId. */ - template - inline + template + inline void for_all_real_power_load_snapshots_at ( Types::vertexId vertexId , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_at ( *this @@ -4179,11 +4179,11 @@ class PowerGrid { * @param vertexId The identifier of a vertex * @param timestampPosition The position of the snapshot * (timestamp of the snapshot). - * @param[in] function The function, e.g. , lambda function - * + * @param[in] function The function, e.g. , lambda function + * * @pre Check if the vertex identifier @p vertexId of the * vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -4191,23 +4191,23 @@ class PowerGrid { * vertexId * , timestampPosition * , []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load snapshots at @p vertexId. */ - template - inline + template + inline void for_all_real_power_load_snapshots_at ( Types::vertexId vertexId , Types::index timestampPosition - , FUNCTION function ) const + , FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_at ( *this @@ -4223,9 +4223,9 @@ class PowerGrid { * @param vertex The vertex object. * @param[in] timestampPosition The timestamp position. * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the @p vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -4233,23 +4233,23 @@ class PowerGrid { * vertex * , timestampPosition * , []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); - * } + * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load at @p timestamp at @p vertex. */ - template - inline + template + inline void for_all_real_power_load_snapshots_at( TVertex const & vertex , Types::index timestampPosition - , FUNCTION function ) + , FUNCTION function ) { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_at ( *this @@ -4265,9 +4265,9 @@ class PowerGrid { * @param vertex The vertex object. * @param[in] timestampPosition The timestamp position * @param[in] function The function, e.g., lambda function. - * + * * @pre Check if the @p vertex exists before using this method. - * + * * @code{.cpp} * if ( network.Graph().VertexExists( vertexId ) ) * { @@ -4275,23 +4275,23 @@ class PowerGrid { * vertex, * timestampPosition, * []( Types::index snapshotId - * , Types::loadSnapshot snapshot ) - * { + * , Types::loadSnapshot snapshot ) + * { * // Do something with the snapshotId and load snapshot object. * } * ); - * } + * } * @endcode - * + * * @tparam Policy The execution policy, e.g., ExecutionPolicy::sequential. * @tparam FUNCTION The function object that is called for * all real power load at @p timestamp at @p vertex. */ - template - inline + template + inline void for_all_real_power_load_snapshots_at ( TVertex const & vertex , Types::index timestampPosition - , FUNCTION function ) const + , FUNCTION function ) const { internal::PowerGridLoopDifferentiation ::for_all_real_power_load_snapshots_at ( *this @@ -4301,7 +4301,7 @@ class PowerGrid { } ///@} - inline Types::count NumberOfGenerators() const + inline Types::count NumberOfGenerators() const { return numberOfGenerators_; } @@ -4333,8 +4333,8 @@ class PowerGrid { std::vector< std::vector > generatorsAtVertex_; /**< Mapping generator to a vertex */ std::vector< TGeneratorProperties > generators_; /**< Vector of generator vertices */ std::vector< bool > generatorExists_; /**< Vector that describes which generator vertices exist */ - - std::vector< std::vector > loadsAtVertex_; + + std::vector< std::vector > loadsAtVertex_; std::vector< TLoadProperties > loads_; /**< Vector of load vertices */ std::vector< bool > loadExists_; /**< Vector that describes which load vertices exist */ @@ -4367,7 +4367,7 @@ class PowerGrid { */ template inline void SwitchEdges ( PowerGridType & grid - , Subgraph remainingSubgraph) + , Subgraph remainingSubgraph) { using TEdge = typename PowerGridType::TGraph::TEdge; grid.Graph().template for_all_edges( @@ -4379,7 +4379,7 @@ inline void SwitchEdges ( PowerGridType & grid } ); - for ( auto edgeId : remainingSubgraph.Edges() ) + for ( auto edgeId : remainingSubgraph.Edges() ) { auto & properties = grid.Graph().EdgeAt(edgeId).Properties(); properties.Status() = true; diff --git a/include/Exceptions/Assertions.hpp b/include/Exceptions/Assertions.hpp index ddd4d55a..85068bf6 100644 --- a/include/Exceptions/Assertions.hpp +++ b/include/Exceptions/Assertions.hpp @@ -4,15 +4,15 @@ * both @p ESSENTIAL_ASSERT and @p USAGE_ASSERT throw asserts if * needed, otherwise if @p EGOA_ENABLE_EXCEPTION_HANDLING is * enabled in the cmake setting both methods throw exceptions. - * + * * Operation | Effect * ---------------------------------------------|----------------------------- - * @code ESSENTIAL_ASSERT ( false ); @endcode | Throws an essential assert. Essential asserts - * | show that a crucial invariant in the code is + * @code ESSENTIAL_ASSERT ( false ); @endcode | Throws an essential assert. Essential asserts + * | show that a crucial invariant in the code is * | violated. This is a hint of a programming mistake. - * @code USAGE_ASSERT ( false ); @endcode | Throws a usage assert. A usage assert shows - * | that the method is not used in a correct way, - * | e.g., incorrect parameter input. Take a look + * @code USAGE_ASSERT ( false ); @endcode | Throws a usage assert. A usage assert shows + * | that the method is not used in a correct way, + * | e.g., incorrect parameter input. Take a look * | at the precondition section of the comments. * * Created on: Feb 14, 2019 @@ -35,7 +35,7 @@ std::cerr << " inside " << __FUNCTION__; \ std::cerr << ".\n Condition: " << #expr; \ abort(); \ - } + } #define USAGE_ASSERT( expr ) \ if (!(expr)) \ @@ -57,7 +57,7 @@ << " inside " << __FUNCTION__ \ << ".\n Condition: " << #expr; \ throw ( std::runtime_error ( message.str() ) ); \ - } + } #define USAGE_ASSERT( expr ) \ if (!(expr)) \ @@ -70,8 +70,8 @@ throw ( std::runtime_error( message.str() ) ); \ } #else // ifdef EGOA_ENABLE_EXCEPTION_HANDLING - #define ESSENTIAL_ASSERT( expr ) ( expr ) - #define USAGE_ASSERT( expr ) ( expr ) + #define ESSENTIAL_ASSERT( expr ) ( expr ) + #define USAGE_ASSERT( expr ) ( expr ) #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING #endif // ifdef EGOA_ENABLE_ASSERTION diff --git a/include/Exceptions/Exceptions.hpp b/include/Exceptions/Exceptions.hpp index d63678d3..ffc95d9b 100644 --- a/include/Exceptions/Exceptions.hpp +++ b/include/Exceptions/Exceptions.hpp @@ -4,7 +4,7 @@ * Created on: Nov 07, 2018 * Author: Franziska Wegner */ - + #ifndef EGOA__EXCEPTIONS__PGT_EXCEPTIONS_HPP #define EGOA__EXCEPTIONS__PGT_EXCEPTIONS_HPP @@ -23,8 +23,8 @@ template void my_exception(T arg1, T arg2, const char *file, const char *func, size_t line) { #ifdef PGT_EXCEPTION_HANDLING if ( arg1 < arg2 ) - throw runtime_error( (std::string)file + ":" + (std::string)func + ":" + std::to_string(line) + - ": index out of bound error with index:" + to_string(arg1) + + throw runtime_error( (std::string)file + ":" + (std::string)func + ":" + std::to_string(line) + + ": index out of bound error with index:" + to_string(arg1) + " > number of elements ( here " + to_string(arg2) + ")." ); #endif } @@ -55,7 +55,7 @@ class BoundMismatch : public std::runtime_error { { if ( minimum > maximum ) { throw BoundMismatch( minimum, maximum ); - } + } return true; } diff --git a/include/IO/Appearance/Color.hpp b/include/IO/Appearance/Color.hpp index 2f7d27bb..6ec442d1 100644 --- a/include/IO/Appearance/Color.hpp +++ b/include/IO/Appearance/Color.hpp @@ -15,15 +15,15 @@ namespace egoa { /** * @class Color - * + * * @code{.cpp} * ... * pgt::Color color(255,255,255); * pgt::Color color(0.9,0.5,0.1); * pgt::Color color(pgt::Color::Name::KITred); * std::cout << "Color: " << to_string(color.Green()) << std::endl; - * std::cout << "Color: " << color.Hexadecimal() << std::endl; - * + * std::cout << "Color: " << color.Hexadecimal() << std::endl; + * * std::cout << std::fixed << std::setprecision(3); * std::cout << color.red() << ", " * << color.green() << ", " @@ -31,7 +31,7 @@ namespace egoa { * << std::endl; * std::cout << "Color: " << color.Hexadecimal() << std::endl; * ... - * + * * @endcode */ class Color { @@ -132,7 +132,7 @@ class Color { , KITseablue50 /**< RGB <- ( 152, 167, 197 ), rgb <- ( 0.598, 0.656, 0.774 ) */ , KITseablue30 /**< RGB <- ( 193, 202, 220 ), rgb <- ( 0.758, 0.794, 0.864 ) */ , KITseablue15 /**< RGB <- ( 224, 229, 238 ), rgb <- ( 0.879, 0.897, 0.932 ) */ - // + // // Thesis Colors , THESISblue /**< RGB <- ( 86, 151, 197 ), rgb <- ( 0.337, 0.592, 0.773 ) */ , THESISblue_dark /**< RGB <- ( 54, 120, 167 ), rgb <- ( 0.212, 0.471, 0.655 ) */ @@ -257,11 +257,11 @@ class Color { , Yellow /**< RGB <- ( 235, 235, 235 ), rgb <- ( 0.92 , 0.92 , 0.92 ) */ , Yellowgreen /**< RGB <- ( 235, 235, 235 ), rgb <- ( 0.92 , 0.92 , 0.92 ) */ }; - public: - // Color ( Type::ubyte red = 0, Type::ubyte green = 0, Type::ubyte blue = 0, Type::ubyte alpha = 0 ) + public: + // Color ( Type::ubyte red = 0, Type::ubyte green = 0, Type::ubyte blue = 0, Type::ubyte alpha = 0 ) // : red_(red), green_(green), blue_(blue), alpha_(alpha) {} - Color ( Types::real red = 0.0, Types::real green = 0.0, Types::real blue = 0, Types::real alpha = 0 ) + Color ( Types::real red = 0.0, Types::real green = 0.0, Types::real blue = 0, Types::real alpha = 0 ) : red_(red), green_(green), blue_(blue), alpha_(alpha) { if ( red_ > 1) { red_ = red_ / 255; @@ -275,7 +275,7 @@ class Color { } Color(Color::Name name); - + ~Color(){} @@ -416,7 +416,7 @@ class Color { return os; } - + ///@Name Getter and setter ///@{ diff --git a/include/IO/Appearance/Stroke.hpp b/include/IO/Appearance/Stroke.hpp index 66c67a4e..e3ef804a 100644 --- a/include/IO/Appearance/Stroke.hpp +++ b/include/IO/Appearance/Stroke.hpp @@ -14,7 +14,7 @@ namespace egoa { /** * @class Stroke - * + * * @code{.cpp} * ... * //code example TODO @@ -55,25 +55,25 @@ class Stroke { ///@name Operators ///@{ #pragma mark OPERATORS - bool operator== ( const Stroke& rhs ) + bool operator== ( const Stroke& rhs ) { return stroke_ == rhs.stroke_; } - bool operator!= ( const Stroke& rhs ) + bool operator!= ( const Stroke& rhs ) { return !operator==(rhs); } ///@} Types::count Type() const { return stroke_; } - + ///@name Operators ///@{ #pragma mark OUTPUT - friend std::ostream & operator<< ( std::ostream & outputStream, Name stroke ) + friend std::ostream & operator<< ( std::ostream & outputStream, Name stroke ) { - switch ( stroke ) + switch ( stroke ) { case Name::solid: outputStream << "solid"; break; case Name::dashed: outputStream << "dashed"; break; diff --git a/include/IO/Helper/DataValidation.hpp b/include/IO/Helper/DataValidation.hpp index 2c1f2999..9f19890c 100644 --- a/include/IO/Helper/DataValidation.hpp +++ b/include/IO/Helper/DataValidation.hpp @@ -1,4 +1,4 @@ -/* +/* * DataValidation.hpp * * Created on: May 09, 2019 @@ -20,35 +20,35 @@ namespace egoa::IO::Helper { bool hasCorrectBound = true; // Check voltage bounds - graph.template for_all_vertices( - [&hasCorrectBound]( TVertex const & vertex ) + graph.template for_all_vertices( + [&hasCorrectBound]( TVertex const & vertex ) { - USAGE_ASSERT ( vertex.Properties().MinimumVoltage() + USAGE_ASSERT ( vertex.Properties().MinimumVoltage() <= vertex.Properties().MaximumVoltage() ); - if ( vertex.Properties().MinimumVoltage() - > vertex.Properties().MaximumVoltage() ) + if ( vertex.Properties().MinimumVoltage() + > vertex.Properties().MaximumVoltage() ) { hasCorrectBound = false; } }); - - graph.template for_all_edges ( - [&hasCorrectBound]( TEdge const & edge ) + + graph.template for_all_edges ( + [&hasCorrectBound]( TEdge const & edge ) { // thetaBound - USAGE_ASSERT ( edge.Properties().ThetaBound().Minimum() - <= edge.Properties().ThetaBound().Maximum() ); - if ( edge.Properties().ThetaBound().Minimum() - > edge.Properties().ThetaBound().Maximum() ) + USAGE_ASSERT ( edge.Properties().ThetaBound().Minimum() + <= edge.Properties().ThetaBound().Maximum() ); + if ( edge.Properties().ThetaBound().Minimum() + > edge.Properties().ThetaBound().Maximum() ) { hasCorrectBound = false; return; } // nominalApparentPowerBound - USAGE_ASSERT ( edge.Properties().NominalApparentPowerBound().Minimum() - <= edge.Properties().NominalApparentPowerBound().Maximum() ); - if ( edge.Properties().NominalApparentPowerBound().Minimum() - > edge.Properties().NominalApparentPowerBound().Maximum() ) + USAGE_ASSERT ( edge.Properties().NominalApparentPowerBound().Minimum() + <= edge.Properties().NominalApparentPowerBound().Maximum() ); + if ( edge.Properties().NominalApparentPowerBound().Minimum() + > edge.Properties().NominalApparentPowerBound().Maximum() ) { hasCorrectBound = false; return; @@ -65,58 +65,58 @@ namespace egoa::IO::Helper { bool hasCorrectBound = true; - network.template for_all_generators ( - [&hasCorrectBound]( TGeneratorProperties const & properties ) + network.template for_all_generators ( + [&hasCorrectBound]( TGeneratorProperties const & properties ) { // nominalRealPowerBound - USAGE_ASSERT ( properties.NominalRealPowerBound().Minimum() - <= properties.NominalRealPowerBound().Maximum() ); - if ( properties.NominalRealPowerBound().Minimum() - > properties.NominalRealPowerBound().Maximum() ) + USAGE_ASSERT ( properties.NominalRealPowerBound().Minimum() + <= properties.NominalRealPowerBound().Maximum() ); + if ( properties.NominalRealPowerBound().Minimum() + > properties.NominalRealPowerBound().Maximum() ) { hasCorrectBound = false; } // realPowerBound - USAGE_ASSERT ( properties.RealPowerBound().Minimum() - <= properties.RealPowerBound().Maximum() ); - if ( properties.RealPowerBound().Minimum() - > properties.RealPowerBound().Maximum() ) + USAGE_ASSERT ( properties.RealPowerBound().Minimum() + <= properties.RealPowerBound().Maximum() ); + if ( properties.RealPowerBound().Minimum() + > properties.RealPowerBound().Maximum() ) { hasCorrectBound = false; } // reactivePowerBound - USAGE_ASSERT ( properties.ReactivePowerBound().Minimum() - <= properties.ReactivePowerBound().Maximum() ); - if ( properties.ReactivePowerBound().Minimum() - > properties.ReactivePowerBound().Maximum() ) + USAGE_ASSERT ( properties.ReactivePowerBound().Minimum() + <= properties.ReactivePowerBound().Maximum() ); + if ( properties.ReactivePowerBound().Minimum() + > properties.ReactivePowerBound().Maximum() ) { hasCorrectBound = false; return; } // qc1Bound - USAGE_ASSERT ( properties.Qc1Bound().Minimum() - <= properties.Qc1Bound().Maximum() ); - if ( properties.Qc1Bound().Minimum() - > properties.Qc1Bound().Maximum() ) + USAGE_ASSERT ( properties.Qc1Bound().Minimum() + <= properties.Qc1Bound().Maximum() ); + if ( properties.Qc1Bound().Minimum() + > properties.Qc1Bound().Maximum() ) { hasCorrectBound = false; return; } // qc2Bound - USAGE_ASSERT ( properties.Qc2Bound().Minimum() - <= properties.Qc2Bound().Maximum() ); - if ( properties.Qc2Bound().Minimum() - > properties.Qc2Bound().Maximum() ) + USAGE_ASSERT ( properties.Qc2Bound().Minimum() + <= properties.Qc2Bound().Maximum() ); + if ( properties.Qc2Bound().Minimum() + > properties.Qc2Bound().Maximum() ) { hasCorrectBound = false; return; } }); - + return hasCorrectBound && HasGraphCorrectBounds( network.Graph() ); } } // namespace egoa::IO::Helper -#endif // EGOA__IO__HELPER__DATA_VALIDATION_HPP \ No newline at end of file +#endif // EGOA__IO__HELPER__DATA_VALIDATION_HPP diff --git a/include/IO/Parser/IeeeCdfMatlabParser.hpp b/include/IO/Parser/IeeeCdfMatlabParser.hpp index 3b1b4ecb..97e2fde5 100644 --- a/include/IO/Parser/IeeeCdfMatlabParser.hpp +++ b/include/IO/Parser/IeeeCdfMatlabParser.hpp @@ -35,9 +35,9 @@ namespace egoa { template , Edges::ElectricalProperties > > class IeeeCdfMatlabParser final { - - using TElectricalVertex = typename GraphType::TVertex; - using TVertexProperties = typename TElectricalVertex::TProperties; + + using TElectricalVertex = typename GraphType::TVertex; + using TVertexProperties = typename TElectricalVertex::TProperties; using TVertex = typename GraphType::TVertex; using TVertexType = typename TVertexProperties::TVertexType; @@ -48,7 +48,7 @@ class IeeeCdfMatlabParser final { using TEdgeProperties = typename TElectricalEdge::TProperties; using TBound = Bound<>; using TNetwork = PowerGrid; - + private: static inline void toUpper ( std::string &str ) { std::transform(str.begin(), str.end(), str.begin(), ::toupper); @@ -65,12 +65,12 @@ class IeeeCdfMatlabParser final { /** * @brief Read base MVA from an m-file in IEEE Common Data Format * @details This value is necessary for the per Unit system. - * + * * @param[in,out] network The parameter base MVA is changed in this method. */ void readBaseMva ( TNetwork & network ) { Types::string str; - while ( str.compare("mpc.baseMVA") ) + while ( str.compare("mpc.baseMVA") ) { input_stream_ >> str; } @@ -82,12 +82,12 @@ class IeeeCdfMatlabParser final { /** * @brief Read the name of the case * @details The name of the power grid, e.g. case14 for the 14 bus system. - * + * * @param[in,out] network The parameter changes the name of the network */ inline void readCaseName( TNetwork & network ) { Types::string str; - while ( str.compare("function") ) + while ( str.compare("function") ) { input_stream_ >> str; } @@ -99,29 +99,29 @@ class IeeeCdfMatlabParser final { /** * @brief Read the bus matrix * @details While reading each line of the matrix a vertex is created and - * added to the network with - * vertex.Name() = bus_i, - * vertex.Type() = type, - * vertex.RealPowerLoad() = Pd / base_mva, - * vertex.ReactivePowerLoad() = Qd / base_mva, - * vertex.ShuntConductance() = Gs / base_mva, - * vertex.ShuntSusceptance() = Bs / base_mva, - * vertex.Area() = area, - * vertex.VoltageMagnitude() = Vm, - * vertex.VoltageAngleSnapshot() = Va, - * vertex.BaseKV = baseKV, - * vertex.Zone() = zone, + * added to the network with + * vertex.Name() = bus_i, + * vertex.Type() = type, + * vertex.RealPowerLoad() = Pd / base_mva, + * vertex.ReactivePowerLoad() = Qd / base_mva, + * vertex.ShuntConductance() = Gs / base_mva, + * vertex.ShuntSusceptance() = Bs / base_mva, + * vertex.Area() = area, + * vertex.VoltageMagnitude() = Vm, + * vertex.VoltageAngleSnapshot() = Va, + * vertex.BaseKV = baseKV, + * vertex.Zone() = zone, * vertex.MaximumVoltage() = Vmax, * vertex.MinimumVoltage() = Vmin. - * - * + * + * * @param[in,out] network Add all buses to the network */ void readBusMatrix( TNetwork & network ) { Types::string str; // Nodes - while ( str.compare("mpc.bus") ) + while ( str.compare("mpc.bus") ) { input_stream_ >> str; } @@ -137,16 +137,16 @@ class IeeeCdfMatlabParser final { input_stream_ >> str; - while ( str.compare("];") ) + while ( str.compare("];") ) { bus.Name() = str.c_str(); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; bus.Type() = Vertices::to_enum( atoi( str.c_str() ) ); input_stream_ >> std::ws >> str; //bus load.RealPowerLoad() = Types::String2double(str) / network.BaseMva(); - + input_stream_ >> str; //bus load.ReactivePowerLoad() = Types::String2double(str) / network.BaseMva(); @@ -169,10 +169,10 @@ class IeeeCdfMatlabParser final { bus.NominalVoltage() = Types::String2double(str); input_stream_ >> std::ws >> str; - bus.Zone() = Types::String2double(str); + bus.Zone() = Types::String2double(str); input_stream_ >> std::ws >> str; - bus.MaximumVoltage() = Types::String2double(str); + bus.MaximumVoltage() = Types::String2double(str); getline(input_stream_, str,';'); bus.MinimumVoltage() = Types::String2double(str); @@ -182,7 +182,7 @@ class IeeeCdfMatlabParser final { mapVertexName2Id_[bus.Name()]= identifier; //bus - if ( load.RealPowerLoad() >= 0 ) + if ( load.RealPowerLoad() >= 0 ) { load.RealPowerLoadBound().Minimum() = 0; load.RealPowerLoadBound().Maximum() = load.RealPowerLoad(); @@ -191,7 +191,7 @@ class IeeeCdfMatlabParser final { load.RealPowerLoadBound().Maximum() = 0; } - if ( load.ReactivePowerLoad() >= 0 ) + if ( load.ReactivePowerLoad() >= 0 ) { load.ReactivePowerLoadBound().Minimum() = 0; load.ReactivePowerLoadBound().Maximum() = load.ReactivePowerLoad(); @@ -200,17 +200,17 @@ class IeeeCdfMatlabParser final { load.ReactivePowerLoadBound().Maximum() = 0; } - if ( load.RealPowerLoad() > 0 || load.ReactivePowerLoad() > 0 ) + if ( load.RealPowerLoad() > 0 || load.ReactivePowerLoad() > 0 ) { load.Name() = bus.Name(); load.Type() = Vertices::IeeeBusType::load; Types::loadId loadId = network.AddLoadAt( identifier, load ); - if ( load.RealPowerLoad () > 0 ) + if ( load.RealPowerLoad () > 0 ) { // Add a snapshot only when necessary network.AddLoadSnapshotAt(loadId, load.RealPowerLoad() ); // Maximum real power p.u. } //@todo Else add load snapshot that has reactive power - } - if ( load.RealPowerLoad () < 0 ) + } + if ( load.RealPowerLoad () < 0 ) { // real power generator if real power demand is negative TGeneratorProperties generator; generator.Name () = bus.Name(); @@ -219,14 +219,14 @@ class IeeeCdfMatlabParser final { generator.RealPowerBound().Minimum() = 0; generator.RealPowerBound().Maximum() = generator.RealPower (); - if ( load.ReactivePowerLoad () < 0 ) + if ( load.ReactivePowerLoad () < 0 ) { generator.ReactivePower () = std::fabs ( load.ReactivePowerLoad () ); // Add reactive power bounds using the absolute value of the demand generator.ReactivePowerBound().Minimum() = 0; generator.ReactivePowerBound().Maximum() = generator.ReactivePower (); } // else is already done before by adding a load vertex - } else if ( load.ReactivePowerLoad () < 0 ) + } else if ( load.ReactivePowerLoad () < 0 ) { // reactive power generator if reactive power demand is negative TGeneratorProperties generator; generator.Name () = bus.Name(); @@ -246,7 +246,7 @@ class IeeeCdfMatlabParser final { /** * @brief Read the branch matrix * @details While reading each row of the matrix a arc is created and added - * to the network with + * to the network with * edge.Conductance() = G not in data (\f$ \frac{R}{|Z|} \f$, with \f$ |Z| = R^2 + X^2 \f$) * edge.Susceptance() = B not in data (\f$ \frac{X}{|Z|} \f$, with \f$ |Z| = R^2 + X^2 \f$) * edge.Resistance() = r (or R for resistance) @@ -262,9 +262,9 @@ class IeeeCdfMatlabParser final { * edge.Status() = status * edge.ThetaBound().Minimum() = angmin.pi/180 (angle is transformed into radian \f$ \frac{angmin^\circ\cdot\pi}{180^\circ} \f$ rad, since \f$ \pi = 180^\circ \f$) * edge.ThetaBound().Maximum() = angmax.pi/180 (angle is transformed into radian \f$ \frac{angmax^\circ\cdot\pi}{180^\circ} \f$ rad, since \f$ \pi = 180^\circ \f$) - * + * * IGNORE: rateB, rateC - * + * * @param[in,out] network Netowork with all arcs */ void readBranchMatrix( TNetwork & network ) { @@ -274,7 +274,7 @@ class IeeeCdfMatlabParser final { network.ThetaBound().Maximum() = 0.0; // TODO this can be done smarter, currently whole file scanned again - while ( str.compare("mpc.branch") ) + while ( str.compare("mpc.branch") ) { input_stream_ >> str; } @@ -300,28 +300,28 @@ class IeeeCdfMatlabParser final { // x in the data input_stream_ >> str; - edge.Reactance() = Types::String2double(str); + edge.Reactance() = Types::String2double(str); // b in the data - input_stream_ >> str; - edge.Charge() = Types::String2double(str); + input_stream_ >> str; + edge.Charge() = Types::String2double(str); // Rate A in the data input_stream_ >> str; edge.ThermalLimit() = Types::String2double(str) / network.BaseMva(); // Rate B in the data - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; edge.ThermalLimitB() = Types::String2double(str) / network.BaseMva(); - + // Rate C in the data input_stream_ >> std::ws >> str; edge.ThermalLimitC() = Types::String2double(str) / network.BaseMva(); - - // Tap ratio tau in the data + + // Tap ratio tau in the data input_stream_ >> std::ws >> str; if(atof(str.c_str()) == 0) - { // + { // edge.TapRatio() = 1.0; } else edge.TapRatio() = Types::String2double(str); @@ -358,15 +358,15 @@ class IeeeCdfMatlabParser final { * @details While reading each row of the matrix a generator is created and * added to the network * vertex.Name() = bus - * vertex.RealPower() = Pg / base_mva, - * vertex.ReactivePower() = Qg / base_mva, - * vertex.ReactivePowerBound().Maximum() = Qmax / base_mva, - * vertex.ReactivePowerBound().Minimum() = Qmin / base_mva, + * vertex.RealPower() = Pg / base_mva, + * vertex.ReactivePower() = Qg / base_mva, + * vertex.ReactivePowerBound().Maximum() = Qmax / base_mva, + * vertex.ReactivePowerBound().Minimum() = Qmin / base_mva, * vertex.VoltageMagnitude() = Vg * vertex.Mbase() = mBase * vertex.Status() = status - * vertex.RealPowerBound().Maximum() = Pmax / base_mva, - * vertex.RealPowerBound().Minimum() = Pmin / base_mva, + * vertex.RealPowerBound().Maximum() = Pmax / base_mva, + * vertex.RealPowerBound().Minimum() = Pmin / base_mva, * vertex.Pc1() = Pc1 * vertex.Pc2() = Pc2 * vertex.Qc1Bound().Minimum() = Qc1min @@ -378,9 +378,9 @@ class IeeeCdfMatlabParser final { * vertex.Ramp30() = ramp_30 * vertex.RampQ() = ramp_q * vertex.Apf() = apf - * - * - * + * + * + * * @param[in,out] network Network with all generator */ void readGeneratorMatrix( TNetwork & network ) { @@ -413,10 +413,10 @@ class IeeeCdfMatlabParser final { input_stream_ >> std::ws >> str; generator.VoltageMagnitude() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.NominalPower() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; Types::index status = Types::String2integer(str); if ( status ) generator.Status() = Vertices::BusStatus::active; @@ -429,55 +429,55 @@ class IeeeCdfMatlabParser final { input_stream_ >> str; generator.RealPowerBound().Minimum() = Types::String2double(str) / network.BaseMva(); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.Pc1() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.Pc2() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.Qc1Bound().Minimum() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.Qc1Bound().Maximum() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.Qc2Bound().Minimum() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.Qc2Bound().Maximum() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.RampAgc() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.Ramp10() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.Ramp30() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.RampQ() = Types::String2double(str); - input_stream_ >> std::ws >> str; + input_stream_ >> std::ws >> str; generator.Apf() = Types::String2double(str); getline(input_stream_, str,'\n'); Types::generatorId generatorId = network.AddGeneratorAt(mapVertexName2Id_[generator.Name()], generator); - network.AddGeneratorRealPowerSnapshotAt( generatorId, generator.RealPower() ); + network.AddGeneratorRealPowerSnapshotAt( generatorId, generator.RealPower() ); // Get first item in the new line - input_stream_ >> str; + input_stream_ >> str; } input_stream_.seekg (0, input_stream_.beg); } /** - * @brief Gammelig + * @brief Gammelig * @todo add both possible function types * @details Gammelig - * + * * @param network Gammelig */ // void readGeneratorCostFunctionMatrix( TNetwork & network ); @@ -496,7 +496,7 @@ class IeeeCdfMatlabParser final { public: explicit IeeeCdfMatlabParser ( std::istream & input_stream ) - : input_stream_(input_stream) + : input_stream_(input_stream) { init(); } diff --git a/include/IO/Parser/PyPsaParser.hpp b/include/IO/Parser/PyPsaParser.hpp index 5e47fb25..ac39a0ed 100644 --- a/include/IO/Parser/PyPsaParser.hpp +++ b/include/IO/Parser/PyPsaParser.hpp @@ -53,7 +53,7 @@ class PyPsaParser { using TIoEdge = io::Edge; // Bounds using TBound = Bound<>; - + public: ///@name Constructors and destructor @@ -79,7 +79,7 @@ class PyPsaParser { , loadSnapshotsSize(0) {} - PyPsaParser ( std::string filenameBuses + PyPsaParser ( std::string filenameBuses , std::string filenameCarriers , std::string filenameGenerators , std::string filenameGeneratorsPMaxPu @@ -88,7 +88,7 @@ class PyPsaParser { , std::string filenameLinesNew , std::string filenameLoads , std::string filenameLoadsPSet - , std::string filenameNetwork + , std::string filenameNetwork , std::string filenameSnapshots , std::string filenameStorageUnits , std::string filenameStorageUnitsInflow ) @@ -111,7 +111,7 @@ class PyPsaParser { ~PyPsaParser() { - mapBusName2VertexId_.clear(); + mapBusName2VertexId_.clear(); mapGeneratorName2Generator_.clear(); mapGeneratorName2Identifier_.clear(); mapGeneratorName2BusName_.clear(); @@ -127,17 +127,17 @@ class PyPsaParser { * @brief Read storage units in flow. * @details For more information see the storage unit section under * https://pypsa.org/doc/components.html. - * + * * @I{ An example input is given by: - * + * * name - Timestamp * AT0 1 hydro - Represents a storage unit name with its production snapshot * } - * + * * @return Returns @p true if the parsing was successful, @p * false otherwise. */ - inline bool ReadStorageUnitsInflows () + inline bool ReadStorageUnitsInflows () { throw std::runtime_error ( "Not implemented yet! Storage units are currently unsupported." ); return true; @@ -147,41 +147,41 @@ class PyPsaParser { * @brief Reads storage units. * @details For more information see the storage unit section under * https://pypsa.org/doc/components.html. - * + * * @I{ The setting is as following: - * name - Name - * + * name - Name + * * bus - Name of the bus (required) * capital_cost - in currency/MWh (default 0, optional) * carrier - (default n/a, optional) - * control - - * cyclic_state_of_charge - - * type - - * efficiency_store - + * control - + * cyclic_state_of_charge - + * type - + * efficiency_store - * efficiency_dispatch - in p.u. (default 1, optional) - * inflow - + * inflow - * marginal_cost - in currency/MWh (default 0, optional) * max_hours - (default NaN, optional) - * p - + * p - * p_min_pu - in p.u., minimum output (default -1, optional) * p_max_pu - in p.u., maximum output (default 1, optional) * p_nom - in MW, nominal power (default 0, optional) - * p_nom_extendable - - * p_nom_opt - + * p_nom_extendable - + * p_nom_opt - * p_set - in MW, real power set point (default 0, optional) - * q - + * q - * q_set - in MVar, reactive power set point (default 0, optional) * sign - power sign (default 1, optional) - * standing_loss - - * state_of_charge - - * state_of_charge_initial - - * state_of_charge_set - - * spill - + * standing_loss - + * state_of_charge - + * state_of_charge_initial - + * state_of_charge_set - + * spill - * } * * @return @p True if the parsing was successful, @p False otherwise. */ - inline bool ReadStorageUnits() + inline bool ReadStorageUnits() { throw std::runtime_error ( "Not implemented yet! Storage units are currently unsupported." ); return true; @@ -193,13 +193,13 @@ class PyPsaParser { * created and added to the network (see the bus section of * https://pypsa.org/doc/components.html * for more information). - * + * * @I{ The setting is as following: - * - * Name in EGOA Name in PyPSA Description - * + * + * Name in EGOA Name in PyPSA Description + * * - vertex.Name() - name - unique name of the bus - * + * * - - carrier - AC, DC (default AC, optional) * - vertex.Des - country - country * - vertex.Type() - type - Not specified. We use the IEEE TYPES here. @@ -209,7 +209,7 @@ class PyPsaParser { * - vertex.VoltageNom - v_nom - in kV, Nominal voltage (default 1, optional) * - vertex.X() - x - X-Coordinate (longitude) * - vertex.Y() - y - Y-Coordinate (latitude) - * + * * Output parameter are: * - control - (default PQ) P,Q,V control strategy for the power flow, must be @p PQ, @p PV or @p Slack. * - marginal_price - in currency/MWh (default 0). Locational marginal price from LOPF from power balance constraint. @@ -218,8 +218,8 @@ class PyPsaParser { * - sub_network - Name of connected sub-network to which the vertex belongs. * - vertex.Theta() - in RAD (default: 0). The Voltage angle. * - v_ang - in radians (default 0) - * - v_mag_pu - in p.u. (default 1). Voltage magnitude, per unit of v_nom. - * } + * - v_mag_pu - in p.u. (default 1). Voltage magnitude, per unit of v_nom. + * } * * @param network The network @f$\network = ( \graph, \generators, \consumers, \capacity, \susceptance, \dots )@f$. * @param filename The filename. @@ -227,7 +227,7 @@ class PyPsaParser { * @return @p True if the parsing was successful, @p False otherwise. */ inline bool ReadBuses ( TNetwork & network - , std::string const & filename ) + , std::string const & filename ) { QFile file( QString::fromStdString(filename + "/" + filenameBuses_) ); OpenFile(file); @@ -235,18 +235,18 @@ class PyPsaParser { dataMapperBuses_.clear(); ExtractBusHeader( splitted ); - while( !file.atEnd() ) + while( !file.atEnd() ) { TVertexProperties vertexProperties; std::string temp; splitted = ReadLine( file, false ); - + USAGE_ASSERT ( static_cast( splitted.size() ) == dataMapperBuses_.size() ); for ( Types::count counter = 0 ; counter < static_cast( splitted.size() ) - ; ++counter ) + ; ++counter ) { temp = splitted[counter].toStdString(); (this->*dataMapperBuses_[counter])( temp , vertexProperties); @@ -259,17 +259,17 @@ class PyPsaParser { /** * @brief Reads carriers. - * @details For more information see the carrier section under + * @details For more information see the carrier section under * https://pypsa.org/doc/components.html. - * + * * @I{ The setting is as following: * - name - Name of the carrier, see ReadGeneratorMatrix for mapping. - * - co2_emissions - in tonnes/MWh (CO2 emissions of this carrier) + * - co2_emissions - in tonnes/MWh (CO2 emissions of this carrier) * } * * @return @p True if the parsing was successful, @p False otherwise. */ - inline bool ReadCarriers() + inline bool ReadCarriers() { throw std::runtime_error ( "Not implemented yet! Storage units are currently unsupported." ); return true; @@ -278,14 +278,14 @@ class PyPsaParser { /** * @brief Read generators maximum real power production * snapshot in p.u. - * @details For more information see the generator section under + * @details For more information see the generator section under * https://pypsa.org/doc/components.html. * * @param network The network @f$\network = ( \graph, \generators, \consumers, \capacity, \susceptance, \dots )@f$. * @param filename The filename - * + * * @I{ - * - name + * - name * - AT0 0 onwind - Represents a generator name with its production snapshot in p.u. * - AT0 0 ror - Represents a generator name with its production snapshot in p.u. * } @@ -293,7 +293,7 @@ class PyPsaParser { * @return @p True if the parsing was successful, @p False otherwise. */ inline bool ReadGeneratorsRealPowerMaxPu ( TNetwork & network - , std::string const & filename ) + , std::string const & filename ) { QFile file( QString::fromStdString(filename + "/" + filenameGeneratorsPMaxPu_) ); OpenFile(file); @@ -301,21 +301,21 @@ class PyPsaParser { dataMapperGeneratorsRealPowerMaxPu_.clear(); ExtractGeneratorMaximumRealPowerPuHeader( splitted ); - - while( !file.atEnd() ) + + while( !file.atEnd() ) { splitted = ReadLine( file, false ); std::string generationValue; - + USAGE_ASSERT ( static_cast( splitted.size() ) == dataMapperGeneratorsRealPowerMaxPu_.size() ); - + if ( !splitted[0].isEmpty() ) { ++ generatorSnapshotsSize; } for ( Types::count counter = 0 ; counter < static_cast( splitted.size() ) - ; ++counter ) + ; ++counter ) { generationValue = splitted[counter].toStdString(); dataMapperGeneratorsRealPowerMaxPu_[counter]( generationValue, network ); @@ -328,7 +328,7 @@ class PyPsaParser { * @brief Read the generator matrix. * @details While reading each row of the matrix a generator is * created and added to the network. The description of the - * elements is as in + * elements is as in * https://pypsa.org/doc/components.html. * * @param network The network @f$\network = ( \graph, \generators, \consumers, \capacity, \susceptance, \dots )@f$. @@ -336,23 +336,23 @@ class PyPsaParser { * * @I{ * Name in EGOA Name in PyPSA Description - * + * * - vertex.Name() - name - unique generator name (required) * - vertex.Name() - bus - bus at which the generator is connected (required) * - vertex.Control() - control - P, Q, V control strategy usually PQ, PV or Slack (default PQ, optional) * - vertex.Type - type - generator type (default n/a, optional) - * - vertex.CapitalCost() - capital_cost - (default n/a, optional) + * - vertex.CapitalCost() - capital_cost - (default n/a, optional) * - vertex.Type - carrier - carrier (default n/a, optional) - * - vertex.efficiency - efficiency - (default n/a, optional) - * - vertex.marginal_cost - marginal_cost - (default n/a, optional) + * - vertex.efficiency - efficiency - (default n/a, optional) + * - vertex.marginal_cost - marginal_cost - (default n/a, optional) * - vertex.Mbase() - p_nom - in MW, nominal power for limits (default 0, optional) * - vertex.IsExtendable() - p_nom_extendable - to allow capacity (default 0, optional) * - vertex.NominalRealPower().Minimum() - p_nom_min - in p.u., if p_nom extendable, i.e., set p_nom_min (default 0, optional) * - vertex.NominalRealPower().Maximum() - p_nom_max - in p.u., if p_nom extendable, i.e., set p_nom_max (default INF, optional) * - vertex.RealPowerBound().Minimum() - p_min_pu - in p.u., the minimum output for each snapshot (default 0, optional) * - vertex.RealPowerBound().Maximum() - p_max_pu - in p.u., the maximum output for each snapshot (default 1, optional) - * - vertex.ReactivePowerBound().Minimum() - - * - vertex.ReactivePowerBound().Maximum() - + * - vertex.ReactivePowerBound().Minimum() - + * - vertex.ReactivePowerBound().Maximum() - * - vertex.RealPowerSetPoint() - p_set - in MW, real power set point (default 0, optional) * - vertex.ReactivePowerSetPoint() - q_set - in MVar, reactive power set point (default 0, optional) * - vertex.PowerSign() - sign - (default 1, optional) @@ -369,21 +369,21 @@ class PyPsaParser { * - vertex.RampLimitDown() - ramp_limit_down - in p.u., (default NaN, optional) * - vertex.RampLimitStartUp() - ramp_limit_start_up - in p.u., (default 1, optional) * - vertex.RampLimitShutDown() - ramp_limit_shut_down - in p.u., (default 1, optional) - * + * * The Output Parameter: - * + * * - vertex.RealPower() - p - in MW, real power at bus (positive if generation) * - vertex.ReactivePower - q - in MVar, reactive power at bus (positive if generation) * - - p_nom_opt - in MW, optimized nominal power (default, 0) * - vertex.Status() - status - Status on or off (default, 1) - * + * * - vertex.Weight() - weight * } * * @return @p True if the parsing was successful, @p False otherwise. */ inline bool ReadGenerators ( TNetwork & network - , std::string const & filename ) + , std::string const & filename ) { QFile file( QString::fromStdString(filename + "/" + filenameGenerators_) ); OpenFile(file); @@ -392,26 +392,26 @@ class PyPsaParser { dataMapperGenerators_.clear(); ExtractGeneratorHeader( splitted ); - while( !file.atEnd() ) + while( !file.atEnd() ) { splitted = ReadLine( file, false ); TGeneratorProperties generator; std::string temp; - + USAGE_ASSERT ( static_cast( splitted.size() ) == dataMapperGenerators_.size() ); - - for ( Types::count counter = 0; - counter < static_cast( splitted.size() ); - ++counter - ) + + for ( Types::count counter = 0; + counter < static_cast( splitted.size() ); + ++counter + ) { temp = splitted[counter].toStdString(); (this->*dataMapperGenerators_[counter])( temp , generator); } // for Types::vertexId generatorId = Const::NONE; - if ( mapGeneratorName2BusName_.find(generator.Name()) != mapGeneratorName2BusName_.end() ) + if ( mapGeneratorName2BusName_.find(generator.Name()) != mapGeneratorName2BusName_.end() ) { - if ( mapBusName2VertexId_.find(mapGeneratorName2BusName_[generator.Name()]) != mapBusName2VertexId_.end() ) + if ( mapBusName2VertexId_.find(mapGeneratorName2BusName_[generator.Name()]) != mapBusName2VertexId_.end() ) { generatorId = network.AddGeneratorAt(mapBusName2VertexId_[mapGeneratorName2BusName_[generator.Name()]], generator); } else { @@ -420,11 +420,11 @@ class PyPsaParser { } else { ESSENTIAL_ASSERT( false && "Generator name does not exist" ); } - if ( mapGeneratorName2Identifier_.find(generator.Name()) == mapGeneratorName2Identifier_.end() ) - { + if ( mapGeneratorName2Identifier_.find(generator.Name()) == mapGeneratorName2Identifier_.end() ) + { mapGeneratorName2Identifier_[generator.Name()] = generatorId; } else { - ESSENTIAL_ASSERT( false && "Generator name to identifier, Generator name duplicates" ); + ESSENTIAL_ASSERT( false && "Generator name to identifier, Generator name duplicates" ); } } // while network.UpdateGeneratorSnapshotSize(); @@ -433,11 +433,11 @@ class PyPsaParser { /** * @brief Sets the generator default values. - * @details The description of the elements is as in + * @details The description of the elements is as in * https://pypsa.org/doc/components.html. - * + * * @I{ - * - name + * - name * - constant * - type - Type of constraint (only "primary energy", i.e., limits on the usage of primary energy before generator conversion) * - carrier_attribute @@ -445,10 +445,10 @@ class PyPsaParser { * - constant - Constant for the rhs * - mu - Shadow price of global constraint * } - * + * * @return @p True if the parsing was successful, @p False otherwise. */ - inline bool ReadGlobalConstraints() + inline bool ReadGlobalConstraints() { throw std::runtime_error ( "Not implemented yet! Storage units are currently unsupported." ); return true; @@ -463,7 +463,7 @@ class PyPsaParser { * @param[in] filename The filename. * * @tparam Graph A graph type such as PowerGrid or StaticGraph. - * + * * @I{ * edge.Name() = name -> in -, branch name (default -, required) * edge.Source() = bus0 -> in -, source bus ID (default -, required) @@ -473,51 +473,51 @@ class PyPsaParser { * edge.Length() = length -> in ?, length of this track (default 0, optional). * Length of line used when "type" is set, also useful for calculating the capital cost. * edge.NumberOfParallelLines() = num_parallel -> in -, number of parallel lines at this branch (default 1, optional). - * When “type” is set, this is the number of parallel lines (can also be fractional). + * When “type” is set, this is the number of parallel lines (can also be fractional). * If “type” is empty “” this value is ignored. * edge.ThermalLimit() = s_max_pu -> in p.u., thermal limit (default 1, optional). - * The maximum allowed absolute flow per unit of s_nom for the OPF (e.g. can be set <1 - * to approximate n-1 factor, or can be time-varying to represent weather-dependent dynamic + * The maximum allowed absolute flow per unit of s_nom for the OPF (e.g. can be set <1 + * to approximate n-1 factor, or can be time-varying to represent weather-dependent dynamic * line rating for overhead lines). - * edge.NominalApparentPower() = s_nom -> in MW or MVAR, nominal apparent power (default 0, optional). + * edge.NominalApparentPower() = s_nom -> in MW or MVAR, nominal apparent power (default 0, optional). * Limit of apparent power which can pass through branch. - * edge.Type() = type -> in -, name of branch standard type (default ?, ?). - * If this is not an empty string “”, then the line standard type impedance parameters - * are multiplied with the line length and divided/multiplied by num_parallel to compute - * x, r, etc. This will override any values set in r, x, and b. If the string is empty, + * edge.Type() = type -> in -, name of branch standard type (default ?, ?). + * If this is not an empty string “”, then the line standard type impedance parameters + * are multiplied with the line length and divided/multiplied by num_parallel to compute + * x, r, etc. This will override any values set in r, x, and b. If the string is empty, * PyPSA will simply read r, x, etc. * edge.NominalVoltage() = v_nom -> in V, nominal voltage, basekv (default ?, ?) * edge.NominalApparentPowerBound().Minimum() = s_nom_min -> in MW or MVAr, minimum nominal apparent power (default 0, optional). * If s_nom is extendable in OPF, set its minimum value. * edge.NominalApparentPowerBound().Maximum() = s_nom_max -> in MW or MVAr, maximum nominal apparent power (default inf, optional). * If s_nom is extendable in OPF, set its maximum value (e.g. limited by potential). - * edge.Reactance() = x -> in Ohm, series reactance (default 0, optional), - * must be non-zero for AC branch in linear power flow. - * If the line has series inductance L in Henries then x = 2\pi f L where f is the frequency in - * Hertz. Series impedance z = r + jx must be non-zero for the non-linear power flow. Ignored if + * edge.Reactance() = x -> in Ohm, series reactance (default 0, optional), + * must be non-zero for AC branch in linear power flow. + * If the line has series inductance L in Henries then x = 2\pi f L where f is the frequency in + * Hertz. Series impedance z = r + jx must be non-zero for the non-linear power flow. Ignored if * type defined. - * edge.Resistance() = r -> in Ohm, series resistance (default 0, optional), - * must be non-zero for DC branch in linear power flow. Series impedance z = r + jx must be non-zero - * for the non-linear power flow. Ignored if type defined. - * edge.Conductance() = g -> in Siemens, shunt conductance (default 0, optional), - * calculated by resistance and reactance dependent on the model (DC or AC), shunt admittance is + * edge.Resistance() = r -> in Ohm, series resistance (default 0, optional), + * must be non-zero for DC branch in linear power flow. Series impedance z = r + jx must be non-zero + * for the non-linear power flow. Ignored if type defined. + * edge.Conductance() = g -> in Siemens, shunt conductance (default 0, optional), + * calculated by resistance and reactance dependent on the model (DC or AC), shunt admittance is * y = g + jb and g = r / (x^2 + r^2). - * edge.Susceptance() = b -> in Siemens, shunt susceptance (default 0, optional), - * calculated by resistance and reactance dependent on the model (DC or AC), if the - * line has shunt capacitance C in Farads then b = 2\pi f C, where f is the frequency + * edge.Susceptance() = b -> in Siemens, shunt susceptance (default 0, optional), + * calculated by resistance and reactance dependent on the model (DC or AC), if the + * line has shunt capacitance C in Farads then b = 2\pi f C, where f is the frequency * in Hertz. Shunt admittance is y = g + jb and b = X / (r^2 + x^2). Ignored if type defined. * edge.NominalApparentPowerExtendable() = s_nom_extendable -> in MW or VAR, nominal apparent power (default false, optional). * Switch to allow capacity s_nom to be extended in OPF. * edge.TerrainFactor = terrain_factor -> in -, terrain factor (default 0, ?). * Terrain factor for increasing capital cost. * edge.ThetaBound().Minimum() = v_ang_min -> in Rad, minimum voltage angle (default -inf, optional). - * Minimum voltage angle difference across the line. This is a placeholder attribute and is not currently + * Minimum voltage angle difference across the line. This is a placeholder attribute and is not currently * used by any PyPSA functions. * edge.ThetaBound().Maximum() = v_ang_max -> in Rad, maximum voltage angle (default inf, optional). - * Maximum voltage angle difference across the line. This is a placeholder attribute and is not currently + * Maximum voltage angle difference across the line. This is a placeholder attribute and is not currently * used by any PyPSA functions. - * - * [Out] = sub_network -> Subnetwork. Name of connected sub-network to which lines belongs. This attribute is set by PyPSA in the function + * + * [Out] = sub_network -> Subnetwork. Name of connected sub-network to which lines belongs. This attribute is set by PyPSA in the function * network.determine_network_topology(); do not set it directly by hand. * [Out] = p0 -> in MW (default 0). * Active power at bus0 (positive if branch is withdrawing power from bus0). @@ -551,7 +551,7 @@ class PyPsaParser { */ template inline bool ReadLines ( Graph & network - , const std::string & filename ) + , const std::string & filename ) { QFile file( QString::fromStdString ( filename + "/" + filenameLines_ ) ); OpenFile(file); @@ -560,7 +560,7 @@ class PyPsaParser { dataMapperLines_.clear(); ExtractLineHeader( splitted ); - while( !file.atEnd() ) + while( !file.atEnd() ) { splitted = ReadLine( file, false ); TIoEdge edge; @@ -571,7 +571,7 @@ class PyPsaParser { for ( Types::count counter = 0 ; counter < static_cast( splitted.size() ) - ; ++counter ) + ; ++counter ) { temp = splitted[counter].toStdString(); (this->*dataMapperLines_[counter])( temp , edge ); @@ -583,62 +583,62 @@ class PyPsaParser { /** * @brief Sets the branch default values. - * @details The description of the elements is as in + * @details The description of the elements is as in * https://pypsa.org/doc/components.html. * * @I{ The setting is as following: - * + * * Name in EGOA Default Name in PyPSA Description - * + * * - Status() - true - * - Type() - Edge::ElectricalEdgeType::standard type (default: -). Name of line standard type. If this is not an empty string “”, then the line standard type impedance parameters are multiplied with the line length and divided/multiplied by num_parallel to compute x, r, etc. This will override any values set in r, x, and b. If the string is empty, PyPSA will simply read r, x, etc. - * - Reactance() - 0 x Series reactance; must be non-zero for AC branch in linear power flow. If the line has series inductance L in Henries then x = 2\pi f L where f is the frequency in Hertz. Series impedance z = r + jx must be non-zero for the non-linear power flow. Ignored if type defined. - * - Resistance() - 0 r Series resistance; must be non-zero for DC branch in linear power flow. Series impedance z = r + jx must be non-zero for the non-linear power flow. Ignored if type defined. + * - Type() - Edge::ElectricalEdgeType::standard type (default: -). Name of line standard type. If this is not an empty string “”, then the line standard type impedance parameters are multiplied with the line length and divided/multiplied by num_parallel to compute x, r, etc. This will override any values set in r, x, and b. If the string is empty, PyPSA will simply read r, x, etc. + * - Reactance() - 0 x Series reactance; must be non-zero for AC branch in linear power flow. If the line has series inductance L in Henries then x = 2\pi f L where f is the frequency in Hertz. Series impedance z = r + jx must be non-zero for the non-linear power flow. Ignored if type defined. + * - Resistance() - 0 r Series resistance; must be non-zero for DC branch in linear power flow. Series impedance z = r + jx must be non-zero for the non-linear power flow. Ignored if type defined. * // calculated by r and x - * - Conductance(0.0) - 0 g Shunt conductivity. Shunt admittance is y = g + jb. - * - Susceptance(0.0) - 0 b Shunt susceptance. If the line has shunt capacitance C in Farads then b = 2\pi f C where f is the frequency in Hertz. Shunt admittance is y = g + jb. Ignored if type defined. - * - NominalApparentPower() - 0.0 s_nom Limit of apparent power which can pass through branch. - * - NominalApparentPowerExtendable() - false s_nom_extendable Switch to allow capacity s_nom to be extended in OPF. - * - NominalApparentPowerBound().Minimum() - 0.0 s_nom_min If s_nom is extendable in OPF, set its minimum value. + * - Conductance(0.0) - 0 g Shunt conductivity. Shunt admittance is y = g + jb. + * - Susceptance(0.0) - 0 b Shunt susceptance. If the line has shunt capacitance C in Farads then b = 2\pi f C where f is the frequency in Hertz. Shunt admittance is y = g + jb. Ignored if type defined. + * - NominalApparentPower() - 0.0 s_nom Limit of apparent power which can pass through branch. + * - NominalApparentPowerExtendable() - false s_nom_extendable Switch to allow capacity s_nom to be extended in OPF. + * - NominalApparentPowerBound().Minimum() - 0.0 s_nom_min If s_nom is extendable in OPF, set its minimum value. * - NominalApparentPowerBound().Maximum() - Const::REAL_INFTY s_nom_max If s_nom is extendable in OPF, set its maximum value (e.g. limited by potential). * - ThermalLimit() - 1.0 s_max_pu The maximum allowed absolute flow per unit of s_nom for the OPF (e.g. can be set <1 to approximate n-1 factor, or can be time-varying to represent weather-dependent dynamic line rating for overhead lines). - * - CapitalCost() - 0.0 capital_cost Capital cost of extending s_nom by 1 MVA. - * - Length() - 0.0 length Length of line used when “type” is set, also useful for calculating the capital cost. - * - TerrainFactor() - 0.0 terrain_factor Terrain factor for increasing capital cost. - * - NumberOfParallelLines() - 1.0 num_parallel When “type” is set, this is the number of parallel lines (can also be fractional). If “type” is empty “” this value is ignored. - * - ThetaBound().Minimum() - -Const::REAL_INFTY v_ang_min Minimum voltage angle difference across the line. This is a placeholder attribute and is not currently used by any PyPSA functions. + * - CapitalCost() - 0.0 capital_cost Capital cost of extending s_nom by 1 MVA. + * - Length() - 0.0 length Length of line used when “type” is set, also useful for calculating the capital cost. + * - TerrainFactor() - 0.0 terrain_factor Terrain factor for increasing capital cost. + * - NumberOfParallelLines() - 1.0 num_parallel When “type” is set, this is the number of parallel lines (can also be fractional). If “type” is empty “” this value is ignored. + * - ThetaBound().Minimum() - -Const::REAL_INFTY v_ang_min Minimum voltage angle difference across the line. This is a placeholder attribute and is not currently used by any PyPSA functions. * - ThetaBound().Minimum() - Const::REAL_INFTY v_ang_max Maximum voltage angle difference across the line. This is a placeholder attribute and is not currently used by any PyPSA functions. - * + * * - sub_network - Name of connected sub-network to which lines belongs. This attribute is set by PyPSA in the function network.determine_network_topology(); do not set it directly by hand. - * - p0 0 Active power at bus0 (positive if branch is withdrawing power from bus0). - * - q0 0 Reactive power at bus0 (positive if branch is withdrawing power from bus0). - * - p1 0 Active power at bus1 (positive if branch is withdrawing power from bus1). - * - q1 0 Reactive power at bus1 (positive if branch is withdrawing power from bus1). - * - x_pu 0 Per unit series reactance calculated by PyPSA from x and bus.v_nom. - * - r_pu 0 Per unit series resistance calculated by PyPSA from r and bus.v_nom - * - g_pu 0 Per unit shunt conductivity calculated by PyPSA from g and bus.v_nom - * - b_pu 0 Per unit shunt susceptance calculated by PyPSA from b and bus.v_nom - * - x_pu_eff 0 Effective per unit series reactance for linear power flow, calculated by PyPSA from x, tap_ratio for transformers and bus.v_nom. - * - r_pu_eff 0 Effective per unit series resistance for linear power flow, calculated by PyPSA from x, tap_ratio for transformers and bus.v_nom. - * - s_nom_opt 0 Optimised capacity for apparent power. + * - p0 0 Active power at bus0 (positive if branch is withdrawing power from bus0). + * - q0 0 Reactive power at bus0 (positive if branch is withdrawing power from bus0). + * - p1 0 Active power at bus1 (positive if branch is withdrawing power from bus1). + * - q1 0 Reactive power at bus1 (positive if branch is withdrawing power from bus1). + * - x_pu 0 Per unit series reactance calculated by PyPSA from x and bus.v_nom. + * - r_pu 0 Per unit series resistance calculated by PyPSA from r and bus.v_nom + * - g_pu 0 Per unit shunt conductivity calculated by PyPSA from g and bus.v_nom + * - b_pu 0 Per unit shunt susceptance calculated by PyPSA from b and bus.v_nom + * - x_pu_eff 0 Effective per unit series reactance for linear power flow, calculated by PyPSA from x, tap_ratio for transformers and bus.v_nom. + * - r_pu_eff 0 Effective per unit series resistance for linear power flow, calculated by PyPSA from x, tap_ratio for transformers and bus.v_nom. + * - s_nom_opt 0 Optimised capacity for apparent power. * - mu_lower 0 Shadow price of lower s_nom limit -F leq f. Always non-negative. * - mu_upper 0 Shadow price of upper s_nom limit f leq F. Always non-negative. - * + * * } - * + * * @param edge The edge object. */ - inline void SetLineDefaultValues( TIoEdge & edge ) + inline void SetLineDefaultValues( TIoEdge & edge ) { edge.Properties().Status() = true; edge.Properties().Type() = Edges::ElectricalEdgeType::standard; - edge.Properties().Reactance() = 0; + edge.Properties().Reactance() = 0; edge.Properties().Resistance() = 0; - + // calculated by r and x edge.Properties().Conductance(0.0); edge.Properties().Susceptance(0.0); - + edge.Properties().TapRatio() = 1; edge.Properties().NominalApparentPower() = 0.0; edge.Properties().NominalApparentPowerExtendable() = false; @@ -664,7 +664,7 @@ class PyPsaParser { * ?? = AT0 1 * ?? = ... * ?? = AT0 k - * + * * where k is the number of loads specified in "loads.csv" * } * @@ -674,16 +674,16 @@ class PyPsaParser { * @return @p True if the parsing was successful, @p False otherwise. */ inline bool ReadLoadsPset ( TNetwork & network - , std::string const & filename ) + , std::string const & filename ) { QFile file( QString::fromStdString(filename + "/" + filenameLoadsPSet_) ); OpenFile(file); QList splitted = ReadLine( file, false ); - + dataMapperLoadsRealPowerMaxPu_.clear(); ExtractLoadMaximumRealPowerPuHeader( splitted ); - while( !file.atEnd() ) + while( !file.atEnd() ) { splitted = ReadLine( file, false ); std::string loadValue; @@ -696,7 +696,7 @@ class PyPsaParser { for ( Types::count counter = 0 ; counter < static_cast( splitted.size() ) - ; ++counter ) + ; ++counter ) { loadValue = splitted[counter].toStdString(); dataMapperLoadsRealPowerMaxPu_[counter]( loadValue, network ); @@ -707,7 +707,7 @@ class PyPsaParser { /** * @brief Read the load matrix that is a mapping of load to bus. - * @details While reading each row of the matrix a mapping between load and bus is made + * @details While reading each row of the matrix a mapping between load and bus is made * and thus, the load is added to the network. * * @I{ @@ -717,7 +717,7 @@ class PyPsaParser { * = p_set * = q_set * = sign - * + * * [out] * = p * = q @@ -729,17 +729,17 @@ class PyPsaParser { * @return @p True if the parsing was successful, @p False otherwise. */ inline bool ReadLoads ( TNetwork & network - , std::string const & filename ) + , std::string const & filename ) { QFile file( QString::fromStdString(filename + "/" + filenameLoads_) ); OpenFile(file); QList splitted = ReadLine( file ); Types::index busColumn(0); - + dataMapperLoads_.clear(); ExtractLoadHeader( splitted, busColumn ); - - while( !file.atEnd() ) + + while( !file.atEnd() ) { splitted = ReadLine( file, false ); TLoadProperties vertex; @@ -747,45 +747,45 @@ class PyPsaParser { Types::string temp; USAGE_ASSERT ( static_cast( splitted.size() ) == dataMapperLoads_.size() ); - + // Read a row for ( Types::count counter = 0 ; counter < static_cast( splitted.size() ) - ; ++counter ) + ; ++counter ) { temp = splitted[counter].toStdString(); (this->*dataMapperLoads_[counter])( temp , vertex); } // for each column in a row Types::loadId loadId = Const::NONE; - if (mapBusName2VertexId_.find( splitted[ busColumn ].toStdString() ) != mapBusName2VertexId_.end() ) + if (mapBusName2VertexId_.find( splitted[ busColumn ].toStdString() ) != mapBusName2VertexId_.end() ) { loadId = network.AddLoadAt( mapBusName2VertexId_[ splitted[ busColumn ].toStdString() ], vertex ); } else { ESSENTIAL_ASSERT( false && "Bus name does not exist" ); } - + if ( mapLoadName2Identifier_.find( vertex.Name() ) == mapLoadName2Identifier_.end() ) { - mapLoadName2Identifier_[vertex.Name()] = loadId; + mapLoadName2Identifier_[vertex.Name()] = loadId; } else { ESSENTIAL_ASSERT( false && "Load name duplicates" ); } - + } // while return true; } /** * @brief Sets the load default values. - * @details The description of the elements is as in + * @details The description of the elements is as in * https://pypsa.org/doc/components.html. - * + * * @I{ * vertex.Type() Vertices::IeeeBusType::load * p_set 0 real power consumption * q_set 0 reactive power consumption * sign -1 power sign - * + * * Output Parameter: * p 0 real power * q 0 reactive power @@ -793,27 +793,27 @@ class PyPsaParser { * * @param vertex The load vertex object. */ - inline void SetLoadDefaultValues ( TLoadProperties & vertex ) + inline void SetLoadDefaultValues ( TLoadProperties & vertex ) { vertex.Type() = Vertices::IeeeBusType::load; } /** * @brief Reads a network. - * @details The description of the elements is as in + * @details The description of the elements is as in * https://pypsa.org/doc/components.html. - * + * * @I{ * - name * - pypsa_version - * - srid + * - srid * } * * @param network The network @f$\network = ( \graph, \generators, \consumers, \capacity, \susceptance, \dots )@f$. * * @return @p True if the parsing was successful, @p False otherwise. */ - inline bool ReadNetwork( TNetwork & network ) + inline bool ReadNetwork( TNetwork & network ) { throw std::runtime_error ( "Not implemented yet! Storage units are currently unsupported." ); return true; @@ -821,9 +821,9 @@ class PyPsaParser { /** * @brief Reads snapshots. - * @details The description of the elements is as in + * @details The description of the elements is as in * https://pypsa.org/doc/components.html. - * + * * @I{ * name - Time stamp * weightings - Weighting of the time stamp @@ -833,7 +833,7 @@ class PyPsaParser { * * @return @p True if the parsing was successful, @p False otherwise. */ - inline bool ReadSnapshots( TNetwork & network ) + inline bool ReadSnapshots( TNetwork & network ) { throw std::runtime_error ( "Not implemented yet! Snapshots weightings are currently unsupported." ); // if ( !splitted[0].empty() ) @@ -852,7 +852,7 @@ class PyPsaParser { * @return @p true if the parsing was successful, @p false otherwise. */ inline bool ReadCompleteNetwork ( TNetwork & network - , std::string const & filename ) + , std::string const & filename ) { network.BaseMva() = 1.0; return ReadBuses ( network, filename ) @@ -876,14 +876,14 @@ class PyPsaParser { */ inline bool ReadCompleteNetwork ( TNetwork & network , TGraph & candidateNetwork - , std::string const & filename ) + , std::string const & filename ) { network.BaseMva() = 1.0; bool booleanBuses = ReadBuses ( network, filename ); candidateNetwork = network.Graph(); - + return booleanBuses - && ReadGenerators ( network, filename ) + && ReadGenerators ( network, filename ) && ReadGeneratorsRealPowerMaxPu ( network, filename ) && ReadLines ( network, filename ) && ReadLines ( candidateNetwork, filename ) @@ -894,8 +894,8 @@ class PyPsaParser { && IO::Helper::HasGraphCorrectBounds ( candidateNetwork ); } ///@} - - public: + + public: ///@name Reader ///@{ #pragma mark READER @@ -909,13 +909,13 @@ class PyPsaParser { * @return @p true if the parsing was successful, @p false otherwise. */ bool read ( TNetwork & network - , std::string const & filename ) + , std::string const & filename ) { return ReadCompleteNetwork ( network, filename ); } /** - * @brief Read network and candidate network from file + * @brief Read network and candidate network from file * * @param network The network @f$\network = ( \graph, \generators, \consumers, \capacity, \susceptance, \dots )@f$. * @param candidateNetwork The candidate network @@ -925,13 +925,13 @@ class PyPsaParser { */ bool read ( TNetwork & network , TGraph & candidateNetwork - , std::string const & filename ) + , std::string const & filename ) { return ReadCompleteNetwork ( network, candidateNetwork, filename ); } ///@} - private: + private: ///@name Auxiliary ///@{ #pragma mark AUXILIARY @@ -982,12 +982,12 @@ class PyPsaParser { * column entry. */ inline QList ReadLine ( QFile & file - , bool compress = true ) + , bool compress = true ) { QByteArray line = file.readLine(); if ( compress ) CompressString( line); line = line.trimmed(); - return line.split(','); + return line.split(','); } /** @@ -995,7 +995,7 @@ class PyPsaParser { * * @param list The list. */ - inline void CompressString ( QByteArray & list ) + inline void CompressString ( QByteArray & list ) { list = list.replace(" ",""); } @@ -1007,9 +1007,9 @@ class PyPsaParser { * * @return @p true file could be opened, @p false otherwise. */ - inline bool OpenFile ( QFile & file ) + inline bool OpenFile ( QFile & file ) { - if (!file.open(QIODevice::ReadOnly)) + if (!file.open(QIODevice::ReadOnly)) { qDebug() << file.errorString(); return false; // TODO throw exception @@ -1043,58 +1043,58 @@ class PyPsaParser { * * @return @p true if the extraction was successful, @p false otherwise. */ - inline bool ExtractBusHeader( QList const & splitted ) + inline bool ExtractBusHeader( QList const & splitted ) { for ( Types::count counter = 0 ; counter < static_cast( splitted.size() ) - ; ++counter ) + ; ++counter ) { if ( splitted[counter] == "name" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddBusName ); - } else if ( splitted[counter] == "v_nom" ) + } else if ( splitted[counter] == "v_nom" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddNominalVoltageToVertexProperty ); - } else if ( splitted[counter] == "x" ) + } else if ( splitted[counter] == "x" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddXcoordinateToVertexProperty ); - } else if ( splitted[counter] == "y" ) + } else if ( splitted[counter] == "y" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddYcoordinateToVertexProperty ); - } else if ( splitted[counter] == "carrier" ) + } else if ( splitted[counter] == "carrier" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddCarrierToVertexProperty ); - } else if ( splitted[counter] == "country" ) + } else if ( splitted[counter] == "country" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddCountryToVertexProperty ); - } else if ( splitted[counter] == "v_mag_pu_set" ) + } else if ( splitted[counter] == "v_mag_pu_set" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddVoltageMagnitudePuSetPointToVertexProperty ); - } else if ( splitted[counter] == "v_mag_pu_min" ) + } else if ( splitted[counter] == "v_mag_pu_min" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddMinimumVoltageMagnitudePuToVertexProperty ); - } else if ( splitted[counter] == "v_mag_pu_max" ) + } else if ( splitted[counter] == "v_mag_pu_max" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddMaximumVoltageMagnitudePuToVertexProperty ); - } else if ( splitted[counter] == "control" ) + } else if ( splitted[counter] == "control" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddControlTypeToVertexProperty ); - } else if ( splitted[counter] == "sub_network" ) + } else if ( splitted[counter] == "sub_network" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddSubnetworkToVertexProperty ); - } else if ( splitted[counter] == "p" ) + } else if ( splitted[counter] == "p" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddRealPowerToVertexProperty ); - } else if ( splitted[counter] == "q" ) + } else if ( splitted[counter] == "q" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddReactivePowerToVertexProperty ); - } else if ( splitted[counter] == "v_mag_pu" ) + } else if ( splitted[counter] == "v_mag_pu" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddVoltageMagnitudePuToVertexProperty ); - } else if ( splitted[counter] == "v_ang" ) + } else if ( splitted[counter] == "v_ang" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddVoltageAngleToVertexProperty ); - } else if ( splitted[counter] == "marginal_price" ) + } else if ( splitted[counter] == "marginal_price" ) { dataMapperBuses_.emplace_back( &PyPsaParser::AddMarginalPriceToVertexProperty ); } // if @@ -1108,119 +1108,119 @@ class PyPsaParser { * @details Dependent on the data some columns exist and some * are missing. This method dynamically extracts the existing * data. - * + * * @param splitted The splitted line. * * @return @p true if the extraction was successful, @p false otherwise. */ - inline bool ExtractLineHeader( QList const & splitted ) + inline bool ExtractLineHeader( QList const & splitted ) { for ( Types::count counter = 0 ; counter < static_cast( splitted.size() ) - ; ++counter ) + ; ++counter ) { if ( splitted[counter] == "name" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddNameToEdge ); - } else if ( splitted[counter] == "bus0" ) + } else if ( splitted[counter] == "bus0" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddSourceVertexToEdge ); - } else if ( splitted[counter] == "bus1" ) + } else if ( splitted[counter] == "bus1" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddTargetVertexToEdge ); - } else if ( splitted[counter] == "capital_cost" ) + } else if ( splitted[counter] == "capital_cost" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddCapitalCostToEdge ); - } else if ( splitted[counter] == "length" ) + } else if ( splitted[counter] == "length" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddLengthToEdge ); - } else if ( splitted[counter] == "num_parallel" ) + } else if ( splitted[counter] == "num_parallel" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddNumberOfParallelLinesToEdge ); - } else if ( splitted[counter] == "s_max_pu" ) + } else if ( splitted[counter] == "s_max_pu" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddMaximumApparentPowerPuToEdge ); - } else if ( splitted[counter] == "s_nom" ) + } else if ( splitted[counter] == "s_nom" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddNominalApparentPowerToEdge ); - } else if ( splitted[counter] == "type" ) + } else if ( splitted[counter] == "type" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddLineTypeToEdge ); - } else if ( splitted[counter] == "v_nom" ) + } else if ( splitted[counter] == "v_nom" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddNominalVoltageToEdge ); - } else if ( splitted[counter] == "s_nom_min" ) + } else if ( splitted[counter] == "s_nom_min" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddMinimumNominalApparentPowerToEdge ); - } else if ( splitted[counter] == "s_nom_max" ) + } else if ( splitted[counter] == "s_nom_max" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddMaximalNominalApparentPowerToEdge ); - } else if ( splitted[counter] == "x" ) + } else if ( splitted[counter] == "x" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddReactanceToEdge ); - } else if ( splitted[counter] == "r" ) + } else if ( splitted[counter] == "r" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddResistanceToEdge ); - } else if ( splitted[counter] == "g" ) + } else if ( splitted[counter] == "g" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddConductanceToEdge ); - } else if ( splitted[counter] == "b" ) + } else if ( splitted[counter] == "b" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddSusceptanceToEdge ); - } else if ( splitted[counter] == "s_nom_extendable" ) + } else if ( splitted[counter] == "s_nom_extendable" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddNominalExtendableApparentPowerToEdge ); - } else if ( splitted[counter] == "terrain_factor" ) + } else if ( splitted[counter] == "terrain_factor" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddTerrainFactorToEdge ); - } else if ( splitted[counter] == "v_ang_min" ) + } else if ( splitted[counter] == "v_ang_min" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddMinimumVoltageAngleToEdge ); - } else if ( splitted[counter] == "v_ang_max" ) + } else if ( splitted[counter] == "v_ang_max" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddMaximumVoltageAngleToEdge ); - } + } // [out] - else if ( splitted[counter] == "sub_network" ) + else if ( splitted[counter] == "sub_network" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddSubnetworkToEdge ); - } else if ( splitted[counter] == "p0" ) + } else if ( splitted[counter] == "p0" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddP0ToEdge ); - } else if ( splitted[counter] == "q0" ) + } else if ( splitted[counter] == "q0" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddQ0ToEdge ); - } else if ( splitted[counter] == "p1" ) + } else if ( splitted[counter] == "p1" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddP1ToEdge ); - } else if ( splitted[counter] == "q1" ) + } else if ( splitted[counter] == "q1" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddQ1ToEdge ); - } else if ( splitted[counter] == "x_pu" ) + } else if ( splitted[counter] == "x_pu" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddReactancePuToEdge ); - } else if ( splitted[counter] == "r_pu" ) + } else if ( splitted[counter] == "r_pu" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddResistancePuToEdge ); - } else if ( splitted[counter] == "g_pu" ) + } else if ( splitted[counter] == "g_pu" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddConductancePuToEdge ); - } else if ( splitted[counter] == "b_pu" ) + } else if ( splitted[counter] == "b_pu" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddSusceptancePuToEdge ); - } else if ( splitted[counter] == "x_pu_eff" ) + } else if ( splitted[counter] == "x_pu_eff" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddEffectiveReactancePuToEdge ); - } else if ( splitted[counter] == "r_pu_eff" ) + } else if ( splitted[counter] == "r_pu_eff" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddEffectiveResistancePuToEdge ); - } else if ( splitted[counter] == "s_nom_opt" ) + } else if ( splitted[counter] == "s_nom_opt" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddOptimalNominalApparentPowerToEdge ); - } else if ( splitted[counter] == "mu_lower" ) + } else if ( splitted[counter] == "mu_lower" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddMuLowerToEdge ); - } else if ( splitted[counter] == "mu_upper" ) + } else if ( splitted[counter] == "mu_upper" ) { dataMapperLines_.emplace_back( &PyPsaParser::AddMuUpperToEdge ); } // if @@ -1238,108 +1238,108 @@ class PyPsaParser { * * @return @p true if the extraction was successful, @p false otherwise. */ - inline bool ExtractGeneratorHeader( QList const & splitted ) + inline bool ExtractGeneratorHeader( QList const & splitted ) { for ( Types::count counter = 0 ; counter < static_cast( splitted.size() ) - ; ++counter ) + ; ++counter ) { if ( splitted[counter] == "name" ) { - dataMapperGenerators_.emplace_back( &PyPsaParser::AddNameToGenerator ); - } else if ( splitted[counter] == "bus" ) + dataMapperGenerators_.emplace_back( &PyPsaParser::AddNameToGenerator ); + } else if ( splitted[counter] == "bus" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AssociateGeneratorWithBus ); - } else if ( splitted[counter] == "control" ) + } else if ( splitted[counter] == "control" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddControlTypeToGenerator ); - } else if ( splitted[counter] == "type" ) + } else if ( splitted[counter] == "type" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddTypeToGenerator ); - } else if ( splitted[counter] == "efficiency" ) + } else if ( splitted[counter] == "efficiency" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddGeneratorEfficiencyToGenerator ); - } else if ( splitted[counter] == "p_nom" ) + } else if ( splitted[counter] == "p_nom" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddNominalRealPowerToGenerator ); - } else if ( splitted[counter] == "p_nom_extendable" ) + } else if ( splitted[counter] == "p_nom_extendable" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddNominalRealPowerToGeneratorExtendable ); - } else if ( splitted[counter] == "p_nom_min" ) + } else if ( splitted[counter] == "p_nom_min" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddNominalRealPowerToGeneratorMin ); - } else if ( splitted[counter] == "p_nom_max" ) + } else if ( splitted[counter] == "p_nom_max" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddNominalRealPowerToGeneratorMax ); - } else if ( splitted[counter] == "p_min_pu" ) + } else if ( splitted[counter] == "p_min_pu" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddMinimumRealPowerPuToGenerator ); - } else if ( splitted[counter] == "p_max_pu" ) + } else if ( splitted[counter] == "p_max_pu" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddMaximumRealPowerPuToGenerator ); - } else if ( splitted[counter] == "p_set" ) + } else if ( splitted[counter] == "p_set" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddRealPowerSetPointToGenerator ); - } else if ( splitted[counter] == "q_set" ) + } else if ( splitted[counter] == "q_set" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddReactivePowerSetPointToGenerator ); - } else if ( splitted[counter] == "sign" ) + } else if ( splitted[counter] == "sign" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddGeneratorSignToGenerator ); - } else if ( splitted[counter] == "carrier" ) + } else if ( splitted[counter] == "carrier" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddCarrierToGenerator ); - } else if ( splitted[counter] == "marginal_cost" ) + } else if ( splitted[counter] == "marginal_cost" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddMarginalCostToGenerator ); - } else if ( splitted[counter] == "capital_cost" ) + } else if ( splitted[counter] == "capital_cost" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddCapitalCostToGenerator ); - } else if ( splitted[counter] == "committable" ) + } else if ( splitted[counter] == "committable" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddCommittabilityToGenerator ); - } else if ( splitted[counter] == "start_up_cost" ) + } else if ( splitted[counter] == "start_up_cost" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddStartUpCostToGenerator ); - } else if ( splitted[counter] == "shut_down_cost" ) + } else if ( splitted[counter] == "shut_down_cost" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddShutDownCostToGenerator ); - } else if ( splitted[counter] == "min_up_time" ) + } else if ( splitted[counter] == "min_up_time" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddMinimumUpTimeToGenerator ); - } else if ( splitted[counter] == "min_down_time" ) + } else if ( splitted[counter] == "min_down_time" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddMinimumDownTimeToGenerator ); - } else if ( splitted[counter] == "initial_status" ) + } else if ( splitted[counter] == "initial_status" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddInitialStatusToGenerator ); - } else if ( splitted[counter] == "ramp_limit_up" ) + } else if ( splitted[counter] == "ramp_limit_up" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddRampLimitUpToGenerator ); - } else if ( splitted[counter] == "ramp_limit_down" ) + } else if ( splitted[counter] == "ramp_limit_down" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddRampLimitDownToGenerator ); - } else if ( splitted[counter] == "ramp_limit_start_up" ) + } else if ( splitted[counter] == "ramp_limit_start_up" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddRampLimitStartUpToGenerator ); - } else if ( splitted[counter] == "ramp_limit_shut_down" ) + } else if ( splitted[counter] == "ramp_limit_shut_down" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddRampLimitShutDownToGenerator ); - } + } // [out] - else if ( splitted[counter] == "p" ) + else if ( splitted[counter] == "p" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddRealPowerToGenerator ); - } else if ( splitted[counter] == "q" ) + } else if ( splitted[counter] == "q" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddReactivePowerToGenerator ); - } else if ( splitted[counter] == "p_nom_opt" ) + } else if ( splitted[counter] == "p_nom_opt" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddNominalRealPowerToGeneratorOpt ); - } else if ( splitted[counter] == "status" ) + } else if ( splitted[counter] == "status" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddStatusToGenerator ); - } else if ( splitted[counter] == "weight" ) + } else if ( splitted[counter] == "weight" ) { dataMapperGenerators_.emplace_back( &PyPsaParser::AddWeightToGenerator ); } // if @@ -1355,32 +1355,32 @@ class PyPsaParser { * @return @p true if the header could be extracted, @p false * otherwise. */ - inline bool ExtractGeneratorMaximumRealPowerPuHeader( QList const & splitted ) + inline bool ExtractGeneratorMaximumRealPowerPuHeader( QList const & splitted ) { for ( Types::count counter = 0 ; counter < static_cast( splitted.size() ) - ; ++counter ) + ; ++counter ) { if ( splitted[counter] == "name" ) { - dataMapperGeneratorsRealPowerMaxPu_.emplace_back ( + dataMapperGeneratorsRealPowerMaxPu_.emplace_back ( std::bind ( & PyPsaParser::AddTimestampOfGenerator - , this + , this , std::placeholders::_1 // input string , std::placeholders::_2 // network ) ); - } else + } else { std::string generatorName = splitted[counter].trimmed().toStdString(); // dataMapperGeneratorsRealPowerMaxPu_.emplace_back( std::bind(&PyPsaParser::AddMaximumRealPowerSnapshotPuToGenerator, std::placeholders::_1, mapGeneratorName2Generator_[generatorName]) ); - if ( mapGeneratorName2Identifier_.find(generatorName) == mapGeneratorName2Identifier_.end() ) + if ( mapGeneratorName2Identifier_.find(generatorName) == mapGeneratorName2Identifier_.end() ) { ESSENTIAL_ASSERT( false && "Generator name does not exist" ); } - dataMapperGeneratorsRealPowerMaxPu_.emplace_back ( + dataMapperGeneratorsRealPowerMaxPu_.emplace_back ( std::bind ( & PyPsaParser::AddMaximumRealPowerSnapshotPuToGenerator , this , std::placeholders::_1 // input string @@ -1401,11 +1401,11 @@ class PyPsaParser { * otherwise. */ inline bool ExtractLoadHeader ( QList const & splitted - , Types::index & column ) + , Types::index & column ) { for ( Types::count counter = 0 ; counter < static_cast( splitted.size() ) - ; ++counter ) + ; ++counter ) { if ( splitted[counter] == "name" ) { @@ -1444,31 +1444,31 @@ class PyPsaParser { * * @return @p true if the header could be extracted, @p false otherwise. */ - inline bool ExtractLoadMaximumRealPowerPuHeader( QList const & splitted ) + inline bool ExtractLoadMaximumRealPowerPuHeader( QList const & splitted ) { for ( Types::count counter = 0 ; counter < static_cast( splitted.size() ) - ; ++counter ) + ; ++counter ) { if ( splitted[counter] == "name" ) { - dataMapperLoadsRealPowerMaxPu_.emplace_back( - std::bind ( &PyPsaParser::AddLoadTimestampName + dataMapperLoadsRealPowerMaxPu_.emplace_back( + std::bind ( &PyPsaParser::AddLoadTimestampName , this , std::placeholders::_1 // input string , std::placeholders::_2 // network ) ); - } else + } else { std::string loadName = splitted[counter].toStdString(); - - if ( mapLoadName2Identifier_.find(loadName) == mapLoadName2Identifier_.end() ) + + if ( mapLoadName2Identifier_.find(loadName) == mapLoadName2Identifier_.end() ) { ESSENTIAL_ASSERT( false && "Load name does not exist" ); } - dataMapperLoadsRealPowerMaxPu_.emplace_back( + dataMapperLoadsRealPowerMaxPu_.emplace_back( std::bind ( &PyPsaParser::AddMaximumRealPowerSnapshotPuToLoad , this , std::placeholders::_1 // input string @@ -1483,7 +1483,7 @@ class PyPsaParser { #pragma mark FUNCTION_POINTER_VECTOR_WITH_FUNCTION_POINTER std::vector headerGeneratorMaximumRealPowerPu_; /**< */ - + ///@name Function pointer types ///@{ using ElectricalVertexFunc = void (PyPsaParser::*)( Types::name const &, TVertexProperties& ); @@ -1527,9 +1527,9 @@ class PyPsaParser { * @param vertex The vertex property. */ void AddBusName ( Types::name const & name - , TVertexProperties & vertexProperty ) - { - vertexProperty.Name() = name; + , TVertexProperties & vertexProperty ) + { + vertexProperty.Name() = name; } /** @@ -1539,34 +1539,34 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ void AddNominalVoltageToVertexProperty ( Types::name const & voltageNominal - , TVertexProperties & vertexProperty ) - { - if ( !voltageNominal.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !voltageNominal.empty() ) { - if ( voltageNominal.compare("inf") != 0 ) + if ( voltageNominal.compare("inf") != 0 ) { // not inf vertexProperty.NominalVoltage() = Types::String2double( voltageNominal ); } else { //inf vertexProperty.NominalVoltage() = Const::REAL_INFTY; } - } + } } /** * @brief Add the bus type to the vertex property. - * + * * @pre Assume IEEE type. * * @param type The type. * @param vertexProperty The vertex property. - * + * * @note Placeholder in PyPsa data, i.e., not used yet. */ inline void AddBusTypeToVertexProperty ( Types::name const & type - , TVertexProperties & vertexProperty ) - { - if ( !type.empty() ) - { + , TVertexProperties & vertexProperty ) + { + if ( !type.empty() ) + { vertexProperty.Type() = Vertices::StringToIeeeBusType ( type ); } } @@ -1578,12 +1578,12 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddXcoordinateToVertexProperty ( Types::name const & xCoordinate - , TVertexProperties & vertexProperty ) - { - if ( !xCoordinate.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !xCoordinate.empty() ) { - vertexProperty.X() = Types::String2double( xCoordinate ); - } + vertexProperty.X() = Types::String2double( xCoordinate ); + } } /** @@ -1593,12 +1593,12 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddYcoordinateToVertexProperty ( Types::name const & yCoordinate - , TVertexProperties & vertexProperty ) - { - if ( !yCoordinate.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !yCoordinate.empty() ) { vertexProperty.Y() = Types::String2double( yCoordinate ); - } + } } /** @@ -1608,12 +1608,12 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddCarrierToVertexProperty ( Types::name const & carrier - , TVertexProperties & vertexProperty ) - { - if ( !carrier.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !carrier.empty() ) { vertexProperty.Carrier() = Vertices::StringToEnergyCarrier ( carrier ); - } + } } /** @@ -1623,13 +1623,13 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddCountryToVertexProperty ( Types::name const & country - , TVertexProperties & vertexProperty ) + , TVertexProperties & vertexProperty ) { // used in data but not specified - if ( !country.empty() ) + if ( !country.empty() ) { vertexProperty.Country() = country; - } - } + } + } /** * @brief Add voltage magnitude set point to the vertex property. @@ -1638,15 +1638,15 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddVoltageMagnitudePuSetPointToVertexProperty ( Types::name const & voltageMagnitudePuSetpoint - , TVertexProperties & vertexProperty ) - { - if ( !voltageMagnitudePuSetpoint.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !voltageMagnitudePuSetpoint.empty() ) { - if ( voltageMagnitudePuSetpoint.compare("inf") != 0 ) + if ( voltageMagnitudePuSetpoint.compare("inf") != 0 ) { // not inf - vertexProperty.VoltageMagnitude() = Types::String2double( voltageMagnitudePuSetpoint ); + vertexProperty.VoltageMagnitude() = Types::String2double( voltageMagnitudePuSetpoint ); } else { //inf - vertexProperty.VoltageMagnitude() = Const::REAL_INFTY; + vertexProperty.VoltageMagnitude() = Const::REAL_INFTY; } } } @@ -1658,11 +1658,11 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddMinimumVoltageMagnitudePuToVertexProperty ( Types::name const & voltageMagnitudePuMinimum - , TVertexProperties & vertexProperty ) - { - if ( !voltageMagnitudePuMinimum.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !voltageMagnitudePuMinimum.empty() ) { /* vertex voltageMagnitudePuMinimum */ - if ( voltageMagnitudePuMinimum.compare("inf") != 0 ) + if ( voltageMagnitudePuMinimum.compare("inf") != 0 ) { // not inf vertexProperty.MinimumVoltage() = Types::String2double( voltageMagnitudePuMinimum ); } else { //inf @@ -1678,11 +1678,11 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddMaximumVoltageMagnitudePuToVertexProperty ( Types::name const & voltageMagnitudePuMaximum - , TVertexProperties & vertexProperty ) - { - if ( !voltageMagnitudePuMaximum.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !voltageMagnitudePuMaximum.empty() ) { /* vertex voltageMagnitudePuMaximum */ - if ( voltageMagnitudePuMaximum.compare("inf") != 0 ) + if ( voltageMagnitudePuMaximum.compare("inf") != 0 ) { // not inf vertexProperty.MaximumVoltage() = Types::String2double( voltageMagnitudePuMaximum ); } else { //inf @@ -1701,13 +1701,13 @@ class PyPsaParser { * * @param control The control type of the bus. * @param vertexProperty The vertex property. - * + * * @note Currently only output and not used yet. */ inline void AddControlTypeToVertexProperty ( Types::string const & control - , TVertexProperties & vertexProperty ) - { - if ( !control.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !control.empty() ) { /* vertex control */ vertexProperty.Control() = Vertices::StringToControlType ( control ); } @@ -1718,15 +1718,15 @@ class PyPsaParser { * * @param subnetwork The subnetwork. * @param vertexProperty The vertex property. - * + * * @note Currently only output and not used yet. */ inline void AddSubnetworkToVertexProperty ( Types::name const & subnetwork - , TVertexProperties & vertexProperty ) - { - if ( !subnetwork.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !subnetwork.empty() ) { - if ( subnetwork.compare("inf") != 0 ) + if ( subnetwork.compare("inf") != 0 ) { // not inf /* vertex subnetwork */ } else { //inf @@ -1740,15 +1740,15 @@ class PyPsaParser { * * @param realPower The real power. * @param vertexProperty The vertex property. - * + * * @note Currently only output and not used yet. */ inline void AddRealPowerToVertexProperty ( Types::name const & realPower - , TVertexProperties & vertexProperty ) - { - if ( !realPower.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !realPower.empty() ) { - if ( realPower.compare("inf") != 0 ) + if ( realPower.compare("inf") != 0 ) { // not inf /* vertex.RealPowerLoad() = Types::String2double( realPower ); */ } else { //inf @@ -1762,15 +1762,15 @@ class PyPsaParser { * * @param reactivePower The reactive power * @param vertexProperty The vertex property - * + * * @note Currently only output and not used yet. */ inline void AddReactivePowerToVertexProperty ( Types::name const & reactivePower - , TVertexProperties & vertexProperty ) - { - if ( !reactivePower.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !reactivePower.empty() ) { - if ( reactivePower.compare("inf") != 0 ) + if ( reactivePower.compare("inf") != 0 ) { // not inf /*vertex.ReactivePowerLoad() = Types::String2double( reactivePower ); */ } else { //inf @@ -1784,21 +1784,21 @@ class PyPsaParser { * * @param voltageMagnitudePu The voltage magnitude in p.u. * @param vertexProperty The vertex property. - * + * * @note Currently only output and not used yet. */ inline void AddVoltageMagnitudePuToVertexProperty ( Types::name const & voltageMagnitudePu - , TVertexProperties & vertexProperty ) + , TVertexProperties & vertexProperty ) { - if ( !voltageMagnitudePu.empty() ) + if ( !voltageMagnitudePu.empty() ) { - if ( voltageMagnitudePu.compare("inf") != 0 ) + if ( voltageMagnitudePu.compare("inf") != 0 ) { // not inf - /* vertex.VoltageMagnitude() = voltageMagnitudePu; */ + /* vertex.VoltageMagnitude() = voltageMagnitudePu; */ } else { //inf - /* vertex.VoltageMagnitude() = voltageMagnitudePu; */ + /* vertex.VoltageMagnitude() = voltageMagnitudePu; */ } - } + } } /** @@ -1806,19 +1806,19 @@ class PyPsaParser { * * @param voltageAngle The voltage angle. * @param vertexProperty The vertex property. - * + * * @note Currently only output and not used yet. */ inline void AddVoltageAngleToVertexProperty ( Types::name const & voltageAngle - , TVertexProperties & vertexProperty ) - { - if ( !voltageAngle.empty() ) + , TVertexProperties & vertexProperty ) + { + if ( !voltageAngle.empty() ) { - if ( voltageAngle.compare("inf") != 0 ) + if ( voltageAngle.compare("inf") != 0 ) { // not inf - vertexProperty.VoltageAngle() = Types::String2double( voltageAngle ); + vertexProperty.VoltageAngle() = Types::String2double( voltageAngle ); } else { //inf - vertexProperty.VoltageAngle() = Const::REAL_INFTY; + vertexProperty.VoltageAngle() = Const::REAL_INFTY; } } } @@ -1828,15 +1828,15 @@ class PyPsaParser { * * @param marginalPrice The marginal price. * @param vertex The vertex property. - * + * * @note Currently only output and not used yet. */ inline void AddMarginalPriceToVertexProperty ( Types::name const & marginalPrice - , TVertexProperties & vertex ) - { - if ( !marginalPrice.empty() ) + , TVertexProperties & vertex ) + { + if ( !marginalPrice.empty() ) { - if ( marginalPrice.compare("inf") != 0 ) + if ( marginalPrice.compare("inf") != 0 ) { // not inf /* marginalPrice */ } else { //inf @@ -1845,7 +1845,7 @@ class PyPsaParser { } } ///@} - + ///@name Generator (also known as source) data ///@{ #pragma mark GENERATOR_DATA_EXTRACTION @@ -1857,13 +1857,13 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddControlTypeToGenerator ( Types::string const & control - , TGeneratorProperties & generatorProperty ) - { + , TGeneratorProperties & generatorProperty ) + { generatorProperty.Control() = Vertices::StringToControlType ( control ); - if ( Vertices::ControlType::unknown == generatorProperty.Control() ) + if ( Vertices::ControlType::unknown == generatorProperty.Control() ) { - generatorProperty.Control() = Vertices::ControlType::PQ; - } + generatorProperty.Control() = Vertices::ControlType::PQ; + } } /** @@ -1873,13 +1873,13 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddNominalRealPowerToGenerator ( Types::string const & pNom - , TGeneratorProperties & generatorProperty ) - { - if ( Types::String2double( pNom ) != 0 ) + , TGeneratorProperties & generatorProperty ) + { + if ( Types::String2double( pNom ) != 0 ) { - generatorProperty.NominalPower() = Types::String2double( pNom ); + generatorProperty.NominalPower() = Types::String2double( pNom ); } else { - generatorProperty.NominalPower() = 1; + generatorProperty.NominalPower() = 1; } } @@ -1890,14 +1890,14 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddNominalRealPowerToGeneratorExtendable ( Types::string const & pNomExtendable - , TGeneratorProperties & generatorProperty ) - { - if ( pNomExtendable == "TRUE" ) - { - generatorProperty.IsExtendable() = true; - } else { - generatorProperty.IsExtendable() = false; - } + , TGeneratorProperties & generatorProperty ) + { + if ( pNomExtendable == "TRUE" ) + { + generatorProperty.IsExtendable() = true; + } else { + generatorProperty.IsExtendable() = false; + } } /** @@ -1907,17 +1907,17 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddNameToGenerator ( Types::name const & name - , TGeneratorProperties & generatorProperty ) - { - generatorProperty.Name() = name; - if ( mapGeneratorName2Generator_.find ( generatorProperty.Name() ) - == mapGeneratorName2Generator_.end() ) + , TGeneratorProperties & generatorProperty ) + { + generatorProperty.Name() = name; + if ( mapGeneratorName2Generator_.find ( generatorProperty.Name() ) + == mapGeneratorName2Generator_.end() ) { - mapGeneratorName2Generator_[generatorProperty.Name()] = generatorProperty; + mapGeneratorName2Generator_[generatorProperty.Name()] = generatorProperty; } else { ESSENTIAL_ASSERT( false && "Generator duplicates" ); } - } + } /** * @brief Associate the generator with a bus. @@ -1926,14 +1926,14 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AssociateGeneratorWithBus ( Types::name const & bus - , TGeneratorProperties & generatorProperty ) - { - if ( !bus.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !bus.empty() ) { - if ( mapGeneratorName2BusName_.find( generatorProperty.Name() ) - == mapGeneratorName2BusName_.end() ) + if ( mapGeneratorName2BusName_.find( generatorProperty.Name() ) + == mapGeneratorName2BusName_.end() ) { - mapGeneratorName2BusName_[ generatorProperty.Name() ] = bus; + mapGeneratorName2BusName_[ generatorProperty.Name() ] = bus; } else { ESSENTIAL_ASSERT( false && "Generator duplicates" ); } @@ -1949,9 +1949,9 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddTypeToGenerator ( Types::string const & type - , TGeneratorProperties & generatorProperty ) - { - if ( !type.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !type.empty() ) { /* generator type */ } @@ -1964,11 +1964,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddGeneratorEfficiencyToGenerator ( Types::string const & efficiency - , TGeneratorProperties & generatorProperty ) - { - if ( !efficiency.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !efficiency.empty() ) { - if ( efficiency.compare("inf") != 0 ) + if ( efficiency.compare("inf") != 0 ) { // not inf generatorProperty.Efficiency() = Types::String2double( efficiency ); } else { //inf @@ -1984,11 +1984,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddNominalRealPowerToGeneratorMin ( Types::string const & pNomMin - , TGeneratorProperties & generatorProperty ) - { - if ( !pNomMin.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !pNomMin.empty() ) { - if ( pNomMin.compare("inf") != 0 ) + if ( pNomMin.compare("inf") != 0 ) { // not inf generatorProperty.NominalRealPowerBound().Minimum() = Types::String2double( pNomMin ); } else { //inf @@ -2004,13 +2004,13 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddNominalRealPowerToGeneratorMax ( Types::string const & pNomMax - , TGeneratorProperties & generatorProperty ) - { - if ( !pNomMax.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !pNomMax.empty() ) { - if ( pNomMax.compare("inf") != 0 ) + if ( pNomMax.compare("inf") != 0 ) { // not inf - generatorProperty.NominalRealPowerBound().Maximum() = Types::String2double( pNomMax ); + generatorProperty.NominalRealPowerBound().Maximum() = Types::String2double( pNomMax ); } else { //inf generatorProperty.NominalRealPowerBound().Maximum() = Const::REAL_INFTY; } @@ -2024,11 +2024,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddMinimumRealPowerPuToGenerator ( Types::string const & pMinPu - , TGeneratorProperties & generatorProperty ) - { - if ( !pMinPu.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !pMinPu.empty() ) { - if ( pMinPu.compare("inf") != 0 ) + if ( pMinPu.compare("inf") != 0 ) { // not inf generatorProperty.RealPowerBound().Minimum() = Types::String2double( pMinPu ); } else { //inf @@ -2044,11 +2044,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddMaximumRealPowerPuToGenerator ( Types::string const & pMaxPu - , TGeneratorProperties & generatorProperty ) - { - if ( !pMaxPu.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !pMaxPu.empty() ) { - if ( pMaxPu.compare("inf") != 0 ) + if ( pMaxPu.compare("inf") != 0 ) { // not inf generatorProperty.RealPowerBound().Maximum() = Types::String2double( pMaxPu ); } else { //inf @@ -2064,11 +2064,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddRealPowerSetPointToGenerator ( Types::string const & pSet - , TGeneratorProperties & generatorProperty ) - { - if ( !pSet.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !pSet.empty() ) { - if ( pSet.compare("inf") != 0 ) + if ( pSet.compare("inf") != 0 ) { // not inf generatorProperty.RealPower() = Types::String2double( pSet ); } else { //inf @@ -2084,11 +2084,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddReactivePowerSetPointToGenerator ( Types::string const & qSet - , TGeneratorProperties & generatorProperty ) - { - if ( !qSet.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !qSet.empty() ) { - if ( qSet.compare("inf") != 0 ) + if ( qSet.compare("inf") != 0 ) { // not inf generatorProperty.ReactivePower() = Types::String2double( qSet ); } else { //inf @@ -2104,12 +2104,12 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddGeneratorSignToGenerator ( Types::string const & sign - , TGeneratorProperties & generatorProperty ) - { - if ( !sign.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !sign.empty() ) { Types::integer powerSign = Types::String2integer( sign ); - if ( powerSign >= 0 ) + if ( powerSign >= 0 ) { generatorProperty.PowerSign() = Vertices::PowerSign::positive; } @@ -2126,9 +2126,9 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddCarrierToGenerator ( Types::string const & carrier - , TGeneratorProperties & generatorProperty ) - { - if ( !carrier.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !carrier.empty() ) { generatorProperty.GeneratorType() = Vertices::StringToGeneratorType ( carrier ); } @@ -2141,13 +2141,13 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddMarginalCostToGenerator ( Types::string const & marginalCost - , TGeneratorProperties & generatorProperty ) - { - if ( !marginalCost.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !marginalCost.empty() ) { - if ( marginalCost.compare("inf") != 0 ) + if ( marginalCost.compare("inf") != 0 ) { // not inf - generatorProperty.MarginalCost() = Types::String2double( marginalCost ); + generatorProperty.MarginalCost() = Types::String2double( marginalCost ); } else { //inf generatorProperty.MarginalCost() = Const::REAL_INFTY; } @@ -2161,11 +2161,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddCapitalCostToGenerator ( Types::string const & capitalCost - , TGeneratorProperties & generatorProperty ) - { - if ( !capitalCost.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !capitalCost.empty() ) { - if ( capitalCost.compare("inf") != 0 ) + if ( capitalCost.compare("inf") != 0 ) { // not inf generatorProperty.CapitalCost() = Types::String2double( capitalCost ); } else { //inf @@ -2188,14 +2188,14 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddCommittabilityToGenerator ( Types::string const & committable - , TGeneratorProperties & generatorProperty ) - { - if ( committable == "True" ) - { - generatorProperty.Committable() = true; - } else { - generatorProperty.Committable() = false; - } + , TGeneratorProperties & generatorProperty ) + { + if ( committable == "True" ) + { + generatorProperty.Committable() = true; + } else { + generatorProperty.Committable() = false; + } } /** @@ -2205,11 +2205,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddStartUpCostToGenerator ( Types::string const & startUpCost - , TGeneratorProperties & generatorProperty ) - { - if ( !startUpCost.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !startUpCost.empty() ) { - if ( startUpCost.compare("inf") != 0 ) + if ( startUpCost.compare("inf") != 0 ) { // not inf generatorProperty.StartUpCost() = Types::String2double( startUpCost ); } else { //inf @@ -2225,11 +2225,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddShutDownCostToGenerator ( Types::string const & shutDownCost - , TGeneratorProperties & generatorProperty ) - { - if ( !shutDownCost.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !shutDownCost.empty() ) { - if ( shutDownCost.compare("inf") != 0 ) + if ( shutDownCost.compare("inf") != 0 ) { // not inf generatorProperty.ShutDownCost() = Types::String2double( shutDownCost ); } else { //inf @@ -2245,13 +2245,13 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddMinimumUpTimeToGenerator ( Types::string const & minUpTime - , TGeneratorProperties & generatorProperty ) - { - if ( !minUpTime.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !minUpTime.empty() ) { - if ( minUpTime.compare("inf") != 0 ) + if ( minUpTime.compare("inf") != 0 ) { // not inf - generatorProperty.MinimumUpTime() = Types::String2double( minUpTime ); + generatorProperty.MinimumUpTime() = Types::String2double( minUpTime ); } else { //inf generatorProperty.MinimumUpTime() = Const::REAL_INFTY; } @@ -2265,11 +2265,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddMinimumDownTimeToGenerator ( Types::string const & minDownTime - , TGeneratorProperties & generatorProperty ) - { - if ( !minDownTime.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !minDownTime.empty() ) { - if ( minDownTime.compare("inf") != 0 ) + if ( minDownTime.compare("inf") != 0 ) { // not inf generatorProperty.MinimumDownTime() = Types::String2double( minDownTime ); } else { //inf @@ -2285,9 +2285,9 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddInitialStatusToGenerator ( Types::string const & initialStatus - , TGeneratorProperties & generatorProperty ) - { - if ( !initialStatus.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !initialStatus.empty() ) { Types::index status = Types::String2integer( initialStatus ); if ( status ) @@ -2304,13 +2304,13 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddRampLimitUpToGenerator ( Types::string const & rampLimitUp - , TGeneratorProperties & generatorProperty ) - { - if ( !rampLimitUp.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !rampLimitUp.empty() ) { - if ( rampLimitUp.compare("inf") != 0 ) + if ( rampLimitUp.compare("inf") != 0 ) { // not inf - generatorProperty.RampLimitUp() = Types::String2double( rampLimitUp ); + generatorProperty.RampLimitUp() = Types::String2double( rampLimitUp ); } else { //inf generatorProperty.RampLimitUp() = Const::REAL_INFTY; } @@ -2324,13 +2324,13 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddRampLimitDownToGenerator ( Types::string const & rampLimitDown - , TGeneratorProperties & generatorProperty ) - { - if ( !rampLimitDown.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !rampLimitDown.empty() ) { - if ( rampLimitDown.compare("inf") != 0 ) + if ( rampLimitDown.compare("inf") != 0 ) { // not inf - generatorProperty.RampLimitDown() = Types::String2double( rampLimitDown ); + generatorProperty.RampLimitDown() = Types::String2double( rampLimitDown ); } else { //inf generatorProperty.RampLimitDown() = Const::REAL_INFTY; } @@ -2344,13 +2344,13 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddRampLimitStartUpToGenerator ( Types::string const & rampLimitStartUp - , TGeneratorProperties & generatorProperty ) - { - if ( !rampLimitStartUp.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !rampLimitStartUp.empty() ) { - if ( rampLimitStartUp.compare("inf") != 0 ) + if ( rampLimitStartUp.compare("inf") != 0 ) { // not inf - generatorProperty.RampLimitStartUp() = Types::String2double( rampLimitStartUp); + generatorProperty.RampLimitStartUp() = Types::String2double( rampLimitStartUp); } else { //inf generatorProperty.RampLimitStartUp() = Const::REAL_INFTY; } @@ -2364,11 +2364,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddRampLimitShutDownToGenerator ( Types::string const & rampLimitShutDown - , TGeneratorProperties & generatorProperty ) - { - if ( !rampLimitShutDown.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !rampLimitShutDown.empty() ) { - if ( rampLimitShutDown.compare("inf") != 0 ) + if ( rampLimitShutDown.compare("inf") != 0 ) { // not inf generatorProperty.RampLimitShutDown() = Types::String2double( rampLimitShutDown ); } else { //inf @@ -2379,7 +2379,7 @@ class PyPsaParser { ///@} ///@name Generator data output - ///@{ + ///@{ #pragma mark GENERATOR_DATA_OUTPUT /** @@ -2389,11 +2389,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddRealPowerToGenerator ( Types::name const & realPower - , TGeneratorProperties & generatorProperty ) - { - if ( !realPower.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !realPower.empty() ) { - if ( realPower.compare("inf") != 0 ) + if ( realPower.compare("inf") != 0 ) { // not inf /* realPower */ } else { //inf @@ -2409,11 +2409,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddReactivePowerToGenerator ( Types::name const & reactivePower - , TGeneratorProperties & generatorProperty ) - { - if ( !reactivePower.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !reactivePower.empty() ) { - if ( reactivePower.compare("inf") != 0 ) + if ( reactivePower.compare("inf") != 0 ) { // not inf /* reactivePower */ } else { //inf @@ -2429,31 +2429,31 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddNominalRealPowerToGeneratorOpt ( Types::name const & pNomOpt - , TGeneratorProperties & generatorProperty ) - { - if ( !pNomOpt.empty() ) - { - if ( pNomOpt.compare("inf") != 0 ) + , TGeneratorProperties & generatorProperty ) + { + if ( !pNomOpt.empty() ) + { + if ( pNomOpt.compare("inf") != 0 ) { // not inf /* pNomOpt */ } else { //inf /* pNomOpt */ } - } + } } /** * @brief Adds a status to the generator @f$\vertex\in\generators@f$. - * + * * @param status The status. * @param generatorProperty The generator property. */ inline void AddStatusToGenerator ( Types::name const & status - , TGeneratorProperties & generatorProperty ) - { - if ( !status.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !status.empty() ) { - if ( status.compare("inf") != 0 ) + if ( status.compare("inf") != 0 ) { // not inf /* status */ } else { //inf @@ -2469,11 +2469,11 @@ class PyPsaParser { * @param generatorProperty The generator property. */ inline void AddWeightToGenerator ( Types::name const & weight - , TGeneratorProperties & generatorProperty ) - { - if ( !weight.empty() ) + , TGeneratorProperties & generatorProperty ) + { + if ( !weight.empty() ) { - if ( weight.compare("inf") != 0 ) + if ( weight.compare("inf") != 0 ) { // not inf /* weight */ } else { //inf @@ -2492,13 +2492,13 @@ class PyPsaParser { * * @param name The name. * @param network The network @f$\network = ( \graph, \generators, \consumers, \capacity, \susceptance, \dots )@f$. - * + * * @todo What happens if load timestamps does not exist? - * + * */ void AddTimestampOfGenerator ( Types::name const & name - , TNetwork & network ) - { /*network.AddSnapshotTimestamp( name ); is already implemented at load equivalent*/ + , TNetwork & network ) + { /*network.AddSnapshotTimestamp( name ); is already implemented at load equivalent*/ } /** @@ -2507,27 +2507,27 @@ class PyPsaParser { * @param maximumRealPowerPu The maximum real power in p.u. * @param network The network @f$\network = ( \graph, \generators, \consumers, \capacity, \susceptance, \dots )@f$. * @param[in] generatorId The generator identifier. - * + * * @todo Check if the number of timestamps are correct - * + * */ inline void AddMaximumRealPowerSnapshotPuToGenerator ( Types::name const & maximumRealPowerPu , TNetwork & network - , Types::vertexId generatorId ) - { - if ( !maximumRealPowerPu.empty() ) + , Types::vertexId generatorId ) + { + if ( !maximumRealPowerPu.empty() ) { - if ( maximumRealPowerPu.compare("inf") != 0 ) + if ( maximumRealPowerPu.compare("inf") != 0 ) { // not inf - network.AddGeneratorRealPowerSnapshotAt ( generatorId, Types::String2double( maximumRealPowerPu ) ); + network.AddGeneratorRealPowerSnapshotAt ( generatorId, Types::String2double( maximumRealPowerPu ) ); } else { //inf - network.AddGeneratorRealPowerSnapshotAt ( generatorId, Const::REAL_INFTY ); + network.AddGeneratorRealPowerSnapshotAt ( generatorId, Const::REAL_INFTY ); } } else { USAGE_ASSERT ( false && "Generator real power snapshot at generatorId is empty!" ); } - } - // void AddMaximumRealPowerSnapshotPuToGenerator ( Types::name & maximumRealPowerPu, TGeneratorProperties * generator ) { generator->RealPower() = Types::String2double( maximumRealPowerPu ); } + } + // void AddMaximumRealPowerSnapshotPuToGenerator ( Types::name & maximumRealPowerPu, TGeneratorProperties * generator ) { generator->RealPower() = Types::String2double( maximumRealPowerPu ); } ///@} ///@name Line (also known as Branch or Circuit) Data @@ -2541,8 +2541,8 @@ class PyPsaParser { * @param edge The edge. */ inline void AddNameToEdge ( Types::name const & name - , TIoEdge & edge ) - { + , TIoEdge & edge ) + { edge.Properties().Name() = name; } @@ -2553,16 +2553,16 @@ class PyPsaParser { * @param edge The edge. */ inline void AddSourceVertexToEdge ( Types::name const & source - , TIoEdge & edge ) - { - if ( !source.empty() ) + , TIoEdge & edge ) + { + if ( !source.empty() ) { - if ( mapBusName2VertexId_.find ( source ) != mapBusName2VertexId_.end() ) + if ( mapBusName2VertexId_.find ( source ) != mapBusName2VertexId_.end() ) { edge.Source() = mapBusName2VertexId_[source]; } } - } + } /** * @brief Associate the line with the target bus. @@ -2571,16 +2571,16 @@ class PyPsaParser { * @param edge The edge. */ inline void AddTargetVertexToEdge ( Types::name const & target - , TIoEdge & edge ) - { - if ( !target.empty() ) + , TIoEdge & edge ) + { + if ( !target.empty() ) { - if ( mapBusName2VertexId_.find ( target ) != mapBusName2VertexId_.end() ) + if ( mapBusName2VertexId_.find ( target ) != mapBusName2VertexId_.end() ) { edge.Target() = mapBusName2VertexId_[target]; } } - } + } /** * @brief Add the capital cost to the line. @@ -2589,11 +2589,11 @@ class PyPsaParser { * @param edge The edge. */ inline void AddCapitalCostToEdge ( Types::name const & capitalCost - , TIoEdge & edge ) - { - if ( !capitalCost.empty() ) + , TIoEdge & edge ) + { + if ( !capitalCost.empty() ) { - if ( capitalCost.compare("inf") != 0 ) + if ( capitalCost.compare("inf") != 0 ) { // not inf edge.Properties().CapitalCost() = Types::String2double( capitalCost ); } else { //inf @@ -2609,11 +2609,11 @@ class PyPsaParser { * @param edge The edge. */ inline void AddLengthToEdge ( Types::name const & length - , TIoEdge & edge ) - { - if ( !length.empty() ) + , TIoEdge & edge ) + { + if ( !length.empty() ) { - if ( length.compare("inf") != 0 ) + if ( length.compare("inf") != 0 ) { // not inf edge.Properties().Length() = Types::String2double( length ); } else { @@ -2629,13 +2629,13 @@ class PyPsaParser { * @param edge The edge. */ inline void AddNumberOfParallelLinesToEdge ( Types::name const & numberParallelLines - , TIoEdge & edge ) - { - if ( !numberParallelLines.empty() ) + , TIoEdge & edge ) + { + if ( !numberParallelLines.empty() ) { - if ( numberParallelLines.compare("inf") != 0 ) + if ( numberParallelLines.compare("inf") != 0 ) { // not inf - edge.Properties().NumberOfParallelLines() = Types::String2integer( numberParallelLines ); + edge.Properties().NumberOfParallelLines() = Types::String2integer( numberParallelLines ); } else { ESSENTIAL_ASSERT( false && "Infinity parallel lines"); } @@ -2649,19 +2649,19 @@ class PyPsaParser { * @param edge The edge. */ inline void AddMaximumApparentPowerPuToEdge ( Types::name const & apparentPowerMaximumPu - , TIoEdge & edge ) - { - if ( !apparentPowerMaximumPu.empty() ) + , TIoEdge & edge ) + { + if ( !apparentPowerMaximumPu.empty() ) { - if ( apparentPowerMaximumPu.compare("inf") != 0 ) + if ( apparentPowerMaximumPu.compare("inf") != 0 ) { // not inf - edge.Properties().ThermalLimit() = Types::String2double( apparentPowerMaximumPu ); + edge.Properties().ThermalLimit() = Types::String2double( apparentPowerMaximumPu ); } else { //inf edge.Properties().ThermalLimit() = Const::REAL_INFTY; } } - } - + } + /** * @brief Add the nominal apparent power to the line. * @@ -2669,19 +2669,19 @@ class PyPsaParser { * @param edge The edge. */ void AddNominalApparentPowerToEdge ( Types::name const & apparentPowerNominal - , TIoEdge & edge ) - { - if ( !apparentPowerNominal.empty() ) + , TIoEdge & edge ) + { + if ( !apparentPowerNominal.empty() ) { - if ( apparentPowerNominal.compare("inf") != 0 ) + if ( apparentPowerNominal.compare("inf") != 0 ) { // not inf - edge.Properties().NominalApparentPower() = Types::String2double( apparentPowerNominal ); + edge.Properties().NominalApparentPower() = Types::String2double( apparentPowerNominal ); } else { //inf edge.Properties().NominalApparentPower() = Const::REAL_INFTY; } } } - + /** * @brief Add the line type to the line. * @@ -2689,11 +2689,11 @@ class PyPsaParser { * @param edge The edge. */ inline void AddLineTypeToEdge ( Types::name const & type - , TIoEdge & edge ) - { - if ( !type.empty() ) + , TIoEdge & edge ) + { + if ( !type.empty() ) { - edge.Properties().Type() = Edges::ElectricalEdgeType::standard; + edge.Properties().Type() = Edges::ElectricalEdgeType::standard; } } @@ -2704,11 +2704,11 @@ class PyPsaParser { * @param edge The edge. */ void AddNominalVoltageToEdge ( Types::name const & voltageNominal - , TIoEdge & edge ) - { - if ( !voltageNominal.empty() ) + , TIoEdge & edge ) + { + if ( !voltageNominal.empty() ) { - if ( voltageNominal.compare("inf") != 0 ) + if ( voltageNominal.compare("inf") != 0 ) { // not inf edge.Properties().NominalVoltage() = Types::String2double( voltageNominal ); } else { //inf @@ -2724,11 +2724,11 @@ class PyPsaParser { * @param edge The edge. */ inline void AddMinimumNominalApparentPowerToEdge ( Types::name const & apparentPowerNominalMinimum - , TIoEdge & edge ) + , TIoEdge & edge ) { /* difference to apparentPowerMaximumPu apart the pu */ - if ( !apparentPowerNominalMinimum.empty() ) + if ( !apparentPowerNominalMinimum.empty() ) { - if ( apparentPowerNominalMinimum.compare("inf") != 0 ) + if ( apparentPowerNominalMinimum.compare("inf") != 0 ) { // not inf edge.Properties().NominalApparentPowerBound().Minimum() = Types::String2double( apparentPowerNominalMinimum ); } else { //inf @@ -2744,13 +2744,13 @@ class PyPsaParser { * @param edge The edge. */ inline void AddMaximalNominalApparentPowerToEdge ( Types::name const & apparentPowerNominalMaximum - , TIoEdge & edge ) - { - if ( !apparentPowerNominalMaximum.empty() ) + , TIoEdge & edge ) + { + if ( !apparentPowerNominalMaximum.empty() ) { - if ( apparentPowerNominalMaximum.compare("inf") != 0 ) + if ( apparentPowerNominalMaximum.compare("inf") != 0 ) { // not inf - edge.Properties().NominalApparentPowerBound().Maximum() = Types::String2double( apparentPowerNominalMaximum ); + edge.Properties().NominalApparentPowerBound().Maximum() = Types::String2double( apparentPowerNominalMaximum ); } else { //inf edge.Properties().NominalApparentPowerBound().Maximum() = Const::REAL_INFTY; } @@ -2763,17 +2763,17 @@ class PyPsaParser { * @param resistance The resistance. * @param edge The edge. */ - inline void AddResistanceToEdge ( Types::name const & resistance - , TIoEdge & edge ) - { - if ( !resistance.empty() ) + inline void AddResistanceToEdge ( Types::name const & resistance + , TIoEdge & edge ) + { + if ( !resistance.empty() ) { - if ( resistance.compare("inf") != 0 ) + if ( resistance.compare("inf") != 0 ) { // not inf edge.Properties().Resistance() = Types::String2double( resistance ); } else { //inf edge.Properties().Resistance() = Const::REAL_INFTY; - } + } } } @@ -2784,16 +2784,16 @@ class PyPsaParser { * @param edge The edge. */ inline void AddReactanceToEdge ( Types::name const & reactance - , TIoEdge & edge ) - { - if ( !reactance.empty() ) + , TIoEdge & edge ) + { + if ( !reactance.empty() ) { - if ( reactance.compare("inf") != 0 ) + if ( reactance.compare("inf") != 0 ) { // not inf edge.Properties().Reactance() = Types::String2double( reactance ); } else { //inf edge.Properties().Reactance() = Const::REAL_INFTY; - } + } } } @@ -2804,18 +2804,18 @@ class PyPsaParser { * @param edge The edge. */ inline void AddConductanceToEdge ( Types::name const & conductance - , TIoEdge & edge ) + , TIoEdge & edge ) { /* Can be calculated by r and x */ - if ( !conductance.empty() ) + if ( !conductance.empty() ) { - if ( conductance.compare("inf") != 0 ) + if ( conductance.compare("inf") != 0 ) { // not inf edge.Properties().Conductance( Types::String2double( conductance ) ); } else { //inf edge.Properties().Conductance( Const::REAL_INFTY ); - } + } } - } + } /** * @brief Add the susceptance to the line. @@ -2824,19 +2824,19 @@ class PyPsaParser { * @param edge The edge. */ inline void AddSusceptanceToEdge ( Types::name const & susceptance - , TIoEdge & edge ) + , TIoEdge & edge ) { /* Can be calculated by r and x */ - if ( !susceptance.empty() ) + if ( !susceptance.empty() ) { - if ( susceptance.compare("inf") != 0 ) + if ( susceptance.compare("inf") != 0 ) { // not inf edge.Properties().Susceptance( Types::String2double( susceptance ) ); } else { //inf edge.Properties().Susceptance( Const::REAL_INFTY ); - } + } } - } - + } + /** * @brief Add the nominal extendable apparent power to the line. * @@ -2844,11 +2844,11 @@ class PyPsaParser { * @param edge The edge. */ void AddNominalExtendableApparentPowerToEdge ( Types::name const & apparentPowerNominalExtendable - , TIoEdge & edge ) - { - if ( !apparentPowerNominalExtendable.empty() ) + , TIoEdge & edge ) + { + if ( !apparentPowerNominalExtendable.empty() ) { - edge.Properties().NominalApparentPowerExtendable() = Types::String2double( apparentPowerNominalExtendable ); + edge.Properties().NominalApparentPowerExtendable() = Types::String2double( apparentPowerNominalExtendable ); } } @@ -2859,16 +2859,16 @@ class PyPsaParser { * @param edge The edge. */ inline void AddTerrainFactorToEdge ( Types::name const & terrainFactor - , TIoEdge & edge ) - { - if ( !terrainFactor.empty() ) - { - if ( terrainFactor.compare("inf") != 0 ) + , TIoEdge & edge ) + { + if ( !terrainFactor.empty() ) + { + if ( terrainFactor.compare("inf") != 0 ) { // not inf edge.Properties().TerrainFactor() = Types::String2double( terrainFactor ); } else { //inf edge.Properties().TerrainFactor() = Const::REAL_INFTY; - } + } } } @@ -2879,16 +2879,16 @@ class PyPsaParser { * @param edge The edge. */ inline void AddMinimumVoltageAngleToEdge ( Types::name const & voltageAngleMin - , TIoEdge & edge ) - { - if ( !voltageAngleMin.empty() ) + , TIoEdge & edge ) + { + if ( !voltageAngleMin.empty() ) { - if ( voltageAngleMin.compare("inf") != 0 ) + if ( voltageAngleMin.compare("inf") != 0 ) { // not inf edge.Properties().ThetaBound().Minimum() = Types::String2double( voltageAngleMin ); } else { //inf edge.Properties().ThetaBound().Minimum() = Const::REAL_INFTY; - } + } } } @@ -2899,11 +2899,11 @@ class PyPsaParser { * @param edge The edge. */ inline void AddMaximumVoltageAngleToEdge ( Types::name const & voltageAngleMax - , TIoEdge & edge ) - { - if ( !voltageAngleMax.empty() ) + , TIoEdge & edge ) + { + if ( !voltageAngleMax.empty() ) { - if ( voltageAngleMax.compare("inf") != 0 ) + if ( voltageAngleMax.compare("inf") != 0 ) { // not inf edge.Properties().ThetaBound().Maximum() = Types::String2double( voltageAngleMax ); } else { //inf @@ -2915,28 +2915,28 @@ class PyPsaParser { /** * @name Line data output. - * - * @brief Each row in the line data creates an edge. + * + * @brief Each row in the line data creates an edge. * * @note Currently only used for output. */ - ///@{ + ///@{ #pragma mark LINE_DATA_OUTPUT - + /** * @brief Add the subnetwork. * * @param subnetwork The subnetwork. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddSubnetworkToEdge ( Types::name const & subnetwork - , TIoEdge & edge ) - { - if ( !subnetwork.empty() ) + , TIoEdge & edge ) + { + if ( !subnetwork.empty() ) { - if ( subnetwork.compare("inf") != 0 ) + if ( subnetwork.compare("inf") != 0 ) { // not inf /* edge subnetwork */ } else { //inf @@ -2950,15 +2950,15 @@ class PyPsaParser { * * @param p0 The real power P0. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddP0ToEdge ( Types::name const & p0 - , TIoEdge & edge ) - { - if ( !p0.empty() ) + , TIoEdge & edge ) + { + if ( !p0.empty() ) { - if ( p0.compare("inf") != 0 ) + if ( p0.compare("inf") != 0 ) { // not inf /* edge p0 */ } else { //inf @@ -2972,15 +2972,15 @@ class PyPsaParser { * * @param q0 The reactive power Q0. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddQ0ToEdge ( Types::name const & q0 - , TIoEdge & edge ) - { - if ( !q0.empty() ) + , TIoEdge & edge ) + { + if ( !q0.empty() ) { - if ( q0.compare("inf") != 0 ) + if ( q0.compare("inf") != 0 ) { // not inf /* edge q0 */ } else { //inf @@ -2994,15 +2994,15 @@ class PyPsaParser { * * @param p1 The real power P1. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddP1ToEdge ( Types::name const & p1 - , TIoEdge & edge ) - { - if ( !p1.empty() ) + , TIoEdge & edge ) + { + if ( !p1.empty() ) { - if ( p1.compare("inf") != 0 ) + if ( p1.compare("inf") != 0 ) { // not inf /* edge p1 */ } else { //inf @@ -3016,15 +3016,15 @@ class PyPsaParser { * * @param q1 The reactive power Q1. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddQ1ToEdge ( Types::name const & q1 - , TIoEdge & edge ) - { - if ( !q1.empty() ) + , TIoEdge & edge ) + { + if ( !q1.empty() ) { - if ( q1.compare("inf") != 0 ) + if ( q1.compare("inf") != 0 ) { // not inf /* edge q1 */ } else { //inf @@ -3038,15 +3038,15 @@ class PyPsaParser { * * @param reactancePu The reactance in p.u. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddReactancePuToEdge ( Types::name const & reactancePu - , TIoEdge & edge ) - { - if ( !reactancePu.empty() ) + , TIoEdge & edge ) + { + if ( !reactancePu.empty() ) { - if ( reactancePu.compare("inf") != 0 ) + if ( reactancePu.compare("inf") != 0 ) { // not inf /* edge reactancePu */ } else { //inf @@ -3059,15 +3059,15 @@ class PyPsaParser { * * @param resistancePu The resistance in p.u. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddResistancePuToEdge ( Types::name const & resistancePu - , TIoEdge & edge ) - { - if ( !resistancePu.empty() ) + , TIoEdge & edge ) + { + if ( !resistancePu.empty() ) { - if ( resistancePu.compare("inf") != 0 ) + if ( resistancePu.compare("inf") != 0 ) { // not inf /* edge resistancePu */ } else { //inf @@ -3081,15 +3081,15 @@ class PyPsaParser { * * @param conductancePu The conductance in p.u. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddConductancePuToEdge ( Types::name const & conductancePu - , TIoEdge & edge ) - { - if ( !conductancePu.empty() ) + , TIoEdge & edge ) + { + if ( !conductancePu.empty() ) { - if ( conductancePu.compare("inf") != 0 ) + if ( conductancePu.compare("inf") != 0 ) { // not inf /* edge conductancePu */ } else { //inf @@ -3103,15 +3103,15 @@ class PyPsaParser { * * @param susceptancePu The susceptance in p.u. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddSusceptancePuToEdge ( Types::name const & susceptancePu - , TIoEdge & edge ) - { - if ( !susceptancePu.empty() ) + , TIoEdge & edge ) + { + if ( !susceptancePu.empty() ) { - if ( susceptancePu.compare("inf") != 0 ) + if ( susceptancePu.compare("inf") != 0 ) { // not inf /* edge susceptancePu */ } else { //inf @@ -3119,21 +3119,21 @@ class PyPsaParser { } } } - + /** * @brief Add the effective reactance in p.u. * * @param reactancePuEffective The effective reactance in p.u. * @param edge The edge - * + * * @note Currently only output and not used yet. */ inline void AddEffectiveReactancePuToEdge ( Types::name const & reactancePuEffective - , TIoEdge & edge ) - { - if ( !reactancePuEffective.empty() ) + , TIoEdge & edge ) + { + if ( !reactancePuEffective.empty() ) { - if ( reactancePuEffective.compare("inf") != 0 ) + if ( reactancePuEffective.compare("inf") != 0 ) { // not inf /* edge reactancePuEffective */ } else { //inf @@ -3145,17 +3145,17 @@ class PyPsaParser { /** * @brief Add the effective resistance in p.u. * - * @param resistancePuEffective The effective resistance in p.u. + * @param resistancePuEffective The effective resistance in p.u. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddEffectiveResistancePuToEdge ( Types::name const & resistancePuEffective - , TIoEdge & edge ) - { - if ( !resistancePuEffective.empty() ) + , TIoEdge & edge ) + { + if ( !resistancePuEffective.empty() ) { - if ( resistancePuEffective.compare("inf") != 0 ) + if ( resistancePuEffective.compare("inf") != 0 ) { // not inf /* edge resistancePuEffective */ } else { //inf @@ -3169,15 +3169,15 @@ class PyPsaParser { * * @param apparentPowerNominalOptimal The optimal nominal apparent power. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddOptimalNominalApparentPowerToEdge ( Types::name const & apparentPowerNominalOptimal - , TIoEdge & edge ) - { - if ( !apparentPowerNominalOptimal.empty() ) + , TIoEdge & edge ) + { + if ( !apparentPowerNominalOptimal.empty() ) { - if ( apparentPowerNominalOptimal.compare("inf") != 0 ) + if ( apparentPowerNominalOptimal.compare("inf") != 0 ) { // not inf /* edge apparentPowerNominalOptimal */ } else { //inf @@ -3191,15 +3191,15 @@ class PyPsaParser { * * @param muLower The mu lower. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddMuLowerToEdge ( Types::name const & muLower - , TIoEdge & edge ) - { - if ( !muLower.empty() ) + , TIoEdge & edge ) + { + if ( !muLower.empty() ) { - if ( muLower.compare("inf") != 0 ) + if ( muLower.compare("inf") != 0 ) { // not inf /* edge muLower */ } else { //inf @@ -3213,15 +3213,15 @@ class PyPsaParser { * * @param muUpper The mu upper. * @param edge The edge. - * + * * @note Currently only output and not used yet. */ inline void AddMuUpperToEdge ( Types::name const & muUpper - , TIoEdge & edge ) - { - if ( !muUpper.empty() ) + , TIoEdge & edge ) + { + if ( !muUpper.empty() ) { - if ( muUpper.compare("inf") != 0 ) + if ( muUpper.compare("inf") != 0 ) { // not inf /* edge muUpper */ } else { //inf @@ -3233,8 +3233,8 @@ class PyPsaParser { /** * @name Load Data. - * - * @brief Each row in the load data creates an load vertex. + * + * @brief Each row in the load data creates an load vertex. * * @note Currently only the name and type is set. */ @@ -3248,9 +3248,9 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddNameToLoad ( Types::string const & name - , TLoadProperties & vertexProperty ) - { - vertexProperty.Name() = name; + , TLoadProperties & vertexProperty ) + { + vertexProperty.Name() = name; } /** @@ -3260,9 +3260,9 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AssociateLoadWithVertex ( Types::string const & bus - , TLoadProperties & vertexProperty ) - { - if ( !bus.empty() ) + , TLoadProperties & vertexProperty ) + { + if ( !bus.empty() ) { /* load bus */ } @@ -3275,14 +3275,14 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddTypeToLoad ( Types::string const & type - , TLoadProperties & vertexProperty ) - { - if ( !type.empty() ) + , TLoadProperties & vertexProperty ) + { + if ( !type.empty() ) { - vertexProperty.Type() = Vertices::IeeeBusType::load; + vertexProperty.Type() = Vertices::IeeeBusType::load; } else { - vertexProperty.Type() = Vertices::IeeeBusType::load; + vertexProperty.Type() = Vertices::IeeeBusType::load; } } @@ -3293,11 +3293,11 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddRealPowerSetPointToLoad ( Types::string const & pset - , TLoadProperties & vertexProperty ) + , TLoadProperties & vertexProperty ) { - if ( !pset.empty() ) + if ( !pset.empty() ) { - if ( pset.compare("inf") != 0 ) + if ( pset.compare("inf") != 0 ) { // not inf /* load pset */ } else { //inf @@ -3313,11 +3313,11 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddReactivePowerSetPointToLoad ( Types::string const & qset - , TLoadProperties & vertexProperty ) + , TLoadProperties & vertexProperty ) { - if ( !qset.empty() ) + if ( !qset.empty() ) { - if ( qset.compare("inf") != 0 ) + if ( qset.compare("inf") != 0 ) { // not inf /* load qset */ } else { //inf @@ -3333,11 +3333,11 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddSignToLoad ( Types::string const & sign - , TLoadProperties & vertexProperty ) - { - if ( !sign.empty() ) + , TLoadProperties & vertexProperty ) + { + if ( !sign.empty() ) { - if ( sign.compare("inf") != 0 ) + if ( sign.compare("inf") != 0 ) { // not inf /* power sign */ } else { //inf @@ -3353,11 +3353,11 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddRealPowerToLoad ( Types::string const & realPower - , TLoadProperties & vertexProperty ) - { - if ( !realPower.empty() ) + , TLoadProperties & vertexProperty ) + { + if ( !realPower.empty() ) { - if ( realPower.compare("inf") != 0 ) + if ( realPower.compare("inf") != 0 ) { // not inf /* load realPower */ } else { //inf @@ -3373,11 +3373,11 @@ class PyPsaParser { * @param vertexProperty The vertex property. */ inline void AddReactivePowerToLoad ( Types::string const & reactivePower - , TLoadProperties & vertexProperty ) - { - if ( !reactivePower.empty() ) + , TLoadProperties & vertexProperty ) + { + if ( !reactivePower.empty() ) { - if ( reactivePower.compare("inf") != 0 ) + if ( reactivePower.compare("inf") != 0 ) { // not inf /* load reactivePower */ } else { //inf @@ -3389,7 +3389,7 @@ class PyPsaParser { /** * @name Load's Real Power Data Snapshot per Timestamp. - * + * * @brief Each row in the load's real power set data creates an * snapshot entry. * @@ -3406,9 +3406,9 @@ class PyPsaParser { * @param network The network @f$\network = ( \graph, \generators, \consumers, \capacity, \susceptance, \dots )@f$. */ inline void AddLoadTimestampName ( Types::name const & name - , TNetwork & network ) - { - network.AddSnapshotTimestamp( name ); + , TNetwork & network ) + { + network.AddSnapshotTimestamp( name ); } /** @@ -3420,20 +3420,20 @@ class PyPsaParser { */ inline void AddMaximumRealPowerSnapshotPuToLoad ( Types::name const & maximumRealPowerPu , TNetwork & network - , Types::vertexId loadId ) - { - if ( !maximumRealPowerPu.empty() ) - { - if ( maximumRealPowerPu.compare("inf") != 0 ) + , Types::vertexId loadId ) + { + if ( !maximumRealPowerPu.empty() ) + { + if ( maximumRealPowerPu.compare("inf") != 0 ) { // not inf - network.AddLoadSnapshotAt ( loadId, Types::String2double( maximumRealPowerPu ) ); + network.AddLoadSnapshotAt ( loadId, Types::String2double( maximumRealPowerPu ) ); } else { //inf - network.AddLoadSnapshotAt ( loadId, Const::REAL_INFTY ); + network.AddLoadSnapshotAt ( loadId, Const::REAL_INFTY ); } } else { USAGE_ASSERT ( false && "Load real power snapshot at loadId is empty!" ); } - } + } ///@} ///@name File and Directory Information @@ -3490,18 +3490,18 @@ template<> class NetworkDifferentiation< egoa::Vertices::ElectricalProperties , egoa::Edges::ElectricalProperties , StaticGraph - , egoa::Edges::ElectricalProperties> > + , egoa::Edges::ElectricalProperties> > { using TGraph = StaticGraph , egoa::Edges::ElectricalProperties>; using TVertexProperties = egoa::Vertices::ElectricalProperties; using TEdgeProperties = egoa::Edges::ElectricalProperties; - + using TIoEdge = io::Edge; public: static Types::edgeId AddEdge ( TGraph & network - , TIoEdge const & ioEdge ) + , TIoEdge const & ioEdge ) { return network.AddEdge( ioEdge.Source(), ioEdge.Target(), ioEdge.Properties() ); } @@ -3517,18 +3517,18 @@ template class NetworkDifferentiation< VertexTypeProperties , EdgeTypeProperties , StaticGraph > + , EdgeTypeProperties> > { using TVertexProperties = VertexTypeProperties; using TEdgeProperties = EdgeTypeProperties; using TGraph = StaticGraph; - + using TIoEdge = io::Edge; public: static Types::edgeId AddEdge ( TGraph & network - , TIoEdge const & ioEdge ) + , TIoEdge const & ioEdge ) { return network.AddEdge( ioEdge.Source(), ioEdge.Target(), ioEdge.Properties() ); } @@ -3546,7 +3546,7 @@ class NetworkDifferentiation< VertexTypeProperties , PowerGrid< StaticGraph< VertexTypeProperties , EdgeTypeProperties > , Vertices::GeneratorProperties<> - , Vertices::LoadProperties > > + , Vertices::LoadProperties > > { using TVertexProperties = VertexTypeProperties; using TEdgeProperties = EdgeTypeProperties; @@ -3574,4 +3574,3 @@ class NetworkDifferentiation< VertexTypeProperties } // namespace egoa #endif // EGOA__IO__PARSER___PY_PSA_PARSER_HPP - diff --git a/include/IO/PowerGridIO.hpp b/include/IO/PowerGridIO.hpp index 2d46df0b..c37d6ca4 100644 --- a/include/IO/PowerGridIO.hpp +++ b/include/IO/PowerGridIO.hpp @@ -3,7 +3,7 @@ * * Created on: Sep 07, 2018 * Author: Franziska Wegner - * + * * Check definitions under https://graphviz.gitlab.io/_pages/doc/info/output.html */ @@ -47,7 +47,7 @@ class PowerGridIO { , std::istream & ); using ReaderFunctionStringBased = bool (*)( PowerGrid< GraphType> & , std::string const & ); - using ReaderFunctionStreamBasedPowerGridAndCandidateNetwork + using ReaderFunctionStreamBasedPowerGridAndCandidateNetwork = bool (*)( PowerGrid< GraphType> & , GraphType & , std::string const & ); @@ -57,7 +57,7 @@ class PowerGridIO { ///@{ using WriterFunctionStreamBased = bool (*)( PowerGrid const & , std::ostream & ); - using WriterFunctionStreamBasedtionStringBased + using WriterFunctionStreamBasedtionStringBased = bool (*)( PowerGrid const & , std::string const & ); ///@} @@ -89,13 +89,13 @@ class PowerGridIO { * * @return @p true if the reading was successful, @p false otherwise. */ - static + static inline bool read ( PowerGrid & network - , std::istream & input_stream ) + , std::istream & input_stream ) { - for ( auto & reader : streamReaders ) + for ( auto & reader : streamReaders ) { - if ( reader ( network, input_stream ) ) + if ( reader ( network, input_stream ) ) { return true; } else { @@ -115,14 +115,14 @@ class PowerGridIO { * * @return @p true if the reading was successful, @p false otherwise. */ - static + static inline bool read ( PowerGrid & network , GraphType & candidateNetwork - , std::string const & filename ) + , std::string const & filename ) { - for ( auto & reader : streamReadersPowerGridAndCandidateNetwork ) + for ( auto & reader : streamReadersPowerGridAndCandidateNetwork ) { - if ( reader ( network, candidateNetwork, filename ) ) + if ( reader ( network, candidateNetwork, filename ) ) { return true; } @@ -141,10 +141,10 @@ class PowerGridIO { * * @return @p true if the reading was successful, @p false otherwise. */ - static + static inline bool read ( PowerGrid & network , std::string const & filename - , ReaderFunctionStreamBased reader = PowerGridIO::read ) + , ReaderFunctionStreamBased reader = PowerGridIO::read ) { std::ifstream input_stream( filename ); return input_stream.good() && reader ( network, input_stream ); @@ -161,10 +161,10 @@ class PowerGridIO { * * @return @p true if the reading was successful, @p false otherwise. */ - static + static inline bool read ( PowerGrid & network , std::string const & filename - , ReaderFunctionStringBased reader = PowerGridIO::read ) + , ReaderFunctionStringBased reader = PowerGridIO::read ) { return reader ( network, filename ); } @@ -181,11 +181,11 @@ class PowerGridIO { * * @return @p true if the reading was successful, @p false otherwise. */ - static + static inline bool read ( PowerGrid & network , GraphType & candidateNetwork , std::string const & filename - , ReaderFunctionStreamBasedPowerGridAndCandidateNetwork reader = PowerGridIO::read ) + , ReaderFunctionStreamBasedPowerGridAndCandidateNetwork reader = PowerGridIO::read ) { return reader ( network, candidateNetwork, filename ); } @@ -206,10 +206,10 @@ class PowerGridIO { * * @return @p true if the writing was successful, @p false otherwise. */ - static + static inline bool write ( PowerGrid const & network , std::ostream & outputStream - , WriterFunctionStreamBased writer = PowerGridIO::write ) + , WriterFunctionStreamBased writer = PowerGridIO::write ) { return writer ( network, outputStream ); } @@ -225,10 +225,10 @@ class PowerGridIO { * * @return @p true if the writing was successful, @p false otherwise. */ - static + static inline bool write ( PowerGrid const & network , std::string const & filename - , WriterFunctionStreamBasedtionStringBased writer = PowerGridIO::write ) + , WriterFunctionStreamBasedtionStringBased writer = PowerGridIO::write ) { return writer ( network, filename ); } @@ -250,7 +250,7 @@ class PowerGridIO { */ static inline bool readIeeeCdfMatlab ( PowerGrid & network - , std::istream & input_stream ) + , std::istream & input_stream ) { if ( !input_stream.good() ) return false; IeeeCdfMatlabParser parser(input_stream); @@ -269,7 +269,7 @@ class PowerGridIO { */ static inline bool writeIeeeCdfMatlab ( PowerGrid const & network - , std::ostream & output_stream ) + , std::ostream & output_stream ) { if (!output_stream.good()) return false; IeeeCdfMatlabParser parser(output_stream); @@ -292,7 +292,7 @@ class PowerGridIO { */ static inline bool ReadPyPsa ( PowerGrid & network - , std::string const & filename ) + , std::string const & filename ) { PyPsaParser parser(filename); return parser.read(network, filename); @@ -312,7 +312,7 @@ class PowerGridIO { static inline bool ReadPyPsa ( PowerGrid & network , GraphType & candidateNetwork - , std::string const & filename ) + , std::string const & filename ) { PyPsaParser parser(filename); return parser.read(network, candidateNetwork, filename); @@ -362,13 +362,13 @@ class PowerGridIO { return writer.write ( network, outputStream ); } ///@} - + ///@name Graph modeling language (GML) ///@details For more information on GML see GML. ///@{ #pragma mark GRAPH_GML - + /** * @brief Reads a graph from a gml file. * @@ -381,7 +381,7 @@ class PowerGridIO { */ static inline bool ReadGraphGml ( PowerGrid & network - , std::istream & input_stream ) + , std::istream & input_stream ) { throw std::runtime_error("ReadGraphGml is not implemented yet"); } @@ -396,11 +396,11 @@ class PowerGridIO { * )@f$. * @param output_stream The output stream to write data to, e.g., a file. * - * @return @p true if the writing was successful, @p false otherwise. + * @return @p true if the writing was successful, @p false otherwise. */ static inline bool WriteGraphGml ( PowerGrid const & network - , std::ostream & output_stream ) + , std::ostream & output_stream ) { throw std::runtime_error("WriteGraphGml is not implemented yet"); } @@ -413,18 +413,18 @@ class PowerGridIO { * )@f$. * @param filename The filename to write the data. * - * @return @p true if the writing was successful, @p false otherwise. + * @return @p true if the writing was successful, @p false otherwise. */ static inline bool WriteGraphGml ( PowerGrid const & network - , std::string const & filename ) + , std::string const & filename ) { throw std::runtime_error("WriteGraphGml is not implemented yet"); } ///@} #else // IF OGDF AVAILABLE - + /** * @brief Writes a graph into a gml file using OGDF. * @@ -436,19 +436,19 @@ class PowerGridIO { */ static inline bool WriteGraphGml ( PowerGrid const & network - , std::string const & filename ) + , std::string const & filename ) { ogdf::Graph graph; - ogdf::GraphAttributes ga( graph, - ogdf::GraphAttributes::nodeGraphics | - ogdf::GraphAttributes::nodeLabel | - ogdf::GraphAttributes::nodeWeight | + ogdf::GraphAttributes ga( graph, + ogdf::GraphAttributes::nodeGraphics | + ogdf::GraphAttributes::nodeLabel | + ogdf::GraphAttributes::nodeWeight | ogdf::GraphAttributes::nodeId | - // ogdf::GraphAttributes::nodeStyle | //does not work yet + // ogdf::GraphAttributes::nodeStyle | //does not work yet ogdf::GraphAttributes::edgeGraphics | ogdf::GraphAttributes::edgeStyle | - ogdf::GraphAttributes::edgeLabel | - ogdf::GraphAttributes::edgeIntWeight | + ogdf::GraphAttributes::edgeLabel | + ogdf::GraphAttributes::edgeIntWeight | ogdf::GraphAttributes::edgeDoubleWeight | ogdf::GraphAttributes::nodeTemplate ); @@ -464,9 +464,9 @@ class PowerGridIO { * * @return @p true if the writing was successful, @p false otherwise. */ - static + static inline bool WriteGml ( ogdf::GraphAttributes const & ga - , std::string const & filename ) + , std::string const & filename ) { return ogdf::GraphIO::write( ga, filename, ogdf::GraphIO::writeGML ); // return ogdf::GraphIO::write( ga, filename, ogdf::GraphIO::writeGraphML ); @@ -478,11 +478,11 @@ class PowerGridIO { * @param shape The OGDF shape. * @param type The basic vertex type. */ - static + static inline void Shape2VertexType ( ogdf::Shape const & shape - , Vertex::BasicVertexType & type ) + , Vertex::BasicVertexType & type ) { - switch (shape) + switch (shape) { case ogdf::Shape::Ellipse: type = Vertex::BasicVertexType::source; break; case ogdf::Shape::Triangle: type = Vertex::BasicVertexType::sink; break; @@ -497,11 +497,11 @@ class PowerGridIO { * @param[in] shape The OGDF shape. * @param type The CDF bus type. */ - static + static inline void Shape2VertexType ( ogdf::Shape shape - , Vertex::CdfBusType & type) + , Vertex::CdfBusType & type) { - switch (shape) + switch (shape) { case ogdf::Shape::Ellipse: type = Vertex::CdfBusType::slack; break; case ogdf::Shape::Triangle: type = Vertex::CdfBusType::load; break; @@ -517,16 +517,16 @@ class PowerGridIO { * @param shape The OGDF shape. * @param type The IEEE bus type. */ - static + static inline void Shape2VertexType ( ogdf::Shape const & shape - , Vertex::IeeeBusType & type) + , Vertex::IeeeBusType & type) { - switch (shape) + switch (shape) { case ogdf::Shape::Ellipse: type = Vertex::IeeeBusType::slack; break; case ogdf::Shape::Triangle: type = Vertex::IeeeBusType::load; break; case ogdf::Shape::RoundedRect: type = Vertex::IeeeBusType::generator; break; - default: type = Vertex::IeeeBusType::unknown; + default: type = Vertex::IeeeBusType::unknown; } } @@ -536,16 +536,16 @@ class PowerGridIO { * @param[in] type The basic vertex type. * @param shape The OGDF shape. */ - static + static inline void VertexType2Shape ( Vertex::BasicVertexType type - , ogdf::Shape & shape ) + , ogdf::Shape & shape ) { - switch (type) + switch (type) { case Vertex::BasicVertexType::source: shape = ogdf::Shape::Ellipse; break; case Vertex::BasicVertexType::sink: shape = ogdf::Shape::Triangle; break; case Vertex::BasicVertexType::intermediate: shape = ogdf::Shape::Rect; break; - default: shape = ogdf::Shape::Hexagon; + default: shape = ogdf::Shape::Hexagon; } } @@ -555,11 +555,11 @@ class PowerGridIO { * @param[in] type The CDF bus type. * @param shape The OGDF shape. */ - static + static inline void VertexType2Shape ( Vertex::CdfBusType type - , ogdf::Shape & shape ) + , ogdf::Shape & shape ) { - switch (type) + switch (type) { case Vertex::CdfBusType::slack: shape = ogdf::Shape::Ellipse; break; case Vertex::CdfBusType::mvar: shape = ogdf::Shape::RoundedRect; break; @@ -575,11 +575,11 @@ class PowerGridIO { * @param[in] type The IEEE bus type. * @param shape The OGDF shape. */ - static + static inline void VertexType2Shape ( Vertex::IeeeBusType type - , ogdf::Shape & shape ) + , ogdf::Shape & shape ) { - switch (type) + switch (type) { case Vertex::IeeeBusType::generator: shape = ogdf::Shape::RoundedRect; break; case Vertex::IeeeBusType::slack: shape = ogdf::Shape::Ellipse; break; @@ -595,10 +595,10 @@ class PowerGridIO { * * @return The OGDF stroke. */ - static - inline ogdf::StrokeType Stroke2OgdfStroke ( Stroke::Name const & stroke ) + static + inline ogdf::StrokeType Stroke2OgdfStroke ( Stroke::Name const & stroke ) { - switch ( stroke ) + switch ( stroke ) { case Stroke::Name::solid: return ogdf::StrokeType::Solid; case Stroke::Name::dashed: return ogdf::StrokeType::Dash; @@ -611,12 +611,12 @@ class PowerGridIO { #endif // not OGDF_AVAILABLE ? - ///@name Graph DOT + ///@name Graph DOT ///@{ -#pragma mark GRAPH_DOT +#pragma mark GRAPH_DOT // see https://en.wikipedia.org/wiki/DOT_(graph_description_language) // see spec http://www.graphviz.org/doc/info/attrs.html#k:color - + /** * @brief Writes a graph dot. * @@ -624,19 +624,19 @@ class PowerGridIO { * @param outputStream The stream to write data to * * @return @true if the writing was successful, @false otherwise. - * + * * @todo Improve and put in its own file. */ - static + static bool WriteGraphDot ( PowerGrid const & network - , std::ostream & outputStream ) + , std::ostream & outputStream ) { - outputStream << "graph " << network.Graph().Name() << " {\n"; - + outputStream << "graph " << network.Graph().Name() << " {\n"; + outputStream << "rankdir=LR" << "\n"; outputStream << "size=" << "\"" << "3,3" << "\"" << "\n"; outputStream << "ratio=" << "\"" << "filled" << "\"" << "\n"; - + // edge style outputStream << "edge["; outputStream << "size=" << "\"" << "3,3" << "\"" << ""; @@ -650,9 +650,9 @@ class PowerGridIO { // edges network.Graph().template for_all_edges( [&outputStream, network](TElectricalEdge edge){ - outputStream << network.Graph().VertexAt(edge.Source()).Properties().Name() - << " -- " - << network.Graph().VertexAt(edge.Target()).Properties().Name(); + outputStream << network.Graph().VertexAt(edge.Source()).Properties().Name() + << " -- " + << network.Graph().VertexAt(edge.Target()).Properties().Name(); Color color; Stroke::Name stroke; Edges::ElectricalEdge2Color( edge.Properties().Type(), color ); @@ -668,17 +668,17 @@ class PowerGridIO { return true; } - static + static bool WriteGraphDot ( PowerGrid const & network - , std::string const & filename ) + , std::string const & filename ) { std::ofstream outputStream(filename); - outputStream << "graph " << network.Graph().Name() << " {\n"; - + outputStream << "graph " << network.Graph().Name() << " {\n"; + outputStream << "rankdir=LR" << "\n"; outputStream << "size=" << "\"" << "3,3" << "\"" << "\n"; outputStream << "ratio=" << "\"" << "filled" << "\"" << "\n"; - + // edge style outputStream << "edge["; outputStream << "size=" << "\"" << "3,3" << "\"" << ""; @@ -692,9 +692,9 @@ class PowerGridIO { // edges network.Graph().template for_all_edges( [&outputStream, network](TElectricalEdge edge){ - outputStream << network.Graph().VertexAt(edge.Source()).Properties().Name() - << " -- " - << network.Graph().VertexAt(edge.Target()).Properties().Name(); + outputStream << network.Graph().VertexAt(edge.Source()).Properties().Name() + << " -- " + << network.Graph().VertexAt(edge.Target()).Properties().Name(); Color color; Stroke::Name stroke; Edges::ElectricalEdge2Color( edge.Properties().Type(), color ); @@ -717,10 +717,10 @@ class PowerGridIO { * * @return The dot style stroke. */ - static + static inline std::string Stroke2DotStyle ( Stroke::Name const & stroke ) { - switch ( stroke ) + switch ( stroke ) { case Stroke::Name::solid: return "solid"; case Stroke::Name::dashed: return "dashed"; diff --git a/include/IO/Wrapper/Edge.hpp b/include/IO/Wrapper/Edge.hpp index 15b7219b..9f19b960 100644 --- a/include/IO/Wrapper/Edge.hpp +++ b/include/IO/Wrapper/Edge.hpp @@ -1,4 +1,4 @@ -/* +/* * Edge.hpp * * Created on: May 3, 2019 @@ -22,13 +22,13 @@ class Edge { target_(Const::INFTY), properties_() { } - + inline Types::vertexId Source() const { return source_; } inline Types::vertexId & Source() { return source_; } inline Types::vertexId Target() const { return target_; } inline Types::vertexId & Target() { return target_; } - + inline TProperties & Properties() { return properties_; } inline TProperties const & Properties() const { return properties_; } @@ -40,4 +40,4 @@ class Edge { } // namespace egoa::io -#endif // EGOA__IO__WRAPPER__EDGE_HPP \ No newline at end of file +#endif // EGOA__IO__WRAPPER__EDGE_HPP diff --git a/include/IO/Writer/GeojsonWriter.hpp b/include/IO/Writer/GeojsonWriter.hpp index 484e4477..e8e78bd2 100644 --- a/include/IO/Writer/GeojsonWriter.hpp +++ b/include/IO/Writer/GeojsonWriter.hpp @@ -39,7 +39,7 @@ class GeoJsonWriter final { // Edges using TEdge = typename TGraph::TEdge; using TEdgeProperties = typename TGraph::TEdgeProperties; - + // Bounds using TBound = Bound<>; @@ -94,7 +94,7 @@ class GeoJsonWriter final { ///@name Auxiliary ///@{ #pragma mark AUXILIARY - + /** * @brief Add indent to the output stream. * @@ -104,7 +104,7 @@ class GeoJsonWriter final { inline void Indent ( std::ostream & os , Types::count depth = 1 ) { - if ( Readable() ) + if ( Readable() ) { Types::string indent( static_cast( depth * indent_ ), ' ' ); os << indent; @@ -118,7 +118,7 @@ class GeoJsonWriter final { */ inline void NewLine ( std::ostream & os) { - if ( Readable() ) + if ( Readable() ) { os << std::endl; } @@ -131,9 +131,9 @@ class GeoJsonWriter final { * newlines, @false compact representation without any indents * and newlines. */ - inline bool Readable () - { - return readable_; + inline bool Readable () + { + return readable_; } ///@} @@ -158,7 +158,7 @@ class GeoJsonWriter final { * @param os The operating system * @param[in] indent The indent */ - inline void WriteFooter ( std::ostream & os + inline void WriteFooter ( std::ostream & os , Types::count indent = 0 ) { Indent( os, indent ); @@ -174,7 +174,7 @@ class GeoJsonWriter final { */ inline void WriteFeatureBegin ( std::ostream & os , Types::count indent = 1 ) - { + { Indent( os, indent ); os << "{"; NewLine(os); @@ -191,10 +191,10 @@ class GeoJsonWriter final { * @param[in] last The last. * @param[in] indent The indent. */ - inline void WriteFeatureEnd ( std::ostream & os + inline void WriteFeatureEnd ( std::ostream & os , bool last = false , Types::count indent = 1 ) - { + { char comma = last?' ':','; Indent( os, indent ); os << "}" @@ -208,11 +208,11 @@ class GeoJsonWriter final { * @param os The output stream. * @param[in] indent The indent. */ - inline void WritePropertiesBegin ( std::ostream & os + inline void WritePropertiesBegin ( std::ostream & os , Types::count indent = 2 ) { Indent( os, indent ); - os << "\"properties\":" + os << "\"properties\":" << "{"; NewLine(os); } @@ -325,7 +325,7 @@ class GeoJsonWriter final { template inline void PropertyTemplate ( std::ostream & os , std::string lhs - , T const & rhs + , T const & rhs , bool last = false , Types::count indent = 2) { @@ -338,7 +338,7 @@ class GeoJsonWriter final { << rhs << "\"" << comma; - NewLine(os); + NewLine(os); } /** @@ -348,7 +348,7 @@ class GeoJsonWriter final { * @param[in] last The last. * @param[in] indent The indent. */ - inline void WritePropertiesEnd ( std::ostream & os + inline void WritePropertiesEnd ( std::ostream & os , bool last = false , Types::count indent = 2 ) { @@ -389,8 +389,8 @@ class GeoJsonWriter final { * @param[in] last The last. * @param[in] indent The indent. */ - inline void WriteFeaturesEnd ( std::ostream & os - , bool last = false + inline void WriteFeaturesEnd ( std::ostream & os + , bool last = false , Types::count indent = 0 ) { char comma = last?' ':','; @@ -406,9 +406,9 @@ class GeoJsonWriter final { * @param os The output stream. * @param[in] indent The indent. */ - inline void WriteGeometry ( std::ostream & os + inline void WriteGeometry ( std::ostream & os , Types::count indent = 2 ) - { + { Indent( os, indent ); os << "\"geometry\": "; } @@ -426,9 +426,9 @@ class GeoJsonWriter final { * @param[in] last The last. * @param[in] indent The indent. */ - inline void WriteVertices ( std::ostream & os - , TGraph const & graph - , bool last = false + inline void WriteVertices ( std::ostream & os + , TGraph const & graph + , bool last = false , Types::count indent = 1 ) { graph.for_all_vertices( [this, &os, &last, &indent]( TVertex const & vertex ){ @@ -449,9 +449,9 @@ class GeoJsonWriter final { * @param[in] last The last. * @param[in] indent The indent. */ - inline void WriteGenerators ( std::ostream & os + inline void WriteGenerators ( std::ostream & os , TNetwork const & network - , bool last = false + , bool last = false , Types::count indent = 1 ) { // network.for_all_generators( [this, &os, &last, &indent]( TGeneratorProperties const & generatorProperty ){ @@ -473,8 +473,8 @@ class GeoJsonWriter final { */ inline void WritePoint ( std::ostream & os , Types::real xCoordinate - , Types::real yCoordinate - , Types::count indent = 2 ) + , Types::real yCoordinate + , Types::count indent = 2 ) { WriteGeometry ( os, indent ); os << "{"; @@ -485,7 +485,7 @@ class GeoJsonWriter final { NewLine(os); Indent( os, indent + 1 ); - os << "\"coordinates\": "; + os << "\"coordinates\": "; WritePointCoordinate ( os, xCoordinate, yCoordinate, 0 ); NewLine(os); Indent( os, indent ); @@ -502,12 +502,12 @@ class GeoJsonWriter final { */ inline void WritePoint ( std::ostream & os , TGraph const & graph - , Types::vertexId vertexId - , Types::count indent = 2 ) + , Types::vertexId vertexId + , Types::count indent = 2 ) { WritePoint ( os , graph.VertexAt(vertexId).X() - , graph.VertexAt(vertexId).Y() + , graph.VertexAt(vertexId).Y() , indent ); } @@ -518,13 +518,13 @@ class GeoJsonWriter final { * @param vertex The vertex. */ inline void WritePoint ( std::ostream & os - , TVertex const & vertex - , Types::count indent = 2 ) + , TVertex const & vertex + , Types::count indent = 2 ) { WritePoint ( os , vertex.Properties().X() - , vertex.Properties().Y() - , indent ); + , vertex.Properties().Y() + , indent ); } /** @@ -536,11 +536,11 @@ class GeoJsonWriter final { */ inline void WritePointCoordinate ( std::ostream & os , Types::real xCoordinate - , Types::real yCoordinate - , Types::count indent = 2 ) + , Types::real yCoordinate + , Types::count indent = 2 ) { - Indent ( os, indent ); - os << "[" + Indent ( os, indent ); + os << "[" << xCoordinate << "," << yCoordinate @@ -680,7 +680,7 @@ class GeoJsonWriter final { * @param os The output stream. * @param[in] indent The indent. */ - inline void WriteLineFooter ( std::ostream & os + inline void WriteLineFooter ( std::ostream & os , Types::count indent = 2 ) { Indent( os, indent + 1 ); @@ -703,13 +703,13 @@ class GeoJsonWriter final { * * @return @p true if the writing was successful, @p false otherwise. */ - bool write ( TNetwork const & network + bool write ( TNetwork const & network , std::string const & filename ) { std::ofstream file; file.open(filename, std::ofstream::trunc); if (!file.is_open()) return false; - + // file is empty file.seekp(0, std::ios::end); return WriteGraph ( file, network.Graph() ); @@ -723,14 +723,14 @@ class GeoJsonWriter final { * * @return @p true if the writing was successful, @p false otherwise. */ - bool write ( TNetwork const & network + bool write ( TNetwork const & network , std::ostream & outputStream ) { return WriteGraph ( outputStream, network.Graph() ); } ///@} - - private: + + private: Types::count const indent_; bool readable_; }; diff --git a/include/MathematicalModel/Callbacks/CallbackEmpty.hpp b/include/MathematicalModel/Callbacks/CallbackEmpty.hpp index 90697412..6f9ffaa4 100644 --- a/include/MathematicalModel/Callbacks/CallbackEmpty.hpp +++ b/include/MathematicalModel/Callbacks/CallbackEmpty.hpp @@ -38,8 +38,8 @@ class CallbackEmpty : public GRBCallback { } private: TSolver * solver_; -}; +}; } // namespace egoa -#endif // EGOA__MATHEMATICAL_MODEL__CALLBACKS__EMPTY_CALLBACK_HPP \ No newline at end of file +#endif // EGOA__MATHEMATICAL_MODEL__CALLBACKS__EMPTY_CALLBACK_HPP diff --git a/include/MathematicalModel/Types.hpp b/include/MathematicalModel/Types.hpp index b8a5c6d2..f5ee4899 100644 --- a/include/MathematicalModel/Types.hpp +++ b/include/MathematicalModel/Types.hpp @@ -66,7 +66,7 @@ enum class ObjectiveSense { }; -enum class Algorithm { +enum class Algorithm { automatical = 0 , primal = 1 , dual = 2 @@ -333,17 +333,17 @@ inline Status CplexToSolverStatus ( IloAlgorithm::Status const & status ) { if ( IloAlgorithm::Status::Feasible == status ) { return Status::feasible; - } else if ( IloAlgorithm::Status::Optimal == status ) { + } else if ( IloAlgorithm::Status::Optimal == status ) { return Status::optimal; - } else if ( IloAlgorithm::Status::Infeasible == status ) { + } else if ( IloAlgorithm::Status::Infeasible == status ) { return Status::infeasible; - } else if ( IloAlgorithm::Status::InfeasibleOrUnbounded == status ) { + } else if ( IloAlgorithm::Status::InfeasibleOrUnbounded == status ) { return Status::inf_or_unb; - } else if ( IloAlgorithm::Status::Unbounded == status ) { + } else if ( IloAlgorithm::Status::Unbounded == status ) { return Status::unbounded; - } else if ( IloAlgorithm::Status::Error == status ) { + } else if ( IloAlgorithm::Status::Error == status ) { return Status::error; - } else if ( IloAlgorithm::Status::Unknown == status ) { + } else if ( IloAlgorithm::Status::Unknown == status ) { return Status::unknown; } else { return Status::unknown; @@ -432,7 +432,7 @@ inline Types::count NodeFileStrategyToInteger ( NodeFileStrategy const & strateg * @param boolean The IloBool boolean type. * * @see https://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.1/ilog.odms.ide.help/refcppopl/html/typedefs/IloBool.html - * + * * @return Returns @p true for IloTrue, otherwise @p false. */ inline bool IloBoolToBoolean ( IloBool const & boolean ) @@ -445,62 +445,62 @@ inline bool IloBoolToBoolean ( IloBool const & boolean ) #pragma mark OUTPUT_OPERATOR -inline std::ostream & operator<<( std::ostream & os, const Status & rhs ) +inline std::ostream & operator<<( std::ostream & os, const Status & rhs ) { - if ( rhs == Status::loaded ) { os << "loaded"; } - else if ( rhs == Status::optimal ) { os << "optimal"; } - else if ( rhs == Status::infeasible ) { os << "infeasible"; } - else if ( rhs == Status::inf_or_unb ) { os << "inf_or_unb";} - else if ( rhs == Status::unbounded ) { os << "unbounded"; } - else if ( rhs == Status::cutoff ) { os << "cutoff"; } - else if ( rhs == Status::iteration_limit) { os << "iteration_limit"; } - else if ( rhs == Status::node_limit ) { os << "node_limit"; } - else if ( rhs == Status::time_limit ) { os << "time_limit"; } - else if ( rhs == Status::solution_limit ) { os << "solution_limit"; } - else if ( rhs == Status::interrupted ) { os << "interrupted"; } - else if ( rhs == Status::numeric ) { os << "numeric"; } - else if ( rhs == Status::suboptimal ) { os << "suboptimal"; } - else if ( rhs == Status::inprogress ) { os << "inprogress"; } - else if ( rhs == Status::user_obj_limit ) { os << "user_obj_limit"; } + if ( rhs == Status::loaded ) { os << "loaded"; } + else if ( rhs == Status::optimal ) { os << "optimal"; } + else if ( rhs == Status::infeasible ) { os << "infeasible"; } + else if ( rhs == Status::inf_or_unb ) { os << "inf_or_unb";} + else if ( rhs == Status::unbounded ) { os << "unbounded"; } + else if ( rhs == Status::cutoff ) { os << "cutoff"; } + else if ( rhs == Status::iteration_limit) { os << "iteration_limit"; } + else if ( rhs == Status::node_limit ) { os << "node_limit"; } + else if ( rhs == Status::time_limit ) { os << "time_limit"; } + else if ( rhs == Status::solution_limit ) { os << "solution_limit"; } + else if ( rhs == Status::interrupted ) { os << "interrupted"; } + else if ( rhs == Status::numeric ) { os << "numeric"; } + else if ( rhs == Status::suboptimal ) { os << "suboptimal"; } + else if ( rhs == Status::inprogress ) { os << "inprogress"; } + else if ( rhs == Status::user_obj_limit ) { os << "user_obj_limit"; } else { os << "unknown"; } return os; -} +} -inline std::ostream & operator<<( std::ostream & os, VariableType const & rhs ) +inline std::ostream & operator<<( std::ostream & os, VariableType const & rhs ) { - if ( rhs == VariableType::continuous ) { os << "continuous"; } - else if ( rhs == VariableType::semicontinuous ) { os << "semicontinuous"; } - else if ( rhs == VariableType::binary ) { os << "binary"; } - else if ( rhs == VariableType::integer ) { os << "integer";} - else if ( rhs == VariableType::semiinteger ) { os << "semiinteger"; } + if ( rhs == VariableType::continuous ) { os << "continuous"; } + else if ( rhs == VariableType::semicontinuous ) { os << "semicontinuous"; } + else if ( rhs == VariableType::binary ) { os << "binary"; } + else if ( rhs == VariableType::integer ) { os << "integer";} + else if ( rhs == VariableType::semiinteger ) { os << "semiinteger"; } else { os << "unknown"; } return os; -} +} -inline std::ostream & operator<<( std::ostream & os, ObjectiveSense const & rhs ) +inline std::ostream & operator<<( std::ostream & os, ObjectiveSense const & rhs ) { - if ( rhs == ObjectiveSense::minimize ) { os << "minimize"; } - else if ( rhs == ObjectiveSense::maximize ) { os << "maximize"; } + if ( rhs == ObjectiveSense::minimize ) { os << "minimize"; } + else if ( rhs == ObjectiveSense::maximize ) { os << "maximize"; } else { os << "unknown"; } return os; } -inline std::ostream & operator<<( std::ostream & os, Algorithm const & rhs ) +inline std::ostream & operator<<( std::ostream & os, Algorithm const & rhs ) { - if ( rhs == Algorithm::automatical ) { os << "Auto"; } - else if ( rhs == Algorithm::primal ) { os << "Primal"; } - else if ( rhs == Algorithm::dual ) { os << "Dual"; } - else if ( rhs == Algorithm::network ) { os << "Network"; } - else if ( rhs == Algorithm::barrier ) { os << "Barrier"; } - else if ( rhs == Algorithm::sifting ) { os << "Sifting"; } - else if ( rhs == Algorithm::concurrent ) { os << "Concurrent"; } - else if ( rhs == Algorithm::feasOpt ) { os << "FeasOpt"; } - else if ( rhs == Algorithm::mip ) { os << "MIP"; } + if ( rhs == Algorithm::automatical ) { os << "Auto"; } + else if ( rhs == Algorithm::primal ) { os << "Primal"; } + else if ( rhs == Algorithm::dual ) { os << "Dual"; } + else if ( rhs == Algorithm::network ) { os << "Network"; } + else if ( rhs == Algorithm::barrier ) { os << "Barrier"; } + else if ( rhs == Algorithm::sifting ) { os << "Sifting"; } + else if ( rhs == Algorithm::concurrent ) { os << "Concurrent"; } + else if ( rhs == Algorithm::feasOpt ) { os << "FeasOpt"; } + else if ( rhs == Algorithm::mip ) { os << "MIP"; } else { os << "None"; } return os; } } // namespace egoa::Solver -#endif // EGOA__MATHEMATICAL_MODEL__TYPE_HPP \ No newline at end of file +#endif // EGOA__MATHEMATICAL_MODEL__TYPE_HPP diff --git a/scripts/Build/buildProject.sh b/scripts/Build/buildProject.sh index 976413b5..aa70f33c 100755 --- a/scripts/Build/buildProject.sh +++ b/scripts/Build/buildProject.sh @@ -1,15 +1,15 @@ #!/bin/sh # # buildProject.sh -# +# # Created on: # Author: Franziska Wegner -# +# # Builds the egoa project with the details specified in the configuration -# script. Templates for configuration scripts can be found under +# script. Templates for configuration scripts can be found under # ./localConfig.sh # ./serverConfig.sh -# +# ######################################################### # Define input argument ################################# @@ -82,12 +82,12 @@ if [ "${buildMode}" = "Release" ]; then -DOGDF_INCLUDE_DIR="$OGDF_INCLUDE_DIR_RELEASE" \ -DOGDF_LIBRARY_DIR="$OGDF_LIBRARY_DIR_RELEASE" \ -DOPENMP_INCLUDES="$OPENMP_INCLUDES" \ - -DOPENMP_LIBRARIES="$OPENMP_LIBRARIES" + -DOPENMP_LIBRARIES="$OPENMP_LIBRARIES" # -DOGDF_USE_ASSERT_EXCEPTIONS="$OGDF_USE_ASSERT_EXCEPTIONS" \ # -DOGDF_WARNING_ERRORS="$OGDF_WARNING_ERRORS" \ # -DCOIN_INCLUDE_DIR="$COIN_INCLUDE_DIR_RELEASE" \ - # -DCOIN_LIBRARY_DIR="$COIN_LIBRARY_DIR_RELEASE" \ + # -DCOIN_LIBRARY_DIR="$COIN_LIBRARY_DIR_RELEASE" \ OGDF_USE_ASSERT_EXCEPTIONS="$OGDF_USE_ASSERT_EXCEPTIONS_RELEASE" OGDF_WARNING_ERRORS="$OGDF_WARNING_ERRORS_RELEASE" @@ -123,8 +123,8 @@ else -DOGDF_INCLUDE_DIR="$OGDF_INCLUDE_DIR_DEBUG" \ -DOGDF_LIBRARY_DIR="$OGDF_LIBRARY_DIR_DEBUG" \ -DOPENMP_INCLUDES="$OPENMP_INCLUDES" \ - -DOPENMP_LIBRARIES="$OPENMP_LIBRARIES" - + -DOPENMP_LIBRARIES="$OPENMP_LIBRARIES" + # -DOGDF_USE_ASSERT_EXCEPTIONS="$OGDF_USE_ASSERT_EXCEPTIONS" \ # -DOGDF_WARNING_ERRORS="$OGDF_WARNING_ERRORS" \ @@ -149,15 +149,15 @@ make ######################################################### # Output general information ############################ ######################################################### -echo +echo echo "---------------------------------------------------------------------------------------------------" -echo +echo echo "-- The build mode is set to:\t\t${buildMode}" echo "-- The build directory is set to:\t${buildDirectory}" echo "-- The cmake directory is set to:\t${cmakeTarget}" echo "-- The config file is set to:\t\t${configFile}" echo "-- Current directory is:\t\t$(pwd)" -echo +echo echo "Cmake Configuration Overview" echo "\tCMAKE_BUILD_TYPE: $buildMode" echo "\tBONMIN_ROOT_DIR: $BONMIN_ROOT_DIR" diff --git a/scripts/Build/buildUsage.sh b/scripts/Build/buildUsage.sh index 2384c264..4bedd232 100755 --- a/scripts/Build/buildUsage.sh +++ b/scripts/Build/buildUsage.sh @@ -1,17 +1,17 @@ #!/bin/sh # # buildUsage.sh -# +# # Created on: Jan 30, 2019 # Author: Franziska Wegner -# +# # Defines a standard usage interface for the build scripts including the # details of a specified configuration script. Templates for configuration -# scripts can be found under -# ./localConfig.sh +# scripts can be found under +# ./localConfig.sh # ./serverConfig.sh -# where "./localConfig.sh" is the default configuration. -# +# where "./localConfig.sh" is the default configuration. +# ######################################################### # Define input argument ################################# diff --git a/scripts/Build/localConfig.sh b/scripts/Build/localConfig.sh index d9636991..754225e9 100755 --- a/scripts/Build/localConfig.sh +++ b/scripts/Build/localConfig.sh @@ -1,13 +1,13 @@ #!/bin/sh # # localConfig.sh -# +# # Created on: # Author: Franziska Wegner -# +# # Project configuration on the local computer to avoid "ccmake ." # configuration. -# +# ######################################################### # Define local standard argument ######################## ######################################################### @@ -28,7 +28,7 @@ CMAKE_TARGET="/Users/fw/Documents/work/frameworks/egoa/framework" CMAKE_CXX_COMPILER="/usr/local/Cellar/llvm@7/7.1.0_1/bin/clang++", CMAKE_C_COMPILER="/usr/local/Cellar/llvm@7/7.1.0_1/bin/clang", -# Enable/Disable Tools +# Enable/Disable Tools EGOA_ENABLE_BONMIN="ON" EGOA_ENABLE_BOOST="OFF" EGOA_ENABLE_CPLEX="ON" @@ -41,11 +41,11 @@ EGOA_ENABLE_OPENMP="ON" EGOA_ENABLE_TESTS="ON" EGOA_ENABLE_VERBOSE_MAKEFILE="ON" # Select test framework -EGOA_TEST_FRAMEWORK="OfflineGoogleTestFramework" +EGOA_TEST_FRAMEWORK="OfflineGoogleTestFramework" # The following path is used when # EGOA_TEST_FRAMEWORK="OfflineGoogleTestFramework" otherwise it will be # ignored -EGOA_TEST_FRAMEWORK_LOCATION="external/GoogleTestFramework" +EGOA_TEST_FRAMEWORK_LOCATION="external/GoogleTestFramework" # Number of Threads # EGOA_THREAD_LIMIT="0", i.e., uses the maximum possible number of threads EGOA_THREAD_LIMIT="1" diff --git a/scripts/Build/serverConfig.sh b/scripts/Build/serverConfig.sh index ccbc2bfc..37bf8803 100755 --- a/scripts/Build/serverConfig.sh +++ b/scripts/Build/serverConfig.sh @@ -1,12 +1,12 @@ #!/bin/sh # # buildProject.sh -# +# # Created on: # Author: Franziska Wegner -# +# # Project configuration on the server to avoid "ccmake ." configuration. -# +# ######################################################### # Define local standard argument ######################## ######################################################### @@ -27,7 +27,7 @@ CMAKE_TARGET="TODO/egoa/framework" CMAKE_CXX_COMPILER="/usr/bin/g++-7" CMAKE_C_COMPILER="/usr/bin/gcc-7" -# Enable/Disable Tools +# Enable/Disable Tools EGOA_ENABLE_BONMIN="ON" EGOA_ENABLE_BOOST="OFF" EGOA_ENABLE_DOCUMENTATION="ON" diff --git a/scripts/Experiments/manageSimulations.sh b/scripts/Experiments/manageSimulations.sh index 0f633770..0f3cf530 100755 --- a/scripts/Experiments/manageSimulations.sh +++ b/scripts/Experiments/manageSimulations.sh @@ -1,39 +1,39 @@ #!/bin/sh # # manageSimulations.sh -# +# # Created on: Feb 03, 2019 # Author: Franziska Wegner -# Basic idea: "Modern Computational Science 18 - Energy of the Future" +# Basic idea: "Modern Computational Science 18 - Energy of the Future" # by Stefan Harfst and Alexander K. Hartmann # ISBN 978-3-8142-2370-4 -# +# # This script enables to manage simulations on a large number of # server/compute nodes. It is basically a wrapper that can check on a list of # server information such as running jobs. In addition, it provides the # possibility to run all kind of commands on multiple server such as kill, # pause, or start of simulations. -# +# # Examples: # ./manageSimulations.sh date -u # ./manageSimulations.sh killall egoa -# +# # To avoid entering at each time your password for the compute node you can do # the following steps and do step 2 for all necessary server (if not mirrored): -# -# 1. user@localmachine> ssh-keygen -t rsa +# +# 1. user@localmachine> ssh-keygen -t rsa # 2. ssh-copy-id user@server.node.kit.edu -# +# # Note: # 1. Change working directory to 'run' and excutes './runme >& logfile &' -# >ssh ${server_node} -n "cd run; ./runme >& logfile &" +# >ssh ${server_node} -n "cd run; ./runme >& logfile &" # -s TRUE -c "cd run; ./runme" # 2. Check for simulations # ssh ${server_node} -n "/bin/ps axo user,pid,%cpu,%mem,lstart,etime,nice,stat,time,cmd | egrep \" R | RN | RN+ | R+ \" " # -b TRUE # ssh ${server_node} -n "/bin/ps axo user,pid,%cpu,%mem,lstart,etime,nice,stat,time,cmd | egrep \" *windfarmCabling* \" " # -b TRUE -c "*windfarmCabling*" -# +# if [ -f "../Personal/StandardConfiguration.sh" ]; then source "../Personal/StandardConfiguration.sh" @@ -57,13 +57,13 @@ usage() { echo "Usage: $0 -c (default: \"date -u\") -b (default: FALSE) -s (default: FALSE) - -w (default: Either from ../Personal/StandardConfiguration.sh \"\$SERVER_LIST\" + -w (default: Either from ../Personal/StandardConfiguration.sh \"\$SERVER_LIST\" or \"host.local\") Examples: > ./manageSimulations.sh -c \"date -u\" > ./manageSimulations.sh -c \"killall egoa\" > ./manageSimulations.sh -b TRUE -c \"*egoa*\" - > ./manageSimulations.sh -s TRUE -w \"server1.kit.edu server2.kit.edu\" + > ./manageSimulations.sh -s TRUE -w \"server1.kit.edu server2.kit.edu\" -c \"cd /algoDaten/egoa/build-debug/bin; ./egoa >& logfile &\" " 1>&2; exit 1; } @@ -121,7 +121,7 @@ if [ -z "${command}" ]; then else command="date -u" fi - + fi for compute_node in ${serverList} ; @@ -131,8 +131,8 @@ do if [ "${checkStatus}" = "TRUE" ]; then ssh ${compute_node} -n "/bin/ps axo user,pid,%cpu,%mem,lstart,etime,nice,stat,time,cmd | egrep \" ${command} \" " elif [ "${runSimulation}" = "TRUE" ]; then - ssh ${compute_node} -n "${command} >& logfile &" - else + ssh ${compute_node} -n "${command} >& logfile &" + else ssh ${compute_node} -n ${command} fi echo "=================================================" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 05fe37dc..ca94f14e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,11 @@ # CMakeLists.txt -# +# # Created on: 30.01.2019 # Author: Franziska Wegner -# +# # Install binaries into the bin folder. The project can be build with any of # the available cmake generators. -# +# include_directories(Boost_INCLUDE_DIRS) diff --git a/src/IO/Appearance/Color.cpp b/src/IO/Appearance/Color.cpp index e6914134..aa7f33c9 100644 --- a/src/IO/Appearance/Color.cpp +++ b/src/IO/Appearance/Color.cpp @@ -101,7 +101,7 @@ namespace egoa { , { 152, 167, 197 } // KITseablue50 , { 193, 202, 220 } // KITseablue30 , { 224, 229, 238 } // KITseablue15 - // + // // Thesis Colors , { 86, 151, 197 } // THESISblue , { 54, 120, 167 } // THESISblue_dark @@ -324,7 +324,7 @@ namespace egoa { , { 0.598, 0.656, 0.774 } // KITseablue50 , { 0.758, 0.794, 0.864 } // KITseablue30 , { 0.879, 0.897, 0.932 } // KITseablue15 - // + // // Thesis Colors , { 0.337, 0.592, 0.773 } // THESISblue , { 0.212, 0.471, 0.655 } // THESISblue_dark @@ -457,46 +457,46 @@ namespace egoa { , alpha_(0) {} - void Color::Red( Types::ubyte red ) { - this->red() = ( red / 255 ); + void Color::Red( Types::ubyte red ) { + this->red() = ( red / 255 ); } - Types::ubyte Color::Red() const { + Types::ubyte Color::Red() const { return static_cast( red_ * 255 >= 0.0 )? ( red_ * 255 + 0.5 ): - ( red_ * 255 - 0.5 ); + ( red_ * 255 - 0.5 ); } - void Color::Green( Types::ubyte green ) { - this->green() = ( green / 255 ); + void Color::Green( Types::ubyte green ) { + this->green() = ( green / 255 ); } - Types::ubyte Color::Green() const { + Types::ubyte Color::Green() const { return static_cast( green_ * 255 >= 0.0 )? ( green_ * 255 + 0.5 ): - ( green_ * 255 - 0.5 ); + ( green_ * 255 - 0.5 ); } - void Color::Blue( Types::ubyte blue ) { - this->blue() = ( blue / 255 ); - } + void Color::Blue( Types::ubyte blue ) { + this->blue() = ( blue / 255 ); + } - Types::ubyte Color::Blue() const { + Types::ubyte Color::Blue() const { return static_cast( blue_ * 255 >= 0.0 )? ( blue_ * 255 + 0.5 ): - ( blue_ * 255 - 0.5 ); + ( blue_ * 255 - 0.5 ); } std::string Color::Hexadecimal( ) { std::stringstream hexstring; hexstring << "#" << std::setfill('0') << std::setw(2) << std::uppercase - << std::hex << static_cast(Red()) + << std::hex << static_cast(Red()) << std::setfill('0') << std::setw(2) << std::uppercase << std::hex << static_cast(Green()) << std::setfill('0') << std::setw(2) << std::uppercase - << std::hex << static_cast(Blue()) + << std::hex << static_cast(Blue()) << std::endl; - return hexstring.str(); + return hexstring.str(); } -} // namespace egoa \ No newline at end of file +} // namespace egoa diff --git a/src/IO/PowerGridIO.cpp b/src/IO/PowerGridIO.cpp index aea89342..c0c62608 100644 --- a/src/IO/PowerGridIO.cpp +++ b/src/IO/PowerGridIO.cpp @@ -22,7 +22,7 @@ const std::vector::ReaderFunctionStringBased> Po PowerGridIO::ReadPyPsa //@todo PowerGridIO::readIeeePti }; -// +// template const std::vector::ReaderFunctionStreamBasedPowerGridAndCandidateNetwork> PowerGridIO::streamReadersPowerGridAndCandidateNetwork = { PowerGridIO::ReadPyPsa diff --git a/src/Runnables/main.cpp b/src/Runnables/main.cpp index 0d2e5b8d..a17e4491 100644 --- a/src/Runnables/main.cpp +++ b/src/Runnables/main.cpp @@ -58,8 +58,8 @@ #include "IO/Appearance/Color.hpp" QString inputFile(""), outputDir(""); -void addCommandLineOptions ( const QCoreApplication &application, - QCommandLineParser &parser ) +void addCommandLineOptions ( const QCoreApplication &application, + QCommandLineParser &parser ) { parser.setApplicationDescription("Power Grid Tool"); parser.addHelpOption(); @@ -95,7 +95,7 @@ void addCommandLineOptions ( const QCoreApplication &application, parser.addOption(solverOption); QCommandLineOption inputFileWarmStartOption( - QStringList() << "inputFileWarmStart", + QStringList() << "inputFileWarmStart", QCoreApplication::translate("main", "Input file for the warm start (default: ../Data/windfarm-benchmarksets/testset-0-instance-1.gml)."), QCoreApplication::translate("main", "inputFileWarmStart"), "WS-testset-0-instance-1.gml" ); @@ -131,13 +131,13 @@ void addCommandLineOptions ( const QCoreApplication &application, #pragma mark COMMANDLINE_POSITIONAL_ARGUMENTS - parser.addPositionalArgument( - "inputFile", + parser.addPositionalArgument( + "inputFile", QCoreApplication::translate("main", "The input file to open.") ); - parser.addPositionalArgument( - "outputDir", + parser.addPositionalArgument( + "outputDir", QCoreApplication::translate("main", "The output directory to write files.") ); @@ -165,15 +165,15 @@ void addCommandLineOptions ( const QCoreApplication &application, // Decide which graph type to use, meaning either a static or a dynamic graph #ifndef USE_DYNAMIC_GRAPH - const bool isStaticGraph = true; + const bool isStaticGraph = true; #else - const bool isStaticGraph = false; + const bool isStaticGraph = false; #endif #ifndef USE_TYPES_REAL_WEIGHT - const bool isTypesReal = true; + const bool isTypesReal = true; #else - const bool isTypesReal = false; + const bool isTypesReal = false; #endif typedef std::conditionaltm_hour << ':' - << now->tm_min << ':' + << now->tm_mday << " at " + << now->tm_hour << ':' + << now->tm_min << ':' << now->tm_sec << " o'clock " << std::endl; std::cerr << std::setw(16) << "Error code" << " = " << e.getErrorCode() << std::endl; std::cerr << std::setw(16) << "Message" << " = " << e.getMessage() << std::endl; @@ -223,13 +223,13 @@ int main(int argc, char *argv[]) { auto algorithm = parser.value("algo").toUpper(); auto solver = parser.value("solver").toUpper(); egoa::Types::real timeLimit = parser.value("time").toDouble(); - bool traceSolution = parser.value("trace").toUpper()=="TRUE"?true:false; + bool traceSolution = parser.value("trace").toUpper()=="TRUE"?true:false; bool verbose = parser.value("verbose").toUpper()=="TRUE"?true:false;; auto networkSetting = parser.value("networkSetting").toUpper(); auto variant = parser.value("variant").toUpper(); auto outputType = parser.value("outputType").toUpper(); -#ifndef NDEBUG +#ifndef NDEBUG qDebug() << Qt::endl; qDebug() << "\tInputFile :" << inputFile; qDebug() << "\tOutputDir :" << outputDir; @@ -253,7 +253,7 @@ int main(int argc, char *argv[]) { egoa::PowerGrid network; std::string filename = egoa::Auxiliary::Basename( inputFile.toStdString() ); filename = egoa::Auxiliary::RemoveExtension( filename ); - + if (!egoa::PowerGridIO::read ( network, inputFile.toStdString(), egoa::PowerGridIO::readIeeeCdfMatlab )) std::cerr << "Expected file " << inputFile.toStdString() << " does not exist!"; @@ -261,7 +261,7 @@ int main(int argc, char *argv[]) { if (verbose) { std::cout << network << std::endl; - std::cout << std::string(40, '-') + std::cout << std::string(40, '-') << std::endl << "\tAlgorithm: " << algorithm.toStdString() << std::endl << "\tVariant: " << variant.toStdString() << std::endl @@ -292,7 +292,7 @@ int main(int argc, char *argv[]) { // else if ( variant == "QUADRATIC" ) { model->SetKVl2Quadratic(); } // check variant here // model->Run(); - // } else + // } else if ( algorithm == "MAXST" || algorithm == "2APPROXIMATION" ) { auto comparator = [&network](egoa::Types::edgeId lhs, egoa::Types::edgeId rhs) { return network.Graph().EdgeAt(lhs).Properties().ThermalLimit() @@ -331,9 +331,9 @@ int main(int argc, char *argv[]) { // if ( verbose && model != nullptr ) { // std::cout << "Finished " - // << algorithm.toStdString() - // << " with status " - // << model->Solver().Status() + // << algorithm.toStdString() + // << " with status " + // << model->Solver().Status() // << std::endl; // std::cout << *model; // std::cout << std::endl << std::endl; @@ -365,7 +365,7 @@ int main(int argc, char *argv[]) { system( ("dot -Tps " + outputDir.toStdString() + algoFile + ".dot -o " + outputDir.toStdString() + algoFile + ".svg").c_str() ); } else if ( outputType == "NONE" ) { // qDebug() << "Output: " << outputType << "\n" << flush; - } else { + } else { // qDebug() << "Output: " << outputType << "\n" << flush; egoa::PowerGridIO::write( network, outputDir.toStdString() + file + ".dot", egoa::PowerGridIO::WriteGraphDot ); egoa::PowerGridIO::write( resultGraph, outputDir.toStdString() + algoFile + ".dot", egoa::PowerGridIO::WriteGraphDot ); diff --git a/tests/Algorithms/Centralities/TestBetweennessCentrality.cpp b/tests/Algorithms/Centralities/TestBetweennessCentrality.cpp index a1a22b5b..a8823934 100644 --- a/tests/Algorithms/Centralities/TestBetweennessCentrality.cpp +++ b/tests/Algorithms/Centralities/TestBetweennessCentrality.cpp @@ -23,8 +23,8 @@ TEST_F ( TestBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter { betweennessAlgorithm_.Run(); EXPECT_EQ ( betweennessAlgorithm_.Collection().Collection().size(), graph_.NumberOfVertices() ); - - for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) + + for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) { if ( 0 == row.SourceId ) { TestCollectionValues ( row, "DTP", "", 4, 0, 0, 5, 10, 7, 3, 4 ); @@ -90,8 +90,8 @@ TEST_F ( TestBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter betweennessAlgorithm_.Run(); EXPECT_EQ ( betweennessAlgorithm_.Collection().Collection().size(), graph_.NumberOfVertices() ); // betweennessAlgorithm_.WriteCollection ( std::cout ); - - for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) + + for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) { if ( 0 == row.SourceId ) { TestCollectionValues ( row, "DTP", "", 4, 0, 0, 5, 10, 7, 3, 4 ); @@ -157,8 +157,8 @@ TEST_F ( TestBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter { betweennessAlgorithm_.Run(); EXPECT_EQ ( betweennessAlgorithm_.Collection().Collection().size(), graph_.NumberOfVertices() ); - - for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) + + for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) { if ( 0 == row.SourceId ) { TestCollectionValues ( row, "DTP", "", 4, 0, 0, 5, 18, 9, 6, 7 ); @@ -223,8 +223,8 @@ TEST_F ( TestBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter { betweennessAlgorithm_.Run(); EXPECT_EQ ( betweennessAlgorithm_.Collection().Collection().size(), graph_.NumberOfVertices() ); - - for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) + + for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) { if ( 0 == row.SourceId ) { TestCollectionValues ( row, "DTP", "", 4, 0, 0, 5, 12, 7, 4, 5 ); @@ -293,10 +293,10 @@ TEST_F ( TestBcDtpVangleUsingMultipleCases TPowerGrid network; if (!TPowerGridIO::read ( network_ , TestCaseExample - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { - std::cerr << "Expected file " - << TestCaseExample + std::cerr << "Expected file " + << TestCaseExample << " does not exist!"; exit(1); } @@ -307,4 +307,4 @@ TEST_F ( TestBcDtpVangleUsingMultipleCases betweennessAlgorithm.Run(); } -} // namespace egoa::test \ No newline at end of file +} // namespace egoa::test diff --git a/tests/Algorithms/Centralities/TestBetweennessCentrality.hpp b/tests/Algorithms/Centralities/TestBetweennessCentrality.hpp index 04b7915d..1a050d1b 100644 --- a/tests/Algorithms/Centralities/TestBetweennessCentrality.hpp +++ b/tests/Algorithms/Centralities/TestBetweennessCentrality.hpp @@ -34,14 +34,14 @@ namespace egoa::test { /** - * @brief Fixture that provides the basic network and measurement setup + * @brief Fixture that provides the basic network and measurement setup */ class TestBetweennessCentralityGraph : public ::testing::Test { protected: ///@name Type aliasing ///@{ #pragma mark BC_GRAPH_TYPE_ALIASING - + // Graph and network data structures using TVertex = Vertices::Vertex>; using TVertexProperties = TVertex::TProperties; @@ -52,7 +52,7 @@ class TestBetweennessCentralityGraph : public ::testing::Test { using TPowerGrid = PowerGrid; // IO using TPowerGridIO = PowerGridIO; - // Measurement + // Measurement using TMeasurementCollection = IO::DtpRuntimeCollection; using TMeasurementRow = typename TMeasurementCollection::TRow; ///@} @@ -148,7 +148,7 @@ class TestBetweennessCentralityGraph : public ::testing::Test { , std::vector const & check ) const { ASSERT_EQ ( original.size(), check.size() ); - + for (Types::count counter = 0 ; counter < original.size() ; ++counter ) @@ -179,8 +179,8 @@ class TestBetweennessCentralityGraph : public ::testing::Test { * @brief Class for testing the betweenness centrality with DTP and * voltage angle difference label. */ -class TestBetweennessCentralityDtpVoltageAngleDifference - : public TestBetweennessCentralityGraph +class TestBetweennessCentralityDtpVoltageAngleDifference + : public TestBetweennessCentralityGraph { protected: @@ -192,7 +192,7 @@ class TestBetweennessCentralityDtpVoltageAngleDifference using TMQueue = MappingBinaryHeap; // Bucket using TLabelSet = Bucket< TQueue >; - + // Dominating theta path using susceptance norm only using TFindPathAlgo = DominatingThetaPath < TGraph , TLabel @@ -214,7 +214,7 @@ class TestBetweennessCentralityDtpVoltageAngleDifference {} ~TestBetweennessCentralityDtpVoltageAngleDifference () {} -}; +}; // *********************************************************************** // *********************************************************************** @@ -226,8 +226,8 @@ class TestBetweennessCentralityDtpVoltageAngleDifference * @brief Class for testing the betweenness centrality with DTP and * voltage angle difference label using @c edge counter @c. */ -class TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter - : public TestBetweennessCentralityDtpVoltageAngleDifference +class TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter + : public TestBetweennessCentralityDtpVoltageAngleDifference { protected: #pragma mark BC_DTP_VANGLE_EDGE_COUNTER_TYPE_ALIASING @@ -235,7 +235,7 @@ class TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter , TFindPathAlgo , TMeasurementCollection , CentralityCounter::counterAtEdges >; - + #pragma mark BC_DTP_VANGLE_EDGE_COUNTER_CONSTRUCTORS_AND_DESTRUCTOR TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter () : TestBetweennessCentralityDtpVoltageAngleDifference() @@ -256,7 +256,7 @@ class TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter #pragma mark BC_DTP_VANGLE_EDGE_COUNTER_MEMBER TBcDtpVangle betweennessAlgorithm_; -}; +}; // *********************************************************************** // *********************************************************************** @@ -268,8 +268,8 @@ class TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter * @brief Class for test betweenness centrality with DTP and voltage * angle difference labels using vertex counter. */ -class TestBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter - : public TestBetweennessCentralityDtpVoltageAngleDifference +class TestBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter + : public TestBetweennessCentralityDtpVoltageAngleDifference { protected: #pragma mark BC_DTP_VANGLE_VERTEX_COUNTER_TYPE_ALIASING @@ -298,7 +298,7 @@ class TestBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter #pragma mark BC_DTP_VANGLE_VERTEX_COUNTER_MEMBERS TBcDtpVangle betweennessAlgorithm_; -}; +}; #pragma mark BC_DTP_SUSCEPTANCE_NORM @@ -306,8 +306,8 @@ class TestBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter * @brief Class for test betweenness centrality with DTP and susceptance * norm labels. */ -class TestBetweennessCentralityDtpSusceptanceNorm - : public TestBetweennessCentralityGraph +class TestBetweennessCentralityDtpSusceptanceNorm + : public TestBetweennessCentralityGraph { protected: @@ -348,8 +348,8 @@ class TestBetweennessCentralityDtpSusceptanceNorm * @brief Class for testing the betweenness centrality with DTP and * susceptance norm labels using @c edge counter @c. */ -class TestBetweennessCentralityDtpSusceptanceNormEdgeCounter - : public TestBetweennessCentralityDtpSusceptanceNorm +class TestBetweennessCentralityDtpSusceptanceNormEdgeCounter + : public TestBetweennessCentralityDtpSusceptanceNorm { protected: @@ -376,7 +376,7 @@ class TestBetweennessCentralityDtpSusceptanceNormEdgeCounter {} ~TestBetweennessCentralityDtpSusceptanceNormEdgeCounter () {} - + #pragma mark BC_DTP_SUSCEPTANCE_NORM_EDGE_COUNTER_MEMBERS TBcDtpBnorm betweennessAlgorithm_; }; @@ -385,8 +385,8 @@ class TestBetweennessCentralityDtpSusceptanceNormEdgeCounter * @brief Class for testing the betweenness centrality with DTP and * susceptance norm labels using @c vertex counter @c. */ -class TestBetweennessCentralityDtpSusceptanceNormVertexCounter - : public TestBetweennessCentralityDtpSusceptanceNorm +class TestBetweennessCentralityDtpSusceptanceNormVertexCounter + : public TestBetweennessCentralityDtpSusceptanceNorm { protected: using TBcDtpBnorm = BetweennessCentrality < TGraph @@ -410,7 +410,7 @@ class TestBetweennessCentralityDtpSusceptanceNormVertexCounter {} virtual ~TestBetweennessCentralityDtpSusceptanceNormVertexCounter () {} - + protected: TBcDtpBnorm betweennessAlgorithm_; }; @@ -420,8 +420,8 @@ class TestBetweennessCentralityDtpSusceptanceNormVertexCounter * susceptance norm labels using @c edge counter @c and the @c * Acm2018MtsfFigure4a @c. */ -class TestBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter - : public TestBetweennessCentralityDtpSusceptanceNormEdgeCounter +class TestBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter + : public TestBetweennessCentralityDtpSusceptanceNormEdgeCounter { protected: TestBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter () @@ -429,10 +429,10 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4a_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { - std::cerr << "Expected file " - << TestCaseAcm2018MtsfFigure4a_ + std::cerr << "Expected file " + << TestCaseAcm2018MtsfFigure4a_ << " does not exist!"; exit(1); } @@ -441,7 +441,7 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter virtual ~TestBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } @@ -452,8 +452,8 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter * susceptance norm labels using @c vertex counter @c and the @c * Acm2018MtsfFigure4a @c. */ -class TestBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter - : public TestBetweennessCentralityDtpSusceptanceNormVertexCounter +class TestBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter + : public TestBetweennessCentralityDtpSusceptanceNormVertexCounter { protected: TestBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter () @@ -461,10 +461,10 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4a_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { - std::cerr << "Expected file " - << TestCaseAcm2018MtsfFigure4a_ + std::cerr << "Expected file " + << TestCaseAcm2018MtsfFigure4a_ << " does not exist!"; exit(1); } @@ -473,7 +473,7 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter virtual ~TestBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } @@ -484,8 +484,8 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter * susceptance norm labels using @c edge counter @c and the @c * Acm2018MtsfFigure4b @c. */ -class TestBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter - : public TestBetweennessCentralityDtpSusceptanceNormEdgeCounter +class TestBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter + : public TestBetweennessCentralityDtpSusceptanceNormEdgeCounter { protected: TestBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter () @@ -493,10 +493,10 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4b_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { - std::cerr << "Expected file " - << TestCaseAcm2018MtsfFigure4b_ + std::cerr << "Expected file " + << TestCaseAcm2018MtsfFigure4b_ << " does not exist!"; exit(1); } @@ -505,7 +505,7 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter virtual ~TestBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } @@ -516,8 +516,8 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter * susceptance norm labels using @c vertex counter @c and the @c * Acm2018MtsfFigure4b @c. */ -class TestBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter - : public TestBetweennessCentralityDtpSusceptanceNormVertexCounter +class TestBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter + : public TestBetweennessCentralityDtpSusceptanceNormVertexCounter { protected: TestBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter () @@ -525,10 +525,10 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4b_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { - std::cerr << "Expected file " - << TestCaseAcm2018MtsfFigure4b_ + std::cerr << "Expected file " + << TestCaseAcm2018MtsfFigure4b_ << " does not exist!"; exit(1); } @@ -537,7 +537,7 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter virtual ~TestBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } @@ -548,8 +548,8 @@ class TestBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter * voltage angle difference labels using @c edge counter @c and the @c * Acm2018MtsfFigure4a @c. */ -class TestBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter - : public TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter +class TestBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter + : public TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter { protected: TestBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter () @@ -557,10 +557,10 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4a_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { - std::cerr << "Expected file " - << TestCaseAcm2018MtsfFigure4a_ + std::cerr << "Expected file " + << TestCaseAcm2018MtsfFigure4a_ << " does not exist!"; exit(1); } @@ -569,7 +569,7 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter virtual ~TestBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } @@ -580,8 +580,8 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter * voltage angle difference labels using @c vertex counter @c and the @c * Acm2018MtsfFigure4a @c. */ -class TestBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter - : public TestBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter +class TestBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter + : public TestBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter { protected: TestBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter () @@ -589,10 +589,10 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4a_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { - std::cerr << "Expected file " - << TestCaseAcm2018MtsfFigure4a_ + std::cerr << "Expected file " + << TestCaseAcm2018MtsfFigure4a_ << " does not exist!"; exit(1); } @@ -601,7 +601,7 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter virtual ~TestBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } @@ -612,8 +612,8 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter * voltage angle difference labels using @c edge counter @c and the @c * Acm2018MtsfFigure4b @c. */ -class TestBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter - : public TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter +class TestBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter + : public TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter { protected: TestBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter () @@ -621,10 +621,10 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4b_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { - std::cerr << "Expected file " - << TestCaseAcm2018MtsfFigure4b_ + std::cerr << "Expected file " + << TestCaseAcm2018MtsfFigure4b_ << " does not exist!"; exit(1); } @@ -633,7 +633,7 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter virtual ~TestBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } @@ -644,8 +644,8 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter * voltage angle difference labels using @c vertex counter @c and the @c * Acm2018MtsfFigure4b @c. */ -class TestBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter - : public TestBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter +class TestBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter + : public TestBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter { protected: TestBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter () @@ -653,10 +653,10 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4b_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { - std::cerr << "Expected file " - << TestCaseAcm2018MtsfFigure4b_ + std::cerr << "Expected file " + << TestCaseAcm2018MtsfFigure4b_ << " does not exist!"; exit(1); } @@ -665,7 +665,7 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter virtual ~TestBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } @@ -677,19 +677,19 @@ class TestBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter * Acm2018MtsfFigure4b @c. */ class TestBcDtpVangleUsingMultipleCases - : public TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter + : public TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter { protected: TestBcDtpVangleUsingMultipleCases () : TestBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter( std::move( TGraph( "MultipleCases" ) ) ) - { + { // Types::string TestCaseExample = "../../framework/data/PowerGrids/IEEE/00-Matpower-Data/case9.m"; // if (!TPowerGridIO::read ( network_ // , TestCaseExample - // , TPowerGridIO::readIeeeCdfMatlab ) ) + // , TPowerGridIO::readIeeeCdfMatlab ) ) // { - // std::cerr << "Expected file " - // << TestCaseExample + // std::cerr << "Expected file " + // << TestCaseExample // << " does not exist!"; // exit(1); // } @@ -698,7 +698,7 @@ class TestBcDtpVangleUsingMultipleCases virtual ~TestBcDtpVangleUsingMultipleCases () {} - virtual void SetUp () override + virtual void SetUp () override { // betweennessAlgorithm_.Clear(); } @@ -706,4 +706,4 @@ class TestBcDtpVangleUsingMultipleCases } // namespace egoa::test -#endif // EGOA__TESTS__ALGORITHMS__TEST_BETWEENNESS_CENTRALITY_HPP \ No newline at end of file +#endif // EGOA__TESTS__ALGORITHMS__TEST_BETWEENNESS_CENTRALITY_HPP diff --git a/tests/Algorithms/Centralities/TestGeneratorBasedBetweennessCentrality.cpp b/tests/Algorithms/Centralities/TestGeneratorBasedBetweennessCentrality.cpp index 5196be27..e26fb97e 100644 --- a/tests/Algorithms/Centralities/TestGeneratorBasedBetweennessCentrality.cpp +++ b/tests/Algorithms/Centralities/TestGeneratorBasedBetweennessCentrality.cpp @@ -25,7 +25,7 @@ TEST_F ( TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter EXPECT_EQ ( betweennessAlgorithm_.Collection().Collection().size(), 1 ); - for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) + for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) { EXPECT_EQ ( row.SourceId, 0 ); TestCollectionValues ( row, "DTP", "", 4, 1, 4, 5, 10, 7, 3, 4 ); @@ -85,7 +85,7 @@ TEST_F ( TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter EXPECT_EQ ( betweennessAlgorithm_.Collection().Collection().size(), 1 ); - for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) + for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) { EXPECT_EQ ( row.SourceId, 0 ); TestCollectionValues ( row, "DTP", "", 4, 1, 4, 5, 10, 7, 3, 4 ); @@ -146,7 +146,7 @@ TEST_F ( TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter EXPECT_EQ ( betweennessAlgorithm_.Collection().Collection().size(), 1 ); - for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) + for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) { EXPECT_EQ ( row.SourceId, 0 ); TestCollectionValues ( row, "DTP", "", 4, 1, 4, 5, 18, 9, 6, 7 ); @@ -206,7 +206,7 @@ TEST_F ( TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter EXPECT_EQ ( betweennessAlgorithm_.Collection().Collection().size(), 1 ); - for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) + for ( TMeasurementRow const & row : betweennessAlgorithm_.Collection().Collection() ) { EXPECT_EQ ( row.SourceId, 0 ); TestCollectionValues ( row, "DTP", "", 4, 1, 4, 5, 12, 7, 4, 5 ); @@ -257,4 +257,4 @@ TEST_F ( TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter TestTotalNumberOfPaths ( totalNumberOfPathsPerVertex, check ); } -} // namespace egoa::test \ No newline at end of file +} // namespace egoa::test diff --git a/tests/Algorithms/Centralities/TestGeneratorBasedBetweennessCentrality.hpp b/tests/Algorithms/Centralities/TestGeneratorBasedBetweennessCentrality.hpp index 6afbeb67..b62d1068 100644 --- a/tests/Algorithms/Centralities/TestGeneratorBasedBetweennessCentrality.hpp +++ b/tests/Algorithms/Centralities/TestGeneratorBasedBetweennessCentrality.hpp @@ -36,8 +36,8 @@ namespace egoa::test { /** * @brief Class creating the initial simple set up */ -class TestGeneratorBasedBetweennessCentralityGraph - : public ::testing::Test +class TestGeneratorBasedBetweennessCentralityGraph + : public ::testing::Test { protected: // Graph and network data structures @@ -52,7 +52,7 @@ class TestGeneratorBasedBetweennessCentralityGraph using TNetwork = PowerGrid; // IO using TPowerGridIO = PowerGridIO; - // Measurement + // Measurement using TMeasurementCollection = IO::DtpRuntimeCollection; using TMeasurementRow = typename TMeasurementCollection::TRow; protected: @@ -112,7 +112,7 @@ class TestGeneratorBasedBetweennessCentralityGraph , std::vector const & check ) const { ASSERT_EQ ( original.size(), check.size() ); - + for (Types::count counter = 0 ; counter < original.size() ; ++counter ) @@ -130,8 +130,8 @@ class TestGeneratorBasedBetweennessCentralityGraph Types::string const TestCaseAcm2018MtsfFigure4b_ = "../../framework/tests/Data/PowerGrids/ieee_2018_acm_eEnergy_MTSF_Figure4b.m"; }; -class TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifference - : public TestGeneratorBasedBetweennessCentralityGraph +class TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifference + : public TestGeneratorBasedBetweennessCentralityGraph { protected: // Power Grid DTP specific data structures including voltage angles @@ -141,7 +141,7 @@ class TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifference using TMQueue = MappingBinaryHeap; // Bucket using TLabelSet = Bucket< TQueue >; - + // Dominating theta path using susceptance norm only using TFindPathAlgo = DominatingThetaPath < TGraph , TLabel @@ -160,16 +160,16 @@ class TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifference TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifference ( TNetwork const & network ) : TestGeneratorBasedBetweennessCentralityGraph( network ) {} -}; +}; -class TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter - : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifference +class TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter + : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifference { protected: using TGeneratorBasedBcDtpVangle = GeneratorBasedBetweennessCentrality < TNetwork , TFindPathAlgo - , TMeasurementCollection + , TMeasurementCollection , CentralityCounter::counterAtEdges >; protected: TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter () @@ -189,15 +189,15 @@ class TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounte protected: TGeneratorBasedBcDtpVangle betweennessAlgorithm_; -}; +}; -class TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter - : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifference +class TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter + : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifference { protected: using TGeneratorBasedBcDtpVangle = GeneratorBasedBetweennessCentrality < TNetwork , TFindPathAlgo - , TMeasurementCollection + , TMeasurementCollection , CentralityCounter::counterAtVertices >; protected: TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter () @@ -217,10 +217,10 @@ class TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceVertexCoun protected: TGeneratorBasedBcDtpVangle betweennessAlgorithm_; -}; +}; -class TestGeneratorBasedBetweennessCentralityDtpSusceptanceNorm - : public TestGeneratorBasedBetweennessCentralityGraph +class TestGeneratorBasedBetweennessCentralityDtpSusceptanceNorm + : public TestGeneratorBasedBetweennessCentralityGraph { protected: // Label specific data structures @@ -250,13 +250,13 @@ class TestGeneratorBasedBetweennessCentralityDtpSusceptanceNorm {} }; -class TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormEdgeCounter - : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNorm +class TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormEdgeCounter + : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNorm { protected: using TGeneratorBasedBcDtpBnorm = GeneratorBasedBetweennessCentrality < TNetwork , TFindPathAlgo - , TMeasurementCollection + , TMeasurementCollection , CentralityCounter::counterAtEdges >; TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormEdgeCounter () @@ -273,18 +273,18 @@ class TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormEdgeCounter : TestGeneratorBasedBetweennessCentralityDtpSusceptanceNorm( network ) , betweennessAlgorithm_( networkConst_ ) {} - + protected: TGeneratorBasedBcDtpBnorm betweennessAlgorithm_; }; -class TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormVertexCounter - : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNorm +class TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormVertexCounter + : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNorm { protected: using TGeneratorBasedBcDtpBnorm = GeneratorBasedBetweennessCentrality < TNetwork , TFindPathAlgo - , TMeasurementCollection + , TMeasurementCollection , CentralityCounter::counterAtVertices >; TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormVertexCounter () @@ -301,13 +301,13 @@ class TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormVertexCounter : TestGeneratorBasedBetweennessCentralityDtpSusceptanceNorm( network ) , betweennessAlgorithm_( networkConst_ ) {} - + protected: TGeneratorBasedBcDtpBnorm betweennessAlgorithm_; }; -class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter - : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormEdgeCounter +class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter + : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormEdgeCounter { protected: TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter () @@ -315,7 +315,7 @@ class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4a_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { std::cerr << "Expected file " << TestCaseAcm2018MtsfFigure4a_ << " does not exist!"; exit(1); @@ -324,14 +324,14 @@ class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter virtual ~TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aEdgeCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } }; -class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter - : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormVertexCounter +class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter + : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormVertexCounter { protected: TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter () @@ -339,7 +339,7 @@ class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4a_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { std::cerr << "Expected file " << TestCaseAcm2018MtsfFigure4a_ << " does not exist!"; exit(1); @@ -348,14 +348,14 @@ class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter virtual ~TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4aVertexCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } }; -class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter - : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormEdgeCounter +class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter + : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormEdgeCounter { protected: TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter () @@ -363,7 +363,7 @@ class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4b_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { std::cerr << "Expected file " << TestCaseAcm2018MtsfFigure4b_ << " does not exist!"; exit(1); @@ -372,14 +372,14 @@ class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter virtual ~TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bEdgeCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } }; -class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter - : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormVertexCounter +class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter + : public TestGeneratorBasedBetweennessCentralityDtpSusceptanceNormVertexCounter { protected: TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter () @@ -387,7 +387,7 @@ class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4b_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { std::cerr << "Expected file " << TestCaseAcm2018MtsfFigure4b_ << " does not exist!"; exit(1); @@ -396,14 +396,14 @@ class TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter virtual ~TestGeneratorBasedBcDtpBnormUsingAcm2018MtsfFigure4bVertexCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } }; -class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter - : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter +class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter + : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter { protected: TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter () @@ -411,7 +411,7 @@ class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4a_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { std::cerr << "Expected file " << TestCaseAcm2018MtsfFigure4a_ << " does not exist!"; exit(1); @@ -420,14 +420,14 @@ class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter virtual ~TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aEdgeCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } }; -class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter - : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter +class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter + : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter { protected: TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter () @@ -435,7 +435,7 @@ class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4a_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { std::cerr << "Expected file " << TestCaseAcm2018MtsfFigure4a_ << " does not exist!"; exit(1); @@ -444,14 +444,14 @@ class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter virtual ~TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4aVertexCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } }; -class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter - : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter +class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter + : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceEdgeCounter { protected: TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter () @@ -459,7 +459,7 @@ class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4b_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { std::cerr << "Expected file " << TestCaseAcm2018MtsfFigure4b_ << " does not exist!"; exit(1); @@ -468,14 +468,14 @@ class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter virtual ~TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bEdgeCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } }; -class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter - : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter +class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter + : public TestGeneratorBasedBetweennessCentralityDtpVoltageAngleDifferenceVertexCounter { protected: TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter () @@ -483,7 +483,7 @@ class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4b_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { std::cerr << "Expected file " << TestCaseAcm2018MtsfFigure4b_ << " does not exist!"; exit(1); @@ -492,7 +492,7 @@ class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter virtual ~TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter(){} - virtual void SetUp() override + virtual void SetUp() override { betweennessAlgorithm_.Clear(); } @@ -500,4 +500,4 @@ class TestGeneratorBasedBcDtpVangleUsingAcm2018MtsfFigure4bVertexCounter } // namespace egoa::test -#endif // EGOA__TESTS__ALGORITHMS__TEST_GENERATOR_BASED_BETWEENNESS_CENTRALITY_HPP \ No newline at end of file +#endif // EGOA__TESTS__ALGORITHMS__TEST_GENERATOR_BASED_BETWEENNESS_CENTRALITY_HPP diff --git a/tests/Algorithms/PathFinding/TestDominatingThetaPath.cpp b/tests/Algorithms/PathFinding/TestDominatingThetaPath.cpp index ef2c4582..904e5475 100644 --- a/tests/Algorithms/PathFinding/TestDominatingThetaPath.cpp +++ b/tests/Algorithms/PathFinding/TestDominatingThetaPath.cpp @@ -18,7 +18,7 @@ using ::testing::MatchesRegex; namespace egoa::test { #pragma mark TEST_DOMINATING_THETA_PATH_PRIMITIVES - + TEST_F ( TestDTPEmptyGraph , QueueEmpty ) { @@ -66,7 +66,7 @@ TEST_F ( TestDTPEmptyGraph } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -76,32 +76,32 @@ TEST_F ( TestDTPEmptyGraph #pragma mark TEST_DOMINATING_THETA_PATH_WITH_GRAPH_ACM_FIGURE_4A TEST_F ( TestDTPUsingAcm2018MtsfFigure4a - , NumberOfLabels ) + , NumberOfLabels ) { EXPECT_EQ ( dtp_.NumberOfLabels(), 0 ); } TEST_F ( TestDTPUsingAcm2018MtsfFigure4a - , Initialization ) + , Initialization ) { EXPECT_EQ ( graph_.NumberOfVertices(), 4 ); EXPECT_EQ ( graph_.NumberOfEdges(), 5 ); EXPECT_EQ ( graph_.NumberOfEdges(), 5 ); EXPECT_EQ ( graph_.MinDegree(), 2 ); EXPECT_EQ ( graph_.MaxDegree(), 3 ); - + Types::edgeId edgeId = graph_.EdgeId ( static_cast(0) , static_cast(1) ); TestEdgeValues ( edgeId, 0, 1.00, -1.00, -1.00, 0.00, 0.00 ); - + edgeId = graph_.EdgeId ( static_cast(0) , static_cast(2) ); TestEdgeValues ( edgeId, 1, 4.00, -1.00, -1.00, 0.00, 0.00 ); - + edgeId = graph_.EdgeId ( static_cast(0) , static_cast(3) ); TestEdgeValues ( edgeId, 2, 3.00, -1.00, -1.00, 0.00, 0.00 ); - + edgeId = graph_.EdgeId ( static_cast(1) , static_cast(2) ); TestEdgeValues ( edgeId, 3, 1.00, -1.00, -1.00, 0.00, 0.00 ); @@ -112,14 +112,14 @@ TEST_F ( TestDTPUsingAcm2018MtsfFigure4a } TEST_F ( TestDTPUsingAcm2018MtsfFigure4a - , RunDTPwithEmptySource ) + , RunDTPwithEmptySource ) { dtp_.Run(); EXPECT_EQ ( 0, dtp_.NumberOfLabels() ); } TEST_F ( TestDTPUsingAcm2018MtsfFigure4a - , RunDTPwithSource ) + , RunDTPwithSource ) { dtp_.Source ( source_ ); dtp_.Run(); @@ -127,7 +127,7 @@ TEST_F ( TestDTPUsingAcm2018MtsfFigure4a } TEST_F ( TestDTPUsingAcm2018MtsfFigure4a - , RunDTPthetaWithSource ) + , RunDTPthetaWithSource ) { dtpTheta_.Source ( source_ ); dtpTheta_.Run(); @@ -135,7 +135,7 @@ TEST_F ( TestDTPUsingAcm2018MtsfFigure4a } TEST_F ( TestDTPUsingAcm2018MtsfFigure4a - , RunDTPthetaWithSourceResultGraph ) + , RunDTPthetaWithSourceResultGraph ) { dtpTheta_.Source ( source_ ); dtpTheta_.Run(); @@ -145,7 +145,7 @@ TEST_F ( TestDTPUsingAcm2018MtsfFigure4a Subgraph expectedGraphWithSink0{&graph_, {0}, {}}; Subgraph resultGraphWithSink0{nullptr, {}, {}}; Types::real result = dtpTheta_.Result( resultGraphWithSink0, 0 ); - + EXPECT_EQ ( expectedGraphWithSink0, resultGraphWithSink0 ); EXPECT_EQ ( 0, result ); @@ -172,14 +172,14 @@ TEST_F ( TestDTPUsingAcm2018MtsfFigure4a } TEST_F ( TestDTPUsingAcm2018MtsfFigure4a - , RunDTPthetaWithSourceResultVector ) + , RunDTPthetaWithSourceResultVector ) { dtpTheta_.Source ( source_ ); dtpTheta_.Run(); EXPECT_EQ ( 7, dtpTheta_.NumberOfLabels() ); std::vector> resultVectorWithSink; - + Types::real result = dtpTheta_.Result( resultVectorWithSink, 0 ); EXPECT_EQ( resultVectorWithSink.size(), 1 ); EXPECT_EQ( resultVectorWithSink[0].size(), 1 ); @@ -220,32 +220,32 @@ TEST_F ( TestDTPUsingAcm2018MtsfFigure4a #pragma mark TEST_DOMINATING_THETA_PATH_WITH_GRAPH_ACM_FIGURE_4B TEST_F ( TestDTPUsingAcm2018MtsfFigure4b - , NumberOfLabels ) + , NumberOfLabels ) { EXPECT_EQ ( dtp_.NumberOfLabels(), 0 ); } TEST_F ( TestDTPUsingAcm2018MtsfFigure4b - , Initialization ) + , Initialization ) { EXPECT_EQ ( graph_.NumberOfVertices(), 4 ); EXPECT_EQ ( graph_.NumberOfEdges(), 5 ); EXPECT_EQ ( graph_.NumberOfEdges(), 5 ); EXPECT_EQ ( graph_.MinDegree(), 2 ); EXPECT_EQ ( graph_.MaxDegree(), 3 ); - + Types::edgeId edgeId = graph_.EdgeId ( static_cast(0) , static_cast(1) ); TestEdgeValues ( edgeId, 0, 1.00, -1.00, -1.00, 0.00, 0.00 ); - + edgeId = graph_.EdgeId ( static_cast(0) , static_cast(2) ); TestEdgeValues ( edgeId, 1, 1.00, -1.00, -1.00, 0.00, 0.00 ); - + edgeId = graph_.EdgeId ( static_cast(0) , static_cast(3) ); TestEdgeValues ( edgeId, 2, 2.00, -1.00, -1.00, 0.00, 0.00 ); - + edgeId = graph_.EdgeId ( static_cast(1) , static_cast(2) ); TestEdgeValues ( edgeId, 3, 1.00, -1.00, -1.00, 0.00, 0.00 ); @@ -256,14 +256,14 @@ TEST_F ( TestDTPUsingAcm2018MtsfFigure4b } TEST_F ( TestDTPUsingAcm2018MtsfFigure4b - , RunDTPwithEmptySource ) + , RunDTPwithEmptySource ) { dtp_.Run(); EXPECT_EQ ( dtp_.NumberOfLabels(), 0 ); } TEST_F ( TestDTPUsingAcm2018MtsfFigure4b - , RunDTPwithSource ) + , RunDTPwithSource ) { dtp_.Source ( source_ ); dtp_.Run(); @@ -271,7 +271,7 @@ TEST_F ( TestDTPUsingAcm2018MtsfFigure4b } TEST_F ( TestDTPUsingAcm2018MtsfFigure4b - , RunDTPthetaWithSource ) + , RunDTPthetaWithSource ) { dtpTheta_.Source ( source_ ); dtpTheta_.Run(); @@ -279,7 +279,7 @@ TEST_F ( TestDTPUsingAcm2018MtsfFigure4b } TEST_F ( TestDTPUsingAcm2018MtsfFigure4b - , RunDTPthetaWithSourceResultGraph ) + , RunDTPthetaWithSourceResultGraph ) { dtpTheta_.Source ( source_ ); dtpTheta_.Run(); @@ -315,14 +315,14 @@ TEST_F ( TestDTPUsingAcm2018MtsfFigure4b } TEST_F ( TestDTPUsingAcm2018MtsfFigure4b - , RunDTPthetaWithSourceResultVector ) + , RunDTPthetaWithSourceResultVector ) { dtpTheta_.Source ( source_ ); dtpTheta_.Run(); EXPECT_EQ ( dtpTheta_.NumberOfLabels(), 5 ); std::vector> resultVectorWithSink; - + Types::real result = dtpTheta_.Result( resultVectorWithSink, 0 ); EXPECT_EQ( resultVectorWithSink.size(), 1 ); EXPECT_EQ( resultVectorWithSink[0].size(), 1 ); diff --git a/tests/Algorithms/PathFinding/TestDominatingThetaPath.hpp b/tests/Algorithms/PathFinding/TestDominatingThetaPath.hpp index 11e41557..e522a838 100644 --- a/tests/Algorithms/PathFinding/TestDominatingThetaPath.hpp +++ b/tests/Algorithms/PathFinding/TestDominatingThetaPath.hpp @@ -97,7 +97,7 @@ class TestDTPPowerGridSpecific : public TestDominatingThetaPath { using TMQTheta = MappingBinaryHeap; // Bucket using TLabelSetTheta = Bucket< TQueueTheta >; - + // Dominating theta path using susceptance norm only using TDtpTheta = DominatingThetaPath < TGraph , TLabelTheta @@ -134,7 +134,7 @@ class TestDTPPowerGridSpecific : public TestDominatingThetaPath { EXPECT_EQ ( graph_.EdgeAt( edgeId ).Properties().Susceptance(), dcSusceptance ); EXPECT_EQ ( graph_.EdgeAt( edgeId ).Properties().Susceptance(), acSusceptance ); EXPECT_EQ ( graph_.EdgeAt( edgeId ).Properties().Conductance(), dcConductance ); - EXPECT_EQ ( graph_.EdgeAt( edgeId ).Properties().Conductance(), acConductance ); + EXPECT_EQ ( graph_.EdgeAt( edgeId ).Properties().Conductance(), acConductance ); } protected: TPowerGrid network_; @@ -151,7 +151,7 @@ class TestDTPPowerGridSpecific : public TestDominatingThetaPath { */ class TestDTPEmptyGraph : public TestDominatingThetaPath { protected: - TestDTPEmptyGraph () + TestDTPEmptyGraph () : TestDominatingThetaPath ( std::move( TGraph( "Empty Test Graph" ) ) ) {} @@ -174,7 +174,7 @@ class TestDTPUsingAcm2018MtsfFigure4a : public TestDTPPowerGridSpecific { { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4a_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { std::cerr << "Expected file " << TestCaseAcm2018MtsfFigure4a_ << " does not exist!"; exit(1); @@ -204,7 +204,7 @@ class TestDTPUsingAcm2018MtsfFigure4b : public TestDTPPowerGridSpecific { { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4b_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { std::cerr << "Expected file " << TestCaseAcm2018MtsfFigure4b_ << " does not exist!"; exit(1); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ab64163e..ab2e9528 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -81,7 +81,7 @@ add_test(NAME TestDynamicGraph COMMAND TestDynamicGraph) # add_executable(PowerFlow PowerFlowModels/PowerFlow.cpp) # target_link_libraries(PowerFlow gtest gtest_main gmock_main EGOA) # add_test(NAME TestPowerFlow COMMAND PowerFlow) -# +# ###################################################################################### # Tests for MST ALGORITHMS ########################################################### ###################################################################################### @@ -130,4 +130,3 @@ add_test(NAME TestDynamicGraph COMMAND TestDynamicGraph) # add_executable(TestGeojsonWriter IO/TestGeojsonWriter.cpp) # target_link_libraries(TestGeojsonWriter EGOA gtest gtest_main gmock_main) # add_test(NAME TestGeojsonWriter COMMAND TestGeojsonWriter) - diff --git a/tests/Data/Output/PyPsaExampleJsonWriterExpectedOutput.json b/tests/Data/Output/PyPsaExampleJsonWriterExpectedOutput.json index f3d7c17c..24a6ad0d 100644 --- a/tests/Data/Output/PyPsaExampleJsonWriterExpectedOutput.json +++ b/tests/Data/Output/PyPsaExampleJsonWriterExpectedOutput.json @@ -1,445 +1,505 @@ { -"type": "FeatureCollection", -"features": [ + "features": [ { - "type": "Feature", - "properties":{ - "name": "EXA 0", - "type": "unknown", - "xCoordinate": "8.59131", - "yCoordinate": "53.6251", - "shuntConductance": "0", - "shuntSusceptance": "0", - "voltageMagnitude": "1", - "voltageAngle": "0", - "nominalVoltage": "380", - "maximumVoltage": "1.79769e+308", - "minimumVoltage": "0", - "country": "NORDDEUTSCHLAND", - "area": "0", - "zone": "0", - "control": "PQ", - "carrier": "AC", - "status": "active" - }, - "geometry": { - "type": "Point", - "coordinates": [8.59131,53.6251] - } + "geometry": { + "coordinates": [ + 8.59131, + 53.6251 + ], + "type": "Point" + }, + "properties": { + "area": "0", + "carrier": "AC", + "control": "PQ", + "country": "NORDDEUTSCHLAND", + "maximumVoltage": "1.79769e+308", + "minimumVoltage": "0", + "name": "EXA 0", + "nominalVoltage": "380", + "shuntConductance": "0", + "shuntSusceptance": "0", + "status": "active", + "type": "unknown", + "voltageAngle": "0", + "voltageMagnitude": "1", + "xCoordinate": "8.59131", + "yCoordinate": "53.6251", + "zone": "0" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "EXA 1", - "type": "unknown", - "xCoordinate": "9.93542", - "yCoordinate": "51.5352", - "shuntConductance": "0", - "shuntSusceptance": "0", - "voltageMagnitude": "1", - "voltageAngle": "0", - "nominalVoltage": "380", - "maximumVoltage": "1.79769e+308", - "minimumVoltage": "0", - "country": "GOETTINGEN", - "area": "0", - "zone": "0", - "control": "PQ", - "carrier": "AC", - "status": "active" - }, - "geometry": { - "type": "Point", - "coordinates": [9.93542,51.5352] - } + "geometry": { + "coordinates": [ + 9.93542, + 51.5352 + ], + "type": "Point" + }, + "properties": { + "area": "0", + "carrier": "AC", + "control": "PQ", + "country": "GOETTINGEN", + "maximumVoltage": "1.79769e+308", + "minimumVoltage": "0", + "name": "EXA 1", + "nominalVoltage": "380", + "shuntConductance": "0", + "shuntSusceptance": "0", + "status": "active", + "type": "unknown", + "voltageAngle": "0", + "voltageMagnitude": "1", + "xCoordinate": "9.93542", + "yCoordinate": "51.5352", + "zone": "0" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "EXA 2", - "type": "unknown", - "xCoordinate": "13.7357", - "yCoordinate": "51.0556", - "shuntConductance": "0", - "shuntSusceptance": "0", - "voltageMagnitude": "1", - "voltageAngle": "0", - "nominalVoltage": "380", - "maximumVoltage": "1.79769e+308", - "minimumVoltage": "0", - "country": "DRESDEN", - "area": "0", - "zone": "0", - "control": "PQ", - "carrier": "AC", - "status": "active" - }, - "geometry": { - "type": "Point", - "coordinates": [13.7357,51.0556] - } + "geometry": { + "coordinates": [ + 13.7357, + 51.0556 + ], + "type": "Point" + }, + "properties": { + "area": "0", + "carrier": "AC", + "control": "PQ", + "country": "DRESDEN", + "maximumVoltage": "1.79769e+308", + "minimumVoltage": "0", + "name": "EXA 2", + "nominalVoltage": "380", + "shuntConductance": "0", + "shuntSusceptance": "0", + "status": "active", + "type": "unknown", + "voltageAngle": "0", + "voltageMagnitude": "1", + "xCoordinate": "13.7357", + "yCoordinate": "51.0556", + "zone": "0" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "EXA 3", - "type": "unknown", - "xCoordinate": "8.37433", - "yCoordinate": "49.0163", - "shuntConductance": "0", - "shuntSusceptance": "0", - "voltageMagnitude": "1", - "voltageAngle": "0", - "nominalVoltage": "380", - "maximumVoltage": "1.79769e+308", - "minimumVoltage": "0", - "country": "KARLSRUHE", - "area": "0", - "zone": "0", - "control": "PQ", - "carrier": "AC", - "status": "active" - }, - "geometry": { - "type": "Point", - "coordinates": [8.37433,49.0163] - } + "geometry": { + "coordinates": [ + 8.37433, + 49.0163 + ], + "type": "Point" + }, + "properties": { + "area": "0", + "carrier": "AC", + "control": "PQ", + "country": "KARLSRUHE", + "maximumVoltage": "1.79769e+308", + "minimumVoltage": "0", + "name": "EXA 3", + "nominalVoltage": "380", + "shuntConductance": "0", + "shuntSusceptance": "0", + "status": "active", + "type": "unknown", + "voltageAngle": "0", + "voltageMagnitude": "1", + "xCoordinate": "8.37433", + "yCoordinate": "49.0163", + "zone": "0" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "EXA 4", - "type": "unknown", - "xCoordinate": "13.0552", - "yCoordinate": "52.4001", - "shuntConductance": "0", - "shuntSusceptance": "0", - "voltageMagnitude": "1", - "voltageAngle": "0", - "nominalVoltage": "380", - "maximumVoltage": "1.79769e+308", - "minimumVoltage": "0", - "country": "POTSDAM", - "area": "0", - "zone": "0", - "control": "PQ", - "carrier": "AC", - "status": "active" - }, - "geometry": { - "type": "Point", - "coordinates": [13.0552,52.4001] - } + "geometry": { + "coordinates": [ + 13.0552, + 52.4001 + ], + "type": "Point" + }, + "properties": { + "area": "0", + "carrier": "AC", + "control": "PQ", + "country": "POTSDAM", + "maximumVoltage": "1.79769e+308", + "minimumVoltage": "0", + "name": "EXA 4", + "nominalVoltage": "380", + "shuntConductance": "0", + "shuntSusceptance": "0", + "status": "active", + "type": "unknown", + "voltageAngle": "0", + "voltageMagnitude": "1", + "xCoordinate": "13.0552", + "yCoordinate": "52.4001", + "zone": "0" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "EXA 5", - "type": "unknown", - "xCoordinate": "13.3951", - "yCoordinate": "52.5279", - "shuntConductance": "0", - "shuntSusceptance": "0", - "voltageMagnitude": "1", - "voltageAngle": "0", - "nominalVoltage": "380", - "maximumVoltage": "1.79769e+308", - "minimumVoltage": "0", - "country": "BERLIN", - "area": "0", - "zone": "0", - "control": "PQ", - "carrier": "AC", - "status": "active" - }, - "geometry": { - "type": "Point", - "coordinates": [13.3951,52.5279] - } + "geometry": { + "coordinates": [ + 13.3951, + 52.5279 + ], + "type": "Point" + }, + "properties": { + "area": "0", + "carrier": "AC", + "control": "PQ", + "country": "BERLIN", + "maximumVoltage": "1.79769e+308", + "minimumVoltage": "0", + "name": "EXA 5", + "nominalVoltage": "380", + "shuntConductance": "0", + "shuntSusceptance": "0", + "status": "active", + "type": "unknown", + "voltageAngle": "0", + "voltageMagnitude": "1", + "xCoordinate": "13.3951", + "yCoordinate": "52.5279", + "zone": "0" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "EXA 6", - "type": "unknown", - "xCoordinate": "10.0085", - "yCoordinate": "53.5599", - "shuntConductance": "0", - "shuntSusceptance": "0", - "voltageMagnitude": "1", - "voltageAngle": "0", - "nominalVoltage": "380", - "maximumVoltage": "1.79769e+308", - "minimumVoltage": "0", - "country": "HAMBURG", - "area": "0", - "zone": "0", - "control": "PQ", - "carrier": "AC", - "status": "active" - }, - "geometry": { - "type": "Point", - "coordinates": [10.0085,53.5599] - } + "geometry": { + "coordinates": [ + 10.0085, + 53.5599 + ], + "type": "Point" + }, + "properties": { + "area": "0", + "carrier": "AC", + "control": "PQ", + "country": "HAMBURG", + "maximumVoltage": "1.79769e+308", + "minimumVoltage": "0", + "name": "EXA 6", + "nominalVoltage": "380", + "shuntConductance": "0", + "shuntSusceptance": "0", + "status": "active", + "type": "unknown", + "voltageAngle": "0", + "voltageMagnitude": "1", + "xCoordinate": "10.0085", + "yCoordinate": "53.5599", + "zone": "0" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "EXA 7", - "type": "unknown", - "xCoordinate": "13.1287", - "yCoordinate": "54.3229", - "shuntConductance": "0", - "shuntSusceptance": "0", - "voltageMagnitude": "1", - "voltageAngle": "0", - "nominalVoltage": "380", - "maximumVoltage": "1.79769e+308", - "minimumVoltage": "0", - "country": "STRALSUND", - "area": "0", - "zone": "0", - "control": "PQ", - "carrier": "AC", - "status": "active" - }, - "geometry": { - "type": "Point", - "coordinates": [13.1287,54.3229] - } + "geometry": { + "coordinates": [ + 13.1287, + 54.3229 + ], + "type": "Point" + }, + "properties": { + "area": "0", + "carrier": "AC", + "control": "PQ", + "country": "STRALSUND", + "maximumVoltage": "1.79769e+308", + "minimumVoltage": "0", + "name": "EXA 7", + "nominalVoltage": "380", + "shuntConductance": "0", + "shuntSusceptance": "0", + "status": "active", + "type": "unknown", + "voltageAngle": "0", + "voltageMagnitude": "1", + "xCoordinate": "13.1287", + "yCoordinate": "54.3229", + "zone": "0" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "EXA 8", - "type": "unknown", - "xCoordinate": "13.233", - "yCoordinate": "53.5729", - "shuntConductance": "0", - "shuntSusceptance": "0", - "voltageMagnitude": "1", - "voltageAngle": "0", - "nominalVoltage": "380", - "maximumVoltage": "1.79769e+308", - "minimumVoltage": "0", - "country": "NEUBRANDENBURG", - "area": "0", - "zone": "0", - "control": "PQ", - "carrier": "AC", - "status": "active" - }, - "geometry": { - "type": "Point", - "coordinates": [13.233,53.5729] - } + "geometry": { + "coordinates": [ + 13.233, + 53.5729 + ], + "type": "Point" + }, + "properties": { + "area": "0", + "carrier": "AC", + "control": "PQ", + "country": "NEUBRANDENBURG", + "maximumVoltage": "1.79769e+308", + "minimumVoltage": "0", + "name": "EXA 8", + "nominalVoltage": "380", + "shuntConductance": "0", + "shuntSusceptance": "0", + "status": "active", + "type": "unknown", + "voltageAngle": "0", + "voltageMagnitude": "1", + "xCoordinate": "13.233", + "yCoordinate": "53.5729", + "zone": "0" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "EXA 9", - "type": "unknown", - "xCoordinate": "30.3223", - "yCoordinate": "59.955", - "shuntConductance": "0", - "shuntSusceptance": "0", - "voltageMagnitude": "1", - "voltageAngle": "0", - "nominalVoltage": "380", - "maximumVoltage": "1.79769e+308", - "minimumVoltage": "0", - "country": "SANKT PETERSBURG", - "area": "0", - "zone": "0", - "control": "PQ", - "carrier": "AC", - "status": "active" - }, - "geometry": { - "type": "Point", - "coordinates": [30.3223,59.955] - } + "geometry": { + "coordinates": [ + 30.3223, + 59.955 + ], + "type": "Point" + }, + "properties": { + "area": "0", + "carrier": "AC", + "control": "PQ", + "country": "SANKT PETERSBURG", + "maximumVoltage": "1.79769e+308", + "minimumVoltage": "0", + "name": "EXA 9", + "nominalVoltage": "380", + "shuntConductance": "0", + "shuntSusceptance": "0", + "status": "active", + "type": "unknown", + "voltageAngle": "0", + "voltageMagnitude": "1", + "xCoordinate": "30.3223", + "yCoordinate": "59.955", + "zone": "0" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "1", - "status": "1", - "type": "standard", - "minimumThetaBound": "-inf", - "maximumThetaBound": "inf", - "resistance": "20", - "reactance": "10", - "conductance": "0", - "susceptance": "-0.1", - "charge": "0", - "thermalLimitA": "0.7", - "thermalLimitB": "0", - "thermalLimitC": "0", - "tapRatio": "1", - "angleShift": "0", - "capitalCost": "2000", - "length": "100", - "numberOfParallelLines": "1", - "nominalApparentPower": "3000", - "nominalVoltage": "380", - "minimumNominalApparentPowerBound": "4000", - "maximumNominalApparentPowerBound": "8000", - "nominalApparentPowerExtendable": "0", - "terrainFactor": "0" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [8.59131,53.6251], - [13.1287,54.3229] - ] - } + "geometry": { + "coordinates": [ + [ + 8.59131, + 53.6251 + ], + [ + 13.1287, + 54.3229 + ] + ], + "type": "LineString" + }, + "properties": { + "angleShift": "0", + "capitalCost": "2000", + "charge": "0", + "conductance": "0", + "length": "100", + "maximumNominalApparentPowerBound": "8000", + "maximumThetaBound": "inf", + "minimumNominalApparentPowerBound": "4000", + "minimumThetaBound": "-inf", + "name": "1", + "nominalApparentPower": "3000", + "nominalApparentPowerExtendable": "0", + "nominalVoltage": "380", + "numberOfParallelLines": "1", + "reactance": "10", + "resistance": "20", + "status": "1", + "susceptance": "-0.1", + "tapRatio": "1", + "terrainFactor": "0", + "thermalLimitA": "0.7", + "thermalLimitB": "0", + "thermalLimitC": "0", + "type": "standard" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "2", - "status": "1", - "type": "standard", - "minimumThetaBound": "-inf", - "maximumThetaBound": "inf", - "resistance": "20", - "reactance": "10", - "conductance": "0", - "susceptance": "-0.1", - "charge": "0", - "thermalLimitA": "0.7", - "thermalLimitB": "0", - "thermalLimitC": "0", - "tapRatio": "1", - "angleShift": "0", - "capitalCost": "3000", - "length": "100", - "numberOfParallelLines": "2", - "nominalApparentPower": "4000", - "nominalVoltage": "380", - "minimumNominalApparentPowerBound": "4000", - "maximumNominalApparentPowerBound": "8000", - "nominalApparentPowerExtendable": "0", - "terrainFactor": "0" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [9.93542,51.5352], - [8.37433,49.0163] - ] - } + "geometry": { + "coordinates": [ + [ + 9.93542, + 51.5352 + ], + [ + 8.37433, + 49.0163 + ] + ], + "type": "LineString" + }, + "properties": { + "angleShift": "0", + "capitalCost": "3000", + "charge": "0", + "conductance": "0", + "length": "100", + "maximumNominalApparentPowerBound": "8000", + "maximumThetaBound": "inf", + "minimumNominalApparentPowerBound": "4000", + "minimumThetaBound": "-inf", + "name": "2", + "nominalApparentPower": "4000", + "nominalApparentPowerExtendable": "0", + "nominalVoltage": "380", + "numberOfParallelLines": "2", + "reactance": "10", + "resistance": "20", + "status": "1", + "susceptance": "-0.1", + "tapRatio": "1", + "terrainFactor": "0", + "thermalLimitA": "0.7", + "thermalLimitB": "0", + "thermalLimitC": "0", + "type": "standard" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "3", - "status": "1", - "type": "standard", - "minimumThetaBound": "-inf", - "maximumThetaBound": "inf", - "resistance": "20", - "reactance": "10", - "conductance": "0", - "susceptance": "-0.1", - "charge": "0", - "thermalLimitA": "0.7", - "thermalLimitB": "0", - "thermalLimitC": "0", - "tapRatio": "1", - "angleShift": "0", - "capitalCost": "4000", - "length": "100", - "numberOfParallelLines": "3", - "nominalApparentPower": "5000", - "nominalVoltage": "380", - "minimumNominalApparentPowerBound": "4000", - "maximumNominalApparentPowerBound": "8000", - "nominalApparentPowerExtendable": "0", - "terrainFactor": "0" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [9.93542,51.5352], - [13.0552,52.4001] - ] - } + "geometry": { + "coordinates": [ + [ + 9.93542, + 51.5352 + ], + [ + 13.0552, + 52.4001 + ] + ], + "type": "LineString" + }, + "properties": { + "angleShift": "0", + "capitalCost": "4000", + "charge": "0", + "conductance": "0", + "length": "100", + "maximumNominalApparentPowerBound": "8000", + "maximumThetaBound": "inf", + "minimumNominalApparentPowerBound": "4000", + "minimumThetaBound": "-inf", + "name": "3", + "nominalApparentPower": "5000", + "nominalApparentPowerExtendable": "0", + "nominalVoltage": "380", + "numberOfParallelLines": "3", + "reactance": "10", + "resistance": "20", + "status": "1", + "susceptance": "-0.1", + "tapRatio": "1", + "terrainFactor": "0", + "thermalLimitA": "0.7", + "thermalLimitB": "0", + "thermalLimitC": "0", + "type": "standard" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "4", - "status": "1", - "type": "standard", - "minimumThetaBound": "-inf", - "maximumThetaBound": "inf", - "resistance": "20", - "reactance": "10", - "conductance": "0", - "susceptance": "-0.1", - "charge": "0", - "thermalLimitA": "0.7", - "thermalLimitB": "0", - "thermalLimitC": "0", - "tapRatio": "1", - "angleShift": "0", - "capitalCost": "5000", - "length": "100", - "numberOfParallelLines": "4", - "nominalApparentPower": "6000", - "nominalVoltage": "380", - "minimumNominalApparentPowerBound": "4000", - "maximumNominalApparentPowerBound": "8000", - "nominalApparentPowerExtendable": "0", - "terrainFactor": "0" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [13.7357,51.0556], - [13.0552,52.4001] - ] - } + "geometry": { + "coordinates": [ + [ + 13.7357, + 51.0556 + ], + [ + 13.0552, + 52.4001 + ] + ], + "type": "LineString" + }, + "properties": { + "angleShift": "0", + "capitalCost": "5000", + "charge": "0", + "conductance": "0", + "length": "100", + "maximumNominalApparentPowerBound": "8000", + "maximumThetaBound": "inf", + "minimumNominalApparentPowerBound": "4000", + "minimumThetaBound": "-inf", + "name": "4", + "nominalApparentPower": "6000", + "nominalApparentPowerExtendable": "0", + "nominalVoltage": "380", + "numberOfParallelLines": "4", + "reactance": "10", + "resistance": "20", + "status": "1", + "susceptance": "-0.1", + "tapRatio": "1", + "terrainFactor": "0", + "thermalLimitA": "0.7", + "thermalLimitB": "0", + "thermalLimitC": "0", + "type": "standard" + }, + "type": "Feature" }, { - "type": "Feature", - "properties":{ - "name": "5", - "status": "1", - "type": "standard", - "minimumThetaBound": "-inf", - "maximumThetaBound": "inf", - "resistance": "20", - "reactance": "10", - "conductance": "0", - "susceptance": "-0.1", - "charge": "0", - "thermalLimitA": "0.7", - "thermalLimitB": "0", - "thermalLimitC": "0", - "tapRatio": "1", - "angleShift": "0", - "capitalCost": "6000", - "length": "100", - "numberOfParallelLines": "5", - "nominalApparentPower": "7000", - "nominalVoltage": "380", - "minimumNominalApparentPowerBound": "4000", - "maximumNominalApparentPowerBound": "8000", - "nominalApparentPowerExtendable": "0", - "terrainFactor": "0" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [13.0552,52.4001], - [13.233,53.5729] - ] - } - } -] + "geometry": { + "coordinates": [ + [ + 13.0552, + 52.4001 + ], + [ + 13.233, + 53.5729 + ] + ], + "type": "LineString" + }, + "properties": { + "angleShift": "0", + "capitalCost": "6000", + "charge": "0", + "conductance": "0", + "length": "100", + "maximumNominalApparentPowerBound": "8000", + "maximumThetaBound": "inf", + "minimumNominalApparentPowerBound": "4000", + "minimumThetaBound": "-inf", + "name": "5", + "nominalApparentPower": "7000", + "nominalApparentPowerExtendable": "0", + "nominalVoltage": "380", + "numberOfParallelLines": "5", + "reactance": "10", + "resistance": "20", + "status": "1", + "susceptance": "-0.1", + "tapRatio": "1", + "terrainFactor": "0", + "thermalLimitA": "0.7", + "thermalLimitB": "0", + "thermalLimitC": "0", + "type": "standard" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" } diff --git a/tests/Data/PowerGrids/PyPSAExample/generators-p_max_pu.csv b/tests/Data/PowerGrids/PyPSAExample/generators-p_max_pu.csv index 1cb60ae7..2c0d5933 100644 --- a/tests/Data/PowerGrids/PyPSAExample/generators-p_max_pu.csv +++ b/tests/Data/PowerGrids/PyPSAExample/generators-p_max_pu.csv @@ -8,4 +8,4 @@ name,EXA 0 onwind,EXA 0 solar,EXA 1 onwind,EXA 1 solar,EXA 2 onwind,EXA 2 solar, 2013-01-01 06:00:00,160,260,360,460,560,660,760,860,960,1060,1160,1260,1360,1460,1560,1660,1760,1860,1960,2060,2160,2260,2360 2013-01-01 07:00:00,170,270,370,470,570,670,770,870,970,1070,1170,1270,1370,1470,1570,1670,1770,1870,1970,2070,2170,2270,2370 2013-01-01 08:00:00,180,280,380,480,580,680,780,880,980,1080,1180,1280,1380,1480,1580,1680,1780,1880,1980,2080,2180,2280,2380 -2013-01-01 09:00:00,190,290,390,490,590,690,790,890,990,1090,1190,1290,1390,1490,1590,1690,1790,1890,1990,2090,2190,2290,2390 \ No newline at end of file +2013-01-01 09:00:00,190,290,390,490,590,690,790,890,990,1090,1190,1290,1390,1490,1590,1690,1790,1890,1990,2090,2190,2290,2390 diff --git a/tests/Data/PowerGrids/PyPSAExample/loads-p_set.csv b/tests/Data/PowerGrids/PyPSAExample/loads-p_set.csv index 10331a53..a2ce30ed 100644 --- a/tests/Data/PowerGrids/PyPSAExample/loads-p_set.csv +++ b/tests/Data/PowerGrids/PyPSAExample/loads-p_set.csv @@ -8,4 +8,4 @@ name,EXA 0,EXA 1,EXA 2,EXA 3,EXA 4,EXA 5,EXA 6,EXA 7,EXA 8,EXA 9 2013-01-01 06:00:00,160,161,162,163,164,165,166,167,168,169 2013-01-01 07:00:00,170,171,172,173,174,175,176,177,178,179 2013-01-01 08:00:00,180,181,182,183,184,185,186,187,188,189 -2013-01-01 09:00:00,190,191,192,193,194,195,196,197,198,199 \ No newline at end of file +2013-01-01 09:00:00,190,191,192,193,194,195,196,197,198,199 diff --git a/tests/Data/PowerGrids/PyPSAExample/storage_units-inflow.csv b/tests/Data/PowerGrids/PyPSAExample/storage_units-inflow.csv index e9b3fcef..a10e8214 100644 --- a/tests/Data/PowerGrids/PyPSAExample/storage_units-inflow.csv +++ b/tests/Data/PowerGrids/PyPSAExample/storage_units-inflow.csv @@ -8,4 +8,4 @@ name,EXA 1 hydro,EXA 2 hydro,EXA 4 hydro,EXA 8 hydro 2013-01-01 06:00:00,300,300,300,300 2013-01-01 07:00:00,200,200,200,200 2013-01-01 08:00:00,100,100,100,100 -2013-01-01 09:00:00,50,50,50,50 \ No newline at end of file +2013-01-01 09:00:00,50,50,50,50 diff --git a/tests/Data/PowerGrids/PyPSAExample/storage_units.csv b/tests/Data/PowerGrids/PyPSAExample/storage_units.csv index 6e59dc0b..ea4b4281 100644 --- a/tests/Data/PowerGrids/PyPSAExample/storage_units.csv +++ b/tests/Data/PowerGrids/PyPSAExample/storage_units.csv @@ -24,4 +24,4 @@ EXA 8 PHS,EXA 8,6.0,TRUE,36.0,0.8,-1.0,PHS,0.8,200000,FALSE EXA 8 battery,EXA 8,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE EXA 8 hydro,EXA 8,700,TRUE,111.22,0.0,0.0,hydro,0.0,0.0,FALSE EXA 9 H2,EXA 9,168.0,TRUE,0.0,0.6,-1.0,H2,0.6,200000,TRUE -EXA 9 battery,EXA 9,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE \ No newline at end of file +EXA 9 battery,EXA 9,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/generators-p_max_pu.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/generators-p_max_pu.csv index fe3cd6a6..8b4dab3f 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/generators-p_max_pu.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/generators-p_max_pu.csv @@ -8,4 +8,4 @@ name,EXA 0 onwind,EXA 0 solar,EXA 1 onwind,EXA 1 solar,EXA 2 onwind,EXA 2 solar, 2013-01-01 06:00:00,0.77,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.71,0.0 2013-01-01 07:00:00,0.88,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.81,0.0 2013-01-01 08:00:00,0.99,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.91,0.13 -2013-01-01 09:00:00,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.11,0.13 \ No newline at end of file +2013-01-01 09:00:00,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.11,0.13 diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/loads-p_set.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/loads-p_set.csv index 683ace40..b7dd5a1f 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/loads-p_set.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/loads-p_set.csv @@ -8,4 +8,4 @@ name,EXA 0,EXA 1,EXA 2,EXA 3,EXA 4,EXA 5,EXA 6,EXA 7,EXA 8,EXA 9 2013-01-01 06:00:00,300,300,300,300,300,300,300,300,300,300 2013-01-01 07:00:00,200,200,200,200,200,200,200,200,200,200 2013-01-01 08:00:00,100,100,100,100,100,100,100,100,100,100 -2013-01-01 09:00:00,50,50,50,50,50,50,50,50,50,50 \ No newline at end of file +2013-01-01 09:00:00,50,50,50,50,50,50,50,50,50,50 diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/storage_units-inflow.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/storage_units-inflow.csv index e9b3fcef..a10e8214 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/storage_units-inflow.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/storage_units-inflow.csv @@ -8,4 +8,4 @@ name,EXA 1 hydro,EXA 2 hydro,EXA 4 hydro,EXA 8 hydro 2013-01-01 06:00:00,300,300,300,300 2013-01-01 07:00:00,200,200,200,200 2013-01-01 08:00:00,100,100,100,100 -2013-01-01 09:00:00,50,50,50,50 \ No newline at end of file +2013-01-01 09:00:00,50,50,50,50 diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/storage_units.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/storage_units.csv index 6e59dc0b..ea4b4281 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/storage_units.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames/storage_units.csv @@ -24,4 +24,4 @@ EXA 8 PHS,EXA 8,6.0,TRUE,36.0,0.8,-1.0,PHS,0.8,200000,FALSE EXA 8 battery,EXA 8,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE EXA 8 hydro,EXA 8,700,TRUE,111.22,0.0,0.0,hydro,0.0,0.0,FALSE EXA 9 H2,EXA 9,168.0,TRUE,0.0,0.6,-1.0,H2,0.6,200000,TRUE -EXA 9 battery,EXA 9,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE \ No newline at end of file +EXA 9 battery,EXA 9,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/generators-p_max_pu.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/generators-p_max_pu.csv index fe3cd6a6..8b4dab3f 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/generators-p_max_pu.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/generators-p_max_pu.csv @@ -8,4 +8,4 @@ name,EXA 0 onwind,EXA 0 solar,EXA 1 onwind,EXA 1 solar,EXA 2 onwind,EXA 2 solar, 2013-01-01 06:00:00,0.77,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.71,0.0 2013-01-01 07:00:00,0.88,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.81,0.0 2013-01-01 08:00:00,0.99,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.91,0.13 -2013-01-01 09:00:00,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.11,0.13 \ No newline at end of file +2013-01-01 09:00:00,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.11,0.13 diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/loads-p_set.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/loads-p_set.csv index 102c8845..9e07136e 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/loads-p_set.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/loads-p_set.csv @@ -5,4 +5,4 @@ name,EXA 0,EXA 1,EXA 2,EXA 3,EXA 4,EXA 5,EXA 6,EXA 7,EXA 8,EXA 9 2013-01-01 03:00:00,600,600,600,600,600,600,600,600,600,600 2013-01-01 04:00:00,500,500,500,500,500,500,500,500,500,500 2013-01-01 05:00:00,400,400,400,400,400,400,400,400,400,400 -2013-01-01 06:00:00,300,300,300,300,300,300,300,300,300,300 \ No newline at end of file +2013-01-01 06:00:00,300,300,300,300,300,300,300,300,300,300 diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/storage_units-inflow.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/storage_units-inflow.csv index e9b3fcef..a10e8214 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/storage_units-inflow.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/storage_units-inflow.csv @@ -8,4 +8,4 @@ name,EXA 1 hydro,EXA 2 hydro,EXA 4 hydro,EXA 8 hydro 2013-01-01 06:00:00,300,300,300,300 2013-01-01 07:00:00,200,200,200,200 2013-01-01 08:00:00,100,100,100,100 -2013-01-01 09:00:00,50,50,50,50 \ No newline at end of file +2013-01-01 09:00:00,50,50,50,50 diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/storage_units.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/storage_units.csv index 6e59dc0b..ea4b4281 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/storage_units.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators/storage_units.csv @@ -24,4 +24,4 @@ EXA 8 PHS,EXA 8,6.0,TRUE,36.0,0.8,-1.0,PHS,0.8,200000,FALSE EXA 8 battery,EXA 8,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE EXA 8 hydro,EXA 8,700,TRUE,111.22,0.0,0.0,hydro,0.0,0.0,FALSE EXA 9 H2,EXA 9,168.0,TRUE,0.0,0.6,-1.0,H2,0.6,200000,TRUE -EXA 9 battery,EXA 9,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE \ No newline at end of file +EXA 9 battery,EXA 9,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/generators-p_max_pu.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/generators-p_max_pu.csv index a6733e0b..19b6eb88 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/generators-p_max_pu.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/generators-p_max_pu.csv @@ -8,4 +8,4 @@ name,EXA 0 onwind,EXA 0 solar,EXA 1 onwind,EXA 1 solar,EXA 2 onwind,EXA 2 solar, 2013-01-01 06:00:00,0.77,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0,0.71,0.0 2013-01-01 07:00:00,0.88,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0,0.81,0.0 2013-01-01 08:00:00,0.99,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13,0.91,0.13 -2013-01-01 09:00:00,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13 \ No newline at end of file +2013-01-01 09:00:00,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13,0.11,0.13 diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/generators.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/generators.csv index ca5569d2..875b6153 100755 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/generators.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/generators.csv @@ -18,4 +18,4 @@ EXA 7 solar,EXA 7,1700000,solar,1.0,15,100.0,TRUE,1000.0,,100.0 EXA 8 onwind,EXA 8,2000000,onwind,1.0,15,100.0,TRUE,1000.0,,100.0 EXA 8 solar,EXA 8,2100000,solar,1.0,15,100.0,TRUE,1000.0,,100.0 EXA 9 onwind,EXA 9,2400000,onwind,1.0,15,100.0,TRUE,1000.0,,100.0 -EXA 9 solar,EXA 9,2300000,solar,1.0,15,100.0,TRUE,1000.0,,100.0 \ No newline at end of file +EXA 9 solar,EXA 9,2300000,solar,1.0,15,100.0,TRUE,1000.0,,100.0 diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/loads-p_set.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/loads-p_set.csv index 102c8845..9e07136e 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/loads-p_set.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/loads-p_set.csv @@ -5,4 +5,4 @@ name,EXA 0,EXA 1,EXA 2,EXA 3,EXA 4,EXA 5,EXA 6,EXA 7,EXA 8,EXA 9 2013-01-01 03:00:00,600,600,600,600,600,600,600,600,600,600 2013-01-01 04:00:00,500,500,500,500,500,500,500,500,500,500 2013-01-01 05:00:00,400,400,400,400,400,400,400,400,400,400 -2013-01-01 06:00:00,300,300,300,300,300,300,300,300,300,300 \ No newline at end of file +2013-01-01 06:00:00,300,300,300,300,300,300,300,300,300,300 diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/storage_units-inflow.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/storage_units-inflow.csv index e9b3fcef..a10e8214 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/storage_units-inflow.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/storage_units-inflow.csv @@ -8,4 +8,4 @@ name,EXA 1 hydro,EXA 2 hydro,EXA 4 hydro,EXA 8 hydro 2013-01-01 06:00:00,300,300,300,300 2013-01-01 07:00:00,200,200,200,200 2013-01-01 08:00:00,100,100,100,100 -2013-01-01 09:00:00,50,50,50,50 \ No newline at end of file +2013-01-01 09:00:00,50,50,50,50 diff --git a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/storage_units.csv b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/storage_units.csv index 6e59dc0b..ea4b4281 100644 --- a/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/storage_units.csv +++ b/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength/storage_units.csv @@ -24,4 +24,4 @@ EXA 8 PHS,EXA 8,6.0,TRUE,36.0,0.8,-1.0,PHS,0.8,200000,FALSE EXA 8 battery,EXA 8,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE EXA 8 hydro,EXA 8,700,TRUE,111.22,0.0,0.0,hydro,0.0,0.0,FALSE EXA 9 H2,EXA 9,168.0,TRUE,0.0,0.6,-1.0,H2,0.6,200000,TRUE -EXA 9 battery,EXA 9,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE \ No newline at end of file +EXA 9 battery,EXA 9,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE diff --git a/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/generators-p_max_pu.csv b/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/generators-p_max_pu.csv index 1cb60ae7..2c0d5933 100644 --- a/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/generators-p_max_pu.csv +++ b/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/generators-p_max_pu.csv @@ -8,4 +8,4 @@ name,EXA 0 onwind,EXA 0 solar,EXA 1 onwind,EXA 1 solar,EXA 2 onwind,EXA 2 solar, 2013-01-01 06:00:00,160,260,360,460,560,660,760,860,960,1060,1160,1260,1360,1460,1560,1660,1760,1860,1960,2060,2160,2260,2360 2013-01-01 07:00:00,170,270,370,470,570,670,770,870,970,1070,1170,1270,1370,1470,1570,1670,1770,1870,1970,2070,2170,2270,2370 2013-01-01 08:00:00,180,280,380,480,580,680,780,880,980,1080,1180,1280,1380,1480,1580,1680,1780,1880,1980,2080,2180,2280,2380 -2013-01-01 09:00:00,190,290,390,490,590,690,790,890,990,1090,1190,1290,1390,1490,1590,1690,1790,1890,1990,2090,2190,2290,2390 \ No newline at end of file +2013-01-01 09:00:00,190,290,390,490,590,690,790,890,990,1090,1190,1290,1390,1490,1590,1690,1790,1890,1990,2090,2190,2290,2390 diff --git a/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/loads-p_set.csv b/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/loads-p_set.csv index 10331a53..a2ce30ed 100644 --- a/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/loads-p_set.csv +++ b/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/loads-p_set.csv @@ -8,4 +8,4 @@ name,EXA 0,EXA 1,EXA 2,EXA 3,EXA 4,EXA 5,EXA 6,EXA 7,EXA 8,EXA 9 2013-01-01 06:00:00,160,161,162,163,164,165,166,167,168,169 2013-01-01 07:00:00,170,171,172,173,174,175,176,177,178,179 2013-01-01 08:00:00,180,181,182,183,184,185,186,187,188,189 -2013-01-01 09:00:00,190,191,192,193,194,195,196,197,198,199 \ No newline at end of file +2013-01-01 09:00:00,190,191,192,193,194,195,196,197,198,199 diff --git a/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/storage_units-inflow.csv b/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/storage_units-inflow.csv index e9b3fcef..a10e8214 100644 --- a/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/storage_units-inflow.csv +++ b/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/storage_units-inflow.csv @@ -8,4 +8,4 @@ name,EXA 1 hydro,EXA 2 hydro,EXA 4 hydro,EXA 8 hydro 2013-01-01 06:00:00,300,300,300,300 2013-01-01 07:00:00,200,200,200,200 2013-01-01 08:00:00,100,100,100,100 -2013-01-01 09:00:00,50,50,50,50 \ No newline at end of file +2013-01-01 09:00:00,50,50,50,50 diff --git a/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/storage_units.csv b/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/storage_units.csv index 6e59dc0b..ea4b4281 100644 --- a/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/storage_units.csv +++ b/tests/Data/PowerGrids/PyPSAExampleGeoJsonWriter/storage_units.csv @@ -24,4 +24,4 @@ EXA 8 PHS,EXA 8,6.0,TRUE,36.0,0.8,-1.0,PHS,0.8,200000,FALSE EXA 8 battery,EXA 8,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE EXA 8 hydro,EXA 8,700,TRUE,111.22,0.0,0.0,hydro,0.0,0.0,FALSE EXA 9 H2,EXA 9,168.0,TRUE,0.0,0.6,-1.0,H2,0.6,200000,TRUE -EXA 9 battery,EXA 9,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE \ No newline at end of file +EXA 9 battery,EXA 9,6.0,TRUE,0.0,0.9,-1.0,battery,0.9,200000,TRUE diff --git a/tests/Data/PowerGrids/ieee_2013_Felsner_Rectangle-and-Square-Representations-of-Planar-Graphs.m b/tests/Data/PowerGrids/ieee_2013_Felsner_Rectangle-and-Square-Representations-of-Planar-Graphs.m index c5092a87..bed91081 100644 --- a/tests/Data/PowerGrids/ieee_2013_Felsner_Rectangle-and-Square-Representations-of-Planar-Graphs.m +++ b/tests/Data/PowerGrids/ieee_2013_Felsner_Rectangle-and-Square-Representations-of-Planar-Graphs.m @@ -28,7 +28,7 @@ % % see [Figure 4b; Section 5; Grastien et al., 2018] % or slide 20 in https://i11www.iti.kit.edu/_media/members/franziska_wegner/2018-07-18_franziska-wegner_energieinformatik_teil13_vl2_the-maximum-transmission-switching-flow-problem.pdf -% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function mpc = mtsf_case4_fig4_a diff --git a/tests/Data/PowerGrids/ieee_2018_acm_eEnergy_MTSF_Figure4a.m b/tests/Data/PowerGrids/ieee_2018_acm_eEnergy_MTSF_Figure4a.m index 8870e368..dc94838b 100644 --- a/tests/Data/PowerGrids/ieee_2018_acm_eEnergy_MTSF_Figure4a.m +++ b/tests/Data/PowerGrids/ieee_2018_acm_eEnergy_MTSF_Figure4a.m @@ -28,7 +28,7 @@ % % see [Figure 4a; Section 5; Grastien et al., 2018] % or slide 20 in https://i11www.iti.kit.edu/_media/members/franziska_wegner/2018-07-18_franziska-wegner_energieinformatik_teil13_vl2_the-maximum-transmission-switching-flow-problem.pdf -% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function mpc = mtsf_case4_fig4_a diff --git a/tests/Data/PowerGrids/ieee_2018_acm_eEnergy_MTSF_Figure4b.m b/tests/Data/PowerGrids/ieee_2018_acm_eEnergy_MTSF_Figure4b.m index 19634383..ab472468 100644 --- a/tests/Data/PowerGrids/ieee_2018_acm_eEnergy_MTSF_Figure4b.m +++ b/tests/Data/PowerGrids/ieee_2018_acm_eEnergy_MTSF_Figure4b.m @@ -28,7 +28,7 @@ % % see [Figure 4b; Section 5; Grastien et al., 2018] % or slide 20 in https://i11www.iti.kit.edu/_media/members/franziska_wegner/2018-07-18_franziska-wegner_energieinformatik_teil13_vl2_the-maximum-transmission-switching-flow-problem.pdf -% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function mpc = mtsf_case4_fig4_a diff --git a/tests/DataStructures/Container/TestBinaryHeap.cpp b/tests/DataStructures/Container/TestBinaryHeap.cpp index 3c0151c8..f738c7f0 100644 --- a/tests/DataStructures/Container/TestBinaryHeap.cpp +++ b/tests/DataStructures/Container/TestBinaryHeap.cpp @@ -42,20 +42,20 @@ TEST_F( TestBinaryHeap, ///@Name Basic Functionalities ///@{ TEST_F ( TestBinaryHeapWithZeroElements - , BasicFunctionalityIsEmptyWhenCreated ) + , BasicFunctionalityIsEmptyWhenCreated ) { ASSERT_TRUE( heapConst_.Empty() ); } TEST_F ( TestBinaryHeapWithZeroElements - , BasicFunctionalityHasSizeOfZero ) + , BasicFunctionalityHasSizeOfZero ) { ASSERT_EQ( heapConst_.Size(), 0 ); } #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBinaryHeapWithZeroElementsDeathTest - , BasicFunctionalityCheckTopElementDeathTest ) + , BasicFunctionalityCheckTopElementDeathTest ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -66,7 +66,7 @@ TEST_F( TestBinaryHeap, #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBinaryHeapWithZeroElements - , BasicFunctionalityCheckTopElementExceptionHandling ) + , BasicFunctionalityCheckTopElementExceptionHandling ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -77,7 +77,7 @@ TEST_F( TestBinaryHeap, } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -85,7 +85,7 @@ TEST_F( TestBinaryHeap, #endif // ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBinaryHeapWithZeroElements - , BasicFunctionalityRemoveAllElements ) + , BasicFunctionalityRemoveAllElements ) { heap_.Clear(); ASSERT_EQ( heap_.Size(), 0 ); @@ -93,7 +93,7 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , BasicFunctionalitySearchForNonExistentElementWhileHeapIsEmpty ) + , BasicFunctionalitySearchForNonExistentElementWhileHeapIsEmpty ) { EXPECT_EQ( heap_.Search(4), Const::NONE ); } @@ -102,14 +102,14 @@ TEST_F( TestBinaryHeap, ///@Name Comparison check ///@{ TEST_F ( TestBinaryHeapWithZeroElements - , EqualityCheckUsingFunctionWithNotIdenticalSuccess ) + , EqualityCheckUsingFunctionWithNotIdenticalSuccess ) { TBinaryHeap heapIdentical; EXPECT_TRUE( heap_.IsEqualTo(heapIdentical) ); } TEST_F ( TestBinaryHeapWithZeroElements - , EqualityCheckUsingFunctionWithNotIdenticalFail ) + , EqualityCheckUsingFunctionWithNotIdenticalFail ) { TBinaryHeap heapIdentical; heapIdentical.Emplace(99); @@ -119,7 +119,7 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , EqualityCheckUsingOperatorSuccess ) + , EqualityCheckUsingOperatorSuccess ) { TBinaryHeap heapIdentical; EXPECT_TRUE( ( heap_ == heapIdentical ) ); @@ -127,7 +127,7 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , EqualityCheckUsingOperatorFail ) + , EqualityCheckUsingOperatorFail ) { TBinaryHeap heapIdentical; heapIdentical.Emplace(99); @@ -139,14 +139,14 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , EqualityCheckUsingFunctionWithIdenticalSuccess ) + , EqualityCheckUsingFunctionWithIdenticalSuccess ) { TBinaryHeap heapIdentical; EXPECT_TRUE( heap_.IsEqualTo(heapIdentical) ); } TEST_F ( TestBinaryHeapWithZeroElements - , EqualityCheckUsingFunctionWithIdenticalFail ) + , EqualityCheckUsingFunctionWithIdenticalFail ) { TBinaryHeap heapIdentical; heapIdentical.Emplace(99); @@ -159,9 +159,9 @@ TEST_F( TestBinaryHeap, ///@Name Add element check ///@{ TEST_F ( TestBinaryHeapWithZeroElements - , OperatorAddElementZero ) + , OperatorAddElementZero ) { - TElement i = 0; + TElement i = 0; heap_ += i; EXPECT_EQ( heap_.Size(), 1 ); @@ -169,7 +169,7 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , OperatorAddElementOneUsingMoverInsertion ) + , OperatorAddElementOneUsingMoverInsertion ) { heap_ += 1; // == heap_ += std::move(1); @@ -178,9 +178,9 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , AddElementUsingEmplace ) + , AddElementUsingEmplace ) { - heap_.Emplace(99); + heap_.Emplace(99); EXPECT_EQ( heap_.Size(), 1 ); EXPECT_EQ( heap_.Top(), 99 ); @@ -190,9 +190,9 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , AddElementUsingInsert ) + , AddElementUsingInsert ) { - heap_.Insert(99); + heap_.Insert(99); EXPECT_EQ( heap_.Size(), 1 ); EXPECT_EQ( heap_.Top(), 99 ); @@ -202,7 +202,7 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , BuildHeapWithEmptyVector ) + , BuildHeapWithEmptyVector ) { TVector emptyElementVector; heap_.BuildWith ( emptyElementVector ); @@ -216,21 +216,21 @@ TEST_F( TestBinaryHeap, ///@{ #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBinaryHeapWithZeroElementsDeathTest - , DecreaseKeyDeathTest ) + , DecreaseKeyDeathTest ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "DecreaseKey" , "index < Size\\(\\)" ); - + TElement p = -1; - ASSERT_DEATH( {heap_.DecreaseKey(0, p);}, assertionString ); + ASSERT_DEATH( {heap_.DecreaseKey(0, p);}, assertionString ); } #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBinaryHeapWithZeroElements - , DecreaseKeyExceptionHandling ) + , DecreaseKeyExceptionHandling ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -243,7 +243,7 @@ TEST_F( TestBinaryHeap, } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -252,34 +252,34 @@ TEST_F( TestBinaryHeap, #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBinaryHeapWithZeroElementsDeathTest - , ChangeKeyDeathTest ) + , ChangeKeyDeathTest ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "ChangeKey" , "index < Size\\(\\)"); - + TElement p = -1; - ASSERT_DEATH( {heap_.ChangeKey(0, p);}, assertionString ); + ASSERT_DEATH( {heap_.ChangeKey(0, p);}, assertionString ); } #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBinaryHeapWithZeroElements - , ChangeKeyExceptionHandling ) + , ChangeKeyExceptionHandling ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "ChangeKey" , "index < Size\\(\\)"); TElement p = -1; - + try { heap_.ChangeKey(0, p); } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -290,13 +290,13 @@ TEST_F( TestBinaryHeap, ///@Name Change comparator ///@{ TEST_F ( TestBinaryHeapWithZeroElements - , ComparatorChangeToLess ) - { + , ComparatorChangeToLess ) + { heap_.Comparator( []( TElement a, TElement b ) { return a < b; } ); EXPECT_EQ ( heap_.Size(), 0 ); EXPECT_TRUE ( heap_.Empty() ); - + heap_.Emplace(1); EXPECT_EQ ( heap_.Size(), 1 ); @@ -310,13 +310,13 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , ComparatorChangeToGreater ) - { + , ComparatorChangeToGreater ) + { heap_.Comparator([]( TElement a, TElement b ) { return a > b; }); EXPECT_EQ ( heap_.Size(), 0 ); EXPECT_TRUE ( heap_.Empty() ); - + heap_.Emplace(55); EXPECT_EQ ( heap_.Size(), 1 ); @@ -334,7 +334,7 @@ TEST_F( TestBinaryHeap, ///@{ #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBinaryHeapWithZeroElementsDeathTest - , RemoveElementUsingPopDeathTest ) + , RemoveElementUsingPopDeathTest ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -345,7 +345,7 @@ TEST_F( TestBinaryHeap, #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBinaryHeapWithZeroElements - , RemoveElementUsingPopExceptionHandling ) + , RemoveElementUsingPopExceptionHandling ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -356,7 +356,7 @@ TEST_F( TestBinaryHeap, } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -365,7 +365,7 @@ TEST_F( TestBinaryHeap, #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBinaryHeapWithZeroElementsDeathTest - , RemoveElementUsingDeleteMinDeathTest ) + , RemoveElementUsingDeleteMinDeathTest ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -377,7 +377,7 @@ TEST_F( TestBinaryHeap, #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBinaryHeapWithZeroElements - , RemoveElementUsingDeleteMinExceptionHandling ) + , RemoveElementUsingDeleteMinExceptionHandling ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -388,7 +388,7 @@ TEST_F( TestBinaryHeap, } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -396,7 +396,7 @@ TEST_F( TestBinaryHeap, #endif // ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBinaryHeapWithZeroElements - , ClearHeap ) + , ClearHeap ) { EXPECT_TRUE( heap_.Empty() ); heap_.Clear(); @@ -404,10 +404,10 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , SwapEmptyHeaps ) + , SwapEmptyHeaps ) { TBinaryHeap heapForSwapping; - + EXPECT_TRUE( heap_.Empty() ); EXPECT_TRUE( heapForSwapping.Empty() ); @@ -425,15 +425,15 @@ TEST_F( TestBinaryHeap, ///@Name Check iterators ///@{ TEST_F ( TestBinaryHeapWithZeroElements - , OutputStream ) + , OutputStream ) { - std::ostringstream os; + std::ostringstream os; os << heap_; EXPECT_EQ( os.str(), "" ); } TEST_F ( TestBinaryHeapWithZeroElements - , HeapIteratorWithOstream ) + , HeapIteratorWithOstream ) { std::ostringstream os; std::copy( heap_.begin(), heap_.end(), std::ostream_iterator( os , "|" ) ); @@ -442,14 +442,14 @@ TEST_F( TestBinaryHeap, // @todo std::copy does not work // TEST_F ( TestBinaryHeapWithZeroElements - // , HeapIteratorCopy ) + // , HeapIteratorCopy ) // { // TBinaryHeap heapForCopy; // std::copy( heap_.Begin(), heap_.End(), heapForCopy ); // } TEST_F ( TestBinaryHeapWithZeroElements - , IteratorSerialForAllElements ) + , IteratorSerialForAllElements ) { heap_.for_all_elements ( []( TElement & element ) { EXPECT_FALSE ( true ); @@ -457,7 +457,7 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , IteratorParallelForAllElements ) + , IteratorParallelForAllElements ) { heap_.for_all_elements ( []( TElement & element ) { EXPECT_FALSE ( true ); @@ -465,7 +465,7 @@ TEST_F( TestBinaryHeap, } TEST_F ( TestBinaryHeapWithZeroElements - , IteratorBreakableForAllElements ) + , IteratorBreakableForAllElements ) { heap_.for_all_elements ( []( TElement & element ) -> bool { EXPECT_FALSE ( true ); @@ -477,19 +477,19 @@ TEST_F( TestBinaryHeap, #pragma mark TEST_BINARY_HEAP_WITH_ONE_INT_ELEMENT TEST_F ( TestBinaryHeapWithOneIntegerElement - , IsNoLongerEmpty ) + , IsNoLongerEmpty ) { ASSERT_FALSE( heap_.Empty() ); } TEST_F ( TestBinaryHeapWithOneIntegerElement - , HasSizeOfOne ) + , HasSizeOfOne ) { ASSERT_THAT( heap_.Size(), Eq(1) ); } TEST_F ( TestBinaryHeapWithOneIntegerElement - , CheckTopElement ) + , CheckTopElement ) { ASSERT_EQ( heap_.Top(), 99 ); } @@ -533,38 +533,38 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, ///@Name Basic Functionalities ///@{ TEST_F ( TestBinaryHeapWithVectorOfInteger - , BasicFunctionalityIsNoLongerEmpty ) + , BasicFunctionalityIsNoLongerEmpty ) { ASSERT_FALSE( heap_.Empty() ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , BasicFunctionalityHasSizeOfSeven ) + , BasicFunctionalityHasSizeOfSeven ) { ASSERT_THAT( heap_.Size(), Eq(7) ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , BasicFunctionalityCheckTopElement ) + , BasicFunctionalityCheckTopElement ) { EXPECT_EQ( heap_.Top(), 1 ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , BasicFunctionalitySearchForElementFour ) + , BasicFunctionalitySearchForElementFour ) { EXPECT_EQ( heap_.Search(4), 5 ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , BasicFunctionalitySwitchToMaxHeapAndCheckTop ) + , BasicFunctionalitySwitchToMaxHeapAndCheckTop ) { heap_.Maximize(); EXPECT_EQ( heap_.Top(), 55 ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , BasicFunctionalitySwitchToMinHeapAndCheckTop ) + , BasicFunctionalitySwitchToMinHeapAndCheckTop ) { heap_.Minimize(); EXPECT_EQ( heap_.Top(), 1 ); @@ -580,68 +580,68 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, ///@Name Comparison check ///@{ TEST_F ( TestBinaryHeapWithVectorOfInteger - , EqualityCheckUsingFunctionWithNotIdenticalSuccess ) + , EqualityCheckUsingFunctionWithNotIdenticalSuccess ) { TBinaryHeap heapIdentical; TVector intVector = { 1, 2, 4, 5, 9, 23, 55}; heapIdentical.BuildWith(intVector); - + EXPECT_TRUE ( heap_.IsEqualTo(heapIdentical) ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , EqualityCheckUsingFunctionWithNotIdenticalFail ) + , EqualityCheckUsingFunctionWithNotIdenticalFail ) { TBinaryHeap heapIdentical; TVector intVector = { 1, 3, 4, 5, 9, 23, 55}; heapIdentical.BuildWith(intVector); - + EXPECT_FALSE ( heap_.IsEqualTo(heapIdentical) ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , EqualityCheckUsingOperatorSuccess ) + , EqualityCheckUsingOperatorSuccess ) { TBinaryHeap heapIdentical; TVector intVector = { 1, 2, 4, 5, 9, 23, 55}; heapIdentical.BuildWith(intVector); - + EXPECT_TRUE ( ( heap_ == heapIdentical ) ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , EqualityCheckUsingOperatorFail ) + , EqualityCheckUsingOperatorFail ) { TBinaryHeap heapIdentical; TVector intVector = { 1, 2, 4, 5, 55, 23, 55}; heapIdentical.BuildWith(intVector); - + EXPECT_FALSE ( ( heap_ == heapIdentical ) ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , EqualityCheckUsingFunctionWithIdenticalSuccess ) + , EqualityCheckUsingFunctionWithIdenticalSuccess ) { TBinaryHeap heapIdentical; TVector intVector = { 5, 9, 23, 55, 1, 4, 2}; heapIdentical.BuildWith(intVector); - + EXPECT_TRUE ( heap_.IsEqualTo(heapIdentical) ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , EqualityCheckUsingFunctionWithIdenticalFail ) + , EqualityCheckUsingFunctionWithIdenticalFail ) { TBinaryHeap heapIdentical; TVector intVector = { 1, 2, 4, 5, 55, 23, 55}; heapIdentical.BuildWith(intVector); - + EXPECT_FALSE ( heap_.IsEqualTo(heapIdentical) ); } ///@} @@ -649,9 +649,9 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, ///@Name Add element check ///@{ TEST_F ( TestBinaryHeapWithVectorOfInteger - , AddElementUsingOperator ) + , AddElementUsingOperator ) { - TElement i = 0; + TElement i = 0; heap_ += i; EXPECT_EQ( heap_.Size(), 8 ); @@ -660,7 +660,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, } TEST_F ( TestBinaryHeapWithVectorOfInteger - , AddElementUsingMoverOperator ) + , AddElementUsingMoverOperator ) { heap_ += 1; // == heap_ += std::move(1); @@ -669,9 +669,9 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, } TEST_F ( TestBinaryHeapWithVectorOfInteger - , AddElementUsingEmplace ) + , AddElementUsingEmplace ) { - heap_.Emplace(99); + heap_.Emplace(99); EXPECT_EQ( heap_.Size(), 8 ); EXPECT_EQ( heap_.Top(), 1 ); @@ -681,9 +681,9 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, } TEST_F ( TestBinaryHeapWithVectorOfInteger - , AddElementUsingInsert ) + , AddElementUsingInsert ) { - heap_.Insert(99); + heap_.Insert(99); EXPECT_EQ( heap_.Size(), 8 ); EXPECT_EQ( heap_.Top(), 1 ); @@ -700,7 +700,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, { TElement p = -1; // Decrease key of element with key 23 at position 6 to element with key -1 - heap_.DecreaseKey(6, p); + heap_.DecreaseKey(6, p); EXPECT_EQ( heap_.Size(), 7 ); EXPECT_EQ( heap_.Top(), -1 ); @@ -725,7 +725,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBinaryHeapWithZeroElements - , DecreaseKeyInvalidIndexExceptionHandling ) + , DecreaseKeyInvalidIndexExceptionHandling ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -736,7 +736,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -748,7 +748,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, { TElement p = -1; // Decrease key of element with key 23 at position 6 to element with key -1 - heap_.ChangeKey(6, p); + heap_.ChangeKey(6, p); EXPECT_EQ( heap_.Size(), 7 ); EXPECT_EQ( heap_.Top(), -1 ); @@ -761,7 +761,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, { TElement p = 42; // Decrease key of element with key 23 at position 6 to element with key 42 - heap_.ChangeKey(6, p); + heap_.ChangeKey(6, p); EXPECT_EQ( heap_.Size(), 7 ); ExpectContent(heap_, {1, 2, 4, 5, 9, 42, 55}); @@ -772,7 +772,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, { TElement p = 42; // Decrease key of element with key 1 at position 0 to element with key 42 - heap_.ChangeKey(0, p); + heap_.ChangeKey(0, p); EXPECT_EQ( heap_.Size(), 7 ); ExpectContent(heap_, {2, 4, 5, 9, 23, 42, 55}); @@ -783,7 +783,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, , ChangeKeyInvalidIndex) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" - , "BinaryHeap" + , "BinaryHeap" , "ChangeKey" , "index < Size\\(\\)"); @@ -792,10 +792,10 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBinaryHeapWithZeroElements - , ChangeKeyInvalidIndexExceptionHandling ) + , ChangeKeyInvalidIndexExceptionHandling ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" - , "BinaryHeap" + , "BinaryHeap" , "ChangeKey" , "index < Size\\(\\)"); try { @@ -803,7 +803,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -814,7 +814,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, ///@Name Change comparator ///@{ TEST_F ( TestBinaryHeapWithVectorOfInteger - , ComparatorChangeToLess ) + , ComparatorChangeToLess ) { heap_.Comparator([]( TElement a, TElement b ) { return a < b; }); @@ -828,7 +828,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, } TEST_F ( TestBinaryHeapWithVectorOfInteger - , ComparatorChangeToGreater ) + , ComparatorChangeToGreater ) { heap_.Comparator([]( TElement a, TElement b ) { return a > b; }); @@ -845,7 +845,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, ///@Name Remove elements ///@{ TEST_F ( TestBinaryHeapWithVectorOfInteger - , RemoveElementUsingPop ) + , RemoveElementUsingPop ) { heap_.Minimize(); heap_.Pop(); @@ -855,11 +855,11 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, heap_.Pop(); EXPECT_EQ( heap_.Size(), 5 ); - EXPECT_EQ( heap_.Top(), 4 ); + EXPECT_EQ( heap_.Top(), 4 ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , RemoveElementUsingDeleteMin ) + , RemoveElementUsingDeleteMin ) { EXPECT_EQ( heap_.DeleteTop(), 1 ); EXPECT_EQ( heap_.DeleteTop(), 2 ); @@ -869,14 +869,14 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, } TEST_F ( TestBinaryHeapWithVectorOfInteger - , RemoveElementUsingClearHeap ) + , RemoveElementUsingClearHeap ) { heap_.Clear(); EXPECT_TRUE( heap_.Empty() ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , SwapHeaps ) + , SwapHeaps ) { TBinaryHeap heapForSwapping; TBinaryHeap heapForComparison; @@ -905,15 +905,15 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, ///@Name Check iterators ///@{ TEST_F ( TestBinaryHeapWithVectorOfInteger - , HeapIteratorOutputStream ) + , HeapIteratorOutputStream ) { - std::ostringstream os; + std::ostringstream os; os << heap_; EXPECT_EQ( os.str(), "1|5|2|55|9|4|23|" ); } TEST_F ( TestBinaryHeapWithVectorOfInteger - , HeapIteratorWithOstream ) + , HeapIteratorWithOstream ) { std::ostringstream os; std::copy( heap_.begin(), heap_.end(), std::ostream_iterator( os , "|" ) ); @@ -941,7 +941,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, // @todo std::copy does not work // TEST_F ( TestBinaryHeapWithVectorOfInteger - // , HeapIteratorCopy ) + // , HeapIteratorCopy ) // { // egoa::BinaryHeap heapForCopy; // std::copy( heap_.begin(), heap_.end(), heapForCopy ); @@ -971,7 +971,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, } TEST_F ( TestBinaryHeapWithVectorOfInteger - , IteratorParallelForAllElements ) + , IteratorParallelForAllElements ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md @@ -1014,13 +1014,13 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, } TEST_F ( TestBinaryHeapWithVectorOfInteger - , IteratorBreakableForAllElements ) + , IteratorBreakableForAllElements ) { TVector intVector = { 1, 5, 2, 55, 9, 4, 23 }; Types::count counter = 0; heap_.for_all_elements ( [&counter,&intVector]( TElement & element ) -> bool { EXPECT_EQ( element, intVector[counter] ); - if ( 9 == intVector[counter] ) { + if ( 9 == intVector[counter] ) { return false; // break } ++counter; @@ -1107,4 +1107,4 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, /// @} -} // namespace egoa::test \ No newline at end of file +} // namespace egoa::test diff --git a/tests/DataStructures/Container/TestBinaryHeap.hpp b/tests/DataStructures/Container/TestBinaryHeap.hpp index 13bcdc0d..0ef59806 100644 --- a/tests/DataStructures/Container/TestBinaryHeap.hpp +++ b/tests/DataStructures/Container/TestBinaryHeap.hpp @@ -27,7 +27,7 @@ class TestBinaryHeap : public ::testing::Test { using TVector = std::vector; void ExpectContent ( TBinaryHeap heap - , std::vector const & elements) + , std::vector const & elements) { for ( auto e : elements ) { ASSERT_FALSE ( heap.Empty() ); @@ -62,7 +62,7 @@ class TestBinaryHeapWithOneIntegerElement : public TestBinaryHeap { TestBinaryHeapWithOneIntegerElement(){} virtual ~TestBinaryHeapWithOneIntegerElement(){} - virtual void SetUp() override + virtual void SetUp() override { TElement element = 99; heap_.Emplace(element); @@ -77,7 +77,7 @@ class TestBinaryHeapWithVectorOfInteger : public TestBinaryHeap { TestBinaryHeapWithVectorOfInteger(){} virtual ~TestBinaryHeapWithVectorOfInteger(){} - virtual void SetUp() override + virtual void SetUp() override { TVector elements = { 5, 9, 23, 55, 1, 4, 2}; heap_.BuildWith ( elements ); @@ -90,7 +90,7 @@ class TestHeapIterator : public TestBinaryHeap { protected: std::vector elements_; - void SetUp() override + void SetUp() override { elements_ = {4, 5, 8, 32, 432, 3, 7}; heap_.BuildWith(elements_); diff --git a/tests/DataStructures/Container/TestBucket.cpp b/tests/DataStructures/Container/TestBucket.cpp index b8a7fa74..7ba899cc 100644 --- a/tests/DataStructures/Container/TestBucket.cpp +++ b/tests/DataStructures/Container/TestBucket.cpp @@ -20,20 +20,20 @@ namespace egoa::test { // *********************************************************************** // *********************************************************************** TEST_F ( TestBucketWithZeroElements - , IsEmptyWhenCreated ) + , IsEmptyWhenCreated ) { ASSERT_TRUE( bucket_.Empty() ); } TEST_F ( TestBucketWithZeroElements - , HasSizeOfZero ) + , HasSizeOfZero ) { ASSERT_THAT( bucket_.Size(), Eq(0) ); } #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElementsDeathTest - , CheckTopElementDeathTest ) + , CheckTopElementDeathTest ) { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" @@ -44,7 +44,7 @@ namespace egoa::test { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithZeroElements - , CheckTopElementExceptionHandling ) + , CheckTopElementExceptionHandling ) { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" @@ -52,24 +52,24 @@ namespace egoa::test { , "!EmptyQueue\\(\\)"); try { bucket_.Top(); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING #endif // ifdef EGOA_ENABLE_ASSERTION - -///@Name Compare two empty buckets with <, >, <=, >= ... + +///@Name Compare two empty buckets with <, >, <=, >= ... ///@todo Check what happens if processed elements are empty but not unprocessed elements, can this even happening? ///@{ #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElementsDeathTest - , CompareTwoEmptyBucketsLhsSmallerRhsDeathTest ) + , CompareTwoEmptyBucketsLhsSmallerRhsDeathTest ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" @@ -81,7 +81,7 @@ namespace egoa::test { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithZeroElements - , CompareTwoEmptyBucketsLhsSmallerRhsExceptionHandling ) + , CompareTwoEmptyBucketsLhsSmallerRhsExceptionHandling ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" @@ -90,12 +90,12 @@ namespace egoa::test { , "!EmptyQueue\\(\\)"); try { auto test = bucket_ < bucketToCompare_; - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -104,11 +104,11 @@ namespace egoa::test { #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElementsDeathTest - , CompareTwoEmptyBucketsLhsSmallerEqualRhsDeathTest ) + , CompareTwoEmptyBucketsLhsSmallerEqualRhsDeathTest ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "operator.*<=" , "!EmptyQueue\\(\\)"); ASSERT_DEATH ( { auto test = bucket_ <= bucketToCompare_;}, assertionString ); @@ -116,21 +116,21 @@ namespace egoa::test { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithZeroElements - , CompareTwoEmptyBucketsLhsSmallerEqualRhsExceptionHandling ) + , CompareTwoEmptyBucketsLhsSmallerEqualRhsExceptionHandling ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "operator.*<=" , "!EmptyQueue\\(\\)"); try { auto test = bucket_ <= bucketToCompare_; - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -139,7 +139,7 @@ namespace egoa::test { #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElementsDeathTest - , CompareTwoEmptyBucketsLhsGreaterRhsDeathTest ) + , CompareTwoEmptyBucketsLhsGreaterRhsDeathTest ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" @@ -151,7 +151,7 @@ namespace egoa::test { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithZeroElements - , CompareTwoEmptyBucketsLhsGreaterRhsExceptionHandling ) + , CompareTwoEmptyBucketsLhsGreaterRhsExceptionHandling ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" @@ -160,12 +160,12 @@ namespace egoa::test { , "!EmptyQueue\\(\\)"); try { auto test = bucket_ > bucketToCompare_; - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -174,7 +174,7 @@ namespace egoa::test { #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElementsDeathTest - , CompareTwoEmptyBucketsLhsGreaterEqualRhsDeathTest ) + , CompareTwoEmptyBucketsLhsGreaterEqualRhsDeathTest ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" @@ -186,7 +186,7 @@ namespace egoa::test { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithZeroElements - , CompareTwoEmptyBucketsLhsGreaterEqualRhsExceptionHandling ) + , CompareTwoEmptyBucketsLhsGreaterEqualRhsExceptionHandling ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" @@ -195,12 +195,12 @@ namespace egoa::test { , "!EmptyQueue\\(\\)"); try { auto test = bucket_ >= bucketToCompare_; - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -210,10 +210,10 @@ namespace egoa::test { // Merge an element into an empty bucket TEST_F ( TestBucketWithZeroElements - , MergeAnElementIntoEmptyBucket ) + , MergeAnElementIntoEmptyBucket ) { TElement element = TElement(2,false); - + ASSERT_EQ ( bucket_.Size(), 0 ); ASSERT_TRUE ( bucket_.Merge( element ) ); ASSERT_TRUE ( element.Valid() ); @@ -244,10 +244,10 @@ TEST_F ( TestBucketWithZeroElements ///@Name Check Domination ///@{ TEST_F ( TestBucketWithZeroElements - , DominationCheckStrictDominationOfToElements ) + , DominationCheckStrictDominationOfToElements ) { TElement element = TElement(2,false); - + ASSERT_EQ ( bucket_.Size(), 0 ); ASSERT_TRUE ( bucket_.Merge( element ) ); ASSERT_TRUE ( element.Valid() ); @@ -255,10 +255,10 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , DominationCheckWeakDominationOfToElements ) + , DominationCheckWeakDominationOfToElements ) { TElement element = TElement(2,false); - + ASSERT_EQ ( bucket_.Size(), 0 ); ASSERT_TRUE ( bucket_.Merge( element ) ); ASSERT_TRUE ( element.Valid() ); @@ -266,10 +266,10 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , DominationCheckNoneDominationOfToElements ) + , DominationCheckNoneDominationOfToElements ) { TElement element = TElement(2,false); - + ASSERT_EQ ( bucket_.Size(), 0 ); ASSERT_TRUE ( bucket_.Merge( element ) ); ASSERT_TRUE ( element.Valid() ); @@ -280,7 +280,7 @@ TEST_F ( TestBucketWithZeroElements ///@Name Access elements ///@{ TEST_F ( TestBucketWithZeroElements - , AccessElementHasElementAt ) + , AccessElementHasElementAt ) { ASSERT_FALSE ( bucket_.HasElementAt(0) ); ASSERT_FALSE ( bucket_.HasElementAt(1) ); @@ -289,10 +289,10 @@ TEST_F ( TestBucketWithZeroElements #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElementsDeathTest - , AccessElementElementAtDeathTest ) + , AccessElementElementAtDeathTest ) { auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "ElementAt" , "HasElementAt\\(index\\)"); ASSERT_DEATH ( {bucket_.ElementAt(0);}, assertionString ); @@ -302,34 +302,34 @@ TEST_F ( TestBucketWithZeroElements #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithZeroElements - , AccessElementElementAtExceptionHandling ) + , AccessElementElementAtExceptionHandling ) { auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "ElementAt" , "HasElementAt\\(index\\)"); try { try { bucket_.ElementAt(0); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } try { bucket_.ElementAt(1); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } try { bucket_.ElementAt(-1); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -338,10 +338,10 @@ TEST_F ( TestBucketWithZeroElements #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElementsDeathTest - , AccessElementWithBracketOperatorDeathTest ) + , AccessElementWithBracketOperatorDeathTest ) { auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "operator.*\\[\\]" , "HasElementAt\\(index\\)"); ASSERT_DEATH ( {bucket_[0];}, assertionString ); @@ -390,10 +390,10 @@ TEST_F ( TestBucketWithZeroElements ///@{ #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElementsDeathTest - , AccessElementTopDeathTest ) + , AccessElementTopDeathTest ) { auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "Top" , "!EmptyQueue\\(\\)"); EXPECT_TRUE ( bucket_.EmptyQueue() ); @@ -402,21 +402,21 @@ TEST_F ( TestBucketWithZeroElements #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithZeroElements - , AccessElementTopExceptionHandling ) + , AccessElementTopExceptionHandling ) { auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "Top" , "!EmptyQueue\\(\\)"); EXPECT_TRUE ( bucket_.EmptyQueue() ); try { bucket_.Top(); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -424,7 +424,7 @@ TEST_F ( TestBucketWithZeroElements #endif // ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElements - , AccessElementOptima ) + , AccessElementOptima ) { bucket_.Optima();; } @@ -434,7 +434,7 @@ TEST_F ( TestBucketWithZeroElements ///@{ #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElementsDeathTest - , RemoveElementUsingPopDeathTest ) + , RemoveElementUsingPopDeathTest ) { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" @@ -445,7 +445,7 @@ TEST_F ( TestBucketWithZeroElements #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithZeroElements - , RemoveElementUsingPopExceptionHandling ) + , RemoveElementUsingPopExceptionHandling ) { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" @@ -453,12 +453,12 @@ TEST_F ( TestBucketWithZeroElements , "!EmptyQueue\\(\\)" ); try { bucket_.Pop(); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -467,31 +467,31 @@ TEST_F ( TestBucketWithZeroElements #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElementsDeathTest - , RemoveElementUsingDeleteMinDeathTest ) + , RemoveElementUsingDeleteMinDeathTest ) { auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" - , "DeleteTop" + , "Bucket" + , "DeleteTop" , "!EmptyQueue\\(\\)" ); ASSERT_DEATH ( {bucket_.DeleteTop();}, assertionString ); } #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithZeroElements - , RemoveElementUsingDeleteMinExceptionHandling ) + , RemoveElementUsingDeleteMinExceptionHandling ) { auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" - , "DeleteTop" + , "Bucket" + , "DeleteTop" , "!EmptyQueue\\(\\)" ); try { bucket_.DeleteTop(); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -499,7 +499,7 @@ TEST_F ( TestBucketWithZeroElements #endif // ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithZeroElements - , RemoveElementAll ) + , RemoveElementAll ) { bucket_.Clear(); EXPECT_EQ ( bucket_.Size(), 0 ); @@ -510,19 +510,19 @@ TEST_F ( TestBucketWithZeroElements ///@Name Empty ///@{ TEST_F ( TestBucketWithZeroElements - , EmptyIsEmpty ) + , EmptyIsEmpty ) { EXPECT_TRUE ( bucket_.Empty() ); } TEST_F ( TestBucketWithZeroElements - , EmptyHasEmptyQueue ) + , EmptyHasEmptyQueue ) { EXPECT_TRUE ( bucket_.EmptyQueue() ); } TEST_F ( TestBucketWithZeroElements - , EmptyIsSizeZero ) + , EmptyIsSizeZero ) { EXPECT_EQ ( bucket_.Size(), 0 ); EXPECT_TRUE ( bucket_.EmptyQueue() ); @@ -533,10 +533,10 @@ TEST_F ( TestBucketWithZeroElements ///@Name Iterators ///@{ TEST_F ( TestBucketWithZeroElements - , IteratorSerialForAllElements ) + , IteratorSerialForAllElements ) { - bucket_.for_all_elements ( - []( TElement & element ) + bucket_.for_all_elements ( + []( TElement & element ) { EXPECT_FALSE ( true ); } @@ -544,10 +544,10 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , IteratorParallelForAllElements ) + , IteratorParallelForAllElements ) { - bucket_.for_all_elements ( - []( TElement & element ) + bucket_.for_all_elements ( + []( TElement & element ) { EXPECT_FALSE ( true ); } @@ -555,10 +555,10 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , IteratorBreakableForAllElements ) + , IteratorBreakableForAllElements ) { - bucket_.for_all_elements ( - []( TElement & element ) -> bool + bucket_.for_all_elements ( + []( TElement & element ) -> bool { EXPECT_FALSE ( true ); return true; @@ -567,10 +567,10 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , IteratorSerialForAllProcessedElements ) + , IteratorSerialForAllProcessedElements ) { - bucket_.for_all_processed_elements ( - []( TElement & element ) + bucket_.for_all_processed_elements ( + []( TElement & element ) { EXPECT_FALSE ( true ); } @@ -578,10 +578,10 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , IteratorParallelForAllProcessedElements ) + , IteratorParallelForAllProcessedElements ) { - bucket_.for_all_processed_elements ( - []( TElement & element ) + bucket_.for_all_processed_elements ( + []( TElement & element ) { EXPECT_FALSE ( true ); } @@ -589,10 +589,10 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , IteratorBreakableForAllProcessedElements ) + , IteratorBreakableForAllProcessedElements ) { - bucket_.for_all_processed_elements ( - []( TElement & element ) -> bool + bucket_.for_all_processed_elements ( + []( TElement & element ) -> bool { EXPECT_FALSE ( true ); return true; @@ -601,10 +601,10 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , IteratorSerialForAllUnprocessedElements ) + , IteratorSerialForAllUnprocessedElements ) { - bucket_.for_all_unprocessed_elements ( - []( TElement & element ) + bucket_.for_all_unprocessed_elements ( + []( TElement & element ) { EXPECT_FALSE ( true ); } @@ -612,10 +612,10 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , IteratorParallelForAllUnprocessedElements ) + , IteratorParallelForAllUnprocessedElements ) { - bucket_.for_all_processed_elements ( - []( TElement & element ) + bucket_.for_all_processed_elements ( + []( TElement & element ) { EXPECT_FALSE ( true ); } @@ -623,10 +623,10 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , IteratorBreakableForAllUnprocessedElements ) + , IteratorBreakableForAllUnprocessedElements ) { - bucket_.for_all_processed_elements ( - []( TElement & element ) -> bool + bucket_.for_all_processed_elements ( + []( TElement & element ) -> bool { EXPECT_FALSE ( true ); return true; @@ -635,14 +635,14 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , IteratorSerialForAllOptima ) + , IteratorSerialForAllOptima ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md ::testing::FLAGS_gtest_death_test_style = "threadsafe"; bucket_.for_all_optima ( - []( TElement const & element ) + []( TElement const & element ) { FAIL(); } @@ -650,14 +650,14 @@ TEST_F ( TestBucketWithZeroElements } TEST_F ( TestBucketWithZeroElements - , IteratorParallelForAllOptima ) + , IteratorParallelForAllOptima ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md ::testing::FLAGS_gtest_death_test_style = "threadsafe"; bucket_.for_all_optima ( - []( TElement const & element ) + []( TElement const & element ) { EXPECT_FALSE ( true ); } @@ -672,20 +672,20 @@ TEST_F ( TestBucketWithZeroElements #pragma mark Bucket with vector of int elements // *********************************************************************** // *********************************************************************** -///@Name Compare two empty buckets with <, >, <=, >= ... +///@Name Compare two empty buckets with <, >, <=, >= ... ///@todo Check what happens if processed elements are empty but not unprocessed elements, can this even happening? ///@{ #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithMultipleIntegerDeathTest - , CompareTwoBucketsWhereOneIsEmptyLhsSmallerRhsDeathTest ) + , CompareTwoBucketsWhereOneIsEmptyLhsSmallerRhsDeathTest ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md ::testing::FLAGS_gtest_death_test_style = "threadsafe"; - + TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "operator.*<" , "!rhs.EmptyQueue\\(\\)" ); ASSERT_DEATH ( { auto test = bucket_ < bucketToCompare_;}, assertionString ); @@ -693,21 +693,21 @@ TEST_F ( TestBucketWithZeroElements #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithMultipleInteger - , CompareTwoBucketsWhereOneIsEmptyLhsSmallerRhsExceptionHandling ) + , CompareTwoBucketsWhereOneIsEmptyLhsSmallerRhsExceptionHandling ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "operator.*<" , "!rhs.EmptyQueue\\(\\)" ); try { auto test = bucket_ < bucketToCompare_; - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -716,7 +716,7 @@ TEST_F ( TestBucketWithZeroElements #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithMultipleIntegerDeathTest - , CompareTwoEmptyBucketsLhsSmallerEqualRhsDeathTest ) + , CompareTwoEmptyBucketsLhsSmallerEqualRhsDeathTest ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md @@ -724,7 +724,7 @@ TEST_F ( TestBucketWithZeroElements TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "operator.*<=" , "!rhs.EmptyQueue\\(\\)" ); ASSERT_DEATH ( { auto test = bucket_ <= bucketToCompare_;}, assertionString ); @@ -732,11 +732,11 @@ TEST_F ( TestBucketWithZeroElements #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithMultipleInteger - , CompareTwoEmptyBucketsLhsSmallerEqualRhsExceptionHandling ) + , CompareTwoEmptyBucketsLhsSmallerEqualRhsExceptionHandling ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "operator.*<=" , "!rhs.EmptyQueue\\(\\)" ); try { @@ -744,7 +744,7 @@ TEST_F ( TestBucketWithZeroElements } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -753,7 +753,7 @@ TEST_F ( TestBucketWithZeroElements #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithMultipleIntegerDeathTest - , CompareTwoEmptyBucketsLhsGreaterRhsDeathTest ) + , CompareTwoEmptyBucketsLhsGreaterRhsDeathTest ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md @@ -762,7 +762,7 @@ TEST_F ( TestBucketWithZeroElements TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" - , "operator.*>" + , "operator.*>" , "!rhs.EmptyQueue\\(\\)" ); ASSERT_DEATH ( { auto test = bucket_ > bucketToCompare_;} , assertionString ); @@ -770,21 +770,21 @@ TEST_F ( TestBucketWithZeroElements #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithMultipleInteger - , CompareTwoEmptyBucketsLhsGreaterRhsExceptionHandling ) + , CompareTwoEmptyBucketsLhsGreaterRhsExceptionHandling ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" - , "operator.*>" + , "operator.*>" , "!rhs.EmptyQueue\\(\\)" ); try { auto test = bucket_ > bucketToCompare_; - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -793,7 +793,7 @@ TEST_F ( TestBucketWithZeroElements #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithMultipleIntegerDeathTest - , CompareTwoEmptyBucketsLhsGreaterEqualRhsDeathTest ) + , CompareTwoEmptyBucketsLhsGreaterEqualRhsDeathTest ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md @@ -811,7 +811,7 @@ TEST_F ( TestBucketWithZeroElements #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithMultipleInteger - , CompareTwoEmptyBucketsLhsGreaterEqualRhsExceptionHandling ) + , CompareTwoEmptyBucketsLhsGreaterEqualRhsExceptionHandling ) { TBucket bucketToCompare_; auto assertionString = buildAssertionString ( "Bucket.hpp" @@ -820,12 +820,12 @@ TEST_F ( TestBucketWithZeroElements , "!rhs.EmptyQueue\\(\\)"); try { auto test = bucket_ >= bucketToCompare_; - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -835,11 +835,11 @@ TEST_F ( TestBucketWithZeroElements // Merge an element into an empty bucket TEST_F ( TestBucketWithMultipleInteger - , MergeANewElementIntoTheBucketStdMergeCorrespondsToDominatesWeakly ) + , MergeANewElementIntoTheBucketStdMergeCorrespondsToDominatesWeakly ) { TElement elementDominated = TElement ( 2, false ); TElement elementMergable = TElement ( 0, false ); - + ASSERT_EQ ( bucket_.Size(), 1 ); ASSERT_FALSE ( bucket_.Merge( elementDominated ) ); @@ -854,11 +854,11 @@ TEST_F ( TestBucketWithMultipleInteger ///@Name Check Domination ///@{ TEST_F ( TestBucketWithMultipleInteger - , DominationCheckStrictDominationOfToElements ) + , DominationCheckStrictDominationOfToElements ) { TElement elementNotMergable = TElement ( 2, false ); TElement elementMergable = TElement ( 1, false ); - + ASSERT_EQ ( bucket_.Size(), 1 ); ASSERT_FALSE( bucket_.Merge( elementNotMergable ) ); ASSERT_FALSE( elementNotMergable.Valid() ); @@ -869,11 +869,11 @@ TEST_F ( TestBucketWithMultipleInteger } TEST_F ( TestBucketWithMultipleInteger - , DominationCheckWeakDominationOfToElements ) + , DominationCheckWeakDominationOfToElements ) { TElement elementNotMergable = TElement ( 1, false ); TElement elementMergable = TElement ( 0, false ); - + ASSERT_EQ ( bucket_.Size(), 1 ); ASSERT_FALSE ( bucket_.Merge( elementNotMergable ) ); ASSERT_FALSE ( elementNotMergable.Valid() ); @@ -884,10 +884,10 @@ TEST_F ( TestBucketWithMultipleInteger } TEST_F ( TestBucketWithMultipleInteger - , DominationCheckNoneDominationOfToElements ) + , DominationCheckNoneDominationOfToElements ) { TElement element = TElement ( 99, false ); - + ASSERT_EQ ( bucket_.Size(), 1 ); ASSERT_TRUE ( bucket_.Merge( element ) ); ASSERT_TRUE ( element.Valid() ); @@ -898,7 +898,7 @@ TEST_F ( TestBucketWithMultipleInteger ///@Name Access elements ///@{ TEST_F ( TestBucketWithMultipleInteger - , AccessElementHasElementAt ) + , AccessElementHasElementAt ) { ASSERT_FALSE ( bucket_.HasElementAt(0) ); ASSERT_FALSE ( bucket_.HasElementAt(-1) ); @@ -909,7 +909,7 @@ TEST_F ( TestBucketWithMultipleInteger #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithMultipleIntegerDeathTest - , AccessElementElementAtDeathTest ) + , AccessElementElementAtDeathTest ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md @@ -940,7 +940,7 @@ TEST_F ( TestBucketWithMultipleInteger #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithMultipleInteger - , AccessElementElementAtExceptionHandling ) + , AccessElementElementAtExceptionHandling ) { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" @@ -949,19 +949,19 @@ TEST_F ( TestBucketWithMultipleInteger try { try { bucket_.ElementAt(0); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } try { bucket_.ElementAt(1); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } try { bucket_.ElementAt(-1); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } @@ -999,7 +999,7 @@ TEST_F ( TestBucketWithMultipleInteger // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md ::testing::FLAGS_gtest_death_test_style = "threadsafe"; - + auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*\\[\\]" @@ -1050,27 +1050,27 @@ TEST_F ( TestBucketWithMultipleInteger ///@Name Access bucket's top element ///@{ TEST_F ( TestBucketWithMultipleInteger - , AccessElementTop ) + , AccessElementTop ) { EXPECT_FALSE ( bucket_.EmptyQueue() ); EXPECT_EQ ( bucket_.Top(), 1 ); } TEST_F ( TestBucketWithMultipleInteger - , AccessElementOptima ) + , AccessElementOptima ) { - TElement element1 ( 1 ); - TElement element2 ( 1 ); + TElement element1 ( 1 ); + TElement element2 ( 1 ); bucket_.Merge( element1 ); bucket_.Merge( element2 ); std::vector optima = bucket_.Optima(); ASSERT_EQ ( 3, optima.size() ); - + for ( Types::count counter = 0 ; counter < optima.size() - ; ++counter ) + ; ++counter ) { ASSERT_EQ ( optima[counter], 1 ); } @@ -1081,22 +1081,22 @@ TEST_F ( TestBucketWithMultipleInteger ///@{ #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithMultipleIntegerDeathTest - , RemoveElementUsingPopDeathTest ) + , RemoveElementUsingPopDeathTest ) { bucket_.Pop(); ASSERT_TRUE ( bucket_.HasElementAt(0) ); ASSERT_EQ ( 1, bucket_.HasElementAt(0) ); - + ASSERT_TRUE ( bucket_.EmptyQueue() ); auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "Pop" , "!EmptyQueue\\(\\)" ); ASSERT_DEATH ( {bucket_.Pop();}, assertionString ); - bucket_.template for_all_processed_elements( - []( TElement const & element ) + bucket_.template for_all_processed_elements( + []( TElement const & element ) { ASSERT_TRUE ( element.Valid() ); } @@ -1105,31 +1105,31 @@ TEST_F ( TestBucketWithMultipleInteger #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithMultipleInteger - , RemoveElementUsingPopExceptionHandling ) + , RemoveElementUsingPopExceptionHandling ) { bucket_.Pop(); ASSERT_TRUE ( bucket_.HasElementAt(0) ); ASSERT_EQ ( 1, bucket_.HasElementAt(0) ); - + ASSERT_TRUE ( bucket_.EmptyQueue() ); auto assertionString = buildAssertionString ( "Bucket.hpp" - , "Bucket" + , "Bucket" , "Pop" , "!EmptyQueue\\(\\)" ); try { bucket_.Pop(); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } - bucket_.template for_all_processed_elements( - []( TElement const & element ) + bucket_.template for_all_processed_elements( + []( TElement const & element ) { ASSERT_TRUE ( element.Valid() ); } @@ -1140,7 +1140,7 @@ TEST_F ( TestBucketWithMultipleInteger #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithMultipleIntegerDeathTest - , RemoveElementUsingDeleteMinDeathTest ) + , RemoveElementUsingDeleteMinDeathTest ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md @@ -1160,8 +1160,8 @@ TEST_F ( TestBucketWithMultipleInteger , "!EmptyQueue\\(\\)" ); ASSERT_DEATH ( {bucket_.DeleteTop();}, assertionString ); - bucket_.template for_all_processed_elements( - []( TElement const & element ) + bucket_.template for_all_processed_elements( + []( TElement const & element ) { ASSERT_TRUE ( element.Valid() ); } @@ -1170,7 +1170,7 @@ TEST_F ( TestBucketWithMultipleInteger #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestBucketWithMultipleInteger - , RemoveElementUsingDeleteMinExceptionHandling ) + , RemoveElementUsingDeleteMinExceptionHandling ) { auto tuple = bucket_.DeleteTop(); TElement element = std::get<0>(tuple); @@ -1186,17 +1186,17 @@ TEST_F ( TestBucketWithMultipleInteger , "!EmptyQueue\\(\\)" ); try { bucket_.DeleteTop(); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } - bucket_.template for_all_processed_elements( - []( TElement const & element ) + bucket_.template for_all_processed_elements( + []( TElement const & element ) { ASSERT_TRUE ( element.Valid() ); } @@ -1206,7 +1206,7 @@ TEST_F ( TestBucketWithMultipleInteger #endif // ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestBucketWithMultipleInteger - , RemoveElementAll ) + , RemoveElementAll ) { bucket_.Clear(); EXPECT_EQ ( bucket_.Size(), 0 ); @@ -1214,7 +1214,7 @@ TEST_F ( TestBucketWithMultipleInteger } TEST_F ( TestBucketWithMultipleInteger - , RemoveElementAllWithPrecedingPop ) + , RemoveElementAllWithPrecedingPop ) { bucket_.Pop(); bucket_.Clear(); @@ -1226,19 +1226,19 @@ TEST_F ( TestBucketWithMultipleInteger ///@Name Empty and size check ///@{ TEST_F ( TestBucketWithMultipleInteger - , IsEmpty ) + , IsEmpty ) { EXPECT_FALSE ( bucket_.Empty() ); } TEST_F ( TestBucketWithMultipleInteger - , HasEmptyQueue ) + , HasEmptyQueue ) { EXPECT_FALSE ( bucket_.EmptyQueue() ); } TEST_F ( TestBucketWithMultipleInteger - , HaseCorrectSize ) + , HaseCorrectSize ) { EXPECT_EQ ( bucket_.Size(), 1 ); } @@ -1247,10 +1247,10 @@ TEST_F ( TestBucketWithMultipleInteger ///@Name Iterators ///@{ TEST_F ( TestBucketWithMultipleInteger - , IteratorSerialForAllElements ) + , IteratorSerialForAllElements ) { // Starting with a bunch of unprocessed elements - std::vector const verificationVectorWithoutProcessedItems = + std::vector const verificationVectorWithoutProcessedItems = { TElement(1,true) , TElement(5,false) , TElement(2,false) @@ -1259,9 +1259,9 @@ TEST_F ( TestBucketWithMultipleInteger , TElement(23,false) , TElement(4,false) }; Types::count counter = 0; - bucket_.template for_all_elements ( + bucket_.template for_all_elements ( [ & verificationVectorWithoutProcessedItems - , & counter ]( TElement const & element ) + , & counter ]( TElement const & element ) { EXPECT_EQ ( element, verificationVectorWithoutProcessedItems[counter] ); EXPECT_EQ ( element.Valid(), verificationVectorWithoutProcessedItems[counter].Valid() ); @@ -1270,9 +1270,9 @@ TEST_F ( TestBucketWithMultipleInteger ); counter = 0; - bucketConst_.template for_all_elements ( + bucketConst_.template for_all_elements ( [ & verificationVectorWithoutProcessedItems - , & counter ]( TElement const & element ) + , & counter ]( TElement const & element ) { EXPECT_EQ ( element, verificationVectorWithoutProcessedItems[counter] ); EXPECT_EQ ( element.Valid(), verificationVectorWithoutProcessedItems[counter].Valid() ); @@ -1282,17 +1282,17 @@ TEST_F ( TestBucketWithMultipleInteger // After this pop only processed items are available as all unprocessed items are not valid, meaning here one element bucket_.Pop(); - bucket_.template for_all_elements ( - []( TElement const & element ) + bucket_.template for_all_elements ( + []( TElement const & element ) { EXPECT_EQ ( element, 1 ); EXPECT_EQ ( element.Valid(), true ); } ); - + // Const call - bucketConst_.template for_all_elements ( - []( TElement const & element ) + bucketConst_.template for_all_elements ( + []( TElement const & element ) { EXPECT_EQ ( element, 1 ); EXPECT_EQ ( element.Valid(), true ); @@ -1302,7 +1302,7 @@ TEST_F ( TestBucketWithMultipleInteger // @todo same as in BinaryHeap: (Q1) Can we test more, (Q2) refactoring TEST_F ( TestBucketWithMultipleInteger - , IteratorParallelForAllElements ) + , IteratorParallelForAllElements ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md @@ -1316,26 +1316,26 @@ TEST_F ( TestBucketWithMultipleInteger std::vector numberOfElements ( numberOfThreads, 0 ); std::vector< std::vector > elementsLoopedOver ( numberOfThreads , std::vector() ); - bucket_.for_all_elements ( + bucket_.for_all_elements ( [ & numberOfThreads , & numberOfElements - , & elementsLoopedOver ]( TElement & element ) + , & elementsLoopedOver ]( TElement & element ) { ++numberOfElements[ omp_get_thread_num() ]; elementsLoopedOver[ omp_get_thread_num() ].emplace_back ( element ); } ); ParallelIteratorCheck ( {1}, numberOfElements, elementsLoopedOver ); - + // Const loop check numberOfElements.clear(); elementsLoopedOver.clear(); numberOfElements.resize ( numberOfThreads, 0 ); elementsLoopedOver.resize ( numberOfThreads, std::vector() ); - bucketConst_.for_all_elements ( + bucketConst_.for_all_elements ( [ & numberOfThreads , & numberOfElements - , & elementsLoopedOver ]( TElement const & element ) + , & elementsLoopedOver ]( TElement const & element ) { ++numberOfElements[ omp_get_thread_num() ]; elementsLoopedOver[ omp_get_thread_num() ].emplace_back ( element ); @@ -1347,16 +1347,16 @@ TEST_F ( TestBucketWithMultipleInteger //@todo Refactoring concerning duplicated calls for const and non-const iterator tests TEST_F ( TestBucketWithMultipleInteger - , IteratorBreakableForAllElements ) + , IteratorBreakableForAllElements ) { // Starting with a bunch of unprocessed elements - std::vector const verificationVectorWithoutProcessedItems = + std::vector const verificationVectorWithoutProcessedItems = { TElement(1,true) }; // Test non-const iterator Types::count counter = 0; - bucket_.for_all_unprocessed_elements ( + bucket_.for_all_unprocessed_elements ( [ & verificationVectorWithoutProcessedItems - , & counter]( TElement & element ) -> bool + , & counter]( TElement & element ) -> bool { EXPECT_EQ( element, verificationVectorWithoutProcessedItems[counter] ); ++counter; @@ -1367,9 +1367,9 @@ TEST_F ( TestBucketWithMultipleInteger // Test non-const iterator counter = 0; - bucketConst_.for_all_unprocessed_elements ( + bucketConst_.for_all_unprocessed_elements ( [ & verificationVectorWithoutProcessedItems - , & counter]( TElement const & element ) -> bool + , & counter]( TElement const & element ) -> bool { EXPECT_EQ( element, verificationVectorWithoutProcessedItems[counter] ); ++counter; @@ -1380,16 +1380,16 @@ TEST_F ( TestBucketWithMultipleInteger } TEST_F ( TestBucketWithMultipleInteger - , IteratorSerialForAllProcessedElements ) + , IteratorSerialForAllProcessedElements ) { - bucket_.for_all_processed_elements ( - []( TElement & element ) + bucket_.for_all_processed_elements ( + []( TElement & element ) { EXPECT_FALSE ( true ); } ); - bucketConst_.for_all_processed_elements ( - []( TElement const & element ) + bucketConst_.for_all_processed_elements ( + []( TElement const & element ) { EXPECT_FALSE ( true ); } @@ -1397,15 +1397,15 @@ TEST_F ( TestBucketWithMultipleInteger bucket_.Pop(); - bucket_.for_all_processed_elements ( - []( TElement & element ) + bucket_.for_all_processed_elements ( + []( TElement & element ) { EXPECT_EQ ( element, 1 ); EXPECT_TRUE ( element.Valid() ); } ); - bucketConst_.for_all_processed_elements ( - []( TElement const & element ) + bucketConst_.for_all_processed_elements ( + []( TElement const & element ) { EXPECT_EQ ( element, 1 ); EXPECT_TRUE ( element.Valid() ); @@ -1415,13 +1415,13 @@ TEST_F ( TestBucketWithMultipleInteger TElement element ( 0, false ); bucket_.Merge ( element ); bucket_.Pop(); - + std::vector const checkProcessedElements = { TElement ( 1, true ) , TElement ( 0, true ) }; Types::count counter = 0; - bucket_.for_all_processed_elements ( + bucket_.for_all_processed_elements ( [ & checkProcessedElements - , & counter]( TElement & element ) + , & counter]( TElement & element ) { EXPECT_EQ ( element, checkProcessedElements [ counter ] ); // EXPECT_TRUE ( element.Valid() ); // Note that this is for the majority of the algorithm correct, but not in general @@ -1438,7 +1438,7 @@ TEST_F ( TestBucketWithMultipleInteger //@todo Refactoring TEST_F ( TestBucketWithMultipleInteger - , IteratorParallelForAllProcessedElements ) + , IteratorParallelForAllProcessedElements ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md @@ -1452,10 +1452,10 @@ TEST_F ( TestBucketWithMultipleInteger std::vector numberOfElements ( numberOfThreads, 0 ); std::vector< std::vector > elementsLoopedOver ( numberOfThreads , std::vector() ); - bucket_.for_all_processed_elements ( + bucket_.for_all_processed_elements ( [ & numberOfThreads , & numberOfElements - , & elementsLoopedOver ]( TElement & element ) + , & elementsLoopedOver ]( TElement & element ) { ++numberOfElements[ omp_get_thread_num() ]; elementsLoopedOver[ omp_get_thread_num() ].emplace_back ( element ); @@ -1463,16 +1463,16 @@ TEST_F ( TestBucketWithMultipleInteger ); std::vector emptyVector; ParallelIteratorCheck ( emptyVector, numberOfElements, elementsLoopedOver ); - + // Const loop check numberOfElements.clear(); elementsLoopedOver.clear(); numberOfElements.resize ( numberOfThreads, 0 ); elementsLoopedOver.resize ( numberOfThreads, std::vector() ); - bucketConst_.for_all_processed_elements ( + bucketConst_.for_all_processed_elements ( [ & numberOfThreads , & numberOfElements - , & elementsLoopedOver ]( TElement const & element ) + , & elementsLoopedOver ]( TElement const & element ) { ++numberOfElements[ omp_get_thread_num() ]; elementsLoopedOver[ omp_get_thread_num() ].emplace_back ( element ); @@ -1489,16 +1489,16 @@ TEST_F ( TestBucketWithMultipleInteger bucket_.Merge ( element ); bucket_.Pop(); - bucket_.for_all_processed_elements ( - []( TElement & element ) + bucket_.for_all_processed_elements ( + []( TElement & element ) { EXPECT_EQ ( element.Value(), 1 ); EXPECT_TRUE ( element.Valid() ); } ); - bucketConst_.for_all_processed_elements ( - []( TElement const & element ) + bucketConst_.for_all_processed_elements ( + []( TElement const & element ) { EXPECT_EQ ( element.Value(), 1 ); EXPECT_TRUE ( element.Valid() ); @@ -1509,17 +1509,17 @@ TEST_F ( TestBucketWithMultipleInteger //@todo test more TEST_F ( TestBucketWithMultipleInteger - , IteratorBreakableForAllProcessedElements ) + , IteratorBreakableForAllProcessedElements ) { - bucket_.for_all_processed_elements ( - []( TElement & element ) -> bool + bucket_.for_all_processed_elements ( + []( TElement & element ) -> bool { EXPECT_FALSE ( true ); return true; } ); - bucketConst_.for_all_processed_elements ( - []( TElement const & element ) -> bool + bucketConst_.for_all_processed_elements ( + []( TElement const & element ) -> bool { EXPECT_FALSE ( true ); return true; @@ -1529,16 +1529,16 @@ TEST_F ( TestBucketWithMultipleInteger //@todo test something TEST_F ( TestBucketWithMultipleInteger - , IteratorSerialForAllUnprocessedElements ) + , IteratorSerialForAllUnprocessedElements ) { // Starting with a bunch of unprocessed elements - std::vector const verificationVectorWithoutProcessedItems = + std::vector const verificationVectorWithoutProcessedItems = { TElement ( 1, true ) }; Types::count counter = 0; - bucket_.for_all_unprocessed_elements ( + bucket_.for_all_unprocessed_elements ( [ & verificationVectorWithoutProcessedItems - , & counter]( TElement & element ) + , & counter]( TElement & element ) { EXPECT_EQ ( element, verificationVectorWithoutProcessedItems[counter] ); ++counter; @@ -1547,9 +1547,9 @@ TEST_F ( TestBucketWithMultipleInteger EXPECT_EQ ( 1, counter ); counter = 0; - bucketConst_.for_all_unprocessed_elements ( + bucketConst_.for_all_unprocessed_elements ( [ & verificationVectorWithoutProcessedItems - , & counter]( TElement const & element ) + , & counter]( TElement const & element ) { EXPECT_EQ ( element, verificationVectorWithoutProcessedItems[counter] ); ++counter; @@ -1559,7 +1559,7 @@ TEST_F ( TestBucketWithMultipleInteger } TEST_F ( TestBucketWithMultipleInteger - , IteratorParallelForAllUnprocessedElements ) + , IteratorParallelForAllUnprocessedElements ) { // For more details see // https://gitlab.inria.fr/Phylophile/Treerecs/blob/f6551e06797b52819ba3e630b92315254a944da5/tests/gtest/googletest/docs/AdvancedGuide.md @@ -1573,26 +1573,26 @@ TEST_F ( TestBucketWithMultipleInteger std::vector numberOfElements ( numberOfThreads, 0 ); std::vector< std::vector > elementsLoopedOver ( numberOfThreads , std::vector() ); - bucket_.for_all_unprocessed_elements ( + bucket_.for_all_unprocessed_elements ( [ & numberOfThreads , & numberOfElements - , & elementsLoopedOver ]( TElement & element ) + , & elementsLoopedOver ]( TElement & element ) { ++numberOfElements[ omp_get_thread_num() ]; elementsLoopedOver[ omp_get_thread_num() ].emplace_back ( element ); } ); ParallelIteratorCheck ( {1}, numberOfElements, elementsLoopedOver ); - + // Const loop check numberOfElements.clear(); elementsLoopedOver.clear(); numberOfElements.resize ( numberOfThreads, 0 ); elementsLoopedOver.resize ( numberOfThreads, std::vector() ); - bucketConst_.for_all_unprocessed_elements ( + bucketConst_.for_all_unprocessed_elements ( [ & numberOfThreads , & numberOfElements - , & elementsLoopedOver ]( TElement const & element ) + , & elementsLoopedOver ]( TElement const & element ) { ++numberOfElements[ omp_get_thread_num() ]; elementsLoopedOver[ omp_get_thread_num() ].emplace_back ( element ); @@ -1600,8 +1600,8 @@ TEST_F ( TestBucketWithMultipleInteger ); ParallelIteratorCheck ( {1}, numberOfElements, elementsLoopedOver ); - bucket_.for_all_unprocessed_elements ( - [&]( TElement & element ) + bucket_.for_all_unprocessed_elements ( + [&]( TElement & element ) { auto iter = std::find ( intVector_.begin(), intVector_.end(), element ); EXPECT_NE ( iter, intVector_.end() ); @@ -1609,8 +1609,8 @@ TEST_F ( TestBucketWithMultipleInteger } ); - bucketConst_.for_all_processed_elements ( - [&]( TElement const & element ) + bucketConst_.for_all_processed_elements ( + [&]( TElement const & element ) { auto iter = std::find ( intVector_.begin(), intVector_.end(), element ); EXPECT_NE ( iter, intVector_.end() ); @@ -1623,16 +1623,16 @@ TEST_F ( TestBucketWithMultipleInteger //@todo refactor with the other breakable loops for all elements /// @todo This does not really test breaking because there is only one unprocessed element TEST_F ( TestBucketWithMultipleInteger - , IteratorBreakableForAllUnprocessedElements ) + , IteratorBreakableForAllUnprocessedElements ) { // Starting with a bunch of unprocessed elements - std::vector const verificationVectorWithoutProcessedItems = + std::vector const verificationVectorWithoutProcessedItems = { TElement(1, true) }; // Test non-const iterator Types::count counter = 0; - bucket_.for_all_unprocessed_elements ( + bucket_.for_all_unprocessed_elements ( [ & verificationVectorWithoutProcessedItems - , & counter ]( TElement & element ) -> bool + , & counter ]( TElement & element ) -> bool { EXPECT_EQ ( element, verificationVectorWithoutProcessedItems[counter] ); ++counter; @@ -1643,9 +1643,9 @@ TEST_F ( TestBucketWithMultipleInteger // Test non-const iterator counter = 0; - bucketConst_.for_all_unprocessed_elements ( + bucketConst_.for_all_unprocessed_elements ( [ & verificationVectorWithoutProcessedItems - , & counter ]( TElement const & element ) -> bool + , & counter ]( TElement const & element ) -> bool { EXPECT_EQ ( element, verificationVectorWithoutProcessedItems[counter] ); ++counter; @@ -1656,19 +1656,19 @@ TEST_F ( TestBucketWithMultipleInteger } TEST_F ( TestBucketWithMultipleInteger - , IteratorSerialForAllOptima ) + , IteratorSerialForAllOptima ) { TElement minElement = bucket_.Top(); - bucket_.for_all_optima ( - [ & minElement ]( TElement const & element ) + bucket_.for_all_optima ( + [ & minElement ]( TElement const & element ) { EXPECT_EQ ( element, minElement ); } ); - bucketConst_.for_all_optima ( - [ & minElement ] ( TElement const & element ) + bucketConst_.for_all_optima ( + [ & minElement ] ( TElement const & element ) { EXPECT_EQ ( element, minElement ); } @@ -1676,19 +1676,19 @@ TEST_F ( TestBucketWithMultipleInteger } TEST_F ( TestBucketWithMultipleInteger - , IteratorParallelForAllOptima ) + , IteratorParallelForAllOptima ) { TElement minElement = bucket_.Top(); - bucket_.for_all_optima ( - [ & minElement ] ( TElement const & element ) + bucket_.for_all_optima ( + [ & minElement ] ( TElement const & element ) { EXPECT_EQ ( element, minElement ); } ); - bucketConst_.for_all_optima ( - [ & minElement ] ( TElement const & element ) + bucketConst_.for_all_optima ( + [ & minElement ] ( TElement const & element ) { EXPECT_EQ ( element, minElement ); } diff --git a/tests/DataStructures/Container/TestBucket.hpp b/tests/DataStructures/Container/TestBucket.hpp index 7b965241..ebe0159c 100644 --- a/tests/DataStructures/Container/TestBucket.hpp +++ b/tests/DataStructures/Container/TestBucket.hpp @@ -100,7 +100,7 @@ using TestBucketWithComparatorMaximizeWithMultipleIntegerDeathTest = TestBucketW template void ParallelIteratorCheck ( std::vector const & numberVector , std::vector const & numberOfElements - , std::vector< std::vector > const & elementsLoopedOver ) + , std::vector< std::vector > const & elementsLoopedOver ) { Types::count sum = 0; for ( Types::count number : numberOfElements ) { @@ -123,9 +123,9 @@ void ParallelIteratorCheck ( std::vector const & num , std::accumulate ( numberVector.begin() , numberVector.end() , 0 - , [](TElement const & left, TElement const & right) { - return left.Value() + right.Value(); - }) + , [](TElement const & left, TElement const & right) { + return left.Value() + right.Value(); + }) ); } diff --git a/tests/DataStructures/Container/TestMappingBinaryHeap.cpp b/tests/DataStructures/Container/TestMappingBinaryHeap.cpp index 9ad12e1d..92136874 100644 --- a/tests/DataStructures/Container/TestMappingBinaryHeap.cpp +++ b/tests/DataStructures/Container/TestMappingBinaryHeap.cpp @@ -77,7 +77,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, Content) { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestMappingBinaryHeapEmpty - , TopExceptionHandling ) + , TopExceptionHandling ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -88,7 +88,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, Content) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -110,7 +110,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, Top) { #pragma mark TopElement #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestMappingBinaryHeapEmptyDeathTest - , TopElementDeathTest ) + , TopElementDeathTest ) { auto assertionString = buildAssertionString ( "MappingBinaryHeap.hpp" , "MappingBinaryHeap" @@ -121,7 +121,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, Top) { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestMappingBinaryHeapEmpty - , TopElementExceptionHandling ) + , TopElementExceptionHandling ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -132,7 +132,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, Top) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -150,7 +150,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, TopElement) { #pragma mark TopKey #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestMappingBinaryHeapEmptyDeathTest - , TopKeyDeathTest ) + , TopKeyDeathTest ) { auto assertionString = buildAssertionString ( "MappingBinaryHeap.hpp" , "MappingBinaryHeap" @@ -161,7 +161,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, TopElement) { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestMappingBinaryHeapEmpty - , TopKeyExceptionHandling ) + , TopKeyExceptionHandling ) { auto assertionString = buildAssertionString ( "MappingBinaryHeap.hpp" , "MappingBinaryHeap" @@ -172,7 +172,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, TopElement) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -810,7 +810,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, EmplaceEqual) { #pragma mark DeleteTop #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestMappingBinaryHeapEmptyDeathTest - , DeleteTopDeathTest ) + , DeleteTopDeathTest ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -821,7 +821,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, EmplaceEqual) { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestMappingBinaryHeapEmpty - , DeleteTopExceptionHandling ) + , DeleteTopExceptionHandling ) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" @@ -832,7 +832,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, EmplaceEqual) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -862,7 +862,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, DeleteTop) { #pragma mark Pop #ifdef EGOA_ENABLE_ASSERTION TEST_F ( TestMappingBinaryHeapEmptyDeathTest - , PopDeathTest ) + , PopDeathTest ) { auto assertionString = buildAssertionString ( "MappingBinaryHeap.hpp" , "MappingBinaryHeap" @@ -873,7 +873,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, DeleteTop) { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestMappingBinaryHeapEmpty - , PopExceptionHandling ) + , PopExceptionHandling ) { auto assertionString = buildAssertionString ( "MappingBinaryHeap.hpp" , "MappingBinaryHeap" @@ -884,7 +884,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, DeleteTop) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } diff --git a/tests/DataStructures/Container/TestStdQueue.cpp b/tests/DataStructures/Container/TestStdQueue.cpp index b884548b..7fc3263c 100644 --- a/tests/DataStructures/Container/TestStdQueue.cpp +++ b/tests/DataStructures/Container/TestStdQueue.cpp @@ -43,13 +43,13 @@ TEST_F ( TestStdQueue, ///@Name Basic Functionalities ///@{ TEST_F ( TestStdQueueWithZeroElements - , BasicFunctionalityIsEmptyWhenCreated ) + , BasicFunctionalityIsEmptyWhenCreated ) { ASSERT_TRUE( queueConst_.Empty() ); } TEST_F ( TestStdQueueWithZeroElements - , BasicFunctionalityHasSizeOfZero ) + , BasicFunctionalityHasSizeOfZero ) { ASSERT_EQ( queueConst_.Size(), 0 ); } @@ -59,4 +59,4 @@ TEST_F ( TestStdQueue, #pragma mark TEST_STD_QUEUE_WITH_MULTIPLE_INTEGER_ELEMENTS -} // namespace egoa::test \ No newline at end of file +} // namespace egoa::test diff --git a/tests/DataStructures/Container/TestStdQueue.hpp b/tests/DataStructures/Container/TestStdQueue.hpp index 0e3b179e..a9af216f 100644 --- a/tests/DataStructures/Container/TestStdQueue.hpp +++ b/tests/DataStructures/Container/TestStdQueue.hpp @@ -22,16 +22,16 @@ class TestStdQueue : public ::testing::Test { using TElement = Types::integer; using TQueue = StdQueue; using TVector = std::vector; - + void AddContent ( TQueue & queue - , std::vector const & elements) + , std::vector const & elements) { for ( auto element : elements ) queue.Emplace(element); } void ExpectContent ( TQueue queue - , std::vector const & elements) + , std::vector const & elements) { for ( auto e : elements ) { ASSERT_FALSE ( queue.Empty() ); @@ -85,4 +85,4 @@ class TestStdQueueWithVectorOfInteger : public TestStdQueue { } // namespace egoa::test -#endif // EGOA__TESTS__DATA_STRUCTURES__CONTAINER__TEST_STD_QUEUE_HPP \ No newline at end of file +#endif // EGOA__TESTS__DATA_STRUCTURES__CONTAINER__TEST_STD_QUEUE_HPP diff --git a/tests/DataStructures/Graphs/TestDynamicGraph.cpp b/tests/DataStructures/Graphs/TestDynamicGraph.cpp index 41ec042e..0f9bba66 100644 --- a/tests/DataStructures/Graphs/TestDynamicGraph.cpp +++ b/tests/DataStructures/Graphs/TestDynamicGraph.cpp @@ -23,18 +23,18 @@ namespace egoa::test { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TEST_F ( TestDynamicGraphEmpty - , DeleteVertexExceptionHandling ) + , DeleteVertexExceptionHandling ) { auto assertionString = this->assertionString("RemoveVertexAt", "VertexExists\\(id\\)"); Types::vertexId id = 0; try { this->graph_.RemoveVertexAt(id); - } catch ( std::runtime_error const & error ) + } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); - } catch ( ... ) + } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -110,7 +110,7 @@ TEST_F(TestDynamicGraphBidirectedPath, DeleteVertexFirst) { #pragma mark UpdateVertices -TEST_F(TestDynamicGraphFourVertices, UpdateVertices) +TEST_F(TestDynamicGraphFourVertices, UpdateVertices) { Types::vertexId vertexToRemove = this->vertexIds_[2]; ASSERT_EQ(2, this->graphConst_.VertexAt(vertexToRemove).Properties().PrivateId()); @@ -125,7 +125,7 @@ TEST_F(TestDynamicGraphFourVertices, UpdateVertices) std::vector privateIds; this->graphConst_.template for_all_vertex_tuples( - [&ids, &privateIds, this](Types::vertexId id, TVertex const & vertex) + [&ids, &privateIds, this](Types::vertexId id, TVertex const & vertex) { ids.push_back(id); privateIds.push_back(vertex.Properties().PrivateId()); @@ -138,7 +138,7 @@ TEST_F(TestDynamicGraphFourVertices, UpdateVertices) ExpectSameContent({0, 1, 3}, privateIds); } -TEST_F(TestDynamicGraphBidirectedPath, UpdateVerticesMiddle) +TEST_F(TestDynamicGraphBidirectedPath, UpdateVerticesMiddle) { Types::vertexId middleVertex = this->vertexIds_[1]; @@ -152,7 +152,7 @@ TEST_F(TestDynamicGraphBidirectedPath, UpdateVerticesMiddle) std::vector privateIds; this->graphConst_.template for_all_vertex_tuples( - [&ids, &privateIds, this](Types::vertexId id, TVertex const & vertex) + [&ids, &privateIds, this](Types::vertexId id, TVertex const & vertex) { ids.push_back(id); privateIds.push_back(vertex.Properties().PrivateId()); @@ -168,7 +168,7 @@ TEST_F(TestDynamicGraphBidirectedPath, UpdateVerticesMiddle) ExpectSameContent({0, 2}, privateIds); } -TEST_F(TestDynamicGraphBidirectedPath, UpdateVerticesFirst) +TEST_F(TestDynamicGraphBidirectedPath, UpdateVerticesFirst) { Types::vertexId firstVertex = this->vertexIds_[0]; @@ -182,7 +182,7 @@ TEST_F(TestDynamicGraphBidirectedPath, UpdateVerticesFirst) std::vector privateIds; this->graphConst_.template for_all_vertex_tuples( - [&ids, &privateIds, this](Types::vertexId id, TVertex const & vertex) + [&ids, &privateIds, this](Types::vertexId id, TVertex const & vertex) { ids.push_back(id); privateIds.push_back(vertex.Properties().PrivateId()); diff --git a/tests/DataStructures/Graphs/TestGraph.cpp b/tests/DataStructures/Graphs/TestGraph.cpp index da42eda5..a03c86d6 100644 --- a/tests/DataStructures/Graphs/TestGraph.cpp +++ b/tests/DataStructures/Graphs/TestGraph.cpp @@ -148,21 +148,21 @@ TYPED_TEST( TestGraphEmpty, EdgeExists ) { EXPECT_FALSE(this->graphConst_.EdgeExists(Const::NONE)); } -TYPED_TEST( TestGraphSingleVertex, EdgeExists ) +TYPED_TEST( TestGraphSingleVertex, EdgeExists ) { EXPECT_FALSE(this->graphConst_.EdgeExists(0)); EXPECT_FALSE(this->graphConst_.EdgeExists(10)); EXPECT_FALSE(this->graphConst_.EdgeExists(Const::NONE)); } -TYPED_TEST( TestGraphFourVertices, EdgeExists ) +TYPED_TEST( TestGraphFourVertices, EdgeExists ) { EXPECT_FALSE(this->graphConst_.EdgeExists(0)); EXPECT_FALSE(this->graphConst_.EdgeExists(10)); EXPECT_FALSE(this->graphConst_.EdgeExists(Const::NONE)); } -TYPED_TEST( TestGraphBidirectedPath, EdgeExists ) +TYPED_TEST( TestGraphBidirectedPath, EdgeExists ) { for (auto id : this->edgeIds_) { EXPECT_TRUE(this->graphConst_.EdgeExists(id)); @@ -175,14 +175,14 @@ TYPED_TEST( TestGraphBidirectedPath, EdgeExists ) EXPECT_FALSE(this->graphConst_.EdgeExists(Const::NONE)); } -TYPED_TEST( TestGraphStar, EdgeExists ) +TYPED_TEST( TestGraphStar, EdgeExists ) { - for (auto id : this->edgeIds_) + for (auto id : this->edgeIds_) { EXPECT_TRUE(this->graphConst_.EdgeExists(id)); } - for (Types::index i = 0; i < 20; ++i) + for (Types::index i = 0; i < 20; ++i) { using std::begin, std::end; bool expected = std::find(begin(this->edgeIds_), @@ -197,31 +197,31 @@ TYPED_TEST( TestGraphStar, EdgeExists ) /// @name Tests for Vertices().size() /// @{ #pragma mark VerticesSize -TYPED_TEST( TestGraphEmpty, VerticesSize ) +TYPED_TEST( TestGraphEmpty, VerticesSize ) { EXPECT_EQ(0, this->graph_.Vertices().size()); EXPECT_EQ(0, this->graphConst_.Vertices().size()); } -TYPED_TEST( TestGraphSingleVertex, VerticesSize ) +TYPED_TEST( TestGraphSingleVertex, VerticesSize ) { EXPECT_EQ(1, this->graph_.Vertices().size()); EXPECT_EQ(1, this->graphConst_.Vertices().size()); } -TYPED_TEST( TestGraphFourVertices, VerticesSize ) +TYPED_TEST( TestGraphFourVertices, VerticesSize ) { EXPECT_EQ(4, this->graph_.Vertices().size()); EXPECT_EQ(4, this->graphConst_.Vertices().size()); } -TYPED_TEST( TestGraphBidirectedPath, VerticesSize ) +TYPED_TEST( TestGraphBidirectedPath, VerticesSize ) { EXPECT_EQ(3, this->graph_.Vertices().size()); EXPECT_EQ(3, this->graphConst_.Vertices().size()); } -TYPED_TEST( TestGraphStar, VerticesSize ) +TYPED_TEST( TestGraphStar, VerticesSize ) { EXPECT_EQ(4, this->graph_.Vertices().size()); EXPECT_EQ(4, this->graphConst_.Vertices().size()); @@ -231,31 +231,31 @@ TYPED_TEST( TestGraphStar, VerticesSize ) /// @name Tests for Vertices().empty() /// @{ #pragma mark VerticesEmpty -TYPED_TEST( TestGraphEmpty, VerticesEmpty ) +TYPED_TEST( TestGraphEmpty, VerticesEmpty ) { EXPECT_TRUE(this->graph_.Vertices().empty()); EXPECT_TRUE(this->graphConst_.Vertices().empty()); } -TYPED_TEST( TestGraphSingleVertex, VerticesEmpty ) +TYPED_TEST( TestGraphSingleVertex, VerticesEmpty ) { EXPECT_FALSE(this->graph_.Vertices().empty()); EXPECT_FALSE(this->graphConst_.Vertices().empty()); } -TYPED_TEST( TestGraphFourVertices, VerticesEmpty ) +TYPED_TEST( TestGraphFourVertices, VerticesEmpty ) { EXPECT_FALSE(this->graph_.Vertices().empty()); EXPECT_FALSE(this->graphConst_.Vertices().empty()); } -TYPED_TEST( TestGraphBidirectedPath, VerticesEmpty ) +TYPED_TEST( TestGraphBidirectedPath, VerticesEmpty ) { EXPECT_FALSE(this->graph_.Vertices().empty()); EXPECT_FALSE(this->graphConst_.Vertices().empty()); } -TYPED_TEST( TestGraphStar, VerticesEmpty ) +TYPED_TEST( TestGraphStar, VerticesEmpty ) { EXPECT_FALSE(this->graph_.Vertices().empty()); EXPECT_FALSE(this->graphConst_.Vertices().empty()); @@ -265,10 +265,10 @@ TYPED_TEST( TestGraphStar, VerticesEmpty ) /// @name Tests for Vertices().begin() and Vertices().end() /// @{ #pragma mark VerticesIterate -TYPED_TEST( TestGraphEmpty, VerticesIterate) +TYPED_TEST( TestGraphEmpty, VerticesIterate) { Types::count counter = 0; - for (auto & v : this->graph_.Vertices()) + for (auto & v : this->graph_.Vertices()) { ++counter; FAIL(); @@ -276,7 +276,7 @@ TYPED_TEST( TestGraphEmpty, VerticesIterate) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphSingleVertex, VerticesIterate) +TYPED_TEST( TestGraphSingleVertex, VerticesIterate) { Types::count counter = 0; for (auto & v : this->graph_.Vertices()) { @@ -290,7 +290,7 @@ TYPED_TEST( TestGraphSingleVertex, VerticesIterate) EXPECT_EQ(1, counter); } -TYPED_TEST( TestGraphFourVertices, VerticesIterate) +TYPED_TEST( TestGraphFourVertices, VerticesIterate) { Types::count counter = 0; std::vector ids; @@ -309,12 +309,12 @@ TYPED_TEST( TestGraphFourVertices, VerticesIterate) EXPECT_TRUE(std::is_sorted(ids.begin(), ids.end())); } -TYPED_TEST( TestGraphStar, VerticesIterate) +TYPED_TEST( TestGraphStar, VerticesIterate) { Types::count counter = 0; std::vector ids; - for (auto & v : this->graph_.Vertices()) + for (auto & v : this->graph_.Vertices()) { ++counter; auto id = v.Identifier(); @@ -331,10 +331,10 @@ TYPED_TEST( TestGraphStar, VerticesIterate) } #pragma mark VerticesIterateConst -TYPED_TEST( TestGraphEmpty, VerticesIterateConst) +TYPED_TEST( TestGraphEmpty, VerticesIterateConst) { Types::count counter = 0; - for (auto& v : this->graphConst_.Vertices()) + for (auto& v : this->graphConst_.Vertices()) { ++counter; FAIL(); @@ -342,10 +342,10 @@ TYPED_TEST( TestGraphEmpty, VerticesIterateConst) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphSingleVertex, VerticesIterateConst) +TYPED_TEST( TestGraphSingleVertex, VerticesIterateConst) { Types::count counter = 0; - for (auto& v : this->graphConst_.Vertices()) + for (auto& v : this->graphConst_.Vertices()) { ++counter; auto id = v.Identifier(); @@ -356,12 +356,12 @@ TYPED_TEST( TestGraphSingleVertex, VerticesIterateConst) EXPECT_EQ(1, counter); } -TYPED_TEST( TestGraphFourVertices, VerticesIterateConst) +TYPED_TEST( TestGraphFourVertices, VerticesIterateConst) { Types::count counter = 0; std::vector ids; - for (auto& v : this->graphConst_.Vertices()) + for (auto& v : this->graphConst_.Vertices()) { ++counter; auto id = v.Identifier(); @@ -375,7 +375,7 @@ TYPED_TEST( TestGraphFourVertices, VerticesIterateConst) EXPECT_TRUE(std::is_sorted(ids.begin(), ids.end())); } -TYPED_TEST( TestGraphStar, VerticesIterateConst) +TYPED_TEST( TestGraphStar, VerticesIterateConst) { Types::count counter = 0; std::vector ids; @@ -398,7 +398,7 @@ TYPED_TEST( TestGraphStar, VerticesIterateConst) /// @name Tests for Vertices().rbegin() and Vertices().rend() /// @{ #pragma mark VerticesIterateBackwards -TYPED_TEST( TestGraphEmpty, VerticesIterateBackwards) +TYPED_TEST( TestGraphEmpty, VerticesIterateBackwards) { Types::count counter = 0; for (auto it = this->graph_.Vertices().rbegin(); @@ -411,7 +411,7 @@ TYPED_TEST( TestGraphEmpty, VerticesIterateBackwards) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphSingleVertex, VerticesIterateBackwards) +TYPED_TEST( TestGraphSingleVertex, VerticesIterateBackwards) { EXPECT_NE(this->graph_.Vertices().rbegin(), this->graph_.Vertices().rend()); @@ -430,7 +430,7 @@ TYPED_TEST( TestGraphSingleVertex, VerticesIterateBackwards) EXPECT_EQ(1, counter); } -TYPED_TEST( TestGraphFourVertices, VerticesIterateBackwards) +TYPED_TEST( TestGraphFourVertices, VerticesIterateBackwards) { Types::count counter = 0; std::vector ids; @@ -455,7 +455,7 @@ TYPED_TEST( TestGraphFourVertices, VerticesIterateBackwards) EXPECT_TRUE(std::is_sorted(ids.begin(), ids.end(), std::greater())); } -TYPED_TEST( TestGraphStar, VerticesIterateBackwards) +TYPED_TEST( TestGraphStar, VerticesIterateBackwards) { Types::count counter = 0; std::vector ids; @@ -466,7 +466,7 @@ TYPED_TEST( TestGraphStar, VerticesIterateBackwards) for (auto it = this->graph_.Vertices().rbegin(); it != this->graph_.Vertices().rend(); - ++it) + ++it) { ++counter; it->Properties().NonConstMemberFunction(); @@ -604,23 +604,23 @@ TYPED_TEST( TestGraphFourVertices, EdgesEmpty ) { EXPECT_TRUE(this->graphConst_.Edges().empty()); } -TYPED_TEST( TestGraphBidirectedPath, EdgesEmpty ) +TYPED_TEST( TestGraphBidirectedPath, EdgesEmpty ) { EXPECT_FALSE(this->graph_.Edges().empty()); EXPECT_FALSE(this->graphConst_.Edges().empty()); } -TYPED_TEST( TestGraphStar, EdgesEmpty ) +TYPED_TEST( TestGraphStar, EdgesEmpty ) { EXPECT_FALSE(this->graph_.Edges().empty()); EXPECT_FALSE(this->graphConst_.Edges().empty()); } #pragma mark EdgesIterate -TYPED_TEST( TestGraphEmpty, EdgesIterate ) +TYPED_TEST( TestGraphEmpty, EdgesIterate ) { Types::count counter = 0; - for (auto& edge : this->graph_.Edges()) + for (auto& edge : this->graph_.Edges()) { ++counter; edge.Properties().NonConstMemberFunction(); @@ -629,7 +629,7 @@ TYPED_TEST( TestGraphEmpty, EdgesIterate ) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphSingleVertex, EdgesIterate ) +TYPED_TEST( TestGraphSingleVertex, EdgesIterate ) { Types::count counter = 0; for ( auto & edge : this->graph_.Edges() ) { @@ -640,7 +640,7 @@ TYPED_TEST( TestGraphSingleVertex, EdgesIterate ) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphFourVertices, EdgesIterate ) +TYPED_TEST( TestGraphFourVertices, EdgesIterate ) { Types::count counter = 0; for (auto& edge : this->graph_.Edges()) { @@ -651,12 +651,12 @@ TYPED_TEST( TestGraphFourVertices, EdgesIterate ) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphBidirectedPath, EdgesIterate ) +TYPED_TEST( TestGraphBidirectedPath, EdgesIterate ) { Types::count counter = 0; std::vector ids; - for (auto& edge : this->graph_.Edges()) + for (auto& edge : this->graph_.Edges()) { ++counter; edge.Properties().NonConstMemberFunction(); @@ -672,12 +672,12 @@ TYPED_TEST( TestGraphBidirectedPath, EdgesIterate ) EXPECT_TRUE(std::is_sorted(ids.begin(), ids.end())); } -TYPED_TEST( TestGraphStar, EdgesIterate) +TYPED_TEST( TestGraphStar, EdgesIterate) { Types::count counter = 0; std::vector ids; - for ( auto & edge : this->graph_.Edges() ) + for ( auto & edge : this->graph_.Edges() ) { ++counter; edge.Properties().NonConstMemberFunction(); @@ -694,10 +694,10 @@ TYPED_TEST( TestGraphStar, EdgesIterate) } #pragma mark EdgesIterateConst -TYPED_TEST( TestGraphEmpty, EdgesIterateConst ) +TYPED_TEST( TestGraphEmpty, EdgesIterateConst ) { Types::count counter = 0; - for (auto & v : this->graphConst_.Edges()) + for (auto & v : this->graphConst_.Edges()) { ++counter; FAIL(); @@ -705,10 +705,10 @@ TYPED_TEST( TestGraphEmpty, EdgesIterateConst ) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphSingleVertex, EdgesIterateConst ) +TYPED_TEST( TestGraphSingleVertex, EdgesIterateConst ) { Types::count counter = 0; - for (auto & v : this->graphConst_.Edges()) + for (auto & v : this->graphConst_.Edges()) { ++counter; FAIL(); @@ -716,10 +716,10 @@ TYPED_TEST( TestGraphSingleVertex, EdgesIterateConst ) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphFourVertices, EdgesIterateConst ) +TYPED_TEST( TestGraphFourVertices, EdgesIterateConst ) { Types::count counter = 0; - for (auto & v : this->graphConst_.Edges()) + for (auto & v : this->graphConst_.Edges()) { ++counter; FAIL(); @@ -727,12 +727,12 @@ TYPED_TEST( TestGraphFourVertices, EdgesIterateConst ) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphBidirectedPath, EdgesIterateConst ) +TYPED_TEST( TestGraphBidirectedPath, EdgesIterateConst ) { Types::count counter = 0; std::vector ids; - for (auto& edge : this->graphConst_.Edges()) + for (auto& edge : this->graphConst_.Edges()) { ++counter; auto id = edge.Identifier(); @@ -747,12 +747,12 @@ TYPED_TEST( TestGraphBidirectedPath, EdgesIterateConst ) EXPECT_TRUE(std::is_sorted(ids.begin(), ids.end())); } -TYPED_TEST( TestGraphStar, EdgesIterateConst) +TYPED_TEST( TestGraphStar, EdgesIterateConst) { Types::count counter = 0; std::vector ids; - for ( auto & edge : this->graphConst_.Edges() ) + for ( auto & edge : this->graphConst_.Edges() ) { ++counter; auto id = edge.Identifier(); @@ -768,7 +768,7 @@ TYPED_TEST( TestGraphStar, EdgesIterateConst) } #pragma mark EdgesIterateBackwards -TYPED_TEST( TestGraphEmpty, EdgesIterateBackwards ) +TYPED_TEST( TestGraphEmpty, EdgesIterateBackwards ) { Types::count counter = 0; for (auto it = this->graph_.Edges().rbegin(); @@ -782,7 +782,7 @@ TYPED_TEST( TestGraphEmpty, EdgesIterateBackwards ) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphSingleVertex, EdgesIterateBackwards ) +TYPED_TEST( TestGraphSingleVertex, EdgesIterateBackwards ) { Types::count counter = 0; for (auto it = this->graph_.Edges().rbegin(); @@ -796,7 +796,7 @@ TYPED_TEST( TestGraphSingleVertex, EdgesIterateBackwards ) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphFourVertices, EdgesIterateBackwards ) +TYPED_TEST( TestGraphFourVertices, EdgesIterateBackwards ) { Types::count counter = 0; for (auto it = this->graph_.Edges().rbegin(); @@ -810,7 +810,7 @@ TYPED_TEST( TestGraphFourVertices, EdgesIterateBackwards ) EXPECT_EQ(0, counter); } -TYPED_TEST( TestGraphBidirectedPath, EdgesIterateBackwards ) +TYPED_TEST( TestGraphBidirectedPath, EdgesIterateBackwards ) { Types::count counter = 0; std::vector ids; @@ -834,7 +834,7 @@ TYPED_TEST( TestGraphBidirectedPath, EdgesIterateBackwards ) EXPECT_TRUE(std::is_sorted(ids.begin(), ids.end(), std::greater())); } -TYPED_TEST( TestGraphStar, EdgesIterateBackwards) +TYPED_TEST( TestGraphStar, EdgesIterateBackwards) { Types::count counter = 0; std::vector ids; @@ -859,7 +859,7 @@ TYPED_TEST( TestGraphStar, EdgesIterateBackwards) } #pragma mark EdgesIterateBackwardsConst -TYPED_TEST( TestGraphEmpty, EdgesIterateBackwardsConst ) +TYPED_TEST( TestGraphEmpty, EdgesIterateBackwardsConst ) { Types::count counter = 0; for (auto it = this->graphConst_.Edges().rbegin(); @@ -953,7 +953,7 @@ TYPED_TEST( TestGraphStar, EdgesIterateBackwardsConst) { #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TYPED_TEST ( TestGraphEmpty - , VertexAtExceptionHandling ) + , VertexAtExceptionHandling ) { auto assertionString = this->assertionString( "VertexAt" , "VertexExists\\(id\\)"); @@ -963,7 +963,7 @@ TYPED_TEST( TestGraphStar, EdgesIterateBackwardsConst) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } try { @@ -971,7 +971,7 @@ TYPED_TEST( TestGraphStar, EdgesIterateBackwardsConst) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -999,7 +999,7 @@ TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } try { @@ -1007,7 +1007,7 @@ TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -1024,7 +1024,7 @@ TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TYPED_TEST ( TestGraphFourVertices - , VertexAtExceptionHandling ) + , VertexAtExceptionHandling ) { auto assertionString = this->assertionString( "VertexAt" , "VertexExists\\(id\\)"); @@ -1034,7 +1034,7 @@ TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } try { @@ -1042,7 +1042,7 @@ TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -1076,7 +1076,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TYPED_TEST ( TestGraphEmpty - , NeighborsOfExceptionHandling ) + , NeighborsOfExceptionHandling ) { auto assertionString = this->assertionString( "NeighborsOf" , "VertexExists\\(id\\)"); @@ -1086,7 +1086,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } try { @@ -1094,7 +1094,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -1111,7 +1111,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TYPED_TEST ( TestGraphSingleVertex - , NeighborsOfExceptionHandling ) + , NeighborsOfExceptionHandling ) { auto assertionString = this->assertionString( "NeighborsOf" , "VertexExists\\(id\\)"); @@ -1121,7 +1121,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } try { @@ -1129,7 +1129,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -1146,7 +1146,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TYPED_TEST ( TestGraphFourVertices - , NeighborsOfExceptionHandling ) + , NeighborsOfExceptionHandling ) { auto assertionString = this->assertionString( "NeighborsOf" , "VertexExists\\(id\\)"); @@ -1156,7 +1156,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } try { @@ -1164,7 +1164,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -1218,7 +1218,7 @@ TYPED_TEST(TestGraphStar, NeighborsOf) { EXPECT_EQ(3, neighbors.size()); ExpectSameContent(expectedNeighbors, neighbors); neighbors.clear(); - + // Leaves for (size_t i = 0; i < 3; ++i) { Types::vertexId id = this->leafIds_[i]; @@ -1491,7 +1491,7 @@ TYPED_TEST(TestGraphFourVertices, MapEdges) { TYPED_TEST(TestGraphStar, MapEdges) { const unsigned OFFSET = 1234; auto result = this->graphConst_.MapEdges([]( - Types::edgeId id, const typename TestFixture::TEdge & edge) + Types::edgeId id, const typename TestFixture::TEdge & edge) { return std::make_pair(id, edge.Properties().PrivateId() + OFFSET); } @@ -1507,7 +1507,7 @@ TYPED_TEST(TestGraphStar, MapEdges) { #pragma mark MapVertices TYPED_TEST(TestGraphEmpty, MapVertices) { int called = 0; - auto function = [&called](Types::vertexId, const typename TestFixture::TVertex &) + auto function = [&called](Types::vertexId, const typename TestFixture::TVertex &) { ++called; return 42; @@ -1558,7 +1558,7 @@ TYPED_TEST( TestGraphEmpty, AddVertex) EXPECT_EQ(i + 1, this->graph_.NumberOfVertices()); // Check if all previously inserted vertices are still correct - for (size_t j = 0; j <= i; ++j) + for (size_t j = 0; j <= i; ++j) { ASSERT_TRUE(this->graph_.VertexExists(indices[j])); EXPECT_EQ(j, this->graph_.VertexAt(indices[j]).Properties().PrivateId() ) @@ -1568,7 +1568,7 @@ TYPED_TEST( TestGraphEmpty, AddVertex) } #pragma mark AddVertexFromTemporary -TYPED_TEST(TestGraphEmpty, AddVertexFromTemporary) +TYPED_TEST(TestGraphEmpty, AddVertexFromTemporary) { using TVertex = typename TestFixture::TVertex; using TVertexProperties = typename TestFixture::TVertexProperties; @@ -1583,7 +1583,7 @@ TYPED_TEST(TestGraphEmpty, AddVertexFromTemporary) } #pragma mark AddVertexFromConstReference -TYPED_TEST(TestGraphEmpty, AddVertexFromConstReference) +TYPED_TEST(TestGraphEmpty, AddVertexFromConstReference) { using TVertex = typename TestFixture::TVertex; using TVertexProperties = typename TestFixture::TVertexProperties; @@ -1606,7 +1606,7 @@ TYPED_TEST( TestGraphFourVertices, AddEdge) { using TEdge = typename TestFixture::TEdge; using TEdgeProperties = typename TestFixture::TEdgeProperties; - for (Types::vertexId i = 0; i < 4; ++i) + for (Types::vertexId i = 0; i < 4; ++i) { ASSERT_TRUE(this->graph_.VertexExists(0)); } @@ -2163,7 +2163,7 @@ TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAt) { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TYPED_TEST ( TestGraphEmpty - , ForAllEdgesAtExceptionHandling ) + , ForAllEdgesAtExceptionHandling ) { auto assertionString = this->assertionString( "for_all_edges_at" , "VertexExists\\(vertexId\\)"); @@ -2171,7 +2171,7 @@ TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAt) { try { this->graph_.template for_all_edges_at( nonexistentId, - [](typename TestFixture::TEdge &) + [](typename TestFixture::TEdge &) { FAIL(); } @@ -2179,7 +2179,7 @@ TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAt) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } @@ -2202,7 +2202,7 @@ TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAtConst) { #else #ifdef EGOA_ENABLE_EXCEPTION_HANDLING TYPED_TEST ( TestGraphEmpty - , ForAllEdgesAtConstExceptionHandling ) + , ForAllEdgesAtConstExceptionHandling ) { auto assertionString = this->assertionString( "for_all_edges_at" , "VertexExists\\(vertexId\\)"); @@ -2217,7 +2217,7 @@ TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAtConst) { } catch ( std::runtime_error const & error ) { EXPECT_THAT ( error.what(), MatchesRegex( assertionString.c_str() ) ); } catch ( ... ) { - FAIL() << "Expected std::runtime_error with message: " + FAIL() << "Expected std::runtime_error with message: " << assertionString; } } diff --git a/tests/DataStructures/Graphs/TestGraph.hpp b/tests/DataStructures/Graphs/TestGraph.hpp index cce27ce2..442346d4 100644 --- a/tests/DataStructures/Graphs/TestGraph.hpp +++ b/tests/DataStructures/Graphs/TestGraph.hpp @@ -111,7 +111,7 @@ class TestGraphFourVertices : public TestGraph { TestGraphFourVertices() : TestGraph("4K_1") {} void SetUp() override { - for ( Types::count i = 0; i < 4; ++i ) + for ( Types::count i = 0; i < 4; ++i ) { vertexIds_.push_back(this->graph_.AddVertex(TVertexProperties(i))); } @@ -137,16 +137,16 @@ class TestGraphBidirectedPath : public TestGraph { TestGraphBidirectedPath() : TestGraph("P_3") {} - void SetUp() override + void SetUp() override { - for ( Types::count i = 0; i < 3; ++i ) + for ( Types::count i = 0; i < 3; ++i ) { vertexIds_.push_back(this->graph_.AddVertex( TVertexProperties{i} )); TVertex vertex = this->graph_.VertexAt( vertexIds_.back() ); mapIdToVertex_.emplace(vertexIds_.back(), vertex ); } - for ( Types::count i = 0; i < 2; ++i ) + for ( Types::count i = 0; i < 2; ++i ) { Types::index privatId = 2 * i; Types::vertexId source = i; @@ -185,20 +185,20 @@ class TestGraphStar : public TestGraph { TestGraphStar() : TestGraph("K_1_3") {} - void SetUp() override + void SetUp() override { centerId_ = this->graph_.AddVertex(TVertexProperties(0)); vertexIds_.push_back(centerId_); TVertex vertex = this->graph_.VertexAt(vertexIds_.back()); mapIdToVertex_.emplace(centerId_, vertex ); // TVertex(0)); - for ( Types::count i = 0; i < 3; ++i ) + for ( Types::count i = 0; i < 3; ++i ) { leafIds_.push_back(this->graph_.AddVertex(TVertexProperties(i + 1))); vertexIds_.push_back(leafIds_.back()); vertex = this->graph_.VertexAt(vertexIds_.back()); mapIdToVertex_.emplace(leafIds_.back(), vertex ); } - for ( Types::count i = 0; i < 3; ++i ) + for ( Types::count i = 0; i < 3; ++i ) { edgeIds_.push_back(this->graph_.AddEdge(centerId_, leafIds_[i], TEdgeProperties(i) )); mapIdToEdge_.emplace(edgeIds_.back(), this->graph_.EdgeAt(edgeIds_.back()) ); @@ -240,7 +240,7 @@ class TestGraphStar TVertex vertex = this->graph_.VertexAt( vertexIds_.back() ); mapIdToVertex_.emplace(centerId_, vertex); Types::vertexId vertexToRemove = this->graph_.AddVertex(TVertexProperties(234)); - for ( Types::count i = 0; i < 3; ++i ) + for ( Types::count i = 0; i < 3; ++i ) { leafIds_.push_back(this->graph_.AddVertex( TVertexProperties{i + 1} )); vertexIds_.push_back(leafIds_.back()); @@ -254,7 +254,7 @@ class TestGraphStar edgesToRemove.push_back(this->graph_.AddEdge(leafIds_[0], leafIds_[2], TEdgeProperties(5) )); this->graph_.AddEdge(leafIds_[1], vertexToRemove, TEdgeProperties{234}); this->graph_.AddEdge(vertexToRemove, leafIds_[2], TEdgeProperties{123}); - for (Types::count i = 0; i < 3; ++i) + for (Types::count i = 0; i < 3; ++i) { TEdgeProperties edgeProperties{i}; edgeIds_.push_back(this->graph_.AddEdge(centerId_, leafIds_[i], edgeProperties)); @@ -263,7 +263,7 @@ class TestGraphStar } // remove edges - for (auto e : edgesToRemove) + for (auto e : edgesToRemove) { this->graph_.RemoveEdgeAt(e); } @@ -286,9 +286,9 @@ using GraphTypes = ::testing::Types< >; template<> -struct FileName> +struct FileName> { - static Types::string Name() + static Types::string Name() { return "StaticGraph.hpp"; } diff --git a/tests/DataStructures/Graphs/TestPowerGrid.cpp b/tests/DataStructures/Graphs/TestPowerGrid.cpp index d799bfcc..e2f98275 100644 --- a/tests/DataStructures/Graphs/TestPowerGrid.cpp +++ b/tests/DataStructures/Graphs/TestPowerGrid.cpp @@ -18,28 +18,28 @@ namespace egoa::test { // *********************************************************************** TEST_F ( TestNetworkEmpty - , BaseMva ) + , BaseMva ) { EXPECT_EQ ( 1, network_.BaseMva() ); EXPECT_EQ ( 1, networkConst_.BaseMva() ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , BaseMva ) + , BaseMva ) { EXPECT_EQ ( 1, network_.BaseMva() ); EXPECT_EQ ( 1, networkConst_.BaseMva() ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , BaseMva ) + , BaseMva ) { EXPECT_EQ ( 1, network_.BaseMva() ); EXPECT_EQ ( 1, networkConst_.BaseMva() ); } TEST_F ( TestPowerGridPyPsaExample - , BaseMva ) + , BaseMva ) { EXPECT_EQ ( 1, network_.BaseMva() ); EXPECT_EQ ( 1, networkConst_.BaseMva() ); @@ -52,19 +52,19 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , ThetaBound ) + , ThetaBound ) { EXPECT_EQ ( -Const::REAL_INFTY, network_.ThetaBound().Minimum() ); EXPECT_EQ ( -Const::REAL_INFTY, networkConst_.ThetaBound().Minimum() ); EXPECT_EQ ( Const::REAL_INFTY, network_.ThetaBound().Maximum() ); EXPECT_EQ ( Const::REAL_INFTY, networkConst_.ThetaBound().Maximum() ); - + EXPECT_TRUE ( Bound<>(-Const::REAL_INFTY,Const::REAL_INFTY) == networkConst_.ThetaBound() ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , ThetaBound ) + , ThetaBound ) { EXPECT_EQ ( -2.61799, round( network_.ThetaBound().Minimum() * 100000 ) / 100000 ); EXPECT_EQ ( -2.61799, round( networkConst_.ThetaBound().Minimum() * 100000 ) / 100000 ); @@ -74,7 +74,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , ThetaBound ) + , ThetaBound ) { EXPECT_EQ ( -2.61799, round( network_.ThetaBound().Minimum() * 100000 ) / 100000 ); EXPECT_EQ ( -2.61799, round( networkConst_.ThetaBound().Minimum() * 100000 ) / 100000 ); @@ -84,7 +84,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , ThetaBound ) + , ThetaBound ) { EXPECT_EQ ( -Const::REAL_INFTY, network_.ThetaBound().Minimum() ); EXPECT_EQ ( -Const::REAL_INFTY, networkConst_.ThetaBound().Minimum() ); @@ -100,28 +100,28 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , GeneratorBoundType ) + , GeneratorBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.GeneratorBoundType() ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.GeneratorBoundType() ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , GeneratorBoundType ) + , GeneratorBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.GeneratorBoundType() ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.GeneratorBoundType() ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , GeneratorBoundType ) + , GeneratorBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.GeneratorBoundType() ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.GeneratorBoundType() ); } TEST_F ( TestPowerGridPyPsaExample - , GeneratorBoundType ) + , GeneratorBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.GeneratorBoundType() ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.GeneratorBoundType() ); @@ -134,28 +134,28 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , LoadBoundType ) + , LoadBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.LoadBoundType() ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.LoadBoundType() ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , LoadBoundType ) + , LoadBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.LoadBoundType() ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.LoadBoundType() ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , LoadBoundType ) + , LoadBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.LoadBoundType() ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.LoadBoundType() ); } TEST_F ( TestPowerGridPyPsaExample - , LoadBoundType ) + , LoadBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.LoadBoundType() ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.LoadBoundType() ); @@ -168,7 +168,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , MakeBounded ) + , MakeBounded ) { network_.MakeBounded (); EXPECT_EQ ( Vertices::BoundType::bounded, network_.GeneratorBoundType() ); @@ -178,7 +178,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , MakeBounded ) + , MakeBounded ) { network_.MakeBounded (); EXPECT_EQ ( Vertices::BoundType::bounded, network_.GeneratorBoundType() ); @@ -188,7 +188,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , MakeBounded ) + , MakeBounded ) { network_.MakeBounded (); EXPECT_EQ ( Vertices::BoundType::bounded, network_.GeneratorBoundType() ); @@ -198,7 +198,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , MakeBounded ) + , MakeBounded ) { network_.MakeBounded (); EXPECT_EQ ( Vertices::BoundType::bounded, network_.GeneratorBoundType() ); @@ -214,7 +214,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , MakeUnbounded ) + , MakeUnbounded ) { network_.MakeUnbounded (); EXPECT_EQ ( Vertices::BoundType::unbounded, network_.GeneratorBoundType() ); @@ -224,7 +224,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , MakeUnbounded ) + , MakeUnbounded ) { network_.MakeUnbounded (); EXPECT_EQ ( Vertices::BoundType::unbounded, network_.GeneratorBoundType() ); @@ -234,7 +234,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , MakeUnbounded ) + , MakeUnbounded ) { network_.MakeUnbounded (); EXPECT_EQ ( Vertices::BoundType::unbounded, network_.GeneratorBoundType() ); @@ -244,7 +244,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , MakeUnbounded ) + , MakeUnbounded ) { network_.MakeUnbounded (); EXPECT_EQ ( Vertices::BoundType::unbounded, network_.GeneratorBoundType() ); @@ -260,7 +260,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , MakePureUnbounded ) + , MakePureUnbounded ) { network_.MakePureUnbounded (); EXPECT_EQ ( Vertices::BoundType::unbounded, network_.GeneratorBoundType() ); @@ -270,7 +270,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , MakePureUnbounded ) + , MakePureUnbounded ) { network_.MakePureUnbounded (); EXPECT_EQ ( Vertices::BoundType::unbounded, network_.GeneratorBoundType() ); @@ -280,7 +280,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , MakePureUnbounded ) + , MakePureUnbounded ) { network_.MakePureUnbounded (); EXPECT_EQ ( Vertices::BoundType::unbounded, network_.GeneratorBoundType() ); @@ -290,7 +290,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , MakePureUnbounded ) + , MakePureUnbounded ) { network_.MakePureUnbounded (); EXPECT_EQ ( Vertices::BoundType::unbounded, network_.GeneratorBoundType() ); @@ -306,7 +306,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , MakeExact ) + , MakeExact ) { network_.MakeExact (); EXPECT_EQ ( Vertices::BoundType::exact, network_.GeneratorBoundType() ); @@ -316,7 +316,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , MakeExact ) + , MakeExact ) { network_.MakeExact (); EXPECT_EQ ( Vertices::BoundType::exact, network_.GeneratorBoundType() ); @@ -326,7 +326,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , MakeExact ) + , MakeExact ) { network_.MakeExact (); EXPECT_EQ ( Vertices::BoundType::exact, network_.GeneratorBoundType() ); @@ -336,7 +336,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , MakeExact ) + , MakeExact ) { network_.MakeExact (); EXPECT_EQ ( Vertices::BoundType::exact, network_.GeneratorBoundType() ); @@ -352,7 +352,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , IsBounded ) + , IsBounded ) { EXPECT_FALSE ( network_.IsBounded () ); EXPECT_FALSE ( networkConst_.IsBounded () ); @@ -362,7 +362,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , IsBounded ) + , IsBounded ) { EXPECT_FALSE ( network_.IsBounded () ); EXPECT_FALSE ( networkConst_.IsBounded () ); @@ -372,7 +372,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , IsBounded ) + , IsBounded ) { EXPECT_FALSE ( network_.IsBounded () ); EXPECT_FALSE ( networkConst_.IsBounded () ); @@ -382,7 +382,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , IsBounded ) + , IsBounded ) { EXPECT_FALSE ( network_.IsBounded () ); EXPECT_FALSE ( networkConst_.IsBounded () ); @@ -398,7 +398,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , IsUnbounded ) + , IsUnbounded ) { EXPECT_FALSE ( network_.IsUnbounded () ); EXPECT_FALSE ( networkConst_.IsUnbounded () ); @@ -411,7 +411,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , IsUnbounded ) + , IsUnbounded ) { EXPECT_FALSE ( network_.IsUnbounded () ); EXPECT_FALSE ( networkConst_.IsUnbounded () ); @@ -424,7 +424,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , IsUnbounded ) + , IsUnbounded ) { EXPECT_FALSE ( network_.IsUnbounded () ); EXPECT_FALSE ( networkConst_.IsUnbounded () ); @@ -437,7 +437,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , IsUnbounded ) + , IsUnbounded ) { EXPECT_FALSE ( network_.IsUnbounded () ); EXPECT_FALSE ( networkConst_.IsUnbounded () ); @@ -456,7 +456,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , IsPureUnbounded ) + , IsPureUnbounded ) { EXPECT_FALSE ( network_.IsPureUnbounded () ); EXPECT_FALSE ( networkConst_.IsPureUnbounded () ); @@ -466,7 +466,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , IsPureUnbounded ) + , IsPureUnbounded ) { EXPECT_FALSE ( network_.IsPureUnbounded () ); EXPECT_FALSE ( networkConst_.IsPureUnbounded () ); @@ -476,7 +476,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , IsPureUnbounded ) + , IsPureUnbounded ) { EXPECT_FALSE ( network_.IsPureUnbounded () ); EXPECT_FALSE ( networkConst_.IsPureUnbounded () ); @@ -486,7 +486,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , IsPureUnbounded ) + , IsPureUnbounded ) { EXPECT_FALSE ( network_.IsPureUnbounded () ); EXPECT_FALSE ( networkConst_.IsPureUnbounded () ); @@ -502,7 +502,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , IsExact ) + , IsExact ) { EXPECT_FALSE ( network_.IsExact () ); EXPECT_FALSE ( networkConst_.IsExact () ); @@ -512,7 +512,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , IsExact ) + , IsExact ) { EXPECT_FALSE ( network_.IsExact () ); EXPECT_FALSE ( networkConst_.IsExact () ); @@ -522,7 +522,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , IsExact ) + , IsExact ) { EXPECT_FALSE ( network_.IsExact () ); EXPECT_FALSE ( networkConst_.IsExact () ); @@ -532,7 +532,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , IsExact ) + , IsExact ) { EXPECT_FALSE ( network_.IsExact () ); EXPECT_FALSE ( networkConst_.IsExact () ); @@ -548,7 +548,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , NetworkBoundType ) + , NetworkBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.NetworkBoundType () ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.NetworkBoundType () ); @@ -567,7 +567,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , NetworkBoundType ) + , NetworkBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.NetworkBoundType () ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.NetworkBoundType () ); @@ -586,7 +586,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , NetworkBoundType ) + , NetworkBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.NetworkBoundType () ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.NetworkBoundType () ); @@ -605,7 +605,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , NetworkBoundType ) + , NetworkBoundType ) { EXPECT_EQ ( Vertices::BoundType::unknown, network_.NetworkBoundType () ); EXPECT_EQ ( Vertices::BoundType::unknown, networkConst_.NetworkBoundType () ); @@ -630,7 +630,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , NetworkType ) + , NetworkType ) { EXPECT_THAT ( "unknown", StrEq( network_.NetworkType () ) ); EXPECT_THAT ( "unknown", StrEq( networkConst_.NetworkType () ) ); @@ -649,7 +649,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , NetworkType ) + , NetworkType ) { EXPECT_THAT ( "unknown", StrEq( network_.NetworkType () ) ); EXPECT_THAT ( "unknown", StrEq( networkConst_.NetworkType () ) ); @@ -668,7 +668,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , NetworkType ) + , NetworkType ) { EXPECT_THAT ( "unknown", StrEq( network_.NetworkType () ) ); EXPECT_THAT ( "unknown", StrEq( networkConst_.NetworkType () ) ); @@ -687,7 +687,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , NetworkType ) + , NetworkType ) { EXPECT_THAT ( "unknown", StrEq( network_.NetworkType () ) ); EXPECT_THAT ( "unknown", StrEq( networkConst_.NetworkType () ) ); @@ -712,11 +712,11 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , AddGeneratorAtUsingVertexId ) + , AddGeneratorAtUsingVertexId ) { TGeneratorProperties generatorProperties; generatorProperties.Name() = "TestGenerator1"; - + auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "AddGeneratorAt" @@ -727,7 +727,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestNetworkEmpty - , AddGeneratorAtUsingVertexId ) + , AddGeneratorAtUsingVertexId ) { TVertexProperties vertex; @@ -755,15 +755,15 @@ TEST_F ( TestNetworkEmpty EXPECT_TRUE ( network_.HasGenerator( generatorId ) ); EXPECT_EQ ( 0, generatorId ); EXPECT_EQ ( 1, network_.NumberOfGenerators() ); - EXPECT_FALSE ( network_.HasGenerator( static_cast(1) ) ); + EXPECT_FALSE ( network_.HasGenerator( static_cast(1) ) ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , AddGeneratorAtUsingVertexId ) + , AddGeneratorAtUsingVertexId ) { EXPECT_TRUE ( network_.HasGeneratorAt( static_cast(0) ) ); EXPECT_FALSE ( network_.HasGeneratorAt( static_cast(2) ) ); - EXPECT_EQ ( 1, network_.NumberOfGenerators() ); + EXPECT_EQ ( 1, network_.NumberOfGenerators() ); TGeneratorProperties generatorProperties; generatorProperties.Name() = "TestGenerator1"; @@ -782,15 +782,15 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a EXPECT_TRUE ( network_.HasGenerator( generatorId2 ) ); EXPECT_EQ ( 2, generatorId2 ); EXPECT_EQ ( 3, network_.NumberOfGenerators() ); - EXPECT_FALSE ( network_.HasGenerator( static_cast(3) ) ); + EXPECT_FALSE ( network_.HasGenerator( static_cast(3) ) ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , AddGeneratorAtUsingVertexId ) + , AddGeneratorAtUsingVertexId ) { EXPECT_TRUE ( network_.HasGeneratorAt( static_cast(0) ) ); EXPECT_FALSE ( network_.HasGeneratorAt( static_cast(2) ) ); - EXPECT_EQ ( 1, network_.NumberOfGenerators() ); + EXPECT_EQ ( 1, network_.NumberOfGenerators() ); TGeneratorProperties generatorProperties; generatorProperties.Name() = "TestGenerator1"; @@ -809,14 +809,14 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b EXPECT_TRUE ( network_.HasGenerator( generatorId2 ) ); EXPECT_EQ ( 2, generatorId2 ); EXPECT_EQ ( 3, network_.NumberOfGenerators() ); - EXPECT_FALSE ( network_.HasGenerator( static_cast(3) ) ); + EXPECT_FALSE ( network_.HasGenerator( static_cast(3) ) ); } TEST_F ( TestPowerGridPyPsaExample - , AddGeneratorAtUsingVertexId ) + , AddGeneratorAtUsingVertexId ) { EXPECT_TRUE ( network_.HasGeneratorAt( static_cast(0) ) ); - EXPECT_EQ ( 23, network_.NumberOfGenerators() ); + EXPECT_EQ ( 23, network_.NumberOfGenerators() ); TGeneratorProperties generatorProperties; generatorProperties.Name() = "TestGenerator1"; @@ -844,10 +844,10 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , AddGeneratorAtUsingVertex ) + , AddGeneratorAtUsingVertex ) { TVertexProperties vertexProperties; - + vertexProperties.Type() = Vertices::to_enum( 99 ); vertexProperties.ShuntConductance() = 0; @@ -877,7 +877,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , AddGeneratorAtUsingVertex ) + , AddGeneratorAtUsingVertex ) { TVertex vertex0 = network_.Graph().VertexAt( static_cast(0) ); TVertex vertex3 = network_.Graph().VertexAt( static_cast(3) ); @@ -885,14 +885,14 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a // Generate generator with default values TGeneratorProperties generatorProperties; generatorProperties.Name() = "TestGenerator1"; - + Types::generatorId generatorId1 = network_.AddGeneratorAt ( vertex0, generatorProperties ); EXPECT_EQ ( 0, network_.Graph().VertexId ( vertex0 ) ); EXPECT_TRUE ( network_.HasGeneratorAt ( vertex0 ) ); EXPECT_TRUE ( network_.HasGenerator( generatorId1 ) ); EXPECT_EQ ( 1, generatorId1 ); - EXPECT_EQ ( 2, network_.NumberOfGenerators() ); + EXPECT_EQ ( 2, network_.NumberOfGenerators() ); Types::generatorId generatorId2 = network_.AddGeneratorAt ( vertex3, generatorProperties ); @@ -905,7 +905,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , AddGeneratorAtUsingVertex ) + , AddGeneratorAtUsingVertex ) { TVertex vertex0 = network_.Graph().VertexAt( static_cast(0) ); TVertex vertex1 = network_.Graph().VertexAt( static_cast(1) ); @@ -918,7 +918,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b EXPECT_TRUE ( network_.HasGeneratorAt ( vertex0 ) ); EXPECT_TRUE ( network_.HasGenerator ( generatorId1 ) ); EXPECT_EQ ( 1, generatorId1 ); - EXPECT_EQ ( 2, network_.NumberOfGenerators() ); + EXPECT_EQ ( 2, network_.NumberOfGenerators() ); Types::generatorId generatorId2 = network_.AddGeneratorAt ( vertex1, generatorProperties ); @@ -931,7 +931,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , AddGeneratorAtUsingVertex ) + , AddGeneratorAtUsingVertex ) { TVertex vertex0 = network_.Graph().VertexAt( static_cast(0) ); TVertex vertex1 = network_.Graph().VertexAt( static_cast(1) ); @@ -944,7 +944,7 @@ TEST_F ( TestPowerGridPyPsaExample EXPECT_TRUE ( network_.HasGeneratorAt ( vertex0 ) ); EXPECT_TRUE ( network_.HasGenerator( generatorId1 ) ); EXPECT_EQ ( 23, generatorId1 ); - EXPECT_EQ ( 24, network_.NumberOfGenerators() ); + EXPECT_EQ ( 24, network_.NumberOfGenerators() ); Types::generatorId generatorId2 = network_.AddGeneratorAt ( vertex1, generatorProperties ); @@ -962,7 +962,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , RemoveGeneratorAtUsingVertexIdGeneratorId ) + , RemoveGeneratorAtUsingVertexIdGeneratorId ) { auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" @@ -978,13 +978,13 @@ TEST_F ( TestNetworkEmptyDeathTest , "HasGeneratorAt" , "Graph\\(\\).VertexExists \\( vertexId \\)"); ASSERT_DEATH ( {network_.HasGeneratorAt ( static_cast(0) );}, assertionString ); - + EXPECT_FALSE ( network_.HasGenerator ( static_cast(0) ) ); EXPECT_EQ ( 0, network_.NumberOfGenerators() ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , RemoveGeneratorAtUsingVertexIdGeneratorId ) + , RemoveGeneratorAtUsingVertexIdGeneratorId ) { EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); EXPECT_TRUE ( network_.HasGenerator ( static_cast(0) ) ); @@ -999,7 +999,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest - , RemoveGeneratorAtUsingVertexIdGeneratorId ) + , RemoveGeneratorAtUsingVertexIdGeneratorId ) { EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); @@ -1032,7 +1032,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , RemoveGeneratorAtUsingVertexIdGeneratorId ) + , RemoveGeneratorAtUsingVertexIdGeneratorId ) { EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); EXPECT_TRUE ( network_.HasGenerator ( static_cast(0) ) ); @@ -1043,11 +1043,11 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(0) ) ); EXPECT_FALSE ( network_.HasGenerator ( static_cast(0) ) ); - EXPECT_EQ ( 0, network_.NumberOfGenerators() ); + EXPECT_EQ ( 0, network_.NumberOfGenerators() ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest - , RemoveGeneratorAtUsingVertexIdGeneratorId ) + , RemoveGeneratorAtUsingVertexIdGeneratorId ) { EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); @@ -1074,7 +1074,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , RemoveGeneratorAtUsingVertexIdGenerator ) + , RemoveGeneratorAtUsingVertexIdGenerator ) { // Generate generator with default values TGeneratorProperties generatorProperties; @@ -1096,13 +1096,13 @@ TEST_F ( TestNetworkEmptyDeathTest , "HasGeneratorAt" , "Graph\\(\\).VertexExists \\( vertexId \\)"); ASSERT_DEATH ( {network_.HasGeneratorAt ( static_cast(0) );}, assertionString ); - + EXPECT_FALSE ( network_.HasGenerator ( generatorProperties ) ); EXPECT_EQ ( 0, network_.NumberOfGenerators() ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , RemoveGeneratorAtUsingVertexIdGenerator ) + , RemoveGeneratorAtUsingVertexIdGenerator ) { TGeneratorProperties & generatorProperties = network_.GeneratorAt( 0 ); @@ -1120,7 +1120,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest - , RemoveGeneratorAtUsingVertexIdGenerator ) + , RemoveGeneratorAtUsingVertexIdGenerator ) { TGeneratorProperties & generatorProperties = network_.GeneratorAt( 0 ); @@ -1150,7 +1150,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest - , RemoveGeneratorAtUsingGeneratorNonExistingVertexId ) + , RemoveGeneratorAtUsingGeneratorNonExistingVertexId ) { TGeneratorProperties & generatorProperties = network_.GeneratorAt( 0 ); @@ -1166,7 +1166,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , RemoveGeneratorAtUsingVertexIdGenerator ) + , RemoveGeneratorAtUsingVertexIdGenerator ) { TGeneratorProperties & generatorProperties = network_.GeneratorAt( 0 ); @@ -1184,7 +1184,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest - , RemoveGeneratorAtUsingVertexIdGenerator ) + , RemoveGeneratorAtUsingVertexIdGenerator ) { TGeneratorProperties & generatorProperties = network_.GeneratorAt( 0 ); @@ -1220,28 +1220,28 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest // *********************************************************************** TEST_F ( TestNetworkEmpty - , HasGenerator ) + , HasGenerator ) { EXPECT_FALSE ( network_.HasGenerator ( static_cast(0) ) ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , HasGenerator ) + , HasGenerator ) { EXPECT_TRUE ( network_.HasGenerator ( static_cast(0) ) ); EXPECT_FALSE ( network_.HasGenerator ( static_cast(1) ) ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , HasGenerator ) + , HasGenerator ) { EXPECT_TRUE ( network_.HasGenerator ( static_cast(0) ) ); EXPECT_FALSE ( network_.HasGenerator ( static_cast(1) ) ); } TEST_F ( TestPowerGridPyPsaExample - , HasGenerator ) -{ + , HasGenerator ) +{ for ( Types::count counter = 0 ; counter < network_.NumberOfGenerators() ; ++counter ) @@ -1252,8 +1252,8 @@ TEST_F ( TestPowerGridPyPsaExample } TEST_F ( TestPowerGridPyPsaExample - , HasGeneratorAfterRemoval ) -{ + , HasGeneratorAfterRemoval ) +{ EXPECT_TRUE ( network_.HasGenerator ( static_cast( 11 ) ) ); network_.RemoveGeneratorAt ( static_cast( 5 ) , static_cast( 11 ) ); @@ -1267,7 +1267,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , HasGeneratorAtVertexId ) + , HasGeneratorAtVertexId ) { auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" @@ -1279,24 +1279,24 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , HasGeneratorAtVertexId ) + , HasGeneratorAtVertexId ) { EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast( 0 ) ) ); EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast( 1 ) ) ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , HasGeneratorAtVertexId ) + , HasGeneratorAtVertexId ) { EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast( 0 ) ) ); EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast( 1 ) ) ); } TEST_F ( TestPowerGridPyPsaExample - , HasGeneratorAtVertexId ) + , HasGeneratorAtVertexId ) { for ( Types::count counter = 0 - ; counter < network_.Graph().NumberOfVertices() + ; counter < network_.Graph().NumberOfVertices() ; ++counter ) { EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast( counter ) ) ); @@ -1304,7 +1304,7 @@ TEST_F ( TestPowerGridPyPsaExample } TEST_F ( TestPowerGridPyPsaExampleDeathTest - , HasGeneratorAtVertexId ) + , HasGeneratorAtVertexId ) { auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" @@ -1322,7 +1322,7 @@ TEST_F ( TestPowerGridPyPsaExampleDeathTest // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , HasGeneratorAtVertexObject ) + , HasGeneratorAtVertexObject ) { auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" @@ -1337,7 +1337,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , HasGeneratorAtVertexObject ) + , HasGeneratorAtVertexObject ) { TVertex vertex0 = network_.Graph().VertexAt( static_cast( 0 ) ); EXPECT_TRUE ( network_.HasGeneratorAt ( vertex0 ) ); @@ -1346,7 +1346,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , HasGeneratorAtVertexObject ) + , HasGeneratorAtVertexObject ) { TVertex vertex0 = network_.Graph().VertexAt( static_cast( 0 ) ); EXPECT_TRUE ( network_.HasGeneratorAt ( vertex0 ) ); @@ -1355,10 +1355,10 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , HasGeneratorAtVertexObject ) + , HasGeneratorAtVertexObject ) { for ( Types::count counter = 0 - ; counter < network_.Graph().NumberOfVertices() + ; counter < network_.Graph().NumberOfVertices() ; ++counter ) { TVertex vertex = network_.Graph().VertexAt( static_cast( counter ) ); @@ -1373,7 +1373,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmpty - , GeneratorId ) + , GeneratorId ) { TGeneratorProperties generatorProperties; @@ -1385,7 +1385,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , GeneratorId ) + , GeneratorId ) { TGeneratorProperties generatorProperties = network_.GeneratorAt ( static_cast( 0 ) ); @@ -1396,13 +1396,13 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a // Find the generator that was extracted from position 0 Types::generatorId generatorId = network_.GeneratorId ( generatorProperties ); - + // That's what we expect EXPECT_EQ ( 0, generatorId ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , GeneratorId ) + , GeneratorId ) { TGeneratorProperties generatorProperties = network_.GeneratorAt ( static_cast( 0 ) ); @@ -1413,7 +1413,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // Find the generator that was extracted from position 0 Types::generatorId generatorId = network_.GeneratorId ( generatorProperties ); - + // That's what we expect EXPECT_EQ ( 0, generatorId ); } @@ -1425,7 +1425,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , GeneratorIds ) + , GeneratorIds ) { std::vector generatorIds; @@ -1439,7 +1439,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , GeneratorIds ) + , GeneratorIds ) { std::vector generatorIds; network_.GeneratorIds ( static_cast(0), generatorIds ); @@ -1449,7 +1449,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , GeneratorIds ) + , GeneratorIds ) { std::vector generatorIds; network_.GeneratorIds ( static_cast(0), generatorIds ); @@ -1459,10 +1459,10 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , GeneratorIds ) + , GeneratorIds ) { std::vector generatorIds; - network_.GeneratorIds ( static_cast(0), generatorIds ); + network_.GeneratorIds ( static_cast(0), generatorIds ); EXPECT_EQ ( 2, generatorIds.size() ); } @@ -1474,7 +1474,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , GeneratorAt ) + , GeneratorAt ) { // Generator does not exist auto assertionString = buildAssertionString ( "PowerGrid.hpp" @@ -1486,26 +1486,26 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , GeneratorAt ) + , GeneratorAt ) { TGeneratorProperties & generatorProperties = network_.GeneratorAt( static_cast(0) ); - + GeneratorComplyInitialValues ( generatorProperties ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , GeneratorAt ) + , GeneratorAt ) { TGeneratorProperties & generatorProperties = network_.GeneratorAt( static_cast(0) ); - + GeneratorComplyInitialValues ( generatorProperties ); } TEST_F ( TestPowerGridPyPsaExample - , GeneratorAt ) + , GeneratorAt ) { TGeneratorProperties & generatorProperties = network_.GeneratorAt( static_cast(0) ); - + GeneratorComplyInitialValues ( generatorProperties ); } @@ -1516,7 +1516,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , GeneratorsAtUsingVertexId ) + , GeneratorsAtUsingVertexId ) { std::vector generators; @@ -1530,7 +1530,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , GeneratorsAtUsingVertexId ) + , GeneratorsAtUsingVertexId ) { std::vector generatorProperties; network_.GeneratorsAt ( static_cast(0) @@ -1542,7 +1542,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a // Clear vector generatorProperties.clear(); EXPECT_EQ ( 0, generatorProperties.size() ); - + // Check number of generators at vertex identifier 1 network_.GeneratorsAt ( static_cast(1) , generatorProperties ); @@ -1550,7 +1550,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , GeneratorsAtUsingVertexId ) + , GeneratorsAtUsingVertexId ) { std::vector generatorProperties; network_.GeneratorsAt ( static_cast(0) @@ -1562,7 +1562,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // Clear vector generatorProperties.clear(); EXPECT_EQ ( 0, generatorProperties.size() ); - + // Check number of generators at vertex identifier 1 network_.GeneratorsAt ( static_cast(1) , generatorProperties ); @@ -1570,7 +1570,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , GeneratorsAtUsingVertexId ) + , GeneratorsAtUsingVertexId ) { std::vector generatorProperties; network_.GeneratorsAt ( static_cast(0) @@ -1582,7 +1582,7 @@ TEST_F ( TestPowerGridPyPsaExample // Clear vector generatorProperties.clear(); EXPECT_EQ ( 0, generatorProperties.size() ); - + // Check number of generators at vertex identifier 1 network_.GeneratorsAt ( static_cast(7) , generatorProperties ); @@ -1596,10 +1596,10 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , GeneratorsAtUsingVertexObject ) + , GeneratorsAtUsingVertexObject ) { std::vector generatorProperties; - + TVertexProperties vertexProperties; TVertex vertex0 ( 9999, vertexProperties ); @@ -1613,7 +1613,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , GeneratorsAtUsingVertexObject ) + , GeneratorsAtUsingVertexObject ) { std::vector generatorProperties; @@ -1628,14 +1628,14 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a // Clear vector generatorProperties.clear(); EXPECT_EQ ( 0, generatorProperties.size() ); - + // Check number of generators at vertex identifier 1 network_.GeneratorsAt( vertex1, generatorProperties ); EXPECT_EQ ( 0, generatorProperties.size() ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , GeneratorsAtUsingVertexObject ) + , GeneratorsAtUsingVertexObject ) { std::vector generatorPropertiesS; @@ -1661,14 +1661,14 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // Clear vector generatorPropertiesS.clear(); EXPECT_EQ ( 0, generatorPropertiesS.size() ); - + // Check number of generators at vertex identifier 1 network_.GeneratorsAt( vertex1, generatorPropertiesS ); EXPECT_EQ ( 0, generatorPropertiesS.size() ); } TEST_F ( TestPowerGridPyPsaExample - , GeneratorsAtUsingVertexObject ) + , GeneratorsAtUsingVertexObject ) { std::vector generatorPropertiesS; @@ -1695,7 +1695,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , FindGenerator ) + , FindGenerator ) { TGeneratorProperties generatorProperties; std::vector generators; @@ -1705,7 +1705,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , FindGenerator ) + , FindGenerator ) { TGeneratorProperties generatorProperties = network_.GeneratorAt ( static_cast(0) ); std::vector generators; @@ -1720,13 +1720,13 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a // Find the generator that was extracted from position 0 Types::generatorId generatorId = network_.FindGenerator ( generatorProperties, generators ); - + // That's what we expect EXPECT_EQ ( 0, generatorId ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , FindGenerator ) + , FindGenerator ) { TGeneratorProperties generatorProperties = network_.GeneratorAt ( static_cast(0) ); std::vector generatorPropertiesS; @@ -1742,13 +1742,13 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // Find the generator that was extracted from position 0 Types::generatorId generatorId = network_.FindGenerator ( generatorProperties , generatorPropertiesS ); - + // That's what we expect EXPECT_EQ ( 0, generatorId ); } TEST_F ( TestPowerGridPyPsaExample - , FindGenerator ) + , FindGenerator ) { TGeneratorProperties generatorProperties = network_.GeneratorAt ( static_cast(15) ); std::vector generatorPropertiesS; @@ -1760,7 +1760,7 @@ TEST_F ( TestPowerGridPyPsaExample // Find the generator that was extracted from position 0 Types::generatorId generatorId = network_.FindGenerator ( generatorProperties , generatorPropertiesS ); - + // That's what we expect: Field 0 of the vector at vertex 7 EXPECT_EQ ( 0, generatorId ); } @@ -1772,7 +1772,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , TotalRealPowerGenerationBoundAt ) + , TotalRealPowerGenerationBoundAt ) { auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" @@ -1784,7 +1784,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalRealPowerGenerationBoundAtBounded ) + , TotalRealPowerGenerationBoundAtBounded ) { // Bounded network_.MakeBounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); @@ -1796,7 +1796,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalRealPowerGenerationBoundAtBoundedHasNoGenerator ) + , TotalRealPowerGenerationBoundAtBoundedHasNoGenerator ) { // Bounded with no generator at that vertex network_.MakeBounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); @@ -1808,7 +1808,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalRealPowerGenerationBoundAtUnbounded ) + , TotalRealPowerGenerationBoundAtUnbounded ) { // Unbounded network_.MakeUnbounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); @@ -1820,7 +1820,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalRealPowerGenerationBoundAtUnboundedHasNoGenerator ) + , TotalRealPowerGenerationBoundAtUnboundedHasNoGenerator ) { // Unbounded with no generator at that vertex network_.MakeUnbounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); @@ -1832,7 +1832,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalRealPowerGenerationBoundAtPureUnbounded ) + , TotalRealPowerGenerationBoundAtPureUnbounded ) { // PureUnbounded network_.MakePureUnbounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); @@ -1844,7 +1844,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalRealPowerGenerationBoundAtPureUnboundedHasNoGenerator ) + , TotalRealPowerGenerationBoundAtPureUnboundedHasNoGenerator ) { // Pure unbounded with no generator at that vertex network_.MakePureUnbounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); @@ -1856,7 +1856,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalRealPowerGenerationBoundAtExact ) + , TotalRealPowerGenerationBoundAtExact ) { // Exact network_.MakeExact (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); @@ -1868,7 +1868,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalRealPowerGenerationBoundAtExactHasNoGenerator ) + , TotalRealPowerGenerationBoundAtExactHasNoGenerator ) { // Exact with no generator at that vertex network_.MakeExact (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); @@ -1880,7 +1880,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalRealPowerGenerationBoundAtBounded ) + , TotalRealPowerGenerationBoundAtBounded ) { // Bounded network_.MakeBounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); @@ -1892,7 +1892,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalRealPowerGenerationBoundAtBoundedHasNoGenerator ) + , TotalRealPowerGenerationBoundAtBoundedHasNoGenerator ) { // Bounded with no generator at that vertex network_.MakeBounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); @@ -1904,7 +1904,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalRealPowerGenerationBoundAtUnbounded ) + , TotalRealPowerGenerationBoundAtUnbounded ) { // Unbounded network_.MakeUnbounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); @@ -1916,7 +1916,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalRealPowerGenerationBoundAtUnboundedHasNoGenerator ) + , TotalRealPowerGenerationBoundAtUnboundedHasNoGenerator ) { // Unbounded with no generator at that vertex network_.MakeUnbounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); @@ -1928,7 +1928,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalRealPowerGenerationBoundAtPureUnbounded ) + , TotalRealPowerGenerationBoundAtPureUnbounded ) { // PureUnbounded network_.MakePureUnbounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); @@ -1940,7 +1940,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalRealPowerGenerationBoundAtPureUnboundedHasNoGenerator ) + , TotalRealPowerGenerationBoundAtPureUnboundedHasNoGenerator ) { // Pure unbounded with no generator at that vertex network_.MakePureUnbounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); @@ -1951,7 +1951,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b EXPECT_EQ ( 0.0, bound.Maximum() ); } -TEST_F ( TestPowerGridAcm2018MtsfFigure4b, TotalRealPowerGenerationBoundAtExact ) +TEST_F ( TestPowerGridAcm2018MtsfFigure4b, TotalRealPowerGenerationBoundAtExact ) { // Exact network_.MakeExact (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); @@ -1963,7 +1963,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b, TotalRealPowerGenerationBoundAtExact } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalRealPowerGenerationBoundAtExactHasNoGenerator ) + , TotalRealPowerGenerationBoundAtExactHasNoGenerator ) { // Exact with no generator at that vertex network_.MakeExact (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); @@ -1975,7 +1975,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , TotalRealPowerGenerationBoundAtBounded ) + , TotalRealPowerGenerationBoundAtBounded ) { // Bounded network_.MakeBounded (); TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(7) @@ -1994,7 +1994,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , TotalRealPowerGenerationAt ) + , TotalRealPowerGenerationAt ) { auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" @@ -2006,8 +2006,8 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest - , TotalRealPowerGenerationAtNonExistingVertex ) -{ + , TotalRealPowerGenerationAtNonExistingVertex ) +{ auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "TotalRealPowerGenerationAt" @@ -2018,8 +2018,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalRealPowerGenerationAtWithVertexThatHasNoGenerator ) -{ + , TotalRealPowerGenerationAtWithVertexThatHasNoGenerator ) +{ Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(1) ); EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); @@ -2028,8 +2028,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalRealPowerGenerationAt ) -{ + , TotalRealPowerGenerationAt ) +{ Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(0) ); EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); @@ -2038,20 +2038,20 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest - , TotalRealPowerGenerationAtNonExistingVertex ) -{ + , TotalRealPowerGenerationAtNonExistingVertex ) +{ auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "TotalRealPowerGenerationAt" , "Graph\\(\\).VertexExists \\( vertexId \\)"); - + ASSERT_DEATH ( {network_.TotalRealPowerGenerationAt ( static_cast(9) );} , assertionString ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalRealPowerGenerationAtWithVertexThatHasNoGenerator ) -{ + , TotalRealPowerGenerationAtWithVertexThatHasNoGenerator ) +{ Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(1) ); EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); @@ -2060,8 +2060,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalRealPowerGenerationAt ) -{ + , TotalRealPowerGenerationAt ) +{ Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(0) ); EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); @@ -2070,8 +2070,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , TotalRealPowerGenerationAt ) -{ + , TotalRealPowerGenerationAt ) +{ Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(0) , static_cast(0) ); @@ -2095,7 +2095,7 @@ TEST_F ( TestPowerGridPyPsaExample , static_cast(6) ); EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(7) ) ); // Test the total real power generation - EXPECT_EQ ( 5280.0, value ); + EXPECT_EQ ( 5280.0, value ); } @@ -2106,7 +2106,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , TotalReactivePowerGenerationBoundAt ) + , TotalReactivePowerGenerationBoundAt ) { auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" @@ -2118,7 +2118,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalReactivePowerGenerationBoundAtBounded ) + , TotalReactivePowerGenerationBoundAtBounded ) { // Bounded network_.MakeBounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); @@ -2130,7 +2130,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalReactivePowerGenerationBoundAtBoundedHasNoGenerator ) + , TotalReactivePowerGenerationBoundAtBoundedHasNoGenerator ) { // Bounded with no generator at that vertex network_.MakeBounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); @@ -2142,7 +2142,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalReactivePowerGenerationBoundAtUnbounded ) + , TotalReactivePowerGenerationBoundAtUnbounded ) { // Unbounded network_.MakeUnbounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); @@ -2154,7 +2154,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalReactivePowerGenerationBoundAtUnboundedHasNoGenerator ) + , TotalReactivePowerGenerationBoundAtUnboundedHasNoGenerator ) { // Unbounded with no generator at that vertex network_.MakeUnbounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); @@ -2166,7 +2166,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalReactivePowerGenerationBoundAtPureUnbounded ) + , TotalReactivePowerGenerationBoundAtPureUnbounded ) { // PureUnbounded network_.MakePureUnbounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); @@ -2178,7 +2178,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalReactivePowerGenerationBoundAtPureUnboundedHasNoGenerator ) + , TotalReactivePowerGenerationBoundAtPureUnboundedHasNoGenerator ) { // Pure unbounded with no generator at that vertex network_.MakePureUnbounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); @@ -2190,7 +2190,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalReactivePowerGenerationBoundAtExact ) + , TotalReactivePowerGenerationBoundAtExact ) { // Exact network_.MakeExact (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); @@ -2202,7 +2202,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalReactivePowerGenerationBoundAtExactHasNoGenerator ) + , TotalReactivePowerGenerationBoundAtExactHasNoGenerator ) { // Exact with no generator at that vertex network_.MakeExact (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); @@ -2214,7 +2214,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalReactivePowerGenerationBoundAtBounded ) + , TotalReactivePowerGenerationBoundAtBounded ) { // Bounded network_.MakeBounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); @@ -2226,7 +2226,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalReactivePowerGenerationBoundAtBoundedHasNoGenerator ) + , TotalReactivePowerGenerationBoundAtBoundedHasNoGenerator ) { // Bounded with no generator at that vertex network_.MakeBounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); @@ -2238,7 +2238,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalReactivePowerGenerationBoundAtUnbounded ) + , TotalReactivePowerGenerationBoundAtUnbounded ) { // Unbounded network_.MakeUnbounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); @@ -2250,7 +2250,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalReactivePowerGenerationBoundAtUnboundedHasNoGenerator ) + , TotalReactivePowerGenerationBoundAtUnboundedHasNoGenerator ) { // Unbounded with no generator at that vertex network_.MakeUnbounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); @@ -2262,7 +2262,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalReactivePowerGenerationBoundAtPureUnbounded ) + , TotalReactivePowerGenerationBoundAtPureUnbounded ) { // PureUnbounded network_.MakePureUnbounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); @@ -2274,7 +2274,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalReactivePowerGenerationBoundAtPureUnboundedHasNoGenerator ) + , TotalReactivePowerGenerationBoundAtPureUnboundedHasNoGenerator ) { // Pure unbounded with no generator at that vertex network_.MakePureUnbounded (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); @@ -2286,7 +2286,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalReactivePowerGenerationBoundAtExact ) + , TotalReactivePowerGenerationBoundAtExact ) { // Exact network_.MakeExact (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); @@ -2298,7 +2298,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalReactivePowerGenerationBoundAtExactHasNoGenerator ) + , TotalReactivePowerGenerationBoundAtExactHasNoGenerator ) { // Exact with no generator at that vertex network_.MakeExact (); TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); @@ -2316,7 +2316,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , TotalReactivePowerGenerationAt ) + , TotalReactivePowerGenerationAt ) { auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" @@ -2328,8 +2328,8 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest - , TotalReactivePowerGenerationAtNonExistingVertex ) -{ + , TotalReactivePowerGenerationAtNonExistingVertex ) +{ auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "TotalReactivePowerGenerationAt" @@ -2340,8 +2340,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalReactivePowerGenerationAtWithVertexThatHasNoGenerator ) -{ + , TotalReactivePowerGenerationAtWithVertexThatHasNoGenerator ) +{ Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(1) ); EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); @@ -2350,8 +2350,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalReactivePowerGenerationAt ) -{ + , TotalReactivePowerGenerationAt ) +{ Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(0) ); EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); @@ -2360,20 +2360,20 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest - , TotalReactivePowerGenerationAtNonExistingVertex ) -{ + , TotalReactivePowerGenerationAtNonExistingVertex ) +{ auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "TotalReactivePowerGenerationAt" , "Graph\\(\\).VertexExists \\( vertexId \\)"); - + ASSERT_DEATH ( {network_.TotalReactivePowerGenerationAt ( static_cast(9) );} , assertionString ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalReactivePowerGenerationAtWithVertexThatHasNoGenerator ) -{ + , TotalReactivePowerGenerationAtWithVertexThatHasNoGenerator ) +{ Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(1) ); EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); @@ -2382,8 +2382,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalReactivePowerGenerationAt ) -{ + , TotalReactivePowerGenerationAt ) +{ Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(0) ); EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); @@ -2392,8 +2392,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b } TEST_F ( TestPowerGridPyPsaExample - , TotalReactivePowerGenerationAt ) -{ + , TotalReactivePowerGenerationAt ) +{ Types::real value = network_.TotalReactivePowerGenerationAt< Vertices::GenerationStrategyDifferentiationType ::totalVertexPowerGenerationPerSnapshot > ( static_cast( 0 ) ); @@ -2410,7 +2410,7 @@ TEST_F ( TestPowerGridPyPsaExample // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , AddLoadAtUsingVertexId ) + , AddLoadAtUsingVertexId ) { TLoadProperties loadProperties; @@ -2424,7 +2424,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestNetworkEmpty - , AddLoadAtUsingVertexId ) + , AddLoadAtUsingVertexId ) { // Add vertex TVertexProperties vertexProperties; @@ -2446,8 +2446,8 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest - , AddLoadAtUsingVertexIdNonExistingVertexId ) -{ + , AddLoadAtUsingVertexIdNonExistingVertexId ) +{ TLoadProperties loadProperties; auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" @@ -2459,8 +2459,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , AddLoadAtUsingVertexId ) -{ + , AddLoadAtUsingVertexId ) +{ Types::vertexId vertexId = static_cast(2); EXPECT_EQ ( 1, network_.NumberOfLoads() ); EXPECT_FALSE ( network_.HasLoadAt ( vertexId ) ); @@ -2477,8 +2477,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , AddLoadAtUsingVertexId ) -{ + , AddLoadAtUsingVertexId ) +{ Types::vertexId vertexId = static_cast(1); EXPECT_EQ ( 1, network_.NumberOfLoads() ); EXPECT_FALSE ( network_.HasLoadAt ( vertexId ) ); @@ -2505,7 +2505,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , AddLoadAtVertexObject ) + , AddLoadAtVertexObject ) { TLoadProperties loadProperties; TVertexProperties vertexProperties; @@ -2521,7 +2521,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestNetworkEmpty - , AddLoadAtVertexObject ) + , AddLoadAtVertexObject ) { TVertexProperties vertexProperties; Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); @@ -2545,8 +2545,8 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , AddLoadAtVertexObject ) -{ + , AddLoadAtVertexObject ) +{ TVertex vertex = network_.Graph().VertexAt ( static_cast(2) ); EXPECT_FALSE ( network_.HasLoadAt ( vertex ) ); @@ -2578,8 +2578,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , AddLoadAtVertexObject ) -{ + , AddLoadAtVertexObject ) +{ TVertex vertex = network_.Graph().VertexAt ( static_cast(1) ); EXPECT_FALSE ( network_.HasLoadAt ( vertex ) ); @@ -2621,7 +2621,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , RemoveLoadAtUsingVertexIdLoadId ) + , RemoveLoadAtUsingVertexIdLoadId ) { EXPECT_EQ ( 0, network_.NumberOfLoads() ); auto assertionString = buildAssertionString ( "PowerGrid.hpp" @@ -2638,24 +2638,24 @@ TEST_F ( TestNetworkEmptyDeathTest , "HasLoadAt" , "Graph\\(\\).VertexExists \\( vertexId \\)"); ASSERT_DEATH ( {network_.HasLoadAt ( static_cast(0) );}, assertionString ); - + EXPECT_FALSE ( network_.HasLoad ( static_cast(0) ) ); EXPECT_EQ ( 0, network_.NumberOfLoads() ); } TEST_F ( TestNetworkEmptyDeathTest - , RemoveLoadAtUsingVertexIdWhereLoadIdDoesNotExists ) + , RemoveLoadAtUsingVertexIdWhereLoadIdDoesNotExists ) { TVertexProperties vertexProperties; Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); TVertex const & vertex = network_.Graph().VertexAt ( vertexId ); - + EXPECT_EQ ( 0, network_.NumberOfLoads() ); auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "RemoveLoadAt" - , "HasLoad \\( loadId \\)"); + , "HasLoad \\( loadId \\)"); ASSERT_DEATH ( {network_.RemoveLoadAt ( vertexId , static_cast(0) );} @@ -2664,7 +2664,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestNetworkEmptyDeathTest - , RemoveLoadAtUsingVertexIdLoadIdAddingAndRemovingMultipleLoads ) + , RemoveLoadAtUsingVertexIdLoadIdAddingAndRemovingMultipleLoads ) { TVertexProperties vertexProperties; TLoadProperties loadProperties; @@ -2716,14 +2716,14 @@ TEST_F ( TestNetworkEmptyDeathTest // *********************************************************************** TEST_F ( TestNetworkEmpty - , HasLoadId ) + , HasLoadId ) { EXPECT_FALSE ( network_.HasLoad ( static_cast(0) ) ); EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(0) ) ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , HasLoadId ) + , HasLoadId ) { // Checks loadId EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); @@ -2742,7 +2742,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , HasLoadId ) + , HasLoadId ) { // Checks loadId EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); @@ -2767,7 +2767,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmpty - , HasLoadObject ) + , HasLoadObject ) { TLoadProperties loadProperties; EXPECT_FALSE ( network_.HasLoad ( loadProperties ) ); @@ -2775,7 +2775,7 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , HasLoadObject ) + , HasLoadObject ) { // Checks loadObject TLoadProperties loadProperties0; EXPECT_FALSE ( network_.HasLoad ( loadProperties0 ) ); @@ -2789,7 +2789,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , HasLoadObject ) + , HasLoadObject ) { // Checks loadObject TLoadProperties loadProperties0; EXPECT_FALSE ( network_.HasLoad ( loadProperties0 ) ); @@ -2797,7 +2797,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); - + TLoadProperties loadProperties1 = network_.LoadAt( 0 ); EXPECT_TRUE ( network_.HasLoad ( loadProperties1 ) ); EXPECT_TRUE ( networkConst_.HasLoad ( loadProperties1 ) ); @@ -2810,13 +2810,13 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , HasLoadAt ) + , HasLoadAt ) { // Checks if there is a load at a vertex auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "HasLoadAt" - , "Graph\\(\\).VertexExists \\( vertexId \\)"); + , "Graph\\(\\).VertexExists \\( vertexId \\)"); ASSERT_DEATH ( {network_.HasLoadAt ( static_cast(0) );} , assertionString ); @@ -2825,7 +2825,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , HasLoadAt ) + , HasLoadAt ) { // Checks if there is a load at a vertex EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(0) ) ); @@ -2841,17 +2841,17 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , HasLoadAt ) + , HasLoadAt ) { // Checks if there is a load at a vertex EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(0) ) ); EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(1) ) ); - + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(2) ) ); EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(2) ) ); - + EXPECT_TRUE ( network_.HasLoadAt ( static_cast(3) ) ); EXPECT_TRUE ( networkConst_.HasLoadAt ( static_cast(3) ) ); } @@ -2863,7 +2863,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , LoadId ) + , LoadId ) { // Checks if there is a load at a vertex TLoadProperties loadProperties0; @@ -2873,7 +2873,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , LoadId ) + , LoadId ) { // Checks if there is a load at a vertex TLoadProperties loadProperties0; EXPECT_EQ ( Const::NONE, network_.LoadId ( loadProperties0 ) ); @@ -2881,7 +2881,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); - + TLoadProperties loadProperties1 = network_.LoadAt( 0 ); EXPECT_EQ ( 0, network_.LoadId ( loadProperties1 ) ); @@ -2890,7 +2890,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , LoadId ) + , LoadId ) { // Checks if there is a load at a vertex TLoadProperties loadProperties0; EXPECT_EQ ( Const::NONE, network_.LoadId ( loadProperties0 ) ); @@ -2898,7 +2898,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); - + TLoadProperties loadProperties1 = network_.LoadAt( 0 ); EXPECT_EQ ( 0, network_.LoadId ( loadProperties1 ) ); @@ -2913,7 +2913,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , LoadIds ) + , LoadIds ) { // Checks if there is a load at a vertex TLoadProperties loadProperties0; @@ -2922,7 +2922,7 @@ TEST_F ( TestNetworkEmptyDeathTest auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "LoadIds" - , "Graph\\(\\).VertexExists\\( vertexId \\)"); + , "Graph\\(\\).VertexExists\\( vertexId \\)"); ASSERT_DEATH ( {network_.LoadIds ( static_cast( 0 ), loadIds );} , assertionString ); @@ -2931,11 +2931,11 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , LoadIds ) + , LoadIds ) { // Checks if there is a load at a vertex TLoadProperties loadProperties0; std::vector loadIds; - + network_.LoadIds ( static_cast( 0 ), loadIds ); EXPECT_EQ ( 0, loadIds.size() ); networkConst_.LoadIds ( static_cast( 0 ), loadIds ); @@ -2959,11 +2959,11 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , LoadIds ) + , LoadIds ) { // Checks if there is a load at a vertex TLoadProperties loadProperties0; std::vector loadIds; - + network_.LoadIds ( static_cast( 0 ), loadIds ); EXPECT_EQ ( 0, loadIds.size() ); networkConst_.LoadIds ( static_cast( 0 ), loadIds ); @@ -2993,12 +2993,12 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , LoadAt ) + , LoadAt ) { // Checks if there is a load at a load ID auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "LoadAt" - , "HasLoad \\( loadId \\)"); + , "HasLoad \\( loadId \\)"); ASSERT_DEATH ( {network_.LoadAt ( static_cast( 0 ) );} , assertionString ); @@ -3007,12 +3007,12 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest - , LoadAt ) + , LoadAt ) { // Checks if there is a load at a load ID and returns the property auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "LoadAt" - , "HasLoad \\( loadId \\)"); + , "HasLoad \\( loadId \\)"); ASSERT_DEATH ( {network_.LoadAt ( static_cast( 3 ) );} , assertionString ); @@ -3021,7 +3021,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , LoadAt ) + , LoadAt ) { // Checks if there is a load at a load ID and returns the property TLoadProperties loadProperties0 = network_.LoadAt ( static_cast( 0 ) ); @@ -3047,12 +3047,12 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest - , LoadAt ) + , LoadAt ) { // Checks if there is a load at a load ID and returns the property auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "LoadAt" - , "HasLoad \\( loadId \\)"); + , "HasLoad \\( loadId \\)"); ASSERT_DEATH ( {network_.LoadAt ( static_cast( 3 ) );} , assertionString ); @@ -3061,7 +3061,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , LoadAt ) + , LoadAt ) { // Checks if there is a load at a load ID and returns the property TLoadProperties loadProperties0 = network_.LoadAt ( static_cast( 0 ) ); @@ -3093,12 +3093,12 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , LoadsAtVertexId ) + , LoadsAtVertexId ) { // Return load properties at a vertex ID auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "LoadsAt" - , "Graph\\(\\).VertexExists\\( vertexId \\)"); + , "Graph\\(\\).VertexExists\\( vertexId \\)"); std::vector loads; ASSERT_DEATH ( {network_.LoadsAt ( static_cast( 0 ), loads );} @@ -3109,7 +3109,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , LoadsAtVertexId ) + , LoadsAtVertexId ) { // Return load properties at a vertex ID std::vector multipleLoadProperties; @@ -3155,7 +3155,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , LoadsAtVertexId ) + , LoadsAtVertexId ) { // Return load properties at a vertex ID std::vector multipleLoadProperties; @@ -3207,12 +3207,12 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , LoadsAtVertex ) + , LoadsAtVertex ) { // Return load properties at a vertex ID auto assertionString = buildAssertionString ( "StaticGraph.hpp" , "StaticGraph" , "VertexAt" - , "VertexExists\\(id\\)"); + , "VertexExists\\(id\\)"); std::vector loads; ASSERT_DEATH ( {network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 0 ) ), loads );} @@ -3222,7 +3222,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , LoadsAtVertex ) + , LoadsAtVertex ) { // Return load properties at a vertex ID std::vector multipleLoadProperties; @@ -3268,7 +3268,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , LoadsAtVertex ) + , LoadsAtVertex ) { // Return load properties at a vertex ID std::vector multipleLoadProperties; @@ -3286,7 +3286,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b EXPECT_EQ ( 0, multipleLoadProperties.size() ); networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 2 ) ), multipleLoadProperties ); EXPECT_EQ ( 0, multipleLoadProperties.size() ); - + network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 3 ) ), multipleLoadProperties ); EXPECT_EQ ( 1, multipleLoadProperties.size() ); EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); @@ -3319,12 +3319,12 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , RealPowerLoadAt ) + , RealPowerLoadAt ) { // Total real power load for a snapshot (here 0 implicitly) for a vertexId auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "RealPowerLoadAt" - , "Graph\\(\\).VertexExists\\( vertexId \\)"); + , "Graph\\(\\).VertexExists\\( vertexId \\)"); ASSERT_DEATH ( {network_.RealPowerLoadAt ( static_cast( 0 ) );} , assertionString ); @@ -3333,10 +3333,10 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , RealPowerLoadAt ) + , RealPowerLoadAt ) { // Total real power load for a snapshot (here 0) for a vertexId Types::index snapshotId = 0; - + Types::real result = network_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); EXPECT_EQ ( 8.0 , result ); result = networkConst_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); @@ -3348,10 +3348,10 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , RealPowerLoadAt ) + , RealPowerLoadAt ) { // Total real power load for a snapshot (here 0) for a vertexId Types::index snapshotId = 0; - + Types::real result = network_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); EXPECT_EQ ( 5.0 , result ); result = networkConst_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); @@ -3369,12 +3369,12 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , RealPowerLoadAtVertexObject ) + , RealPowerLoadAtVertexObject ) { // Total real power load for a snapshot (here 0 implicitly) for a vertexId auto assertionString = buildAssertionString ( "StaticGraph.hpp" , "StaticGraph" , "VertexAt" - , "VertexExists\\(id\\)"); + , "VertexExists\\(id\\)"); ASSERT_DEATH ( {network_.RealPowerLoadAt ( network_.Graph().VertexAt( static_cast( 0 ) ) );} , assertionString ); @@ -3383,10 +3383,10 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , RealPowerLoadAtVertexObject ) + , RealPowerLoadAtVertexObject ) { // Total real power load for a snapshot (here 0) for a vertexId Types::index snapshotId = 0; - + Types::real result = network_.RealPowerLoadAt( network_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); EXPECT_EQ ( 8.0 , result ); result = networkConst_.RealPowerLoadAt( networkConst_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); @@ -3398,10 +3398,10 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , RealPowerLoadAtVertexObject ) + , RealPowerLoadAtVertexObject ) { // Total real power load for a snapshot (here 0) for a vertexId Types::index snapshotId = 0; - + Types::real result = network_.RealPowerLoadAt( network_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); EXPECT_EQ ( 5.0 , result ); result = networkConst_.RealPowerLoadAt( networkConst_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); @@ -3419,12 +3419,12 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , TotalRealPowerLoadBoundAt ) + , TotalRealPowerLoadBoundAt ) { // Total real power load for a snapshot (here 0 implicitly) for a vertexId auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "TotalRealPowerLoadBoundAt" - , "Graph\\(\\).VertexExists \\( vertexId \\)"); + , "Graph\\(\\).VertexExists \\( vertexId \\)"); ASSERT_DEATH ( {network_.TotalRealPowerLoadBoundAt ( static_cast( 0 ) );} , assertionString ); @@ -3433,7 +3433,7 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , TotalRealPowerLoadBoundAt ) + , TotalRealPowerLoadBoundAt ) { // Total real power load for a snapshot (here 0) for a vertexId network_.MakePureUnbounded (); TBound bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); @@ -3469,7 +3469,7 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , TotalRealPowerLoadBoundAt ) + , TotalRealPowerLoadBoundAt ) { // Total real power load for a snapshot (here 0) for a vertexId network_.MakePureUnbounded (); TBound bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); @@ -3511,10 +3511,10 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , AddGeneratorRealPowerSnapshotAt ) + , AddGeneratorRealPowerSnapshotAt ) { // Add generator snapshot (real power) TGeneratorProperties generatorProperties; - + CreateExampleGeneratorProperties( generatorProperties ); auto assertionString = buildAssertionString ( "PowerGrid.hpp" @@ -3535,15 +3535,15 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , AddGeneratorRealPowerSnapshotAt ) + , AddGeneratorRealPowerSnapshotAt ) { // Add generator snapshot (real power) TGeneratorProperties generatorProperties; - + CreateExampleGeneratorProperties( generatorProperties ); EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(2) ) ); - + Types::generatorId generatorId = network_.AddGeneratorAt(static_cast(2), generatorProperties); - + network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() ); EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(2) ) ); @@ -3554,10 +3554,10 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a generatorProperties = generatorsAtVertex[0]; } EXPECT_EQ ( 1, generatorsAtVertex.size() ); - + CheckExampleGeneratorProperties ( generatorProperties ); generatorsAtVertex.clear(); - + network_.GeneratorsAt ( static_cast(2), generatorsAtVertex ); if ( !generatorsAtVertex.empty() ) { @@ -3568,15 +3568,15 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , AddGeneratorRealPowerSnapshotAt ) + , AddGeneratorRealPowerSnapshotAt ) { // Add generator snapshot (real power) TGeneratorProperties generatorProperties; - + CreateExampleGeneratorProperties( generatorProperties ); EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); - + Types::generatorId generatorId = network_.AddGeneratorAt(static_cast(1), generatorProperties); - + network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() ); network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() ); EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(1) ) ); @@ -3588,10 +3588,10 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b generatorProperties = generatorsAtVertex[0]; } EXPECT_EQ ( 1, generatorsAtVertex.size() ); - + CheckExampleGeneratorProperties ( generatorProperties ); generatorsAtVertex.clear(); - + network_.GeneratorsAt ( static_cast(1), generatorsAtVertex ); if ( !generatorsAtVertex.empty() ) { @@ -3611,20 +3611,20 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmpty - , UpdateGeneratorSnapshotSize ) -{ + , UpdateGeneratorSnapshotSize ) +{ network_.UpdateGeneratorSnapshotSize(); } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , UpdateGeneratorSnapshotSize ) -{ - network_.UpdateGeneratorSnapshotSize(); + , UpdateGeneratorSnapshotSize ) +{ + network_.UpdateGeneratorSnapshotSize(); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , UpdateGeneratorSnapshotSize ) -{ + , UpdateGeneratorSnapshotSize ) +{ network_.UpdateGeneratorSnapshotSize(); } @@ -3635,20 +3635,20 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmpty - , UpdateLoadSnapshotSize ) -{ + , UpdateLoadSnapshotSize ) +{ network_.UpdateLoadSnapshotSize(); } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , UpdateLoadSnapshotSize ) -{ - network_.UpdateLoadSnapshotSize(); + , UpdateLoadSnapshotSize ) +{ + network_.UpdateLoadSnapshotSize(); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , UpdateLoadSnapshotSize ) -{ + , UpdateLoadSnapshotSize ) +{ network_.UpdateLoadSnapshotSize(); } @@ -3659,10 +3659,10 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , AddLoadSnapshotAt ) -{ + , AddLoadSnapshotAt ) +{ TLoadProperties loadProperties; - + CreateExampleLoadProperties( loadProperties ); auto assertionString = buildAssertionString ( "PowerGrid.hpp" @@ -3683,31 +3683,31 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , AddLoadSnapshotAt ) -{ + , AddLoadSnapshotAt ) +{ TLoadProperties loadProperties; - + CreateExampleLoadProperties( loadProperties ); EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); - + Types::loadId loadId = network_.AddLoadAt(static_cast(1), loadProperties); - + network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); EXPECT_TRUE ( network_.HasLoadAt ( static_cast(1) ) ); std::vector loadsAtVertex; network_.LoadsAt ( static_cast(1), loadsAtVertex ); - if ( !loadsAtVertex.empty() ) + if ( !loadsAtVertex.empty() ) { loadProperties = loadsAtVertex[0]; } EXPECT_EQ ( 1, loadsAtVertex.size() ); - + CheckExampleLoadProperties ( loadProperties ); loadsAtVertex.clear(); - + network_.LoadsAt ( static_cast(1), loadsAtVertex ); - if ( !loadsAtVertex.empty() ) + if ( !loadsAtVertex.empty() ) { loadProperties = loadsAtVertex[0]; } @@ -3716,15 +3716,15 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , AddLoadSnapshotAt ) -{ + , AddLoadSnapshotAt ) +{ TLoadProperties loadProperties; - + CreateExampleLoadProperties( loadProperties ); EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); - + Types::loadId loadId = network_.AddLoadAt(static_cast(1), loadProperties); - + network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); @@ -3732,17 +3732,17 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b std::vector loadsAtVertex; network_.LoadsAt ( static_cast(1), loadsAtVertex ); - if ( !loadsAtVertex.empty() ) + if ( !loadsAtVertex.empty() ) { loadProperties = loadsAtVertex[0]; } EXPECT_EQ ( 1, loadsAtVertex.size() ); - + CheckExampleLoadProperties ( loadProperties ); loadsAtVertex.clear(); - + network_.LoadsAt ( static_cast(1), loadsAtVertex ); - if ( !loadsAtVertex.empty() ) + if ( !loadsAtVertex.empty() ) { loadProperties = loadsAtVertex[0]; } @@ -3757,8 +3757,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmpty - , AddSnapshotWeighting ) -{ + , AddSnapshotWeighting ) +{ network_.AddSnapshotWeighting( 9.9 ); auto assertionString = buildAssertionString ( "PowerGrid.hpp" @@ -3770,15 +3770,15 @@ TEST_F ( TestNetworkEmpty } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , AddSnapshotWeighting ) -{ + , AddSnapshotWeighting ) +{ network_.AddSnapshotWeighting( 9.9 ); - network_.AddSnapshotWeighting( 1.9 ); + network_.AddSnapshotWeighting( 1.9 ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , AddSnapshotWeighting ) -{ + , AddSnapshotWeighting ) +{ network_.AddSnapshotWeighting( 4.9 ); network_.AddSnapshotWeighting( 3.9 ); } @@ -3790,8 +3790,8 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // *********************************************************************** TEST_F ( TestNetworkEmptyDeathTest - , AddSnapshotTimestamp ) -{ + , AddSnapshotTimestamp ) +{ network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); auto assertionString = buildAssertionString ( "PowerGrid.hpp" @@ -3803,15 +3803,15 @@ TEST_F ( TestNetworkEmptyDeathTest } TEST_F ( TestPowerGridAcm2018MtsfFigure4a - , AddSnapshotTimestamp ) -{ + , AddSnapshotTimestamp ) +{ network_.AddSnapshotTimestamp( "2009-09-19 19:19:19" ); - network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); + network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); } TEST_F ( TestPowerGridAcm2018MtsfFigure4b - , AddSnapshotTimestamp ) -{ + , AddSnapshotTimestamp ) +{ network_.AddSnapshotTimestamp( "2009-09-19 19:19:19" ); network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); } @@ -3858,7 +3858,7 @@ TEST_F ( TestPowerGridPyPsaExample TEST_F ( TestNetworkEmpty , TimestampAt ) -{ +{ auto assertionString = buildAssertionString ( "PowerGrid.hpp" , "PowerGrid" , "TimestampAt" @@ -3903,7 +3903,7 @@ TEST_F ( TestPowerGridPyPsaExample , GeneratorRealPowerSnapshotAtUsingGeneratorIdAndTimestamp ) { Types::generatorSnapshot snapshot = network_.GeneratorRealPowerSnapshotAt ( 1, "2013-01-01 03:00:00" ); - EXPECT_EQ ( 230, snapshot ); + EXPECT_EQ ( 230, snapshot ); } // *********************************************************************** @@ -4018,14 +4018,14 @@ TEST_F ( TestNetworkEmptyDeathTest TEST_F ( TestPowerGridAcm2018MtsfFigure4a , LoadSnapshotOf ) -{ +{ EXPECT_EQ ( 8, network_.LoadSnapshotOf ( 0, 0 ) ); } TEST_F ( TestPowerGridPyPsaExample , LoadSnapshotOf ) -{ +{ EXPECT_EQ ( 137, network_.LoadSnapshotOf ( 7, 3 ) ); } -} // namespace egoa::test \ No newline at end of file +} // namespace egoa::test diff --git a/tests/DataStructures/Graphs/TestPowerGrid.hpp b/tests/DataStructures/Graphs/TestPowerGrid.hpp index 02eb158f..9e8ac6f4 100644 --- a/tests/DataStructures/Graphs/TestPowerGrid.hpp +++ b/tests/DataStructures/Graphs/TestPowerGrid.hpp @@ -84,16 +84,16 @@ class TestPowerGrid : public ::testing::Test { generatorProperties.RealPowerBound().Maximum() = 9.9; generatorProperties.RealPowerBound().Minimum() = 0.1; - + generatorProperties.Pc1() = 23; generatorProperties.Pc2() = 27; - + generatorProperties.Qc1Bound().Maximum() = 11; generatorProperties.Qc1Bound().Minimum() = 10; - + generatorProperties.Qc2Bound().Maximum() = 25; generatorProperties.Qc2Bound().Minimum() = 21; - + generatorProperties.RampAgc() = 3; generatorProperties.Ramp10() = 10; generatorProperties.Ramp30() = 30; @@ -175,7 +175,7 @@ using TestNetworkEmptyDeathTest = TestNetworkEmpty; class TestPowerGridAcm2018MtsfFigure4a : public TestPowerGrid { protected: TestPowerGridAcm2018MtsfFigure4a () - : TestPowerGrid () + : TestPowerGrid () {} virtual ~TestPowerGridAcm2018MtsfFigure4a () {} @@ -184,16 +184,16 @@ class TestPowerGridAcm2018MtsfFigure4a : public TestPowerGrid { { EXPECT_EQ ( true, generatorProperties.IsActive() ); EXPECT_EQ ( Vertices::BusStatus::active, generatorProperties.Status() ); - + EXPECT_EQ ( 1.234, generatorProperties.RealPower() ); EXPECT_EQ ( 1.111, generatorProperties.ReactivePower() ); - + EXPECT_EQ ( 0.0, generatorProperties.RealPowerBound().Minimum() ); EXPECT_EQ ( 8.0, generatorProperties.RealPowerBound().Maximum() ); - + EXPECT_EQ ( 0.0, generatorProperties.ReactivePowerBound().Minimum() ); EXPECT_EQ ( 2.0, generatorProperties.ReactivePowerBound().Maximum() ); - + EXPECT_EQ ( 1.10, generatorProperties.VoltageMagnitude() ); } @@ -201,10 +201,10 @@ class TestPowerGridAcm2018MtsfFigure4a : public TestPowerGrid { { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4a_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { - std::cerr << "Expected file " - << TestCaseAcm2018MtsfFigure4a_ + std::cerr << "Expected file " + << TestCaseAcm2018MtsfFigure4a_ << " does not exist!"; exit(1); } @@ -224,7 +224,7 @@ using TestPowerGridAcm2018MtsfFigure4aDeathTest = TestPowerGridAcm2018MtsfFigure class TestPowerGridAcm2018MtsfFigure4b : public TestPowerGrid { protected: TestPowerGridAcm2018MtsfFigure4b () - : TestPowerGrid () + : TestPowerGrid () {} virtual ~TestPowerGridAcm2018MtsfFigure4b () {} @@ -233,16 +233,16 @@ class TestPowerGridAcm2018MtsfFigure4b : public TestPowerGrid { { EXPECT_EQ ( true, generatorProperties.IsActive() ); EXPECT_EQ ( Vertices::BusStatus::active, generatorProperties.Status() ); - + EXPECT_EQ ( 0.0, generatorProperties.RealPower() ); EXPECT_EQ ( 0.0, generatorProperties.ReactivePower() ); - + EXPECT_EQ ( 0.0, generatorProperties.RealPowerBound().Minimum() ); EXPECT_EQ ( 5.0, generatorProperties.RealPowerBound().Maximum() ); - + EXPECT_EQ ( 0.0, generatorProperties.ReactivePowerBound().Minimum() ); EXPECT_EQ ( 0.0, generatorProperties.ReactivePowerBound().Maximum() ); - + EXPECT_EQ ( 1.10, generatorProperties.VoltageMagnitude() ); } @@ -250,10 +250,10 @@ class TestPowerGridAcm2018MtsfFigure4b : public TestPowerGrid { { if (!TPowerGridIO::read ( network_ , TestCaseAcm2018MtsfFigure4b_ - , TPowerGridIO::readIeeeCdfMatlab ) ) + , TPowerGridIO::readIeeeCdfMatlab ) ) { - std::cerr << "Expected file " - << TestCaseAcm2018MtsfFigure4b_ + std::cerr << "Expected file " + << TestCaseAcm2018MtsfFigure4b_ << " does not exist!"; exit(1); } @@ -273,7 +273,7 @@ using TestPowerGridAcm2018MtsfFigure4bDeathTest = TestPowerGridAcm2018MtsfFigure class TestPowerGridPyPsaExample : public TestPowerGrid { protected: TestPowerGridPyPsaExample () - : TestPowerGrid () + : TestPowerGrid () {} virtual ~TestPowerGridPyPsaExample () {} @@ -282,16 +282,16 @@ class TestPowerGridPyPsaExample : public TestPowerGrid { { EXPECT_EQ ( true, generatorProperties.IsActive() ); EXPECT_EQ ( Vertices::BusStatus::active, generatorProperties.Status() ); - + EXPECT_EQ ( 0.0, generatorProperties.RealPower() ); EXPECT_EQ ( 0.0, generatorProperties.ReactivePower() ); - + EXPECT_EQ ( 0, generatorProperties.RealPowerBound().Minimum() ); EXPECT_EQ ( Const::REAL_INFTY, generatorProperties.RealPowerBound().Maximum() ); - + EXPECT_EQ ( 0.0, generatorProperties.ReactivePowerBound().Minimum() ); EXPECT_EQ ( Const::REAL_INFTY, generatorProperties.ReactivePowerBound().Maximum() ); - + EXPECT_EQ ( 1, generatorProperties.VoltageMagnitude() ); } @@ -302,8 +302,8 @@ class TestPowerGridPyPsaExample : public TestPowerGrid { , TestCaseSmallExample_ , TPowerGridIO::ReadPyPsa ) ) { - std::cerr << "Expected file " - << TestCaseSmallExample_ + std::cerr << "Expected file " + << TestCaseSmallExample_ << " does not exist!"; exit(1); } diff --git a/tests/Helper/TestHelper.hpp b/tests/Helper/TestHelper.hpp index d679e909..d3b366a9 100644 --- a/tests/Helper/TestHelper.hpp +++ b/tests/Helper/TestHelper.hpp @@ -43,7 +43,7 @@ struct FileName { */ Types::string buildAssertionString ( Types::string fileName , Types::string function - , Types::string message ) + , Types::string message ) { std::stringstream result; #ifdef EGOA_ENABLE_ASSERTION @@ -84,7 +84,7 @@ Types::string buildAssertionString ( Types::string fileName Types::string buildAssertionString ( Types::string fileName , Types::string enclosingClass , Types::string function - , Types::string message ) + , Types::string message ) { return buildAssertionString ( fileName, function, message ); } @@ -108,7 +108,7 @@ Types::string buildAssertionString ( Types::string fileName */ template Types::string buildAssertionString ( Types::string function - , Types::string message ) + , Types::string message ) { return buildAssertionString ( FileName::Name(), function, message ); } @@ -124,7 +124,7 @@ Types::string buildAssertionString ( Types::string function */ template void ExpectSameContent ( std::vector left - , std::vector right ) + , std::vector right ) { std::sort(left.begin(), left.end()); std::sort(right.begin(), right.end()); @@ -135,7 +135,7 @@ template void ExpectSameContent ( LeftIt leftBegin , LeftIt leftEnd , RightIt rightBegin - , RightIt rightEnd ) + , RightIt rightEnd ) { std::vector left{leftBegin, leftEnd}; std::vector right{rightBegin, rightEnd}; @@ -158,11 +158,11 @@ template void ExpectEqual ( LeftIt leftBegin , LeftIt leftEnd , RightIt rightBegin - , RightIt rightEnd ) + , RightIt rightEnd ) { auto leftIt = leftBegin; auto rightIt = rightBegin; - while ( leftIt != leftEnd && rightIt != rightEnd ) + while ( leftIt != leftEnd && rightIt != rightEnd ) { EXPECT_EQ ( *leftIt, *rightIt ); ++leftIt; @@ -175,7 +175,7 @@ void ExpectEqual ( LeftIt leftBegin template void ExpectEqual ( LeftRange && left - , RightRange && right ) + , RightRange && right ) { using std::begin, std::end; ExpectEqual ( begin(left), end(left), begin(right), end(right) ); @@ -200,12 +200,12 @@ class MinimalProperties { void NonConstMemberFunction() {} friend bool operator== ( MinimalProperties const & left - , MinimalProperties const & right ) + , MinimalProperties const & right ) { return left.privateId_ == right.privateId_; } friend bool operator!= ( MinimalProperties const & left - , MinimalProperties const & right ) + , MinimalProperties const & right ) { return !(left == right); } @@ -215,7 +215,7 @@ class MinimalProperties { }; inline std::ostream & operator<< ( std::ostream & stream - , MinimalProperties const & edge ) + , MinimalProperties const & edge ) { stream << "{" << "privateId = " @@ -262,7 +262,7 @@ class HashableElement { }; inline std::ostream & operator<< ( std::ostream & stream - , HashableElement const & element ) + , HashableElement const & element ) { stream << "#" << element.Identifier(); return stream; @@ -276,7 +276,7 @@ namespace std { */ template<> struct hash { - size_t operator() ( egoa::test::HashableElement const & element ) const + size_t operator() ( egoa::test::HashableElement const & element ) const { return element.Identifier(); } diff --git a/tests/IO/TestGeojsonWriter.cpp b/tests/IO/TestGeojsonWriter.cpp index 9fa9a93f..1ada1158 100644 --- a/tests/IO/TestGeojsonWriter.cpp +++ b/tests/IO/TestGeojsonWriter.cpp @@ -62,4 +62,4 @@ TEST_F ( TestGeojsonExample, CompareGeneratedStringWithFile ) EXPECT_EQ(expectedOutput,genfile); } -} //namespace egoa::test \ No newline at end of file +} //namespace egoa::test diff --git a/tests/IO/TestGeojsonWriter.hpp b/tests/IO/TestGeojsonWriter.hpp index 951fd1bc..a0da4ddc 100644 --- a/tests/IO/TestGeojsonWriter.hpp +++ b/tests/IO/TestGeojsonWriter.hpp @@ -69,8 +69,8 @@ class TestGeojsonExample : public TestGeojsonWriter { , TestCaseSmallExampleInput_ , TPowerGridIO::ReadPyPsa ) ) { - std::cerr << "Expected file " - << TestCaseSmallExampleInput_ + std::cerr << "Expected file " + << TestCaseSmallExampleInput_ << " does not exist!"; ASSERT_TRUE(false); } diff --git a/tests/IO/TestIeeeCdfMatlabParser.cpp b/tests/IO/TestIeeeCdfMatlabParser.cpp index e96050f5..24100497 100644 --- a/tests/IO/TestIeeeCdfMatlabParser.cpp +++ b/tests/IO/TestIeeeCdfMatlabParser.cpp @@ -32,4 +32,4 @@ TEST_F ( TestIeeeCdfMatlabParser, DeathTest ) { } } // namespace test -} // namespace egoa \ No newline at end of file +} // namespace egoa diff --git a/tests/IO/TestIeeeCdfMatlabParser.hpp b/tests/IO/TestIeeeCdfMatlabParser.hpp index d64fbc81..6444af7e 100644 --- a/tests/IO/TestIeeeCdfMatlabParser.hpp +++ b/tests/IO/TestIeeeCdfMatlabParser.hpp @@ -40,4 +40,4 @@ namespace test { } // test } // namespace egoa -#endif // EGOA___TESTS___IO___TEST_IEEE_CDF_MATLAB_PARSER_HPP \ No newline at end of file +#endif // EGOA___TESTS___IO___TEST_IEEE_CDF_MATLAB_PARSER_HPP diff --git a/tests/IO/TestPyPsaParser.cpp b/tests/IO/TestPyPsaParser.cpp index ddecadcb..44fe1287 100644 --- a/tests/IO/TestPyPsaParser.cpp +++ b/tests/IO/TestPyPsaParser.cpp @@ -13,7 +13,7 @@ namespace egoa::test { -TEST_F ( TestPyPsaExample, CompareNetworkGlobalProperties ) +TEST_F ( TestPyPsaExample, CompareNetworkGlobalProperties ) { EXPECT_EQ(0 , network_.Graph().MinDegree() ); EXPECT_EQ(3 , network_.Graph().MaxDegree() ); @@ -25,11 +25,11 @@ TEST_F ( TestPyPsaExample, CompareNetworkGlobalProperties ) // network_.OutputLoadSnaps(); } -TEST_F ( TestPyPsaExample, CompareVerticesPropertiesWithBusesData ) +TEST_F ( TestPyPsaExample, CompareVerticesPropertiesWithBusesData ) { Types::index x = 1; Types::index y = 11; - + network_.Graph().template for_all_vertices( [&x,&y]( TVertex const & vertex ) { @@ -57,7 +57,7 @@ TEST_F ( TestPyPsaExample, CompareVerticesPropertiesWithBusesData ) }); } -TEST_F ( TestPyPsaExample, CompareVerticesPropertiesWithLinesData ) +TEST_F ( TestPyPsaExample, CompareVerticesPropertiesWithLinesData ) { Types::index x = 1; @@ -65,30 +65,30 @@ TEST_F ( TestPyPsaExample, CompareVerticesPropertiesWithLinesData ) [&x]( TEdge const & edge ) { EXPECT_EQ(x , Types::String2integer(edge.Properties().Name()) ); - + // default - EXPECT_EQ(true , edge.Properties().Status() ); + EXPECT_EQ(true , edge.Properties().Status() ); EXPECT_EQ(20 , edge.Properties().Resistance() ); EXPECT_EQ(10 , edge.Properties().Reactance() ); - - // default + + // default EXPECT_EQ( 0 , edge.Properties().Conductance() ); EXPECT_EQ( 0.04 , edge.Properties().Conductance() ); EXPECT_EQ(-0.1 , edge.Properties().Susceptance() ); EXPECT_EQ(-0.02 , edge.Properties().Susceptance() ); - EXPECT_EQ(0.7 , edge.Properties().Weight() ); - EXPECT_EQ(0 , edge.Properties().Charge() ); - EXPECT_EQ(0 , edge.Properties().ThermalLimitB() ); - EXPECT_EQ(0 , edge.Properties().ThermalLimitC() ); - EXPECT_EQ(1 , edge.Properties().TapRatio() ); - EXPECT_EQ(0 , edge.Properties().AngleShift() ); - EXPECT_EQ(0 , edge.Properties().TapRatioCosThetaShift() ); - EXPECT_EQ(0 , edge.Properties().TapRatioSinThetaShift() ); - EXPECT_EQ(-Const::REAL_INFTY, edge.Properties().ThetaBound().Minimum() ); - EXPECT_EQ( Const::REAL_INFTY, edge.Properties().ThetaBound().Maximum() ); - EXPECT_EQ(0 , edge.Properties().NominalApparentPowerExtendable() ); - EXPECT_EQ(0 , edge.Properties().TerrainFactor() ); + EXPECT_EQ(0.7 , edge.Properties().Weight() ); + EXPECT_EQ(0 , edge.Properties().Charge() ); + EXPECT_EQ(0 , edge.Properties().ThermalLimitB() ); + EXPECT_EQ(0 , edge.Properties().ThermalLimitC() ); + EXPECT_EQ(1 , edge.Properties().TapRatio() ); + EXPECT_EQ(0 , edge.Properties().AngleShift() ); + EXPECT_EQ(0 , edge.Properties().TapRatioCosThetaShift() ); + EXPECT_EQ(0 , edge.Properties().TapRatioSinThetaShift() ); + EXPECT_EQ(-Const::REAL_INFTY, edge.Properties().ThetaBound().Minimum() ); + EXPECT_EQ( Const::REAL_INFTY, edge.Properties().ThetaBound().Maximum() ); + EXPECT_EQ(0 , edge.Properties().NominalApparentPowerExtendable() ); + EXPECT_EQ(0 , edge.Properties().TerrainFactor() ); EXPECT_EQ(Edges::ElectricalEdgeType::standard, edge.Properties().Type() ); @@ -96,7 +96,7 @@ TEST_F ( TestPyPsaExample, CompareVerticesPropertiesWithLinesData ) EXPECT_EQ(100 , edge.Properties().Length() ); EXPECT_EQ(x , edge.Properties().NumberOfParallelLines() ); EXPECT_EQ(0.7 , edge.Properties().ThermalLimit() ); - EXPECT_EQ ( ceil ( ( ( x*1.0 + 2 ) * 1000 / ( x * 1.0 ) ) * 1000 / 1000 ) + EXPECT_EQ ( ceil ( ( ( x*1.0 + 2 ) * 1000 / ( x * 1.0 ) ) * 1000 / 1000 ) , ceil ( edge.Properties().NominalApparentPower() * 1000 / 1000 ) ); EXPECT_EQ(380 , edge.Properties().NominalVoltage() ); EXPECT_EQ(4000 , edge.Properties().NominalApparentPowerBound().Minimum() ); @@ -105,8 +105,8 @@ TEST_F ( TestPyPsaExample, CompareVerticesPropertiesWithLinesData ) }); } -TEST_F ( TestPyPsaExample, CompareGeneratorsPropertiesWithGeneratorsData ) -{ +TEST_F ( TestPyPsaExample, CompareGeneratorsPropertiesWithGeneratorsData ) +{ std::vector generatorTypes { Vertices::GeneratorType::onwind , Vertices::GeneratorType::solar }; Types::count counter = 0; @@ -114,7 +114,7 @@ TEST_F ( TestPyPsaExample, CompareGeneratorsPropertiesWithGeneratorsData ) network_.template for_all_generators( [&counter,&generatorTypes]( TGeneratorProperties const & generator ) { - // EXPECT_EQ(0 , generator.Name() ); + // EXPECT_EQ(0 , generator.Name() ); EXPECT_EQ( (counter+2)*100000 , generator.CapitalCost() ); EXPECT_EQ(generatorTypes[counter%2] , generator.GeneratorType() ); EXPECT_EQ(1.0 , generator.Efficiency() ); @@ -126,9 +126,9 @@ TEST_F ( TestPyPsaExample, CompareGeneratorsPropertiesWithGeneratorsData ) else EXPECT_EQ(Const::REAL_INFTY , generator.NominalRealPowerBound().Maximum() ); - EXPECT_EQ(TVertexType::generator , generator.Type() ); - EXPECT_EQ(0 , generator.X() ); - EXPECT_EQ(0 , generator.Y() ); + EXPECT_EQ(TVertexType::generator , generator.Type() ); + EXPECT_EQ(0 , generator.X() ); + EXPECT_EQ(0 , generator.Y() ); EXPECT_EQ(1 , generator.VoltageMagnitude() ); EXPECT_EQ(0 , generator.NominalRealPowerBound().Minimum() ); EXPECT_EQ(Vertices::PowerSign::positive , generator.PowerSign() ); @@ -160,12 +160,12 @@ TEST_F ( TestPyPsaExample, CompareGeneratorsPropertiesWithGeneratorsData ) }); } -TEST_F ( TestPyPsaExample, CheckGeneratorRealPowerSnapshots ) +TEST_F ( TestPyPsaExample, CheckGeneratorRealPowerSnapshots ) { Types::index generatorId = 1; Types::index snapId = 0; network_.template for_all_real_power_generator_snapshots( - [&generatorId, &snapId](Types::index snapshotId, Types::generatorSnapshot snapshot) + [&generatorId, &snapId](Types::index snapshotId, Types::generatorSnapshot snapshot) { EXPECT_EQ ( generatorId*100 + (snapId%10)*10, snapshot); EXPECT_EQ ( (snapId%10), snapshotId); @@ -194,18 +194,18 @@ TEST_F ( TestPyPsaExample, CheckGeneratorRealPowerSnapshots ) snapId = 0; std::vector numberOfColumsPerVertex = {2,2,2,2,2,3,2,3,3,2}; Types::count counter = 0; - network_.Graph().template for_all_vertex_identifiers( - [&generatorId, - &snapId, - &numberOfColumsPerVertex, + network_.Graph().template for_all_vertex_identifiers( + [&generatorId, + &snapId, + &numberOfColumsPerVertex, &counter, this](Types::vertexId vertexId) { - network_.template for_all_real_power_generator_snapshots_at( + network_.template for_all_real_power_generator_snapshots_at( vertexId - , [&generatorId, - &snapId, - &numberOfColumsPerVertex, + , [&generatorId, + &snapId, + &numberOfColumsPerVertex, &counter](Types::index snapshotId, Types::generatorSnapshot snapshot) { EXPECT_EQ ( generatorId*100 + (snapId%10)*10, snapshot); @@ -213,7 +213,7 @@ TEST_F ( TestPyPsaExample, CheckGeneratorRealPowerSnapshots ) ++snapId; if ( 0 == (snapId%10) ) ++generatorId; ++counter; - } + } ); EXPECT_EQ ( numberOfColumsPerVertex[vertexId], counter/10); counter = 0; @@ -221,14 +221,14 @@ TEST_F ( TestPyPsaExample, CheckGeneratorRealPowerSnapshots ) ); } -TEST_F ( TestPyPsaExample, CheckLoadRealPowerSnapshots ) +TEST_F ( TestPyPsaExample, CheckLoadRealPowerSnapshots ) { Types::loadId loadId = 0; Types::index snapId = 0; network_.template for_all_real_power_load_snapshots( [&loadId, &snapId] ( Types::index snapshotId - , Types::loadSnapshot snapshot ) + , Types::loadSnapshot snapshot ) { // std::cout << "snapshotId: " << snapshotId << " ; snapshots: " << snapshot << std::endl; EXPECT_EQ ( 100 + (snapId%10)*10 + loadId, snapshot); @@ -243,7 +243,7 @@ TEST_F ( TestPyPsaExample, CheckLoadRealPowerSnapshots ) network_.template for_all_loads( [this,&loadId, &snapId](TLoadProperties const & loadProperties) { - this->network_.template for_all_real_power_load_snapshots_of( + this->network_.template for_all_real_power_load_snapshots_of( loadId, [&loadId, &snapId](Types::index snapshotId, Types::generatorSnapshot snapshot) { EXPECT_EQ ( 100 + (snapId%10)*10 + loadId, snapshot); @@ -259,18 +259,18 @@ TEST_F ( TestPyPsaExample, CheckLoadRealPowerSnapshots ) snapId = 0; std::vector numberOfColumsPerVertex = {1,1,1,1,1,1,1,1,1,1}; Types::count counter = 0; - network_.Graph().template for_all_vertex_identifiers( - [&loadId, - &snapId, - &numberOfColumsPerVertex, + network_.Graph().template for_all_vertex_identifiers( + [&loadId, + &snapId, + &numberOfColumsPerVertex, &counter, this](Types::vertexId vertexId) { - network_.template for_all_real_power_load_snapshots_at( + network_.template for_all_real_power_load_snapshots_at( vertexId - , [&loadId, - &snapId, - &numberOfColumsPerVertex, + , [&loadId, + &snapId, + &numberOfColumsPerVertex, &counter](Types::index snapshotId, Types::generatorSnapshot snapshot) { EXPECT_EQ ( 100 + (snapId%10)*10 + loadId, snapshot); @@ -278,7 +278,7 @@ TEST_F ( TestPyPsaExample, CheckLoadRealPowerSnapshots ) ++snapId; if ( 0 == (snapId%10) ) ++loadId; ++counter; - } + } ); EXPECT_EQ ( numberOfColumsPerVertex[vertexId], counter/10); counter = 0; @@ -287,8 +287,8 @@ TEST_F ( TestPyPsaExample, CheckLoadRealPowerSnapshots ) } TEST_F ( PyPSAExampleInconsistencyGeneratorsDeathTest - , DeathTestInconsistency ) -{ + , DeathTestInconsistency ) +{ auto assertionString = buildAssertionString ( "PyPsaParser.hpp" , "PyPsaParser" , "ExtractGeneratorMaximumRealPowerPuHeader" @@ -300,8 +300,8 @@ TEST_F ( PyPSAExampleInconsistencyGeneratorsDeathTest } TEST_F ( PyPSAExampleInconsistencyInTimestampLengthDeathTest - , DeathTestInconsistency ) -{ + , DeathTestInconsistency ) +{ auto assertionString = buildAssertionString ( "PyPsaParser.hpp" , "PyPsaParser" , "HasCorrectSnapshotSizes" @@ -313,8 +313,8 @@ TEST_F ( PyPSAExampleInconsistencyInTimestampLengthDeathTest } TEST_F ( PyPSAExampleDuplicatedGeneratorsDeathTest - , DeathTestGeneratorDuplicates ) -{ + , DeathTestGeneratorDuplicates ) +{ auto assertionString = buildAssertionString ( "PyPsaParser.hpp" , "PyPsaParser" , "AddNameToGenerator" @@ -326,15 +326,15 @@ TEST_F ( PyPSAExampleDuplicatedGeneratorsDeathTest } TEST_F ( PyPSA_PyPSA_data_2018_11_20__elec_s1024_AT - , SimpleReadTest ) -{ + , SimpleReadTest ) +{ if ( ! egoa::PowerGridIO::read( network_ , graph_ , TestCaseSmallExample_ , TPowerGridIO::ReadPyPsa ) ) { - std::cout << "Expected file " - << TestCaseSmallExample_ + std::cout << "Expected file " + << TestCaseSmallExample_ << " does not exist!"; } } diff --git a/tests/IO/TestPyPsaParser.hpp b/tests/IO/TestPyPsaParser.hpp index a7dee238..31d43edd 100644 --- a/tests/IO/TestPyPsaParser.hpp +++ b/tests/IO/TestPyPsaParser.hpp @@ -65,7 +65,7 @@ class TestPyPsaParser : public ::testing::Test { class TestPyPsaExample : public TestPyPsaParser { protected: TestPyPsaExample () - : TestPyPsaParser () + : TestPyPsaParser () {} virtual void SetUp () override @@ -75,8 +75,8 @@ class TestPyPsaExample : public TestPyPsaParser { , TestCaseSmallExample_ , TPowerGridIO::ReadPyPsa ) ) { - std::cerr << "Expected file " - << TestCaseSmallExample_ + std::cerr << "Expected file " + << TestCaseSmallExample_ << " does not exist!"; exit(1); } @@ -91,7 +91,7 @@ class TestPyPsaExample : public TestPyPsaParser { class PyPSAExampleInconsistencyGeneratorsDeathTest : public TestPyPsaParser { protected: PyPSAExampleInconsistencyGeneratorsDeathTest () - : TestPyPsaParser () + : TestPyPsaParser () {} Types::string const TestCaseSmallExample_ = "../../framework/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyGenerators"; @@ -103,7 +103,7 @@ class PyPSAExampleInconsistencyGeneratorsDeathTest : public TestPyPsaParser { class PyPSAExampleInconsistencyInTimestampLengthDeathTest : public TestPyPsaParser { protected: PyPSAExampleInconsistencyInTimestampLengthDeathTest () - : TestPyPsaParser () + : TestPyPsaParser () {} Types::string const TestCaseSmallExample_ = "../../framework/tests/Data/PowerGrids/PyPSAExampleDeathTestInconsistencyInTimestampLength"; @@ -115,7 +115,7 @@ class PyPSAExampleInconsistencyInTimestampLengthDeathTest : public TestPyPsaPars class PyPSAExampleDuplicatedGeneratorsDeathTest : public TestPyPsaParser { protected: PyPSAExampleDuplicatedGeneratorsDeathTest () - : TestPyPsaParser () + : TestPyPsaParser () {} Types::string const TestCaseSmallExample_ = "../../framework/tests/Data/PowerGrids/PyPSAExampleDeathTestDuplicatedGeneratorNames"; @@ -127,7 +127,7 @@ class PyPSAExampleDuplicatedGeneratorsDeathTest : public TestPyPsaParser { class PyPSA_PyPSA_data_2018_11_20__elec_s1024_AT : public TestPyPsaParser { protected: PyPSA_PyPSA_data_2018_11_20__elec_s1024_AT () - : TestPyPsaParser () + : TestPyPsaParser () {} Types::string const TestCaseSmallExample_ = "../../framework/data/PowerGrids/PyPSA/pypsa-iti-collaboration/elec_s1024_AT";;