Skip to content

Commit

Permalink
Fix a few newly-introduced code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes committed Jul 1, 2024
1 parent 5207775 commit 7c65bf8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ class HydroManagement final
const Antares::Data::Area::ScratchMap& scratchmap,
HydroSpecificMap& hydro_specific_map);
//! Prepare the effective demand for each area
void prepareEffectiveDemand(uint year, HydroSpecificMap& hydro_specific_map);
void prepareEffectiveDemand(uint year, HydroSpecificMap& hydro_specific_map) const;
//! Monthly Optimal generations
void prepareMonthlyOptimalGenerations(double* random_reservoir_level,
void prepareMonthlyOptimalGenerations(const double* random_reservoir_level,
uint y,
HydroSpecificMap& hydro_specific_map);

Expand Down
5 changes: 2 additions & 3 deletions src/solver/hydro/management/PrepareInflows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ void PrepareInflows::Run(uint year)
void PrepareInflows::LoadInflows(uint year)
{
areas_.each(
// un-const because now data is a member of area [&](const Data::Area& area)
[&](Data::Area& area)
[this, year](Data::Area& area)
{
const auto& srcinflows = area.hydro.series->storage.getColumn(year);

Expand Down Expand Up @@ -69,7 +68,7 @@ void PrepareInflows::LoadInflows(uint year)
void PrepareInflows::ChangeInflowsToAccommodateFinalLevels(uint year)
{
areas_.each(
[this, &year](Data::Area& area)
[&year](Data::Area& area)
{
auto& data = area.hydro.managementData[year];

Expand Down
2 changes: 1 addition & 1 deletion src/solver/hydro/management/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void HydroManagement::prepareNetDemand(uint year,
});
}

void HydroManagement::prepareEffectiveDemand(uint year, HydroSpecificMap& hydro_specific_map)
void HydroManagement::prepareEffectiveDemand(uint year, HydroSpecificMap& hydro_specific_map) const
{
areas_.each(
[this, &year, &hydro_specific_map](Data::Area& area)
Expand Down
2 changes: 1 addition & 1 deletion src/solver/hydro/management/monthly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ double HydroManagement::prepareMonthlyTargetGenerations(
return total;
}

void HydroManagement::prepareMonthlyOptimalGenerations(double* random_reservoir_level,
void HydroManagement::prepareMonthlyOptimalGenerations(const double* random_reservoir_level,
uint y,
HydroSpecificMap& hydro_specific_map)
{
Expand Down
10 changes: 5 additions & 5 deletions src/solver/ts-generator/availability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,10 @@ std::vector<Data::ThermalCluster*> getAllClustersToGen(const Data::AreaList& are
return clusters;
}

void writeResultsToDisk(const Data::Study& study,
Solver::IResultWriter& writer,
const Matrix<>& series,
const std::string& savePath)
static void writeResultsToDisk(const Data::Study& study,
Solver::IResultWriter& writer,
const Matrix<>& series,
const std::string& savePath)
{
if (study.parameters.noOutput)
{
Expand All @@ -627,7 +627,7 @@ void writeResultsToDisk(const Data::Study& study,
writer.addEntryFromBuffer(savePath, buffer);
}

void writeResultsToDisk(const Matrix<>& series, const std::filesystem::path savePath)
static void writeResultsToDisk(const Matrix<>& series, const std::filesystem::path& savePath)
{
std::string buffer;
series.saveToBuffer(buffer, 0);
Expand Down

0 comments on commit 7c65bf8

Please sign in to comment.