19#ifndef LIBMESH_PARALLEL_HISTOGRAM_H
20#define LIBMESH_PARALLEL_HISTOGRAM_H
28#include "libmesh/libmesh_common.h"
29#include "libmesh/parallel_object.h"
50template <
typename KeyType,
typename IdxType=
unsigned int>
54 typedef typename std::vector<KeyType>::const_iterator
IterType;
63 const std::vector<KeyType> & d);
115 const std::vector<KeyType> &
data;
123template <
typename KeyType,
typename IdxType>
132template <
typename KeyType,
typename IdxType>
136 if (bin_iters.empty())
139 return cast_int<IdxType>(bin_iters.size()-1);
144template <
typename KeyType,
typename IdxType>
148 libmesh_assert_less ((bin+1), bin_iters.size());
151 return cast_int<IdxType>
152 (std::distance (bin_iters[bin], bin_iters[bin+1]));
157template <
typename KeyType,
typename IdxType>
161 libmesh_assert_less (bin, hist.size());
169template <
typename KeyType,
typename IdxType>
173 libmesh_assert_less ((bin+1), bin_bounds.size());
175 return bin_bounds[bin];
180template <
typename KeyType,
typename IdxType>
184 libmesh_assert_less ((bin+1), bin_bounds.size());
186 return bin_bounds[bin+1];
An object whose state is distributed along a set of processors.
const Parallel::Communicator & comm() const
Defines a histogram to be used in parallel in conjunction with a BinSorter.
std::vector< IterType > bin_iters
std::vector< KeyType >::const_iterator IterType
IdxType local_bin_size(const IdxType bin) const
double lower_bound(const IdxType bin) const
const std::vector< IdxType > & get_histogram() const
void make_histogram(const IdxType nbins, KeyType max, KeyType min)
The actual function which sorts the data into nbins.
double upper_bound(const IdxType bin) const
IdxType n_bins() const
The number of bins in the histogram.
void build_histogram()
Build the histogram across all processors and store the result in the input vector hist.
IdxType global_bin_size(const IdxType bin) const
std::vector< double > bin_bounds
const std::vector< KeyType > & data
std::vector< IdxType > hist
The libMesh namespace provides an interface to certain functionality in the library.