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

[WIP] Replace integers by proper enums in methods signatures #1214

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions src/solver/variable/adequacy/overallCost.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ class OverallCost : public Variable::IVariable<OverallCost<NextT>, NextT, VCardO
}

void localBuildAnnualSurveyReport(SurveyResults& results,
int fileLevel,
int precision,
Category::File fileLevel,
Category::Precision precision,
unsigned int numSpace) const
{
// Initializing external pointer on current variable non applicable status
Expand Down
4 changes: 2 additions & 2 deletions src/solver/variable/adequacy/spilledEnergy.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ class SpilledEnergy : public Variable::IVariable<SpilledEnergy<NextT>, NextT, VC
}

void localBuildAnnualSurveyReport(SurveyResults& results,
int fileLevel,
int precision,
Category::File fileLevel,
Category::Precision precision,
unsigned int numSpace) const
{
// Initializing external pointer on current variable non applicable status
Expand Down
14 changes: 7 additions & 7 deletions src/solver/variable/area.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,17 @@ class Areas //: public Variable::IVariable<Areas<NextT>, NextT, VCardAllAreas>
void weekEnd(State& state);

void buildSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision) const;
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision) const;

void buildAnnualSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision,
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision,
uint numSpace) const;

void buildDigest(SurveyResults&, int digestLevel, int dataLevel) const;
void buildDigest(SurveyResults&, Category::Digest digestLevel, Category::DataLevel dataLevel) const;

void beforeYearByYearExport(uint year, uint numSpace);

Expand Down
14 changes: 7 additions & 7 deletions src/solver/variable/area.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ inline void Areas<NextT>::initializeFromThermalCluster(Data::Study*,

template<class NextT>
void Areas<NextT>::buildSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision) const
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision) const
{
int count_int = count;
bool linkDataLevel = dataLevel & Category::link;
Expand Down Expand Up @@ -115,9 +115,9 @@ void Areas<NextT>::buildSurveyReport(SurveyResults& results,

template<class NextT>
void Areas<NextT>::buildAnnualSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision,
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision,
uint numSpace) const
{
int count_int = count;
Expand Down Expand Up @@ -168,7 +168,7 @@ void Areas<NextT>::buildAnnualSurveyReport(SurveyResults& results,
}

template<class NextT>
void Areas<NextT>::buildDigest(SurveyResults& results, int digestLevel, int dataLevel) const
void Areas<NextT>::buildDigest(SurveyResults& results, Category::Digest digestLevel, Category::DataLevel dataLevel) const
{
int count_int = count;
if (count_int)
Expand Down
12 changes: 6 additions & 6 deletions src/solver/variable/bindConstraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ class BindingConstraints
void hourEnd(State& state, uint hourInTheYear);

void buildSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision) const;
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision) const;

void buildAnnualSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision,
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision,
uint numSpace) const;

Yuni::uint64 memoryUsage() const;
Expand Down
12 changes: 6 additions & 6 deletions src/solver/variable/bindConstraints.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ namespace Antares::Solver::Variable
{
template<class NextT>
void BindingConstraints<NextT>::buildSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision) const
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision) const
{
if (bool bcDataLevel = dataLevel & Category::bindingConstraint; !bcDataLevel)
return;
Expand All @@ -51,9 +51,9 @@ void BindingConstraints<NextT>::buildSurveyReport(SurveyResults& results,

template<class NextT>
void BindingConstraints<NextT>::buildAnnualSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision,
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision,
uint numSpace) const
{
if (bool bcDataLevel = dataLevel & Category::bindingConstraint; !bcDataLevel)
Expand Down
13 changes: 13 additions & 0 deletions src/solver/variable/categories.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,17 @@ enum DataLevel
bindingConstraint = 16,
//! The maximum available level
maxDataLevel = 16,
//! Used for end of iterations on data levels
dataLevelsEnd = 32,

//! All data level
allDataLevel = area | thermalAggregate | link | setOfAreas | bindingConstraint
};

constexpr inline Category::DataLevel nextDataLevel(Category::DataLevel dataLevel) {
return static_cast<Category::DataLevel>(dataLevel * 2);
}

enum File
{
//! Values of physical variables
Expand All @@ -69,10 +76,16 @@ enum File
bc = 16,
//! The maximum available value
maxFileLevel = 16,
//! Used for end of iterations on file levels
fileLevelsEnd = 32,
//! All file level
allFile = va | id | de | de_res | bc,
};

constexpr inline Category::File nextFileLevel(Category::File fileLevel) {
return static_cast<Category::File>(fileLevel * 2);
}

enum Precision
{
//! hour
Expand Down
4 changes: 2 additions & 2 deletions src/solver/variable/commons/hydro.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ class TimeSeriesValuesHydro
}

void localBuildAnnualSurveyReport(SurveyResults& results,
int fileLevel,
int precision,
Category::File fileLevel,
Category::Precision precision,
unsigned int numSpace) const
{
// Initializing external pointer on current variable non applicable status
Expand Down
14 changes: 7 additions & 7 deletions src/solver/variable/commons/join.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,27 +288,27 @@ class Join : public Variable::IVariable<Join<LeftT, RightT, BindConstT>, Yuni::D
}

void buildSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision) const
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision) const
{
LeftType::buildSurveyReport(results, dataLevel, fileLevel, precision);
RightType::buildSurveyReport(results, dataLevel, fileLevel, precision);
BindConstType::buildSurveyReport(results, dataLevel, fileLevel, precision);
}

void buildAnnualSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision,
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision,
uint numSpace) const
{
LeftType::buildAnnualSurveyReport(results, dataLevel, fileLevel, precision, numSpace);
RightType::buildAnnualSurveyReport(results, dataLevel, fileLevel, precision, numSpace);
BindConstType::buildAnnualSurveyReport(results, dataLevel, fileLevel, precision, numSpace);
}

void buildDigest(SurveyResults& results, int digestLevel, int dataLevel) const
void buildDigest(SurveyResults& results, Category::Digest digestLevel, Category::DataLevel dataLevel) const
{
// Building the digest
LeftType ::buildDigest(results, digestLevel, dataLevel);
Expand Down
2 changes: 1 addition & 1 deletion src/solver/variable/commons/links/links.cpp.inc.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void Links::simulationEnd()
}
}

void Links::buildDigest(SurveyResults& results, int digestLevel, int dataLevel) const
void Links::buildDigest(SurveyResults& results, Category::Digest digestLevel, Category::DataLevel dataLevel) const
{
int count_int = count;
bool linkDataLevel = dataLevel & Category::link;
Expand Down
14 changes: 7 additions & 7 deletions src/solver/variable/commons/links/links.h.inc.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -170,21 +170,21 @@ public:
void hourEnd(State& state, uint hourInTheYear);

void buildSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision) const;
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision) const;

void buildAnnualSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision,
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision,
uint numSpace) const;

void beforeYearByYearExport(uint year, uint numSpace);

Yuni::uint64 memoryUsage() const;

void buildDigest(SurveyResults& results, int digestLevel, int dataLevel) const;
void buildDigest(SurveyResults& results, Category::Digest digestLevel, Category::DataLevel dataLevel) const;

template<class I>
static void provideInformations(I& infos);
Expand Down
12 changes: 6 additions & 6 deletions src/solver/variable/commons/links/links.hxx.inc.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ inline void Links::hourEnd(State& state, uint hourInTheYear)
}

inline void Links::buildSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision) const
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision) const
{
int count_int = count;
bool link_dataLevel = (dataLevel & Category::link);
Expand Down Expand Up @@ -219,9 +219,9 @@ inline void Links::buildSurveyReport(SurveyResults& results,
}

inline void Links::buildAnnualSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision,
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision,
uint numSpace) const
{
int count_int = count;
Expand Down
4 changes: 2 additions & 2 deletions src/solver/variable/commons/load.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ class TimeSeriesValuesLoad
}

void localBuildAnnualSurveyReport(SurveyResults& results,
int fileLevel,
int precision,
Category::File fileLevel,
Category::Precision precision,
unsigned int numSpace) const
{
// Initializing external pointer on current variable non applicable status
Expand Down
4 changes: 2 additions & 2 deletions src/solver/variable/commons/miscGenMinusRowPSP.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ class MiscGenMinusRowPSP
}

void localBuildAnnualSurveyReport(SurveyResults& results,
int fileLevel,
int precision,
Category::File fileLevel,
Category::Precision precision,
unsigned int numSpace) const
{
// Initializing external pointer on current variable non applicable status
Expand Down
4 changes: 2 additions & 2 deletions src/solver/variable/commons/psp.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ class PSP : public Variable::IVariable<PSP<NextT>, NextT, VCardPSP>
}

void localBuildAnnualSurveyReport(SurveyResults& results,
int fileLevel,
int precision,
Category::File fileLevel,
Category::Precision precision,
unsigned int numSpace) const
{
// Initializing external pointer on current variable non applicable status
Expand Down
4 changes: 2 additions & 2 deletions src/solver/variable/commons/rowBalance.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ class RowBalance : public Variable::IVariable<RowBalance<NextT>, NextT, VCardRow
}

void localBuildAnnualSurveyReport(SurveyResults& results,
int fileLevel,
int precision,
Category::File fileLevel,
Category::Precision precision,
unsigned int) const
{
// Initializing external pointer on current variable non applicable status
Expand Down
4 changes: 2 additions & 2 deletions src/solver/variable/commons/solar.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ class TimeSeriesValuesSolar
}

void localBuildAnnualSurveyReport(SurveyResults& results,
int fileLevel,
int precision,
Category::File fileLevel,
Category::Precision precision,
unsigned int numSpace) const
{
// Initializing external pointer on current variable non applicable status
Expand Down
6 changes: 3 additions & 3 deletions src/solver/variable/commons/spatial-aggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class SpatialAggregate
NextType::template simulationEndSpatialAggregates(allVars, set);
}

inline void buildDigest(SurveyResults& results, int digestLevel, int dataLevel) const
inline void buildDigest(SurveyResults& results, Category::Digest digestLevel, Category::DataLevel dataLevel) const
{
// Generate the Digest for the local results (districts part)
if (VCardType::columnCount != 0 && (VCardType::categoryDataLevel & Category::setOfAreas))
Expand All @@ -344,8 +344,8 @@ class SpatialAggregate
}

void localBuildAnnualSurveyReport(SurveyResults& results,
int fileLevel,
int precision,
Category::File fileLevel,
Category::Precision precision,
uint numSpace) const
{
if (VCardType::columnCount != 0 && (VCardType::categoryDataLevel & Category::setOfAreas))
Expand Down
4 changes: 2 additions & 2 deletions src/solver/variable/commons/wind.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ class TimeSeriesValuesWind
}

void localBuildAnnualSurveyReport(SurveyResults& results,
int fileLevel,
int precision,
Category::File fileLevel,
Category::Precision precision,
unsigned int numSpace) const
{
// Initializing external pointer on current variable non applicable status
Expand Down
14 changes: 7 additions & 7 deletions src/solver/variable/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,14 @@ class List : public NextT
** \brief Ask to all variables to fullfil the report
*/
void buildSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision) const;
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision) const;

void buildAnnualSurveyReport(SurveyResults& results,
int dataLevel,
int fileLevel,
int precision,
Category::DataLevel dataLevel,
Category::File fileLevel,
Category::Precision precision,
unsigned int numSpace) const;

/*!
Expand All @@ -237,7 +237,7 @@ class List : public NextT
/*!
** \brief Ask to all variables to fullfil the digest
*/
void buildDigest(SurveyResults& results, int digestLevel, int dataLevel) const;
void buildDigest(SurveyResults& results, Category::Digest digestLevel, Category::DataLevel dataLevel) const;
//@}

//! \name Memory management
Expand Down
Loading
Loading