21 #ifndef __SOLVER_VARIABLE_SET_OF_AREAS_HXX__
22 #define __SOLVER_VARIABLE_SET_OF_AREAS_HXX__
24 namespace Antares::Solver::Variable
27 void SetsOfAreas<NextT>::initializeFromStudy(Data::Study& study)
29 using namespace Antares;
34 auto& sets = study.setsOfAreas;
36 pSetsOfAreas.reserve(sets.size());
37 pOriginalSets.reserve(sets.size());
40 for (uint setIndex = 0; setIndex != sets.size(); ++setIndex)
42 if (!sets.hasOutput(setIndex))
47 const auto& setname = sets.caption(setIndex);
50 if (!sets.resultSize(setIndex))
52 logs.warning() <<
"The set of areas named '" << setname
53 <<
"' is empty. No output will be produced for this set.";
57 auto n = std::make_unique<NextT>();
61 n->initializeFromStudy(study);
66 n->broadcastNonApplicability(
true);
70 n->getPrintStatusFromStudy(study);
72 pSetsOfAreas.push_back(std::move(n));
74 auto* originalSet = &sets[setIndex];
75 assert(originalSet != NULL);
76 assert(!originalSet->empty());
77 pOriginalSets.push_back(originalSet);
79 pNames.push_back(setname);
96 inline void SetsOfAreas<NextT>::initializeFromThermalCluster(
Data::Study*,
103 template<
class NextT>
104 inline void SetsOfAreas<NextT>::simulationBegin()
109 template<
class NextT>
110 inline void SetsOfAreas<NextT>::simulationEnd()
115 template<
class NextT>
116 inline void SetsOfAreas<NextT>::yearBegin(uint , uint )
121 template<
class NextT>
122 inline void SetsOfAreas<NextT>::yearEndBuild(
State& , uint , uint )
127 template<
class NextT>
128 inline void SetsOfAreas<NextT>::yearEnd(uint , uint )
133 template<
class NextT>
134 inline void SetsOfAreas<NextT>::computeSummary(
unsigned int ,
unsigned int )
139 template<
class NextT>
140 inline void SetsOfAreas<NextT>::hourBegin(uint )
145 template<
class NextT>
146 inline void SetsOfAreas<NextT>::weekBegin(
State&)
151 template<
class NextT>
152 inline void SetsOfAreas<NextT>::weekForEachArea(
State&,
unsigned int )
157 template<
class NextT>
158 inline void SetsOfAreas<NextT>::weekEnd(
State&)
163 template<
class NextT>
164 void SetsOfAreas<NextT>::hourForEachArea(
State& state,
unsigned int)
169 template<
class NextT>
170 inline void SetsOfAreas<NextT>::hourForEachLink(
State& state)
175 template<
class NextT>
176 inline void SetsOfAreas<NextT>::hourEnd(
State& state, uint hourInTheYear)
182 template<
class NextT>
183 inline void SetsOfAreas<NextT>::buildSurveyReport(SurveyResults& results,
188 int count_int = count;
189 bool setOfAreasDataLevel = dataLevel & Category::DataLevel::setOfAreas;
190 if (count_int && setOfAreasDataLevel)
192 pSetsOfAreas[results.data.setOfAreasIndex]->buildSurveyReport(results,
199 template<
class NextT>
200 inline void SetsOfAreas<NextT>::buildAnnualSurveyReport(SurveyResults& results,
206 int count_int = count;
207 bool setOfAreasDataLevel = dataLevel & Category::DataLevel::setOfAreas;
208 if (count_int && setOfAreasDataLevel)
210 pSetsOfAreas[results.data.setOfAreasIndex]->buildAnnualSurveyReport(results,
218 template<
class NextT>
219 void SetsOfAreas<NextT>::buildDigest(SurveyResults& results,
int digestLevel,
int dataLevel)
const
221 int count_int = count;
222 bool setOfAreasDataLevel = dataLevel & Category::DataLevel::setOfAreas;
223 if (count_int && setOfAreasDataLevel)
226 results.data.rowCaptions.clear();
227 results.data.rowCaptions.resize(pSetsOfAreas.size());
228 results.data.area =
nullptr;
229 results.data.rowIndex = 0;
231 for (
auto& set: pSetsOfAreas)
233 results.data.columnIndex = 0;
234 results.data.rowCaptions[results.data.rowIndex].clear()
235 <<
"@ " << pNames[results.data.rowIndex];
236 set->buildDigest(results, digestLevel, dataLevel);
237 ++results.data.rowIndex;
242 template<
class NextT>
244 inline void SetsOfAreas<NextT>::provideInformations(I& infos)
247 if (VCardType::nodeDepthForGUI)
249 infos.template beginNode<VCardType>();
251 NextType::template provideInformations<I>(infos);
258 infos.template addVCard<VCardType>();
260 NextType::template provideInformations<I>(infos);
264 template<
class NextT>
266 void SetsOfAreas<NextT>::yearEndSpatialAggregates(V& allVars, uint year, uint numSpace)
268 for (uint setindex = 0; setindex != pSetsOfAreas.size(); ++setindex)
270 assert(setindex < pOriginalSets.size());
271 pSetsOfAreas[setindex]->yearEndSpatialAggregates(allVars,
273 *(pOriginalSets[setindex]),
278 template<
class NextT>
280 void SetsOfAreas<NextT>::computeSpatialAggregatesSummary(V& allVars,
282 unsigned int numSpace)
284 for (uint setindex = 0; setindex != pSetsOfAreas.size(); ++setindex)
286 assert(setindex < pOriginalSets.size());
287 pSetsOfAreas[setindex]->computeSpatialAggregatesSummary(allVars, year, numSpace);
291 template<
class NextT>
293 void SetsOfAreas<NextT>::simulationEndSpatialAggregates(V& allVars)
295 for (uint i = 0; i != pSetsOfAreas.size(); ++i)
297 pSetsOfAreas[i]->simulationEndSpatialAggregates(allVars, *(pOriginalSets[i]));
301 template<
class NextT>
302 void SetsOfAreas<NextT>::beforeYearByYearExport(uint year, uint numSpace)
304 for (uint i = 0; i != pSetsOfAreas.size(); ++i)
306 pSetsOfAreas[i]->beforeYearByYearExport(year, numSpace);
310 template<
class NextT>
311 template<
class SearchVCardT,
class O>
312 inline void SetsOfAreas<NextT>::computeSpatialAggregateWith(O&)
317 template<
class NextT>
318 template<
class SearchVCardT,
class O>
319 inline void SetsOfAreas<NextT>::computeSpatialAggregateWith(O& out,
329 template<
class NextT>
330 template<
class VCardToFindT>
331 inline const double* SetsOfAreas<NextT>::retrieveHourlyResultsForCurrentYear()
const
336 template<
class NextT>
337 template<
class VCardToFindT>
338 inline void SetsOfAreas<NextT>::retrieveResultsForArea(
346 template<
class NextT>
347 template<
class VCardToFindT>
348 inline void SetsOfAreas<NextT>::retrieveResultsForThermalCluster(
356 template<
class NextT>
357 template<
class VCardToFindT>
358 inline void SetsOfAreas<NextT>::retrieveResultsForLink(
366 template<
class NextT>
367 template<
class PredicateT>
Definition of a link between two areas (Interconnection)
Definition: links.h:58
Definition for a single area.
Definition: area.h:51
A single thermal cluster.
Definition: cluster.h:76
static void RetrieveVariableList(PredicateT &predicate)
Retrieve the list of all individual variables.
Definition: setofareas.hxx:368
Definition: cbuilder.h:120
VariableAccessor< typename VCardT::ResultsType, VCardT::columnCount >::Type ResultsType
The true type used for the results.
Definition: info.h:760