187 template<
int CDataLevel,
int CFile>
204 typename VCardType::VCardOrigin::IntermediateValuesBaseType IntermediateValuesBaseType;
205 pNbYearsParallel = study.maxNbYearsInParallel;
209 pValuesForTheCurrentYear =
new IntermediateValuesBaseType[pNbYearsParallel];
210 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
212 VariableAccessorType::InitializeAndReset(pValuesForTheCurrentYear[numSpace], study);
215 auto& limits = study.runtime.rangeLimits;
217 pRatioYear = 100. / (double)limits.year[Data::rangeCount];
218 pRatioDay = 100. / (double)limits.day[Data::rangeCount];
219 pRatioMonth = 100. / (double)limits.month[Data::rangeCount];
220 pRatioWeek = 100. / (double)limits.week[Data::rangeCount];
223 NextType::initializeFromStudy(study);
229 NextType::initializeFromArea(study, area);
235 NextType::initializeFromAreaLink(study, link);
238 void simulationBegin()
241 NextType::simulationBegin();
246 NextType::simulationEnd();
249 void yearBegin(uint year)
252 NextType::yearBegin(year);
255 void yearEndBuildPrepareDataForEachThermalCluster(
State& state, uint year)
258 NextType::yearEndBuildPrepareDataForEachThermalCluster(state, year);
261 void yearEndBuildForEachThermalCluster(
State& state, uint year)
264 NextType::yearEndBuildForEachThermalCluster(state, year);
267 void yearEndBuild(
State& state,
unsigned int year,
unsigned int numSpace)
270 NextType::yearEndBuild(state, year, numSpace);
273 void yearEnd(uint year)
276 NextType::yearEnd(year);
279 void weekBegin(
State& state)
282 NextType::weekBegin(state);
285 void weekEnd(
State& state)
288 NextType::weekEnd(state);
291 void hourBegin(uint hourInTheYear)
294 NextType::hourBegin(hourInTheYear);
297 void hourForEachArea(
State& state,
unsigned int numSpace)
300 NextType::hourForEachArea(state, numSpace);
303 template<
class V,
class SetT>
304 void yearEndSpatialAggregates(V& allVars, uint year,
const SetT& set, uint numSpace)
306 if (VCardType::VCardOrigin::spatialAggregateMode & Category::spatialAggregateEachYear)
308 internalSpatialAggregateForCurrentYear(allVars, set, numSpace);
312 NextType::yearEndSpatialAggregates(allVars, year, set, numSpace);
316 void computeSpatialAggregatesSummary(V& allVars,
317 std::map<unsigned int, unsigned int>& numSpaceToYear,
318 uint nbYearsForCurrentSummary)
320 if (VCardType::VCardOrigin::spatialAggregateMode & Category::spatialAggregateEachYear)
322 internalSpatialAggregateForParallelYears(numSpaceToYear, nbYearsForCurrentSummary);
326 NextType::computeSpatialAggregatesSummary(allVars,
328 nbYearsForCurrentSummary);
331 template<
class V,
class SetT>
332 void simulationEndSpatialAggregates(V& allVars,
const SetT& set)
334 if (VCardType::VCardOrigin::spatialAggregateMode & Category::spatialAggregateOnce)
336 internalSpatialAggregate(allVars, 0, set);
340 NextType::simulationEndSpatialAggregates(allVars, set);
343 inline void buildDigest(SurveyResults&
results,
int digestLevel,
int dataLevel)
const
350 results.isPrinted = AncestorType::isPrinted;
351 results.isCurrentVarNA = AncestorType::isNonApplicable;
353 VariableAccessorType::template BuildDigest<typename VCardType::VCardOrigin>(
360 NextType::buildDigest(
results, digestLevel, dataLevel);
363 void localBuildAnnualSurveyReport(SurveyResults&
results,
372 results.isPrinted = AncestorType::isPrinted;
373 results.isCurrentVarNA = AncestorType::isNonApplicable;
375 typedef VariableAccessor<
typename VCardType::IntermediateValuesBaseType,
378 VAType::template BuildAnnualSurveyReport<typename VCardType::VCardOrigin>(
380 pValuesForTheCurrentYear[numSpace],
387 template<
class V,
class SetT>
388 void internalSpatialAggregate(V& allVars, uint year,
const SetT& set)
392 VariableAccessorType::Reset(pValuesForTheCurrentYear[0]);
397 auto end = set.end();
398 for (
auto i = set.begin(); i != end; ++i)
402 (pValuesForTheCurrentYear[0], *i , 0);
408 VariableAccessorType::MultiplyHourlyResultsBy(pValuesForTheCurrentYear[0],
413 & Category::spatialAggregateSumThen1IfPositive)
415 VariableAccessorType::SetTo1IfPositive(pValuesForTheCurrentYear[0]);
419 VariableAccessorType::Or(pValuesForTheCurrentYear[0]);
424 assert(!set.empty() &&
"The set should not be empty at this point");
428 VariableAccessorType::template ComputeStatistics<VCardOrigin>(pValuesForTheCurrentYear[0]);
429 VariableAccessorType::ComputeSummary(pValuesForTheCurrentYear[0],
434 template<
class V,
class SetT>
435 void internalSpatialAggregateForCurrentYear(V& allVars,
const SetT& set, uint numSpace)
439 VariableAccessorType::Reset(pValuesForTheCurrentYear[numSpace]);
444 auto end = set.end();
445 for (
auto i = set.begin(); i != end; ++i)
449 (pValuesForTheCurrentYear[numSpace], *i , numSpace);
455 VariableAccessorType::MultiplyHourlyResultsBy(pValuesForTheCurrentYear[numSpace],
460 & Category::spatialAggregateSumThen1IfPositive)
462 VariableAccessorType::SetTo1IfPositive(pValuesForTheCurrentYear[numSpace]);
466 VariableAccessorType::Or(pValuesForTheCurrentYear[numSpace]);
471 assert(!set.empty() &&
"The set should not be empty at this point");
475 VariableAccessorType::template ComputeStatistics<VCardOrigin>(
476 pValuesForTheCurrentYear[numSpace]);
479 void internalSpatialAggregateForParallelYears(
480 std::map<unsigned int, unsigned int>& numSpaceToYear,
481 uint nbYearsForCurrentSummary)
483 for (
unsigned int numSpace = 0; numSpace < nbYearsForCurrentSummary; ++numSpace)
486 VariableAccessorType::ComputeSummary(pValuesForTheCurrentYear[numSpace],
488 numSpaceToYear[numSpace]);
494 typename VCardType::IntermediateValuesTypeForSpatialAg pValuesForTheCurrentYear;
500 unsigned int pNbYearsParallel;