Antares Simulator
Power System Simulator
ui-runtimeinfos.h
1 /*
2  * Copyright 2007-2025, 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 #ifndef __ANTARES_LIBS_STUDY_UI_RUNTIME_INFOS_H__
22 #define __ANTARES_LIBS_STUDY_UI_RUNTIME_INFOS_H__
23 
24 #include <yuni/yuni.h>
25 #include <yuni/core/string.h>
26 
27 #include "antares/study/binding_constraint/BindingConstraintsRepository.h"
28 
29 #include "area/area.h"
30 #include "binding_constraint/BindingConstraint.h"
31 #include "fwd.h"
32 
33 namespace Antares::Data
34 {
35 class UIRuntimeInfo final
36 {
37 public:
38  using VectorByType = std::map<enum BindingConstraint::Type,
40  using ByOperatorAndType = std::map<enum BindingConstraint::Operator, VectorByType>;
41 
42 public:
44 
45 
48  UIRuntimeInfo(Study& study);
49 
52  {
53  }
54 
56 
60  void reloadAll();
61 
65  void reload();
66 
67  void reloadBindingConstraints();
68 
72  uint linkCount() const
73  {
74  return pLinkCount;
75  }
76 
80  uint clusterCount() const
81  {
82  return pClusterCount;
83  }
84 
88  AreaLink* link(uint i)
89  {
90  assert(i < pLink.size());
91  return pLink[i];
92  }
93 
94  const AreaLink* link(uint i) const
95  {
96  assert(i < pLink.size());
97  return pLink[i];
98  }
99 
104  {
105  assert(i < pClusters.size());
106  return pClusters[i];
107  }
108 
109  const ThermalCluster* cluster(uint i) const
110  {
111  assert(i < pClusters.size());
112  return pClusters[i];
113  }
114 
115  BindingConstraint* constraint(uint i)
116  {
117  assert(i < pConstraint.size());
118  return pConstraint[i].get();
119  }
120 
121  const BindingConstraint* constraint(uint i) const
122  {
123  assert(i < pConstraint.size());
124  return pConstraint[i].get();
125  }
126 
127  uint constraintCount() const
128  {
129  return (uint)pConstraint.size();
130  }
131 
132  uint countItems(BindingConstraint::Operator op, BindingConstraint::Type type);
133 
134  uint visibleClustersCount(uint layerID);
135 
136  uint visibleLinksCount(uint layerID);
137 
138 public:
140  Area::LinkMap orderedAreasAndLinks;
144  ByOperatorAndType byOperator;
147 
148 private:
149  Study& pStudy;
151  uint pClusterCount;
152  ThermalCluster::Vector pClusters;
154  uint pLinkCount;
155 }; // class UIRuntimeInfo
156 
157 } // namespace Antares::Data
158 
159 #endif // __ANTARES_LIBS_STUDY_UI_RUNTIME_INFOS_H__
std::set< std::shared_ptr< BindingConstraint >, CompareBindingConstraintName > Set
Ordered Set of binding constraints.
Definition: BindingConstraint.h:88
Type
Definition: BindingConstraint.h:55
std::vector< std::shared_ptr< BindingConstraint > > Vector
Vector of binding constraints.
Definition: BindingConstraintsRepository.h:39
Definition: study.h:57
A single thermal cluster.
Definition: cluster.h:76
std::vector< Data::ThermalCluster * > Vector
Vector of thermal clusters.
Definition: cluster.h:85
Definition: ui-runtimeinfos.h:36
AreaLink::Vector pLink
Vector of pointers to links, in lexicographic order.
Definition: ui-runtimeinfos.h:146
uint clusterCount() const
The total number of links in the clusters.
Definition: ui-runtimeinfos.h:80
Area::LinkMap orderedAreasAndLinks
Areas ordered by their name + links ordered by their name.
Definition: ui-runtimeinfos.h:140
~UIRuntimeInfo()
Destructor.
Definition: ui-runtimeinfos.h:51
ByOperatorAndType byOperator
All binding constraints according their operator (<, > and = only)
Definition: ui-runtimeinfos.h:144
BindingConstraint::Set orderedConstraint
Binding constraints ordered by their name.
Definition: ui-runtimeinfos.h:142
void reloadAll()
Reload all informations about the study.
Definition: ui-runtimeinfos.cpp:38
uint linkCount() const
The total number of links in the study.
Definition: ui-runtimeinfos.h:72
AreaLink * link(uint i)
Get the link according a given index.
Definition: ui-runtimeinfos.h:88
void reload()
Reload informations about the study.
Definition: ui-runtimeinfos.cpp:44
ThermalCluster * cluster(uint i)
Get the cluster according a given index.
Definition: ui-runtimeinfos.h:103
UIRuntimeInfo(Study &study)
Constructor.
Definition: ui-runtimeinfos.cpp:32