68 typedef typename SpecifierRemover<ResultsT>::Type CleanType;
69 typedef CleanType Type[ColumnCountT];
72 static void MultiplyHourlyResultsBy(U& intermediateValues,
const double v)
74 assert(!std::isnan(v));
75 for (uint i = 0; i != ColumnCountT; ++i)
77 Antares::Memory::Stored<double>::ReturnType array = intermediateValues[i].hour;
78 for (uint y = 0; y != HOURS_PER_YEAR; ++y)
86 static void SetTo1IfPositive(U& intermediateValues)
88 for (uint i = 0; i != ColumnCountT; ++i)
90 Antares::Memory::Stored<double>::ReturnType array = intermediateValues[i].hour;
91 for (uint y = 0; y != HOURS_PER_YEAR; ++y)
93 array[y] = std::abs(array[y]) > 0. ? 1. : 0.;
99 static void Or(U& intermediateValues)
101 for (uint i = 0; i != ColumnCountT; ++i)
103 Antares::Memory::Stored<double>::ReturnType array = intermediateValues[i].hour;
104 for (uint y = 0; y != HOURS_PER_YEAR; ++y)
106 array[y] = std::abs(array[y]) > 0. ? 100. : 0.;
112 static void InitializeAndReset(U& out,
Data::Study& study)
114 for (uint i = 0; i != ColumnCountT; ++i)
116 out[i].initializeFromStudy(study);
122 static void Reset(U& out)
124 for (uint i = 0; i != ColumnCountT; ++i)
130 template<
class VCardT,
class U>
131 static void ComputeStatistics(U& intermediateValues)
133 for (uint i = 0; i != ColumnCountT; ++i)
136 if (VCardT::spatialAggregate & Category::spatialAggregateOr)
138 intermediateValues[i].computeStatisticsOrForTheCurrentYear();
142 if (VCardT::spatialAggregatePostProcessing
143 == (
int)Category::spatialAggregatePostProcessingPrice)
145 intermediateValues[i].computeAveragesForCurrentYearFromHourlyResults();
149 intermediateValues[i].computeStatisticsForTheCurrentYear();
156 static void ComputeSummary(U& intermediateValues, Type& container, uint year)
158 for (uint i = 0; i != ColumnCountT; ++i)
161 container[i].merge(year, intermediateValues[i]);
165 template<
class VCardT>
167 const Type& container,
171 for (uint i = 0; i != ColumnCountT; ++i)
176 results.variableUnit = VCardT::Multiple::Unit(i);
177 container[i].template buildDigest<VCardT>(results, digestLevel, dataLevel);
185 template<
class VCardType>
187 const Type& container,
192 for (uint i = 0; i != ColumnCountT; ++i)
197 results.variableUnit = VCardType::Multiple::Unit(i);
198 container[i].template buildSurveyReport<ResultsT, VCardType>(results,
210 template<
class VCardType>
212 const Type& container,
216 for (uint i = 0; i != ColumnCountT; ++i)
221 container[i].template buildAnnualSurveyReport<VCardType>(results,
231 template<
class U,
class VarT>
232 static void ComputeSum(U& out,
const VarT& var, uint numSpace)
234 for (uint i = 0; i != ColumnCountT; ++i)
236 Antares::Memory::Stored<double>::ConstReturnType src
237 = var.retrieveRawHourlyValuesForCurrentYear(i, numSpace);
240 for (uint h = 0; h != HOURS_PER_YEAR; ++h)
242 out[i].hour[h] += src[h];
247 template<
class U,
class VarT>
248 static void ComputeMax(U& out,
const VarT& var, uint numSpace)
250 for (uint i = 0; i != ColumnCountT; ++i)
252 Antares::Memory::Stored<double>::ConstReturnType src
253 = var.retrieveRawHourlyValuesForCurrentYear(i, numSpace);
256 for (uint h = 0; h != HOURS_PER_YEAR; ++h)
258 if (out[i].hour[h] < src[h])
260 out[i].hour[h] = src[h];
270 typedef typename SpecifierRemover<ResultsT>::Type CleanType;
271 typedef std::vector<CleanType> Type;
274 static void MultiplyHourlyResultsBy(U& intermediateValues,
const double v)
276 assert(!std::isnan(v));
278 const typename Type::const_iterator end = intermediateValues.end();
279 for (
typename Type::const_iterator i = intermediateValues.begin(); i != end; ++i)
282 for (uint y = 0; y != HOURS_PER_YEAR; ++y)
290 static void SetTo1IfPositive(U& intermediateValues)
293 const typename Type::const_iterator end = intermediateValues.end();
294 for (
typename Type::const_iterator i = intermediateValues.begin(); i != end; ++i)
297 for (uint y = 0; y != HOURS_PER_YEAR; ++y)
299 array[y] = std::abs(array[y]) > 0. ? 1. : 0.;
305 static void Or(U& intermediateValues)
308 const typename Type::const_iterator end = intermediateValues.end();
309 for (
typename Type::const_iterator i = intermediateValues.begin(); i != end; ++i)
312 for (uint y = 0; y != HOURS_PER_YEAR; ++y)
314 array[y] = std::abs(array[y]) > 0. ? 100. : 0.;
320 static void InitializeAndReset(U& out,
Data::Study& study)
322 const typename Type::const_iterator end = out.end();
323 for (
typename Type::const_iterator i = out.begin(); i != end; ++i)
325 (*i).initializeFromStudy(study);
331 static void Reset(U& out)
333 const typename Type::const_iterator end = out.end();
334 for (
typename Type::const_iterator i = out.begin(); i != end; ++i)
340 template<
class VCardT,
class U>
341 static void ComputeStatistics(U& intermediateValues, Type& container, uint)
343 for (uint i = 0; i != container.size(); ++i)
345 if (VCardT::spatialAggregate & Category::spatialAggregateOr)
347 intermediateValues[i].computeStatisticsOrForTheCurrentYear();
352 if (VCardT::spatialAggregatePostProcessing
353 == (
int)Category::spatialAggregatePostProcessingPrice)
356 intermediateValues[i].computeAveragesForCurrentYearFromHourlyResults();
360 intermediateValues[i].computeStatisticsForTheCurrentYear();
367 static void ComputeSummary(U& intermediateValues, Type& container, uint year)
369 for (uint i = 0; i != container.size(); ++i)
372 container[i].merge(year, intermediateValues[i]);
376 template<
class VCardT>
378 const Type& container,
385 for (uint i = 0; i != container.size(); ++i)
389 container[i].template buildDigest<VCardT>(results, digestLevel, dataLevel);
394 static bool setClusterCaption(
SurveyResults& results,
int fileLevel, uint idx)
396 assert(results.
data.
area &&
"Area is NULL");
397 const bool thermal_details = fileLevel & Category::FileLevel::de;
398 const bool renewable_details = fileLevel & Category::FileLevel::de_res;
399 const bool st_storage_details = fileLevel & Category::FileLevel::de_sts;
401 std::array<bool, 3> kind_of_details = {thermal_details,
407 auto how_many_kinds_of_details = std::count(kind_of_details.begin(),
408 kind_of_details.end(),
411 if (how_many_kinds_of_details != 1)
413 logs.error() <<
"Inconsistent fileLevel detected";
419 auto& thermal = results.
data.
area->thermal;
423 if (renewable_details)
425 auto& renewable = results.
data.
area->renewable;
426 results.
variableCaption = renewable.list.enabledClusterAt(idx)->name();
429 if (st_storage_details)
431 auto& st_storage_part = results.
data.
area->shortTermStorage;
432 results.
variableCaption = st_storage_part.storagesByIndex[idx].properties.name;
438 template<
class VCardType>
440 const Type& container,
448 for (uint i = 0; i != container.size(); ++i)
450 res = setClusterCaption(results, fileLevel, i);
455 results.variableUnit = VCardType::Unit();
457 container[i].template buildSurveyReport<ResultsT, VCardType>(results,
466 template<
class VCardType>
468 const Type& container,
475 for (uint i = 0; i != container.size(); ++i)
477 res = setClusterCaption(results, fileLevel, i);
482 container[i].template buildAnnualSurveyReport<VCardType>(results,
489 template<
class U,
class VarT>
490 static void ComputeSum(U& out,
const VarT& var, uint numSpace)
492 for (uint i = 0; i != var.results().size(); ++i)
494 Antares::Memory::Stored<double>::ConstReturnType src
495 = var.retrieveRawHourlyValuesForCurrentYear(i, numSpace);
498 for (uint h = 0; h != HOURS_PER_YEAR; ++h)
500 out[i].hour[h] += src[h];
505 template<
class U,
class VarT>
506 static void ComputeMax(U& out,
const VarT& var, uint numSpace)
508 for (uint i = 0; i != var.results().size(); ++i)
510 Antares::Memory::Stored<double>::ConstReturnType src
511 = var.retrieveRawHourlyValuesForCurrentYear(i, numSpace);
514 for (uint h = 0; h != HOURS_PER_YEAR; ++h)
516 if (out[i].hour[h] < src[h])
518 out[i].hour[h] = src[h];
528 typedef typename SpecifierRemover<ResultsT>::Type CleanType;
529 typedef CleanType Type;
532 static void MultiplyHourlyResultsBy(U& intermediateValues,
const double v)
534 assert(!std::isnan(v));
535 for (uint y = 0; y != HOURS_PER_YEAR; ++y)
537 intermediateValues.hour[y] *= v;
542 static void SetTo1IfPositive(U& intermediateValues)
544 for (uint y = 0; y != HOURS_PER_YEAR; ++y)
546 intermediateValues.hour[y] = std::abs(intermediateValues.hour[y]) > 0. ? 1. : 0.;
551 static void Or(U& intermediateValues)
553 for (uint y = 0; y != HOURS_PER_YEAR; ++y)
555 intermediateValues.hour[y] = std::abs(intermediateValues.hour[y]) > 0. ? 100. : 0.;
560 static void InitializeAndReset(U& out,
Data::Study& study)
562 out.initializeFromStudy(study);
567 static void Reset(U& out)
572 template<
class VCardT,
class U>
573 static void ComputeStatistics(U& intermediateValues)
575 if (VCardT::spatialAggregate & Category::spatialAggregateOr)
577 intermediateValues.computeStatisticsOrForTheCurrentYear();
582 if (VCardT::spatialAggregatePostProcessing
583 == (
int)Category::spatialAggregatePostProcessingPrice)
586 intermediateValues.computeAveragesForCurrentYearFromHourlyResults();
590 intermediateValues.computeStatisticsForTheCurrentYear();
596 static void ComputeSummary(U& intermediateValues, Type& container, uint year)
599 container.merge(year, intermediateValues);
602 template<
class VCardT>
604 const Type& container,
611 results.variableUnit = VCardT::Unit();
612 container.template buildDigest<VCardT>(results, digestLevel, dataLevel);
616 template<
class VCardType>
618 const Type& container,
622 bool updateCaption =
true)
629 results.variableUnit = VCardType::Unit();
631 container.template buildSurveyReport<ResultsT, VCardType>(results,
639 template<
class VCardType>
641 const Type& container,
648 results.variableUnit = VCardType::Unit();
649 container.template buildAnnualSurveyReport<VCardType>(results, fileLevel, precision);
653 template<
class U,
class VarT>
654 static void ComputeSum(U& out,
const VarT& var, uint numSpace)
656 Antares::Memory::Stored<double>::ConstReturnType src
657 = var.retrieveRawHourlyValuesForCurrentYear(-1, numSpace);
660 for (uint h = 0; h != HOURS_PER_YEAR; ++h)
662 out.hour[h] += src[h];
666 template<
class U,
class VarT>
667 static void ComputeMax(U& out,
const VarT& var, uint numSpace)
669 Antares::Memory::Stored<double>::ConstReturnType src
670 = var.retrieveRawHourlyValuesForCurrentYear(-1, numSpace);
673 for (uint h = 0; h != HOURS_PER_YEAR; ++h)
675 if (out.hour[h] < src[h])
677 out.hour[h] = src[h];