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