Go to the documentation of this file.
23 #include "libmesh/parallel_histogram.h"
24 #include "libmesh/parallel.h"
25 #include "libmesh/parallel_conversion_utils.h"
26 #include "libmesh/parallel_hilbert.h"
34 template <
typename KeyType,
typename IdxType>
36 const std::vector<KeyType> & d) :
45 template <
typename KeyType,
typename IdxType>
50 libmesh_assert_less (min, max);
67 bin_bounds.resize (nbins+1);
68 bin_iters.resize (nbins+1,
data.begin());
71 bin_iters[0] =
data.begin();
75 for (IdxType b=1; b<nbins; ++b)
80 std::lower_bound (bin_iters[b-1],
data.end(),
84 bin_iters[nbins] =
data.end();
90 template <
typename KeyType,
typename IdxType>
94 std::vector<IdxType> local_hist (this->n_bins());
97 local_hist[b] = this->local_bin_size(b);
101 this->comm().sum(hist);
112 #ifdef LIBMESH_HAVE_LIBHILBERT
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
The libMesh namespace provides an interface to certain functionality in the library.
Histogram(const Parallel::Communicator &comm, const std::vector< KeyType > &d)
Constructor.
static KeyType to_key_type(const double f)
bool is_sorted(const std::vector< KeyType > &v)
Defines a histogram to be used in parallel in conjunction with a BinSorter.
double to_double(const KeyType &k)
A utility function which converts whatever KeyType is to a double for the histogram bounds.
void make_histogram(const IdxType nbins, KeyType max, KeyType min)
The actual function which sorts the data into nbins.
IterBase * data
Ideally this private member data should have protected access.
const std::vector< KeyType > & data
An object whose state is distributed along a set of processors.
void build_histogram()
Build the histogram across all processors and store the result in the input vector hist.