chombo-discharge
CD_Loads.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2024 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_Loads_H
13 #define CD_Loads_H
14 
15 // Std includes
16 #include <vector>
17 #include <map>
18 
19 // Chombo includes
20 #include <Vector.H>
21 
22 // Our includes
23 #include <CD_NamespaceHeader.H>
24 
29 class Loads
30 {
31 public:
35  Loads() noexcept;
36 
40  virtual ~Loads() noexcept;
41 
46  virtual std::map<int, Real>&
47  getLoads() noexcept;
48 
53  virtual const std::map<int, Real>&
54  getLoads() const noexcept;
55 
59  virtual void
60  resetLoads() noexcept;
61 
66  virtual void
67  assignLoads(const std::map<int, Real>& a_assignedLoads) noexcept;
68 
73  virtual void
74  assignLoads(const std::vector<Real>& a_assignedLoads) noexcept;
75 
80  virtual void
81  assignLoads(const Vector<Real>& a_assignedLoads) noexcept;
82 
87  virtual void
88  incrementLoads(const std::map<int, Real>& a_increments) noexcept;
89 
94  virtual void
95  incrementLoads(const std::vector<Real>& a_increments) noexcept;
96 
101  virtual void
102  incrementLoads(const Vector<Real>& a_increments) noexcept;
103 
109  virtual void
110  incrementLoad(const int a_rank, const Real a_increment) noexcept;
111 
116  virtual std::vector<std::pair<int, Real>>
117  getSortedLoads() const noexcept;
118 
119 protected:
124  std::map<int, Real> m_loads;
125 };
126 
127 #include <CD_NamespaceFooter.H>
128 
129 #endif
Class for holding computational loads.
Definition: CD_Loads.H:30
Loads() noexcept
Constructor. Assigns zero loads.
Definition: CD_Loads.cpp:23
virtual void assignLoads(const std::map< int, Real > &a_assignedLoads) noexcept
Assign loads.
Definition: CD_Loads.cpp:66
virtual ~Loads() noexcept
Destructor (does nothing).
Definition: CD_Loads.cpp:30
virtual void resetLoads() noexcept
Reset loads. Sets all loads to 0.
Definition: CD_Loads.cpp:54
virtual std::map< int, Real > & getLoads() noexcept
Get the computational loads.
Definition: CD_Loads.cpp:38
std::map< int, Real > m_loads
Actual computational loads per MPI rank.
Definition: CD_Loads.H:124
virtual void incrementLoad(const int a_rank, const Real a_increment) noexcept
Increment load on rank.
Definition: CD_Loads.cpp:168
virtual void incrementLoads(const std::map< int, Real > &a_increments) noexcept
Increment loads. In this version a_increments[0] is the load increment for rank 0,...
Definition: CD_Loads.cpp:117
virtual std::vector< std::pair< int, Real > > getSortedLoads() const noexcept
Get sorted loads.
Definition: CD_Loads.cpp:183