Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a few newly-introduced code smells #2218

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading