Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
area.hxx
1/*
2** Copyright 2007-2024, RTE (https://www.rte-france.com)
3** See AUTHORS.txt
4** SPDX-License-Identifier: MPL-2.0
5** This file is part of Antares-Simulator,
6** Adequacy and Performance assessment for interconnected energy networks.
7**
8** Antares_Simulator is free software: you can redistribute it and/or modify
9** it under the terms of the Mozilla Public Licence 2.0 as published by
10** the Mozilla Foundation, either version 2 of the License, or
11** (at your option) any later version.
12**
13** Antares_Simulator is distributed in the hope that it will be useful,
14** but WITHOUT ANY WARRANTY; without even the implied warranty of
15** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16** Mozilla Public Licence 2.0 for more details.
17**
18** You should have received a copy of the Mozilla Public Licence 2.0
19** along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20*/
21#pragma once
22
23#include "antares/study/parts/load/prepro.h"
24#include "antares/study/parts/parts.h"
25
26namespace Antares::Data
27{
28struct CompareAreaName final
29{
30 inline bool operator()(const Area* s1, const Area* s2) const
31 {
32 return s1->name < s2->name;
33 }
34};
35
37{
38 assert(i < areas.size() and "Index out of bounds");
39 return byIndex[i];
40}
41
42inline const Area* AreaList::operator[](uint i) const
43{
44 assert(i < areas.size() and "Index out of bounds");
45 return byIndex[i];
46}
47
48template<enum TimeSeriesType T>
50{
51 switch (T)
52 {
53 case timeSeriesLoad:
54 return &(load.prepro->xcast);
55 case timeSeriesSolar:
56 return &(solar.prepro->xcast);
57 case timeSeriesWind:
58 return &(wind.prepro->xcast);
59 case timeSeriesHydro:
60 return nullptr;
61 case timeSeriesThermal:
62 return nullptr;
63 }
64 return nullptr;
65}
66
67template<enum TimeSeriesType T>
68inline const XCast* Area::xcastData() const
69{
70 switch (T)
71 {
72 case timeSeriesLoad:
73 return &(load.prepro->xcast);
74 case timeSeriesSolar:
75 return &(solar.prepro->xcast);
76 case timeSeriesWind:
77 return &(wind.prepro->xcast);
78 case timeSeriesHydro:
79 return nullptr;
80 case timeSeriesThermal:
81 return nullptr;
82 }
83 return nullptr;
84}
85
86template<class PredicateT>
87inline void AreaList::each(const PredicateT& predicate)
88{
89 auto end = areas.end();
90 for (auto i = areas.begin(); i != end; ++i)
91 {
92 auto& area = *(i->second);
93 predicate(area);
94 }
95}
96
97template<class PredicateT>
98inline void AreaList::each(const PredicateT& predicate) const
99{
100 auto end = areas.cend();
101 for (auto i = areas.cbegin(); i != end; ++i)
102 {
103 auto& area = *(i->second);
104 predicate(area);
105 }
106}
107
108inline uint AreaList::size() const
109{
110 return (uint)areas.size();
111}
112
113inline AreaList::iterator AreaList::begin()
114{
115 return areas.begin();
116}
117
118inline AreaList::const_iterator AreaList::begin() const
119{
120 return areas.begin();
121}
122
123inline AreaList::const_iterator AreaList::cbegin() const
124{
125 return areas.begin();
126}
127
128inline AreaList::iterator AreaList::end()
129{
130 return areas.end();
131}
132
133inline AreaList::const_iterator AreaList::end() const
134{
135 return areas.end();
136}
137
138inline AreaList::const_iterator AreaList::cend() const
139{
140 return areas.end();
141}
142
143inline AreaList::reverse_iterator AreaList::rbegin()
144{
145 return areas.rbegin();
146}
147
148inline AreaList::const_reverse_iterator AreaList::rbegin() const
149{
150 return areas.rbegin();
151}
152
153inline AreaList::reverse_iterator AreaList::rend()
154{
155 return areas.rend();
156}
157
158inline AreaList::const_reverse_iterator AreaList::rend() const
159{
160 return areas.rend();
161}
162
163} // namespace Antares::Data
Area::Map areas
All areas in the list.
Definition area.h:667
Area::Map::const_reverse_iterator const_reverse_iterator
A const iterator.
Definition area.h:375
Area * operator[](uint i)
Get an area from its index.
Definition area.hxx:36
Area::Map::reverse_iterator reverse_iterator
An iterator.
Definition area.h:373
Area::Map::const_iterator const_iterator
A const iterator.
Definition area.h:371
std::vector< Area * > byIndex
All areas by their index.
Definition area.h:665
Area::Map::iterator iterator
An iterator.
Definition area.h:369
uint size() const
Get the total number of areas.
Definition area.hxx:108
void each(const PredicateT &predicate)
Iterate through all areas.
Definition area.hxx:87
Definition for a single area.
Definition area.h:52
AreaName name
Name of the area.
Definition area.h:213
XCast * xcastData()
Get the XCast data according a given time-series type.
Definition area.hxx:49
Wind::Container wind
Wind time-series and Wind prepro data.
Definition area.h:258
std::unique_ptr< Data::Load::Prepro > prepro
Data for the pre-processor.
Definition container.h:66
std::unique_ptr< Data::Solar::Prepro > prepro
Data for the pre-processor.
Definition container.h:63
std::unique_ptr< Data::Wind::Prepro > prepro
Data for the pre-processor.
Definition container.h:63
Definition xcast.h:35
Definition area.hxx:29