chombo-discharge
CD_ParallelOps.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_ParallelOps_H
13 #define CD_ParallelOps_H
14 
15 // Chombo includes
16 #include <RealVect.H>
17 
18 // Our includes
19 #include <CD_NamespaceHeader.H>
20 
24 namespace ParallelOps {
25 
29  inline void
30  barrier() noexcept;
31 
39  inline std::pair<int, int>
40  partition(const int a_N) noexcept;
41 
46  inline Real
47  min(const Real& a_input) noexcept;
48 
53  inline int
54  min(const int& a_input) noexcept;
55 
60  inline long long int
61  min(const long long int& a_input) noexcept;
62 
68  inline std::pair<Real, RealVect>
69  min(const Real& a_val, const RealVect& a_pos) noexcept;
70 
75  inline Real
76  max(const Real& a_input) noexcept;
77 
82  inline int
83  max(const int& a_input) noexcept;
84 
89  inline long long
90  max(const long long& a_input) noexcept;
91 
97  inline std::pair<Real, RealVect>
98  max(const Real& a_val, const RealVect& a_pos) noexcept;
99 
104  inline std::pair<Real, int>
105  maxRank(const Real& a_val) noexcept;
106 
111  inline std::pair<Real, int>
112  minRank(const Real& a_val) noexcept;
113 
118  inline Real
119  average(const Real& a_val) noexcept;
120 
125  inline Real
126  sum(const Real& a_value) noexcept;
127 
132  inline int
133  sum(const int& a_value) noexcept;
134 
139  inline long
140  sum(const long& a_value) noexcept;
141 
146  inline long long
147  sum(const long long& a_value) noexcept;
148 
153  inline unsigned long long
154  sum(const unsigned long long& a_value) noexcept;
155 
160  inline Real
161  standardDeviation(const Real& a_value) noexcept;
162 
169  inline void
170  vectorSum(Vector<Real>& a_data) noexcept;
177  inline void
178  vectorSum(Vector<int>& a_data) noexcept;
179 
186  inline void
187  vectorSum(Vector<long int>& a_data) noexcept;
188 
195  inline void
196  vectorSum(Vector<long long int>& a_data) noexcept;
197 } // namespace ParallelOps
198 
199 #include <CD_NamespaceFooter.H>
200 
201 #include <CD_ParallelOpsImplem.H>
202 
203 #endif
Implementation of CD_ParallelOps.H.
For putting a bunch of often-used MPI reductions in one place.
Definition: CD_ParallelOps.H:24
Real max(const Real &a_input) noexcept
Get the maximum of the input, reduced over MPI ranks (in the Chombo communicator)
Definition: CD_ParallelOpsImplem.H:176
std::pair< Real, int > maxRank(const Real &a_val) noexcept
Get the maximum value and the rank having the maximum value.
Definition: CD_ParallelOpsImplem.H:293
Real average(const Real &a_val) noexcept
Compute the average (across MPI ranks) of the input value.
Definition: CD_ParallelOpsImplem.H:500
Real standardDeviation(const Real &a_value) noexcept
Compute the standard deviation of the input value.
Definition: CD_ParallelOpsImplem.H:512
std::pair< Real, int > minRank(const Real &a_val) noexcept
Get the minimum value and the rank having the minimum value.
Definition: CD_ParallelOpsImplem.H:323
void vectorSum(Vector< Real > &a_data) noexcept
Perform a summation of all the MPI ranks's input data.
Definition: CD_ParallelOpsImplem.H:448
Real min(const Real &a_input) noexcept
Get the minimum of the input, reduced over MPI ranks (in the Chombo communicator)
Definition: CD_ParallelOpsImplem.H:58
Real sum(const Real &a_value) noexcept
Compute the sum across all MPI ranks.
Definition: CD_ParallelOpsImplem.H:353
void barrier() noexcept
MPI barrier.
Definition: CD_ParallelOpsImplem.H:25
std::pair< int, int > partition(const int a_N) noexcept
Partition the input number such that each MPI rank gets an equal chunk. We assume that N is the lengt...
Definition: CD_ParallelOpsImplem.H:35