Skip to content

Commit

Permalink
Renamed timeSeries into timeSeriesEnum (#1675)
Browse files Browse the repository at this point in the history
* [DEV] Renamed timeSeries into timeSeriesEnum

* [DEV] Renamed timeSeriesEnum in timeSeriesType
  • Loading branch information
payetvin authored Oct 4, 2023
1 parent ab96d29 commit 0d3b342
Show file tree
Hide file tree
Showing 48 changed files with 181 additions and 179 deletions.
4 changes: 2 additions & 2 deletions src/libs/antares/study/area/area.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ class Area final : private Yuni::NonCopyable<Area>
/*!
** \brief Get the XCast data according a given time-series type
*/
template<enum TimeSeries T>
template<enum TimeSeriesType T>
XCast* xcastData();
template<enum TimeSeries T>
template<enum TimeSeriesType T>
const XCast* xcastData() const;

public:
Expand Down
6 changes: 3 additions & 3 deletions src/libs/antares/study/area/area.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ inline const Area* AreaList::operator[](uint i) const
return byIndex[i];
}

template<enum TimeSeries T>
template<enum TimeSeriesType T>
inline XCast* Area::xcastData()
{
switch (T)
Expand All @@ -71,7 +71,7 @@ inline XCast* Area::xcastData()
return nullptr;
}

template<enum TimeSeries T>
template<enum TimeSeriesType T>
inline const XCast* Area::xcastData() const
{
switch (T)
Expand Down Expand Up @@ -167,4 +167,4 @@ inline AreaList::const_reverse_iterator AreaList::rend() const
return areas.rend();
}

} // namespace Antares
} // namespace Antares
2 changes: 1 addition & 1 deletion src/libs/antares/study/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ std::string styleToString(const StyleType& style);
**
** These values are mainly used for mask bits
*/
enum TimeSeries : unsigned int
enum TimeSeriesType : unsigned int
{
//! TimeSeries : Load
timeSeriesLoad = 1,
Expand Down
4 changes: 2 additions & 2 deletions src/libs/antares/study/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void Parameters::reset()
resetSeeds();
}

bool Parameters::isTSGeneratedByPrepro(const TimeSeries ts) const
bool Parameters::isTSGeneratedByPrepro(const TimeSeriesType ts) const
{
return (timeSeriesToGenerate & ts);
}
Expand Down Expand Up @@ -1090,7 +1090,7 @@ bool Parameters::loadFromINI(const IniFile& ini, uint version, const StudyLoadOp
void Parameters::fixRefreshIntervals()
{
using T = std::
tuple<uint& /* refreshInterval */, enum TimeSeries /* ts */, const std::string /* label */>;
tuple<uint& /* refreshInterval */, enum TimeSeriesType /* ts */, const std::string /* label */>;
const std::list<T> timeSeriesToCheck = {{refreshIntervalLoad, timeSeriesLoad, "load"},
{refreshIntervalSolar, timeSeriesSolar, "solar"},
{refreshIntervalHydro, timeSeriesHydro, "hydro"},
Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/study/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Parameters final
** \param mask The time-serie to test
** \return True if the time-series must be generated by the preprocessor, false otherwise
*/
bool isTSGeneratedByPrepro(const TimeSeries ts) const;
bool isTSGeneratedByPrepro(const TimeSeriesType ts) const;

/*!
** \brief Reset to default all values in a structure for general data
Expand Down
2 changes: 2 additions & 0 deletions src/libs/antares/study/parts/common/series.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define __ANTARES_LIBS_STUDY_PARTS_COMMON_TIMESERIES_H__

#include <antares/array/matrix.h>
#include <vector>
#include "../../fwd.h"

namespace Antares::Data
Expand Down Expand Up @@ -66,5 +67,6 @@ class DataSeriesCommon
uint getSeriesIndex(unsigned int year) const;

}; // class DataSeriesCommon

} // namespace Antares::Data
#endif /* __ANTARES_LIBS_STUDY_PARTS_COMMON_TIMESERIES_H__ */
2 changes: 1 addition & 1 deletion src/libs/antares/study/study.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ void Study::ensureDataAreLoadedForAllBindingConstraints()

namespace // anonymous
{
template<enum TimeSeries T>
template<enum TimeSeriesType T>
struct TS final
{
static bool IsNeeded(const Study& s, const uint y)
Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/study/study.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class Study: public Yuni::NonCopyable<Study>, public IObject, public LayerData
/*!
** \brief Destroy all data of the TS generator '@TS'
*/
template<enum TimeSeries TS>
template<enum TimeSeriesType TS>
void destroyTSGeneratorData();

//! Destroy all data of the load TS generator
Expand Down
14 changes: 7 additions & 7 deletions src/libs/antares/study/study.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,27 @@ inline void Study::storeTimeSeriesNumbers(Solver::IResultWriter& resultWriter) c
storeTimeseriesNumbers<TimeSeriesT>(resultWriter, areas);
}

template<enum TimeSeries TS>
template<enum TimeSeriesType TS>
inline void Study::destroyTSGeneratorData()
{
switch (TS)
{
case TimeSeries::timeSeriesLoad:
case TimeSeriesType::timeSeriesLoad:
destroyAllLoadTSGeneratorData();
break;
case TimeSeries::timeSeriesSolar:
case TimeSeriesType::timeSeriesSolar:
destroyAllSolarTSGeneratorData();
break;
case TimeSeries::timeSeriesWind:
case TimeSeriesType::timeSeriesWind:
destroyAllWindTSGeneratorData();
break;
case TimeSeries::timeSeriesHydro:
case TimeSeriesType::timeSeriesHydro:
destroyAllHydroTSGeneratorData();
break;
case TimeSeries::timeSeriesThermal:
case TimeSeriesType::timeSeriesThermal:
destroyAllThermalTSGeneratorData();
break;
case TimeSeries::timeSeriesCount:
case TimeSeriesType::timeSeriesCount:
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/study/xcast/xcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ XCast::Distribution XCast::StringToDistribution(AnyString text)
return dtNone;
}

XCast::XCast(TimeSeries ts) :
XCast::XCast(TimeSeriesType ts) :
useTranslation(tsTranslationNone),
distribution(dtBeta),
capacity(0),
Expand Down
4 changes: 2 additions & 2 deletions src/libs/antares/study/xcast/xcast.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class XCast final : private Yuni::NonCopyable<XCast>
/*!
** \brief Constructor
*/
XCast(TimeSeries ts);
XCast(TimeSeriesType ts);
/*!
** \brief Destructor
*/
Expand Down Expand Up @@ -208,7 +208,7 @@ class XCast final : private Yuni::NonCopyable<XCast>
Matrix<float> conversion;

//! The related time-series
const TimeSeries timeSeries;
const TimeSeriesType timeSeries;

protected:
void resetTransferFunction();
Expand Down
2 changes: 1 addition & 1 deletion src/solver/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void Application::prepare(int argc, char* argv[])
pParameters->include.hurdleCosts);

bool tsGenThermal
= (0 != (pParameters->timeSeriesToGenerate & Antares::Data::TimeSeries::timeSeriesThermal));
= (0 != (pParameters->timeSeriesToGenerate & Antares::Data::TimeSeriesType::timeSeriesThermal));

checkMinStablePower(tsGenThermal, pStudy->areas);

Expand Down
26 changes: 13 additions & 13 deletions src/solver/simulation/timeseries-numbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ using namespace Yuni;
using namespace Antares::Data;
using namespace std;

const map<TimeSeries, int> ts_to_tsIndex = {{timeSeriesLoad, 0},
const map<TimeSeriesType, int> ts_to_tsIndex = {{timeSeriesLoad, 0},
{timeSeriesHydro, 1},
{timeSeriesWind, 2},
{timeSeriesThermal, 3},
{timeSeriesSolar, 4},
{timeSeriesRenewable, 5},
{timeSeriesTransmissionCapacities, 6}};

const map<TimeSeries, string> ts_to_tsTitle
const map<TimeSeriesType, string> ts_to_tsTitle
= {{timeSeriesLoad, "load"},
{timeSeriesHydro, "hydro"},
{timeSeriesWind, "wind"},
Expand All @@ -65,7 +65,7 @@ void addInterModalTimeSeriesToMessage(const array<bool, timeSeriesCount>& isTSin
{
bool isFirstLogged = true;

map<TimeSeries, int>::const_iterator it = ts_to_tsIndex.begin();
map<TimeSeriesType, int>::const_iterator it = ts_to_tsIndex.begin();
for (; it != ts_to_tsIndex.end(); ++it)
{
if (isTSintermodal[it->second])
Expand Down Expand Up @@ -263,7 +263,7 @@ class areaLinksTransCapaNumberOfTSretriever : public areaNumberOfTSretriever
class IntraModalConsistencyChecker
{
public:
IntraModalConsistencyChecker(const TimeSeries ts,
IntraModalConsistencyChecker(const TimeSeriesType ts,
const array<bool, timeSeriesCount>& isTSintramodal,
const array<bool, timeSeriesCount>& isTSgenerated,
areaNumberOfTSretriever* tsCounter,
Expand Down Expand Up @@ -344,7 +344,7 @@ bool checkIntraModalConsistency(array<uint, timeSeriesCount>& nbTimeseriesByMode
{
// Initialization of a map associating a time-series to an object that retrieves
// the number of time series inside an area
using mapTStoRetriever = map<TimeSeries, shared_ptr<areaNumberOfTSretriever>>;
using mapTStoRetriever = map<TimeSeriesType, shared_ptr<areaNumberOfTSretriever>>;
mapTStoRetriever ts_to_numberOfTSretrievers;
ts_to_numberOfTSretrievers[timeSeriesLoad] = make_shared<loadAreaNumberOfTSretriever>(study);
ts_to_numberOfTSretrievers[timeSeriesHydro] = make_shared<hydroAreaNumberOfTSretriever>(study);
Expand All @@ -361,7 +361,7 @@ bool checkIntraModalConsistency(array<uint, timeSeriesCount>& nbTimeseriesByMode
mapTStoRetriever::iterator it = ts_to_numberOfTSretrievers.begin();
for (; it != ts_to_numberOfTSretrievers.end(); ++it)
{
const TimeSeries tsKind = it->first;
const TimeSeriesType tsKind = it->first;
areaNumberOfTSretriever* tsRetriever = (it->second).get();
int indexTS = ts_to_tsIndex.at(it->first);
IntraModalConsistencyChecker intraModalchecker(
Expand Down Expand Up @@ -976,13 +976,13 @@ void TimeSeriesNumbers::StoreTimeSeriesNumbersIntoOuput(Data::Study& study, IRes
if (study.parameters.storeTimeseriesNumbers)
{
fixTSNumbersWhenWidthIsOne(study);
study.storeTimeSeriesNumbers<TimeSeries::timeSeriesLoad>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeries::timeSeriesSolar>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeries::timeSeriesHydro>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeries::timeSeriesWind>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeries::timeSeriesThermal>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeries::timeSeriesRenewable>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeries::timeSeriesTransmissionCapacities>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeriesType::timeSeriesLoad>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeriesType::timeSeriesSolar>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeriesType::timeSeriesHydro>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeriesType::timeSeriesWind>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeriesType::timeSeriesThermal>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeriesType::timeSeriesRenewable>(resultWriter);
study.storeTimeSeriesNumbers<TimeSeriesType::timeSeriesTransmissionCapacities>(resultWriter);

Simulation::BindingConstraintsTimeSeriesNumbersWriter ts_writer(resultWriter);
ts_writer.write(study.bindingConstraintsGroups);
Expand Down
4 changes: 2 additions & 2 deletions src/solver/ts-generator/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace TSGenerator
/*!
** \brief Regenerate the time-series
*/
template<enum Data::TimeSeries T>
template<enum Data::TimeSeriesType T>
bool GenerateTimeSeries(Data::Study& study, uint year, IResultWriter& writer);

bool GenerateThermalTimeSeries(Data::Study& study,
Expand All @@ -60,7 +60,7 @@ void DestroyAll(Data::Study& study);
/*!
** \brief Destroy a TS generator if it exists and no longer needed
*/
template<enum Data::TimeSeries T>
template<enum Data::TimeSeriesType T>
void Destroy(Data::Study& study, uint year);

} // namespace TSGenerator
Expand Down
4 changes: 2 additions & 2 deletions src/solver/ts-generator/generator.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ inline bool GenerateTimeSeries<Data::timeSeriesHydro>(Data::Study& study,
}

// --- TS Generators using XCast ---
template<enum Data::TimeSeries T>
template<enum Data::TimeSeriesType T>
bool GenerateTimeSeries(Data::Study& study, uint year, IResultWriter& writer)
{
auto* xcast = reinterpret_cast<XCast::XCast*>(
Expand Down Expand Up @@ -91,7 +91,7 @@ bool GenerateTimeSeries(Data::Study& study, uint year, IResultWriter& writer)
return r;
}

template<enum Data::TimeSeries T>
template<enum Data::TimeSeriesType T>
void Destroy(Data::Study& study, uint year)
{
auto* xcast = reinterpret_cast<XCast::XCast*>(
Expand Down
2 changes: 1 addition & 1 deletion src/solver/ts-generator/xcast/xcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ enum
mu = Data::XCast::dataCoeffMu,
};

XCast::XCast(Data::Study& study, Data::TimeSeries ts, IResultWriter& writer) :
XCast::XCast(Data::Study& study, Data::TimeSeriesType ts, IResultWriter& writer) :
study(study),
timeSeriesType(ts),
pNeverInitialized(true),
Expand Down
4 changes: 2 additions & 2 deletions src/solver/ts-generator/xcast/xcast.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class XCast final : private Yuni::NonCopyable<XCast>
/*!
** \brief Default constructor
*/
XCast(Data::Study& study, Data::TimeSeries ts, IResultWriter& writer);
XCast(Data::Study& study, Data::TimeSeriesType ts, IResultWriter& writer);
/*!
** \brief Destructor
*/
Expand Down Expand Up @@ -104,7 +104,7 @@ class XCast final : private Yuni::NonCopyable<XCast>
//! The current year
uint year;
//! The time-series type
const Data::TimeSeries timeSeriesType;
const Data::TimeSeriesType timeSeriesType;

//! The random generator to use
MersenneTwister* random;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace AntaresStudy
{
namespace Area
{
CorrelationPost::CorrelationPost(IAction* parent, Data::TimeSeries ts, const AnyString& areaname) :
CorrelationPost::CorrelationPost(IAction* parent, Data::TimeSeriesType ts, const AnyString& areaname) :
pAction(parent), pType(ts), pOriginalAreaName(areaname)
{
pInfos.caption << "Correlation for " << areaname << " (deferred)";
Expand Down
4 changes: 2 additions & 2 deletions src/ui/action/handler/antares-study/area/correlation-post.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CorrelationPost : public IAction
/*!
** \brief Default constructor
*/
explicit CorrelationPost(IAction* parent, Data::TimeSeries ts, const AnyString& areaname);
explicit CorrelationPost(IAction* parent, Data::TimeSeriesType ts, const AnyString& areaname);
//! Destructor
virtual ~CorrelationPost();
//@}
Expand All @@ -66,7 +66,7 @@ class CorrelationPost : public IAction
private:
//! The attached action
IAction::Ptr pAction;
Data::TimeSeries pType;
Data::TimeSeriesType pType;
Data::AreaName pOriginalAreaName;

}; // class IAction
Expand Down
2 changes: 1 addition & 1 deletion src/ui/action/handler/antares-study/area/correlation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace AntaresStudy
{
namespace Area
{
Correlation::Correlation(Data::TimeSeries ts, const AnyString& areaname) :
Correlation::Correlation(Data::TimeSeriesType ts, const AnyString& areaname) :
pType(ts), pOriginalAreaName(areaname)
{
switch (ts)
Expand Down
4 changes: 2 additions & 2 deletions src/ui/action/handler/antares-study/area/correlation.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Correlation : public IAction
/*!
** \brief Default constructor
*/
explicit Correlation(Data::TimeSeries ts, const AnyString& areaname);
explicit Correlation(Data::TimeSeriesType ts, const AnyString& areaname);
//! Destructor
virtual ~Correlation();
//@}
Expand All @@ -63,7 +63,7 @@ class Correlation : public IAction
virtual void createPostActionsWL(const IAction::Ptr& node);

private:
Data::TimeSeries pType;
Data::TimeSeriesType pType;
Data::AreaName pOriginalAreaName;

}; // class IAction
Expand Down
4 changes: 2 additions & 2 deletions src/ui/action/handler/antares-study/area/timeseries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace AntaresStudy
{
namespace Area
{
DataTimeseries::DataTimeseries(Data::TimeSeries ts, const AnyString& areaname) :
DataTimeseries::DataTimeseries(Data::TimeSeriesType ts, const AnyString& areaname) :
pType(ts), pOriginalAreaName(areaname)
{
switch (ts)
Expand All @@ -62,7 +62,7 @@ DataTimeseries::DataTimeseries(Data::TimeSeries ts, const AnyString& areaname) :
}
}

DataTimeseries::DataTimeseries(Data::TimeSeries ts,
DataTimeseries::DataTimeseries(Data::TimeSeriesType ts,
const AnyString& areaname,
const AnyString& clustername) :
pType(ts), pOriginalAreaName(areaname), pOriginalPlantName(clustername)
Expand Down
Loading

0 comments on commit 0d3b342

Please sign in to comment.