OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
PartBinsCyc.h
Go to the documentation of this file.
1 
16 #ifndef OPAL_BinsCyc_HH
17 #define OPAL_BinsCyc_HH
18 
19 #ifndef PartBinTest
20 #else
21 #include "ranlib.h"
22 #define Inform ostream
23 #endif
24 
25 #include "Algorithms/PartBins.h"
26 #include <gsl/gsl_rng.h>
27 #include <gsl/gsl_histogram.h>
28 #include <gsl/gsl_cdf.h>
29 #include <gsl/gsl_randist.h>
30 
31 #include <cassert>
32 
33 class PartBinsCyc: public PartBins {
34 
35 public:
36 
37 
39  PartBinsCyc(int bunches, int bins, size_t partInBin[]);
40  PartBinsCyc(int specifiedNumBins, int bins);
41 
43  int getNBins() {return bins_m; }
44 
46  inline size_t getGlobalBinCount(int bin) {
47  size_t a = nBin_m[bin];
48  reduce(a, a, OpAddAssign());
49  return a;
50  }
51 
53  inline size_t getLocalBinCount(int bin) {
54  assert(bin < bins_m);
55  return nBin_m[bin];
56  }
57 
58  bool weHaveBins() {
59  return ( nemittedBins_m > 0 );
60  }
61 };
62 
63 #endif // OPAL_BinsCyc_HH
bool weHaveBins()
Definition: PartBinsCyc.h:58
bool reduce(Communicate &, InputIterator, InputIterator, OutputIterator, const ReduceOp &, bool *IncludeVal=0)
Definition: GlobalComm.hpp:55
int nemittedBins_m
Definition: PartBins.h:251
std::unique_ptr< size_t[]> nBin_m
Definition: PartBins.h:257
Defines a structure to hold energy bins and their associated data.
size_t getGlobalBinCount(int bin)
How many particles are on one bin.
Definition: PartBinsCyc.h:46
int bins_m
Definition: PartBins.h:144
PartBinsCyc(int bunches, int bins, size_t partInBin[])
Definition: PartBinsCyc.cpp:8
int getNBins()
Definition: PartBinsCyc.h:43
size_t getLocalBinCount(int bin)
How many particles are on one energy bin.
Definition: PartBinsCyc.h:53