From 225c7a81f60a899ec63f6d012cfaffbd6d63baa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Omn=C3=A8s?= Date: Mon, 2 Dec 2024 12:46:16 +0100 Subject: [PATCH] Rename thread_number -> numSpace for consistency (#2515) Even though numSpace isn't a great name, we should stick to it for consistency. Otherwise it's confusing. --- .../adq_patch_post_process_list.cpp | 12 +++++----- .../adq_patch_post_process_list.h | 2 +- .../optimisation/optim_post_process_list.h | 2 +- .../optimisation/post_process_commands.h | 16 ++++++------- .../optimisation/optim_post_process_list.cpp | 8 +++---- .../optimisation/post_process_commands.cpp | 24 +++++++++---------- src/solver/simulation/base_post_process.cpp | 8 +++---- .../solver/simulation/base_post_process.h | 6 ++--- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp b/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp index 996ec70c6e..1d54cb0da0 100644 --- a/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp +++ b/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp @@ -27,15 +27,15 @@ namespace Antares::Solver::Simulation { AdqPatchPostProcessList::AdqPatchPostProcessList(const AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, Calendar& calendar): - interfacePostProcessList(problemeHebdo, thread_number) + interfacePostProcessList(problemeHebdo, numSpace) { post_process_list.push_back( - std::make_unique(problemeHebdo_, thread_number_, areas)); + std::make_unique(problemeHebdo_, numSpace_, areas)); post_process_list.push_back( std::make_unique(problemeHebdo_, areas, false, false)); @@ -43,16 +43,16 @@ AdqPatchPostProcessList::AdqPatchPostProcessList(const AdqPatchParams& adqPatchP areas, sheddingPolicy, splxOptimization, - thread_number)); + numSpace)); // Here a post process particular to adq patch post_process_list.push_back(std::make_unique(adqPatchParams, problemeHebdo_, areas, - thread_number_)); + numSpace_)); // Here a post process particular to adq patch post_process_list.push_back( - std::make_unique(problemeHebdo_, areas, thread_number)); + std::make_unique(problemeHebdo_, areas, numSpace)); post_process_list.push_back( std::make_unique(problemeHebdo_, areas, true, false)); post_process_list.push_back( diff --git a/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.h b/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.h index cba4657fb2..d73ce8cfd2 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.h @@ -34,7 +34,7 @@ class AdqPatchPostProcessList: public interfacePostProcessList public: AdqPatchPostProcessList(const AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, diff --git a/src/solver/optimisation/include/antares/solver/optimisation/optim_post_process_list.h b/src/solver/optimisation/include/antares/solver/optimisation/optim_post_process_list.h index eecd9edfba..833a556db1 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/optim_post_process_list.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/optim_post_process_list.h @@ -29,7 +29,7 @@ class OptPostProcessList: public interfacePostProcessList { public: OptPostProcessList(PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, diff --git a/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h b/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h index 5bf5ecf314..4c3fd49bd1 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h @@ -28,12 +28,12 @@ class DispatchableMarginPostProcessCmd: public basePostProcessCommand { public: DispatchableMarginPostProcessCmd(PROBLEME_HEBDO* problemeHebdo, - unsigned int thread_number, + unsigned int numSpace, AreaList& areas); void execute(const optRuntimeData& opt_runtime_data) override; private: - unsigned int thread_number_ = 0; + unsigned int numSpace_ = 0; const AreaList& area_list_; }; @@ -59,12 +59,12 @@ class RemixHydroPostProcessCmd: public basePostProcessCommand AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization simplexOptimization, - unsigned int thread_number); + unsigned int numSpace); void execute(const optRuntimeData& opt_runtime_data) override; private: const AreaList& area_list_; - unsigned int thread_number_ = 0; + unsigned int numSpace_ = 0; SheddingPolicy shedding_policy_; SimplexOptimization splx_optimization_; }; @@ -76,13 +76,13 @@ class DTGmarginForAdqPatchPostProcessCmd: public basePostProcessCommand public: DTGmarginForAdqPatchPostProcessCmd(PROBLEME_HEBDO* problemeHebdo, AreaList& areas, - unsigned int thread_number); + unsigned int numSpace); void execute(const optRuntimeData& opt_runtime_data) override; private: const AreaList& area_list_; - unsigned int thread_number_ = 0; + unsigned int numSpace_ = 0; }; class InterpolateWaterValuePostProcessCmd: public basePostProcessCommand @@ -118,7 +118,7 @@ class CurtailmentSharingPostProcessCmd: public basePostProcessCommand CurtailmentSharingPostProcessCmd(const AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, AreaList& areas, - unsigned int thread_number); + unsigned int numSpace); void execute(const optRuntimeData& opt_runtime_data) override; @@ -130,7 +130,7 @@ class CurtailmentSharingPostProcessCmd: public basePostProcessCommand const AreaList& area_list_; const AdqPatchParams& adqPatchParams_; - unsigned int thread_number_ = 0; + unsigned int numSpace_ = 0; }; } // namespace Antares::Solver::Simulation diff --git a/src/solver/optimisation/optim_post_process_list.cpp b/src/solver/optimisation/optim_post_process_list.cpp index a9eb38f7e8..9f52a11ac1 100644 --- a/src/solver/optimisation/optim_post_process_list.cpp +++ b/src/solver/optimisation/optim_post_process_list.cpp @@ -26,24 +26,24 @@ namespace Antares::Solver::Simulation { OptPostProcessList::OptPostProcessList(PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, Calendar& calendar) : - interfacePostProcessList(problemeHebdo, thread_number) + interfacePostProcessList(problemeHebdo, numSpace) { post_process_list.push_back( - std::make_unique(problemeHebdo_, thread_number_, areas)); + std::make_unique(problemeHebdo_, numSpace_, areas)); post_process_list.push_back( std::make_unique(problemeHebdo_, areas, false, false)); post_process_list.push_back(std::make_unique(problemeHebdo_, areas, sheddingPolicy, splxOptimization, - thread_number)); + numSpace)); post_process_list.push_back( std::make_unique(problemeHebdo_, areas, true, false)); post_process_list.push_back( diff --git a/src/solver/optimisation/post_process_commands.cpp b/src/solver/optimisation/post_process_commands.cpp index 7ca5a4b0d5..b069050960 100644 --- a/src/solver/optimisation/post_process_commands.cpp +++ b/src/solver/optimisation/post_process_commands.cpp @@ -34,10 +34,10 @@ const uint nbHoursInWeek = 168; // Dispatchable Margin // ----------------------------- DispatchableMarginPostProcessCmd::DispatchableMarginPostProcessCmd(PROBLEME_HEBDO* problemeHebdo, - unsigned int thread_number, + unsigned int numSpace, AreaList& areas): basePostProcessCommand(problemeHebdo), - thread_number_(thread_number), + numSpace_(numSpace), area_list_(areas) { } @@ -49,7 +49,7 @@ void DispatchableMarginPostProcessCmd::execute(const optRuntimeData& opt_runtime area_list_.each( [this, &hourInYear, &year](Data::Area& area) { - double* dtgmrg = area.scratchpad[thread_number_].dispatchableGenerationMargin; + double* dtgmrg = area.scratchpad[numSpace_].dispatchableGenerationMargin; for (uint h = 0; h != nbHoursInWeek; ++h) { dtgmrg[h] = 0.; @@ -96,10 +96,10 @@ RemixHydroPostProcessCmd::RemixHydroPostProcessCmd(PROBLEME_HEBDO* problemeHebdo AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization simplexOptimization, - unsigned int thread_number): + unsigned int numSpace): basePostProcessCommand(problemeHebdo), area_list_(areas), - thread_number_(thread_number), + numSpace_(numSpace), shedding_policy_(sheddingPolicy), splx_optimization_(simplexOptimization) { @@ -112,7 +112,7 @@ void RemixHydroPostProcessCmd::execute(const optRuntimeData& opt_runtime_data) *problemeHebdo_, shedding_policy_, splx_optimization_, - thread_number_, + numSpace_, hourInYear); } @@ -124,10 +124,10 @@ using namespace Antares::Data::AdequacyPatch; DTGmarginForAdqPatchPostProcessCmd::DTGmarginForAdqPatchPostProcessCmd( PROBLEME_HEBDO* problemeHebdo, AreaList& areas, - unsigned int thread_number): + unsigned int numSpace): basePostProcessCommand(problemeHebdo), area_list_(areas), - thread_number_(thread_number) + numSpace_(numSpace) { } @@ -147,7 +147,7 @@ void DTGmarginForAdqPatchPostProcessCmd::execute(const optRuntimeData&) for (uint hour = 0; hour < nbHoursInWeek; hour++) { auto& hourlyResults = problemeHebdo_->ResultatsHoraires[Area]; - const auto& scratchpad = area_list_[Area]->scratchpad[thread_number_]; + const auto& scratchpad = area_list_[Area]->scratchpad[numSpace_]; const double dtgMrg = scratchpad.dispatchableGenerationMargin[hour]; const double ens = hourlyResults.ValeursHorairesDeDefaillancePositive[hour]; const bool triggered = problemeHebdo_->adequacyPatchRuntimeData @@ -211,11 +211,11 @@ CurtailmentSharingPostProcessCmd::CurtailmentSharingPostProcessCmd( const AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, AreaList& areas, - unsigned int thread_number): + unsigned int numSpace): basePostProcessCommand(problemeHebdo), area_list_(areas), adqPatchParams_(adqPatchParams), - thread_number_(thread_number) + numSpace_(numSpace) { } @@ -256,7 +256,7 @@ double CurtailmentSharingPostProcessCmd::calculateDensNewAndTotalLmrViolation() // adjust densNew according to the new specification/request by ELIA /* DENS_new (node A) = max [ 0; ENS_init (node A) + net_position_init (node A) + ? flows (node 1 -> node A) - DTG.MRG(node A)] */ - const auto& scratchpad = area_list_[Area]->scratchpad[thread_number_]; + const auto& scratchpad = area_list_[Area]->scratchpad[numSpace_]; double dtgMrg = scratchpad.dispatchableGenerationMargin[hour]; // write down densNew values for all the hours problemeHebdo_->ResultatsHoraires[Area].ValeursHorairesDENS[hour] = std::max( diff --git a/src/solver/simulation/base_post_process.cpp b/src/solver/simulation/base_post_process.cpp index 4cd7bb8cf9..d3c2da7f3c 100644 --- a/src/solver/simulation/base_post_process.cpp +++ b/src/solver/simulation/base_post_process.cpp @@ -36,14 +36,14 @@ basePostProcessCommand::basePostProcessCommand(PROBLEME_HEBDO* problemeHebdo): interfacePostProcessList::interfacePostProcessList(PROBLEME_HEBDO* problemesHebdo, uint numSpace): problemeHebdo_(problemesHebdo), - thread_number_(numSpace) + numSpace_(numSpace) { } std::unique_ptr interfacePostProcessList::create( AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, @@ -53,7 +53,7 @@ std::unique_ptr interfacePostProcessList::create( { return std::make_unique(adqPatchParams, problemeHebdo, - thread_number, + numSpace, areas, sheddingPolicy, splxOptimization, @@ -62,7 +62,7 @@ std::unique_ptr interfacePostProcessList::create( else { return std::make_unique(problemeHebdo, - thread_number, + numSpace, areas, sheddingPolicy, splxOptimization, diff --git a/src/solver/simulation/include/antares/solver/simulation/base_post_process.h b/src/solver/simulation/include/antares/solver/simulation/base_post_process.h index 6918fb85d3..f1e6215415 100644 --- a/src/solver/simulation/include/antares/solver/simulation/base_post_process.h +++ b/src/solver/simulation/include/antares/solver/simulation/base_post_process.h @@ -71,7 +71,7 @@ class interfacePostProcessList // gp : the constructors' signatures of the post process list classes. static std::unique_ptr create(AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, @@ -80,11 +80,11 @@ class interfacePostProcessList protected: // Member functions - interfacePostProcessList(PROBLEME_HEBDO* problemeHebdo, uint thread_number); + interfacePostProcessList(PROBLEME_HEBDO* problemeHebdo, uint numSpace); // Data mambers PROBLEME_HEBDO* const problemeHebdo_ = nullptr; - const unsigned int thread_number_ = 0; + const unsigned int numSpace_; std::vector> post_process_list; };