Skip to content

Commit

Permalink
Rename thread_number -> numSpace for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes committed Dec 2, 2024
1 parent d4a660e commit b423f57
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,32 @@ 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<DispatchableMarginPostProcessCmd>(problemeHebdo_, thread_number_, areas));
std::make_unique<DispatchableMarginPostProcessCmd>(problemeHebdo_, numSpace_, areas));

post_process_list.push_back(
std::make_unique<HydroLevelsUpdatePostProcessCmd>(problemeHebdo_, areas, false, false));
post_process_list.push_back(std::make_unique<RemixHydroPostProcessCmd>(problemeHebdo_,
areas,
sheddingPolicy,
splxOptimization,
thread_number));
numSpace));

// Here a post process particular to adq patch
post_process_list.push_back(std::make_unique<CurtailmentSharingPostProcessCmd>(adqPatchParams,
problemeHebdo_,
areas,
thread_number_));
numSpace_));
// Here a post process particular to adq patch
post_process_list.push_back(
std::make_unique<DTGmarginForAdqPatchPostProcessCmd>(problemeHebdo_, areas, thread_number));
std::make_unique<DTGmarginForAdqPatchPostProcessCmd>(problemeHebdo_, areas, numSpace));
post_process_list.push_back(
std::make_unique<HydroLevelsUpdatePostProcessCmd>(problemeHebdo_, areas, true, false));
post_process_list.push_back(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OptPostProcessList: public interfacePostProcessList
{
public:
OptPostProcessList(PROBLEME_HEBDO* problemeHebdo,
uint thread_number,
uint numSpace,
AreaList& areas,
SheddingPolicy sheddingPolicy,
SimplexOptimization splxOptimization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
};

Expand All @@ -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_;
};
Expand All @@ -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
Expand Down Expand Up @@ -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;

Expand All @@ -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
8 changes: 4 additions & 4 deletions src/solver/optimisation/optim_post_process_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DispatchableMarginPostProcessCmd>(problemeHebdo_, thread_number_, areas));
std::make_unique<DispatchableMarginPostProcessCmd>(problemeHebdo_, numSpace_, areas));
post_process_list.push_back(
std::make_unique<HydroLevelsUpdatePostProcessCmd>(problemeHebdo_, areas, false, false));
post_process_list.push_back(std::make_unique<RemixHydroPostProcessCmd>(problemeHebdo_,
areas,
sheddingPolicy,
splxOptimization,
thread_number));
numSpace));
post_process_list.push_back(
std::make_unique<HydroLevelsUpdatePostProcessCmd>(problemeHebdo_, areas, true, false));
post_process_list.push_back(
Expand Down
24 changes: 12 additions & 12 deletions src/solver/optimisation/post_process_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}
Expand All @@ -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.;
Expand Down Expand Up @@ -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)
{
Expand All @@ -112,7 +112,7 @@ void RemixHydroPostProcessCmd::execute(const optRuntimeData& opt_runtime_data)
*problemeHebdo_,
shedding_policy_,
splx_optimization_,
thread_number_,
numSpace_,
hourInYear);
}

Expand All @@ -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)
{
}

Expand All @@ -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
Expand Down Expand Up @@ -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)
{
}

Expand Down Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions src/solver/simulation/base_post_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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> interfacePostProcessList::create(
AdqPatchParams& adqPatchParams,
PROBLEME_HEBDO* problemeHebdo,
uint thread_number,
uint numSpace,
AreaList& areas,
SheddingPolicy sheddingPolicy,
SimplexOptimization splxOptimization,
Expand All @@ -53,7 +53,7 @@ std::unique_ptr<interfacePostProcessList> interfacePostProcessList::create(
{
return std::make_unique<AdqPatchPostProcessList>(adqPatchParams,
problemeHebdo,
thread_number,
numSpace,
areas,
sheddingPolicy,
splxOptimization,
Expand All @@ -62,7 +62,7 @@ std::unique_ptr<interfacePostProcessList> interfacePostProcessList::create(
else
{
return std::make_unique<OptPostProcessList>(problemeHebdo,
thread_number,
numSpace,
areas,
sheddingPolicy,
splxOptimization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class interfacePostProcessList
// gp : the constructors' signatures of the post process list classes.
static std::unique_ptr<interfacePostProcessList> create(AdqPatchParams& adqPatchParams,
PROBLEME_HEBDO* problemeHebdo,
uint thread_number,
uint numSpace,
AreaList& areas,
SheddingPolicy sheddingPolicy,
SimplexOptimization splxOptimization,
Expand All @@ -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_ = 0;
std::vector<std::unique_ptr<basePostProcessCommand>> post_process_list;
};

Expand Down

0 comments on commit b423f57

Please sign in to comment.