diff --git a/src/solver/variable/include/antares/solver/variable/constants.h b/src/solver/variable/include/antares/solver/variable/constants.h index b5dbccf747..67a49ce68c 100644 --- a/src/solver/variable/include/antares/solver/variable/constants.h +++ b/src/solver/variable/include/antares/solver/variable/constants.h @@ -27,7 +27,6 @@ namespace Solver { namespace Variable { -constexpr unsigned int maxHoursInAYear = 8785; template struct PrecisionToPrintfFormat diff --git a/src/solver/variable/include/antares/solver/variable/economy/STSbyGroup.h b/src/solver/variable/include/antares/solver/variable/economy/STSbyGroup.h index 70adaea52a..4e3ad6ee7c 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/STSbyGroup.h +++ b/src/solver/variable/include/antares/solver/variable/economy/STSbyGroup.h @@ -341,7 +341,7 @@ class STSbyGroup: public Variable::IVariable, NextT, VCardSTSb { uint64_t r = (sizeof(IntermediateValues) * nbColumns_ + IntermediateValues::MemoryUsage()) * pNbYearsParallel; - r += sizeof(double) * nbColumns_ * maxHoursInAYear * pNbYearsParallel; + r += sizeof(double) * nbColumns_ * HOURS_PER_YEAR * pNbYearsParallel; r += AncestorType::memoryUsage(); return r; } diff --git a/src/solver/variable/include/antares/solver/variable/economy/STStorageCashFlowByCluster.h b/src/solver/variable/include/antares/solver/variable/economy/STStorageCashFlowByCluster.h index db6beb4c95..eb2eaa48b9 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/STStorageCashFlowByCluster.h +++ b/src/solver/variable/include/antares/solver/variable/economy/STStorageCashFlowByCluster.h @@ -263,7 +263,7 @@ class STstorageCashFlowByCluster: public Variable::IVariableareaWideIndex] .hour[i]; state.thermalClusterPMinOfTheClusterForYear[i] += pminOfTheClusterForYear - [numSpace][(state.thermalCluster->areaWideIndex * maxHoursInAYear) + i]; + [numSpace][(state.thermalCluster->areaWideIndex * HOURS_PER_YEAR) + i]; } // Next variable @@ -322,7 +322,7 @@ class ProductionByDispatchablePlant pValuesForTheCurrentYear[numSpace][cluster->areaWideIndex].hour[state.hourInTheYear] += thermal[area->index].thermalClustersProductions[cluster->areaWideIndex]; - pminOfTheClusterForYear[numSpace][(cluster->areaWideIndex * maxHoursInAYear) + pminOfTheClusterForYear[numSpace][(cluster->areaWideIndex * HOURS_PER_YEAR) + state.hourInTheYear] = thermal[area->index].PMinOfClusters[cluster->areaWideIndex]; } @@ -348,7 +348,7 @@ class ProductionByDispatchablePlant { uint64_t r = (sizeof(IntermediateValues) * pSize + IntermediateValues::MemoryUsage()) * pNbYearsParallel; - r += sizeof(double) * pSize * maxHoursInAYear * pNbYearsParallel; + r += sizeof(double) * pSize * HOURS_PER_YEAR * pNbYearsParallel; r += AncestorType::memoryUsage(); return r; } diff --git a/src/solver/variable/include/antares/solver/variable/economy/productionByRenewablePlant.h b/src/solver/variable/include/antares/solver/variable/economy/productionByRenewablePlant.h index 8da6244e49..82ce7b3dcf 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/productionByRenewablePlant.h +++ b/src/solver/variable/include/antares/solver/variable/economy/productionByRenewablePlant.h @@ -312,7 +312,7 @@ class ProductionByRenewablePlant: public Variable::IVariable::ReturnType array = intermediateValues[i].hour; - for (uint y = 0; y != maxHoursInAYear; ++y) + for (uint y = 0; y != HOURS_PER_YEAR; ++y) { array[y] *= v; } @@ -88,7 +88,7 @@ struct VariableAccessor for (uint i = 0; i != ColumnCountT; ++i) { Antares::Memory::Stored::ReturnType array = intermediateValues[i].hour; - for (uint y = 0; y != maxHoursInAYear; ++y) + for (uint y = 0; y != HOURS_PER_YEAR; ++y) { array[y] = std::abs(array[y]) > 0. ? 1. : 0.; } @@ -101,7 +101,7 @@ struct VariableAccessor for (uint i = 0; i != ColumnCountT; ++i) { Antares::Memory::Stored::ReturnType array = intermediateValues[i].hour; - for (uint y = 0; y != maxHoursInAYear; ++y) + for (uint y = 0; y != HOURS_PER_YEAR; ++y) { array[y] = std::abs(array[y]) > 0. ? 100. : 0.; } @@ -247,7 +247,7 @@ struct VariableAccessor = var.retrieveRawHourlyValuesForCurrentYear(i, numSpace); assert(src != NULL); - for (uint h = 0; h != maxHoursInAYear; ++h) + for (uint h = 0; h != HOURS_PER_YEAR; ++h) { out[i].hour[h] += src[h]; } @@ -263,7 +263,7 @@ struct VariableAccessor = var.retrieveRawHourlyValuesForCurrentYear(i, numSpace); assert(src != NULL); - for (uint h = 0; h != maxHoursInAYear; ++h) + for (uint h = 0; h != HOURS_PER_YEAR; ++h) { if (out[i].hour[h] < src[h]) { @@ -289,7 +289,7 @@ struct VariableAccessor for (typename Type::const_iterator i = intermediateValues.begin(); i != end; ++i) { array = (*i).hour; - for (uint y = 0; y != maxHoursInAYear; ++y) + for (uint y = 0; y != HOURS_PER_YEAR; ++y) { array[y] *= v; } @@ -304,7 +304,7 @@ struct VariableAccessor for (typename Type::const_iterator i = intermediateValues.begin(); i != end; ++i) { array = (*i).hour; - for (uint y = 0; y != maxHoursInAYear; ++y) + for (uint y = 0; y != HOURS_PER_YEAR; ++y) { array[y] = std::abs(array[y]) > 0. ? 1. : 0.; } @@ -319,7 +319,7 @@ struct VariableAccessor for (typename Type::const_iterator i = intermediateValues.begin(); i != end; ++i) { array = (*i).hour; - for (uint y = 0; y != maxHoursInAYear; ++y) + for (uint y = 0; y != HOURS_PER_YEAR; ++y) { array[y] = std::abs(array[y]) > 0. ? 100. : 0.; } @@ -516,7 +516,7 @@ struct VariableAccessor = var.retrieveRawHourlyValuesForCurrentYear(i, numSpace); assert(src != NULL); - for (uint h = 0; h != maxHoursInAYear; ++h) + for (uint h = 0; h != HOURS_PER_YEAR; ++h) { out[i].hour[h] += src[h]; } @@ -532,7 +532,7 @@ struct VariableAccessor = var.retrieveRawHourlyValuesForCurrentYear(i, numSpace); assert(src != NULL); - for (uint h = 0; h != maxHoursInAYear; ++h) + for (uint h = 0; h != HOURS_PER_YEAR; ++h) { if (out[i].hour[h] < src[h]) { @@ -553,7 +553,7 @@ struct VariableAccessor static void MultiplyHourlyResultsBy(U& intermediateValues, const double v) { assert(!std::isnan(v)); - for (uint y = 0; y != maxHoursInAYear; ++y) + for (uint y = 0; y != HOURS_PER_YEAR; ++y) { intermediateValues.hour[y] *= v; } @@ -562,7 +562,7 @@ struct VariableAccessor template static void SetTo1IfPositive(U& intermediateValues) { - for (uint y = 0; y != maxHoursInAYear; ++y) + for (uint y = 0; y != HOURS_PER_YEAR; ++y) { intermediateValues.hour[y] = std::abs(intermediateValues.hour[y]) > 0. ? 1. : 0.; } @@ -571,7 +571,7 @@ struct VariableAccessor template static void Or(U& intermediateValues) { - for (uint y = 0; y != maxHoursInAYear; ++y) + for (uint y = 0; y != HOURS_PER_YEAR; ++y) { intermediateValues.hour[y] = std::abs(intermediateValues.hour[y]) > 0. ? 100. : 0.; } @@ -683,7 +683,7 @@ struct VariableAccessor = var.retrieveRawHourlyValuesForCurrentYear(-1, numSpace); assert(src != NULL); - for (uint h = 0; h != maxHoursInAYear; ++h) + for (uint h = 0; h != HOURS_PER_YEAR; ++h) { out.hour[h] += src[h]; } @@ -696,7 +696,7 @@ struct VariableAccessor = var.retrieveRawHourlyValuesForCurrentYear(-1, numSpace); assert(src != NULL); - for (uint h = 0; h != maxHoursInAYear; ++h) + for (uint h = 0; h != HOURS_PER_YEAR; ++h) { if (out.hour[h] < src[h]) { diff --git a/src/solver/variable/include/antares/solver/variable/state.h b/src/solver/variable/include/antares/solver/variable/state.h index 597b692d9e..bea807a716 100644 --- a/src/solver/variable/include/antares/solver/variable/state.h +++ b/src/solver/variable/include/antares/solver/variable/state.h @@ -115,14 +115,14 @@ class State void yearEndBuildThermalClusterCalculateStartupCosts( const uint& maxDurationON, - const std::array& ON_min, - const std::array& ON_opt, + const std::array& ON_min, + const std::array& ON_opt, const Data::ThermalCluster* currentCluster); - std::array computeEconomicallyOptimalNbClustersONforEachHour( + std::array computeEconomicallyOptimalNbClustersONforEachHour( const uint& maxDurationON, - const std::array& ON_min, - const std::array& ON_max) const; + const std::array& ON_min, + const std::array& ON_max) const; /*! ** \brief Smooth the thermal units run after resolutions @@ -182,17 +182,17 @@ class State VALEURS_DE_NTC_ET_RESISTANCES ntc; //! Thermal production for the current thermal cluster for the whole year - double thermalClusterProductionForYear[Variable::maxHoursInAYear]; + double thermalClusterProductionForYear[HOURS_PER_YEAR]; //! Number of unit dispatched for all clusters for the whole year for ucHeruistic (fast) or //! ucMILP (accurate) - uint thermalClusterDispatchedUnitsCountForYear[Variable::maxHoursInAYear]; + uint thermalClusterDispatchedUnitsCountForYear[HOURS_PER_YEAR]; //! Thermal operating cost for the current thermal cluster for the whole year - double thermalClusterOperatingCostForYear[Variable::maxHoursInAYear]; + double thermalClusterOperatingCostForYear[HOURS_PER_YEAR]; //! Thermal NP Cost for the current thermal cluster for the whole year - double thermalClusterNonProportionalCostForYear[Variable::maxHoursInAYear]; + double thermalClusterNonProportionalCostForYear[HOURS_PER_YEAR]; //! Minimum power of the cluster for the whole year - double thermalClusterPMinOfTheClusterForYear[Variable::maxHoursInAYear]; + double thermalClusterPMinOfTheClusterForYear[HOURS_PER_YEAR]; double renewableClusterProduction; diff --git a/src/solver/variable/include/antares/solver/variable/storage/average.h b/src/solver/variable/include/antares/solver/variable/storage/average.h index 04b9272377..0b43eeeb0c 100644 --- a/src/solver/variable/include/antares/solver/variable/storage/average.h +++ b/src/solver/variable/include/antares/solver/variable/storage/average.h @@ -100,7 +100,7 @@ struct Average: public NextT switch (precision) { case Category::hourly: - InternalExportValues(report, + InternalExportValues(report, Memory::RawPointer( avgdata.hourly)); break; diff --git a/src/solver/variable/include/antares/solver/variable/storage/averagedata.h b/src/solver/variable/include/antares/solver/variable/storage/averagedata.h index a2b52841f6..0ed11ae239 100644 --- a/src/solver/variable/include/antares/solver/variable/storage/averagedata.h +++ b/src/solver/variable/include/antares/solver/variable/storage/averagedata.h @@ -54,7 +54,7 @@ class AverageData uint64_t dynamicMemoryUsage() const { - return sizeof(double) * maxHoursInAYear + sizeof(double) * nbYearsCapacity; + return sizeof(double) * HOURS_PER_YEAR + sizeof(double) * nbYearsCapacity; } public: diff --git a/src/solver/variable/include/antares/solver/variable/storage/intermediate.hxx b/src/solver/variable/include/antares/solver/variable/storage/intermediate.hxx index 516175a2b8..727ef96514 100644 --- a/src/solver/variable/include/antares/solver/variable/storage/intermediate.hxx +++ b/src/solver/variable/include/antares/solver/variable/storage/intermediate.hxx @@ -34,7 +34,7 @@ inline IntermediateValues::~IntermediateValues() inline void IntermediateValues::reset() { - Antares::Memory::Zero(maxHoursInAYear, hour); + Antares::Memory::Zero(HOURS_PER_YEAR, hour); memset(month, 0, sizeof(month)); memset(week, 0, sizeof(week)); memset(day, 0, sizeof(day)); @@ -53,7 +53,7 @@ inline const IntermediateValues::Type& IntermediateValues::operator[]( inline uint64_t IntermediateValues::MemoryUsage() { - return +sizeof(Type) * maxHoursInAYear; + return +sizeof(Type) * HOURS_PER_YEAR; } template @@ -66,7 +66,7 @@ inline void IntermediateValues::buildAnnualSurveyReport(SurveyResults& report, switch (precision) { case Category::hourly: - internalExportAnnualValues(report, hour, false); + internalExportAnnualValues(report, hour, false); break; case Category::daily: internalExportAnnualValues(report, day, false); diff --git a/src/solver/variable/include/antares/solver/variable/storage/minmax-data.h b/src/solver/variable/include/antares/solver/variable/storage/minmax-data.h index 6c2278d7e2..27bc3e89b4 100644 --- a/src/solver/variable/include/antares/solver/variable/storage/minmax-data.h +++ b/src/solver/variable/include/antares/solver/variable/storage/minmax-data.h @@ -49,7 +49,7 @@ class MinMaxData std::vector monthly{MONTHS_PER_YEAR}; std::vector weekly{WEEKS_PER_YEAR}; std::vector daily{DAYS_PER_YEAR}; - std::vector hourly{maxHoursInAYear}; + std::vector hourly{HOURS_PER_YEAR}; }; // class MinMaxData diff --git a/src/solver/variable/include/antares/solver/variable/storage/minmax.h b/src/solver/variable/include/antares/solver/variable/storage/minmax.h index f545383e1c..4f116723fe 100644 --- a/src/solver/variable/include/antares/solver/variable/storage/minmax.h +++ b/src/solver/variable/include/antares/solver/variable/storage/minmax.h @@ -83,7 +83,7 @@ struct MinMaxBase: public NextT switch (precision) { case Category::hourly: - InternalExportIndices(report, + InternalExportIndices(report, Memory::RawPointer(minmax.hourly.data()), fileLevel); break; @@ -106,7 +106,7 @@ struct MinMaxBase: public NextT switch (precision) { case Category::hourly: - InternalExportValues(report, + InternalExportValues(report, Memory::RawPointer(minmax.hourly.data())); break; case Category::daily: @@ -137,7 +137,7 @@ struct MinMaxBase: public NextT uint64_t memoryUsage() const { - return sizeof(double) * maxHoursInAYear + NextType::memoryUsage(); + return sizeof(double) * HOURS_PER_YEAR + NextType::memoryUsage(); } template class DecoratorT> diff --git a/src/solver/variable/include/antares/solver/variable/storage/raw.h b/src/solver/variable/include/antares/solver/variable/storage/raw.h index a2e184e7a0..a1cde659cf 100644 --- a/src/solver/variable/include/antares/solver/variable/storage/raw.h +++ b/src/solver/variable/include/antares/solver/variable/storage/raw.h @@ -104,7 +104,7 @@ struct Raw: public NextT switch (precision) { case Category::hourly: - InternalExportValues( + InternalExportValues( report, ::Antares::Memory::RawPointer(rawdata.hourly)); break; @@ -161,7 +161,7 @@ struct Raw: public NextT uint64_t memoryUsage() const { - return +sizeof(double) * maxHoursInAYear + NextType::memoryUsage(); + return +sizeof(double) * HOURS_PER_YEAR + NextType::memoryUsage(); } template class DecoratorT> diff --git a/src/solver/variable/include/antares/solver/variable/storage/stdDeviation.h b/src/solver/variable/include/antares/solver/variable/storage/stdDeviation.h index 96ad925f08..05ef774e11 100644 --- a/src/solver/variable/include/antares/solver/variable/storage/stdDeviation.h +++ b/src/solver/variable/include/antares/solver/variable/storage/stdDeviation.h @@ -77,7 +77,7 @@ struct StdDeviation: public NextT protected: void initializeFromStudy(Antares::Data::Study& study) { - Antares::Memory::Allocate(stdDeviationHourly, maxHoursInAYear); + Antares::Memory::Allocate(stdDeviationHourly, HOURS_PER_YEAR); // Next NextType::initializeFromStudy(study); @@ -91,7 +91,7 @@ struct StdDeviation: public NextT (void)::memset(stdDeviationMonthly, 0, sizeof(double) * MONTHS_PER_YEAR); (void)::memset(stdDeviationWeekly, 0, sizeof(double) * WEEKS_PER_YEAR); (void)::memset(stdDeviationDaily, 0, sizeof(double) * DAYS_PER_YEAR); - Antares::Memory::Zero(maxHoursInAYear, stdDeviationHourly); + Antares::Memory::Zero(HOURS_PER_YEAR, stdDeviationHourly); stdDeviationYear = 0.; // Next NextType::reset(); @@ -104,7 +104,7 @@ struct StdDeviation: public NextT unsigned int i; // StdDeviation value for each hour throughout all years - for (i = 0; i != maxHoursInAYear; ++i) + for (i = 0; i != HOURS_PER_YEAR; ++i) { stdDeviationHourly[i] += rhs.hour[i] * rhs.hour[i] * pRatio; } @@ -142,7 +142,7 @@ struct StdDeviation: public NextT switch (precision) { case Category::hourly: - InternalExportValues( + InternalExportValues( report, results, Memory::RawPointer(stdDeviationHourly)); @@ -180,7 +180,7 @@ struct StdDeviation: public NextT uint64_t memoryUsage() const { - return sizeof(double) * maxHoursInAYear + NextType::memoryUsage(); + return sizeof(double) * HOURS_PER_YEAR + NextType::memoryUsage(); } template class DecoratorT> diff --git a/src/solver/variable/state.cpp b/src/solver/variable/state.cpp index 9318e49f21..a1ee59e24d 100644 --- a/src/solver/variable/state.cpp +++ b/src/solver/variable/state.cpp @@ -234,20 +234,20 @@ void State::yearEndBuildFromThermalClusterIndex(const uint clusterAreaWideIndex) uint endHourForCurrentYear = startHourForCurrentYear + study.runtime->rangeLimits.hour[Data::rangeCount]; - assert(endHourForCurrentYear <= Variable::maxHoursInAYear); + assert(endHourForCurrentYear <= HOURS_PER_YEAR); // Nombre minimal de groupes en fonctionnement à l'heure h (determiné par Peff et Pnom) - std::array ON_min; + std::array ON_min; // Nombre maximal de groupes en fonctionnement à l'heure h (determine par Peff et Pmin) - std::array ON_max; + std::array ON_max; // Nombre de groupes économiquement optimal en fonctionnement à l'heure h - std::array ON_opt{}; + std::array ON_opt{}; // Get cluster properties Data::ThermalCluster* currentCluster = area->thermal.list.enabledClusterAt(clusterAreaWideIndex) .get(); - assert(endHourForCurrentYear <= Variable::maxHoursInAYear); + assert(endHourForCurrentYear <= HOURS_PER_YEAR); assert(endHourForCurrentYear <= currentCluster->series.timeSeries.height); assert(currentCluster); @@ -373,8 +373,8 @@ void State::yearEndBuildFromThermalClusterIndex(const uint clusterAreaWideIndex) void State::yearEndBuildThermalClusterCalculateStartupCosts( const uint& maxDurationON, - const std::array& ON_min, - const std::array& ON_opt, + const std::array& ON_min, + const std::array& ON_opt, const Data::ThermalCluster* currentCluster) { uint startHourForCurrentYear = study.runtime->rangeLimits.hour[Data::rangeBegin]; @@ -422,18 +422,18 @@ void State::yearEndBuildThermalClusterCalculateStartupCosts( } } -std::array +std::array State::computeEconomicallyOptimalNbClustersONforEachHour( const uint& maxDurationON, - const std::array& ON_min, - const std::array& ON_max) const + const std::array& ON_min, + const std::array& ON_max) const { uint startHourForCurrentYear = study.runtime->rangeLimits.hour[Data::rangeBegin]; uint endHourForCurrentYear = startHourForCurrentYear + study.runtime->rangeLimits.hour[Data::rangeCount]; // Nombre de groupes économiquement optimal en fonctionnement à l'heure h - std::array ON_opt; + std::array ON_opt; uint nivmax; // valeur maximale de ON_opt[h] , progressivement réactualisée à la baisse uint nivmin; // valeur minimale de ON_opt[h] , progressivement réactualisée à la hausse diff --git a/src/solver/variable/storage/averagedata.cpp b/src/solver/variable/storage/averagedata.cpp index 69d820ce7c..4a88945bb6 100644 --- a/src/solver/variable/storage/averagedata.cpp +++ b/src/solver/variable/storage/averagedata.cpp @@ -45,7 +45,7 @@ AverageData::~AverageData() void AverageData::reset() { - Antares::Memory::Zero(maxHoursInAYear, hourly); + Antares::Memory::Zero(HOURS_PER_YEAR, hourly); (void)::memset(monthly, 0, sizeof(double) * MONTHS_PER_YEAR); (void)::memset(weekly, 0, sizeof(double) * WEEKS_PER_YEAR); (void)::memset(daily, 0, sizeof(double) * DAYS_PER_YEAR); @@ -54,7 +54,7 @@ void AverageData::reset() void AverageData::initializeFromStudy(Data::Study& study) { - Antares::Memory::Allocate(hourly, maxHoursInAYear); + Antares::Memory::Allocate(hourly, HOURS_PER_YEAR); nbYearsCapacity = study.runtime->rangeLimits.year[Data::rangeEnd] + 1; year = new double[nbYearsCapacity]; @@ -70,7 +70,7 @@ void AverageData::merge(unsigned int y, const IntermediateValues& rhs) double ratio = (double)yearsWeight[y] / (double)yearsWeightSum; // Average value for each hour throughout all years - for (i = 0; i != maxHoursInAYear; ++i) + for (i = 0; i != HOURS_PER_YEAR; ++i) { hourly[i] += rhs.hour[i] * ratio; } diff --git a/src/solver/variable/storage/intermediate.cpp b/src/solver/variable/storage/intermediate.cpp index 4299ed7e23..4799085aaf 100644 --- a/src/solver/variable/storage/intermediate.cpp +++ b/src/solver/variable/storage/intermediate.cpp @@ -35,8 +35,8 @@ IntermediateValues::IntermediateValues(): calendar(nullptr), year(0.) { - Antares::Memory::Allocate(hour, maxHoursInAYear); - Antares::Memory::Zero(maxHoursInAYear, hour); + Antares::Memory::Allocate(hour, HOURS_PER_YEAR); + Antares::Memory::Zero(HOURS_PER_YEAR, hour); (void)::memset(month, 0, sizeof(Type) * MONTHS_PER_YEAR); (void)::memset(week, 0, sizeof(Type) * WEEKS_PER_YEAR); (void)::memset(day, 0, sizeof(Type) * DAYS_PER_YEAR); @@ -89,7 +89,7 @@ void IntermediateValues::computeStatisticsForTheCurrentYear() // One day for (j = 0; j != HOURS_PER_DAY; ++j) { - assert(indx < maxHoursInAYear); + assert(indx < HOURS_PER_YEAR); d += hour[indx]; ++indx; } @@ -144,7 +144,7 @@ void IntermediateValues::computeStatisticsOrForTheCurrentYear() // One day for (j = 0; j != HOURS_PER_DAY; ++j) { - assert(indx < maxHoursInAYear); + assert(indx < HOURS_PER_YEAR); if (hour[indx] > 0.) { day[i] = 100.; diff --git a/src/solver/variable/storage/rawdata.cpp b/src/solver/variable/storage/rawdata.cpp index 8f7bf3d6c4..4baf8531bd 100644 --- a/src/solver/variable/storage/rawdata.cpp +++ b/src/solver/variable/storage/rawdata.cpp @@ -42,7 +42,7 @@ RawData::~RawData() void RawData::initializeFromStudy(const Data::Study& study) { - Antares::Memory::Allocate(hourly, maxHoursInAYear); + Antares::Memory::Allocate(hourly, HOURS_PER_YEAR); nbYearsCapacity = study.runtime->rangeLimits.year[Data::rangeEnd] + 1; year = new double[nbYearsCapacity]; } @@ -50,7 +50,7 @@ void RawData::initializeFromStudy(const Data::Study& study) void RawData::reset() { // Reset - Antares::Memory::Zero(maxHoursInAYear, hourly); + Antares::Memory::Zero(HOURS_PER_YEAR, hourly); (void)::memset(monthly, 0, sizeof(double) * MONTHS_PER_YEAR); (void)::memset(weekly, 0, sizeof(double) * WEEKS_PER_YEAR); (void)::memset(daily, 0, sizeof(double) * DAYS_PER_YEAR); @@ -61,7 +61,7 @@ void RawData::merge(unsigned int y, const IntermediateValues& rhs) { unsigned int i; // StdDeviation value for each hour throughout all years - for (i = 0; i != maxHoursInAYear; ++i) + for (i = 0; i != HOURS_PER_YEAR; ++i) { hourly[i] += rhs.hour[i]; } diff --git a/src/solver/variable/surveyresults/surveyresults.cpp b/src/solver/variable/surveyresults/surveyresults.cpp index 0402fb6c15..9f724ad6ba 100644 --- a/src/solver/variable/surveyresults/surveyresults.cpp +++ b/src/solver/variable/surveyresults/surveyresults.cpp @@ -533,8 +533,8 @@ SurveyResults::SurveyResults(const Data::Study& s, const String& o, IResultWrite values = new ValueType[maxVariables]; for (uint i = 0; i != maxVariables; ++i) { - values[i] = new double[maxHoursInAYear]; - memset(values[i], 0, sizeof(double) * maxHoursInAYear); + values[i] = new double[HOURS_PER_YEAR]; + memset(values[i], 0, sizeof(double) * HOURS_PER_YEAR); } // captions @@ -638,7 +638,7 @@ void SurveyResults::exportDigestAllYears(std::string& buffer) for (auto j = data.rowCaptions.begin(); j != end; ++j, ++y) { // asserts - assert(y < maxHoursInAYear); + assert(y < HOURS_PER_YEAR); buffer.append("\t").append(j->c_str()); @@ -646,7 +646,7 @@ void SurveyResults::exportDigestAllYears(std::string& buffer) for (uint i = 0; i != data.columnIndex; ++i) { assert(i < maxVariables && "i greater can not be greater than maxVariables"); - assert(y < maxHoursInAYear && "y can not be greater than maxHoursInAYear"); + assert(y < HOURS_PER_YEAR && "y can not be greater than HOURS_PER_YEAR"); if (digestNonApplicableStatus[y][i]) { @@ -791,7 +791,7 @@ void SurveyResults::saveToFile(int dataLevel, int fileLevel, int precisionLevel) for (uint y = heightBegin; y < heightEnd; ++y) { // Asserts - assert(y < maxHoursInAYear); + assert(y < HOURS_PER_YEAR); // Index writeDateToFileDescriptor(y + 1, precisionLevel);