32#ifndef MADNESS_WORLD_RANGE_H__INCLUDED
33#define MADNESS_WORLD_RANGE_H__INCLUDED
38# include <tbb/partitioner.h>
63 template <
typename iteratorT>
110 int nleft = (left.
n+1)/2;
162 template<
typename integralT,
typename distanceT>
163 inline static typename std::enable_if<std::is_integral<integralT>::value,
void>
::type
173 template<
typename iterT,
typename distanceT>
174 inline static typename std::enable_if<!std::is_integral<iterT>::value,
void>
::type
184 template<
class integralT>
185 inline static typename std::enable_if<std::is_integral<integralT>::value, integralT>
::type
186 distance(integralT first, integralT last) {
return last - first; }
195 template<
class iterT>
198 typename std::enable_if<!std::is_integral<iterT>::value>
::type* =
nullptr)
Range, vaguely a la Intel TBB, to encapsulate a random-access, STL-like start and end iterator with c...
Definition range.h:64
Range(Range &left, const Split &)
Splits range between new and old (r) objects. Cost is O(1).
Definition range.h:103
static std::enable_if< std::is_integral< integralT >::value, integralT >::type distance(integralT first, integralT last)
Calculate the distance between two iterators.
Definition range.h:186
unsigned int get_chunksize() const
Access the chunk size.
Definition range.h:152
bool is_divisible() const
Return true if this iteration range can be divided; that is, there are more items than the chunk size...
Definition range.h:146
static auto distance(iterT first, iterT last, typename std::enable_if<!std::is_integral< iterT >::value >::type *=nullptr) -> decltype(std::distance(first, last))
Calculate the distance between two iterators.
Definition range.h:197
long n
Number of items to iterator over.
Definition range.h:65
const iterator & end() const
Access the end.
Definition range.h:140
iteratorT iterator
Alias for the iterator type.
Definition range.h:71
static std::enable_if<!std::is_integral< iterT >::value, void >::type advance(iterT &it, distanceT n)
Advance by n elements in the range.
Definition range.h:175
bool empty() const
Returns true if size == 0.
Definition range.h:130
int chunksize
Number of items to give to each thread/process.
Definition range.h:68
Range(const iterator &start, const iterator &finish, int chunk=1)
Makes the range [start, finish).
Definition range.h:80
static std::enable_if< std::is_integral< integralT >::value, void >::type advance(integralT &i, distanceT n)
Advance by n elements in the range.
Definition range.h:164
iteratorT finish
Last item for iteration (first past the end, conventionally).
Definition range.h:67
const iterator & begin() const
Access the beginning.
Definition range.h:135
iteratorT start
First item for iteration.
Definition range.h:66
size_t size() const
Returns the number of items in the range (cost is O(1)).
Definition range.h:125
Range(const Range &r)
Copy constructor. Cost is O(1).
Definition range.h:93
tbb::split Split
Dummy class, a la Intel TBB, used to distinguish splitting constructor.
Definition range.h:54
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
std::string type(const PairType &n)
Definition PNOParameters.h:18
void advance(madness::Hash_private::HashIterator< hashT > &it, const distT &dist)
Definition worldhashmap.h:610
int distance(const madness::Hash_private::HashIterator< hashT > &it, const madness::Hash_private::HashIterator< hashT > &jt)
Definition worldhashmap.h:616