16 #ifndef HASH_PAIR_BUILDER_PERIODIC_PARALLEL_H
17 #define HASH_PAIR_BUILDER_PERIODIC_PARALLEL_H
33 template<
class Pred,
class OP>
48 parallel_dims[0] = !(globDomain[0]==locDomain[0]);
49 parallel_dims[1] = !(globDomain[1]==locDomain[1]);
50 parallel_dims[2] = !(globDomain[2]==locDomain[2]);
53 period=extend_r-extend_l;
57 for (
unsigned i=0; i<3; ++i) {
58 extend_l_local[i] = locDomain[i].first()*
hr_m[i]+extend_l[i];
59 extend_r_local[i] = extend_l[i]+(locDomain[i].last()+1)*
hr_m[i];
60 domain_width_local[i] = extend_r_local[i]-extend_l_local[i];
68 for (
unsigned dim = 0; dim<3; ++dim)
84 std::size_t *buckets =
new size_t[Nbucket];
85 std::size_t *next =
new size_t[size];
86 std::fill(buckets, buckets+Nbucket, END);
87 std::fill(next, next+size, END);
92 int offset[14][3] = {{ 1, 1, 1}, { 0, 1, 1}, {-1, 1, 1},
93 { 1, 0, 1}, { 0, 0, 1}, {-1, 0, 1},
94 { 1,-1, 1}, { 0,-1, 1}, {-1,-1, 1},
95 { 1, 1, 0}, { 0, 1, 0}, {-1, 1, 0},
96 { 1, 0, 0}, { 0, 0, 0}};
99 for(std::size_t i = 0;i<size;++i)
103 next[i] = buckets[bucket_id];
104 buckets[bucket_id] = i;
107 double part_count = 0;
109 for (
int bx=0+
int(!parallel_dims[0]); bx<
buckets_per_dim[0]-int(!parallel_dims[0]); ++bx) {
110 for (
int by=0+
int(!parallel_dims[1]); by<
buckets_per_dim[1]-int(!parallel_dims[1]); ++by) {
111 for (
int bz=0+
int(!parallel_dims[2]); bz<
buckets_per_dim[2]-int(!parallel_dims[2]); ++bz) {
114 for (
unsigned n=0;
n<neigh;++
n){
115 int bx_neigh, by_neigh, bz_neigh;
118 bx_neigh = bx+offset[
n][0];
120 if (!parallel_dims[0]) {
124 shift[0] = -period[0];
129 shift[0] = period[0];
133 by_neigh = by+offset[
n][1];
134 if (!parallel_dims[1]) {
137 shift[1] = -period[0];
141 shift[1] = period[1];
145 bz_neigh = bz+offset[
n][2];
146 if (!parallel_dims[2]) {
149 shift[2] = -period[2];
153 shift[2] = period[2];
161 unsigned bucket_id_neigh =
165 std::size_t i = buckets[bucket_id_self];
174 j = buckets[bucket_id_neigh];
176 for (
int o=0;o<self_offset;o++){
189 if (bucket_id_self==bucket_id_neigh)
213 for (
unsigned d=0; d<3; ++d)
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)
Vektor< double, 3 > rmax_m
int get_bucket_id(int i, const Pred &)
HashPairBuilderPeriodicParallel(PBase &p)
Vektor< double, 3 > h_chaining
Vektor< int, 3 > buckets_per_dim
void for_each(const Pred &pred, const OP &op, Vektor< double, 3 > extend_l, Vektor< double, 3 > extend_r)
PBase::Position_t Position_t
Vektor< double, 3 > rmin_m