1 #ifndef DIY_DETAIL_ALGORITHMS_SORT_HPP
2 #define DIY_DETAIL_ALGORITHMS_SORT_HPP
4 #include <diy/partners/common.hpp>
12 struct ScanPartners:
public RegularPartners
14 typedef RegularPartners Parent;
16 ScanPartners(
int nblocks,
int k):
17 Parent(1, nblocks, k) {}
20 size_t rounds()
const {
return 2*Parent::rounds(); }
22 inline bool active(
int round,
int gid,
const Master&)
const {
if (round < Parent::rounds()) { ... }
else { ... } }
25 inline void incoming(
int round,
int gid, std::vector<int>& partners,
const Master&)
const { Parent::fill(round - 1, gid, partners); }
27 inline void outgoing(
int round,
int gid, std::vector<int>& partners,
const Master&)
const { std::vector<int> tmp; Parent::fill(round, gid, tmp); partners.push_back(tmp[0]); }
32 template<
class Block,
class T,
class Op>
35 Scan(
const T Block::* in_,
38 in(in_), out(out_), op(op_) {}
40 void operator()(
void* b_,
const ReduceProxy& srp,
const RegularSwapPartners& partners)
const
42 Block* b =
static_cast<Block*
>(b_);
47 if (srp.in_link().size() > 0)
48 for (
unsigned i = 0; i < srp.in_link().size(); ++i)
51 srp.dequeue(srp.in_link().target(i).gid, x);
52 b->*out = op(x, b->*out);
55 if (srp.out_link().size() > 0)
56 for (
unsigned i = 0; i < srp.out_link().size(); ++i)
57 srp.enqueue(srp.out_link().target(i), b->*out);
void in(const RegularLink< Bounds > &link, const Point &p, OutIter out, const Bounds &domain)
Finds the neighbor(s) containing the target point. Assumptions:
Definition: pick.hpp:100