1#ifndef HASH_PAIR_BUILDER_H
2#define HASH_PAIR_BUILDER_H
18 template<
class Pred,
class OP>
49 std::size_t *buckets =
new size_t[Nbucket];
50 std::size_t *next =
new size_t[size];
51 std::fill(buckets, buckets+Nbucket, END);
52 std::fill(next, next+size, END);
64 int offset[14][3] = {{ 1, 1, 1}, { 0, 1, 1}, {-1, 1, 1},
65 { 1, 0, 1}, { 0, 0, 1}, {-1, 0, 1},
66 { 1,-1, 1}, { 0,-1, 1}, {-1,-1, 1},
67 { 1, 1, 0}, { 0, 1, 0}, {-1, 1, 0},
68 { 1, 0, 0}, { 0, 0, 0}};
71 for(std::size_t i = 0;i<size;++i)
75 next[i] = buckets[bucket_id];
76 buckets[bucket_id] = i;
79 for (std::size_t i=0; i< Nbucket; ++i) {
81 std::size_t j = buckets[i];
95 for (
int n=0;
n<neigh;++
n){
96 int bx_neigh = bx+offset[
n][0];
97 int by_neigh = by+offset[
n][1];
98 int bz_neigh = bz+offset[
n][2];
106 unsigned bucket_id_neigh =
110 std::size_t i = buckets[bucket_id_self];
119 j = buckets[bucket_id_neigh];
121 for (
int o=0;o<self_offset;o++){
137 if (bucket_id_self==bucket_id_neigh)
183 int sum(
int i,
const Pred& pred,
int f[],
int offset[])
185 std::cout <<
"SUM " << pred.getRange(1) <<
"f[1]=" << f[1] <<
std::endl;
187 for(
int d = 0;d<
Dim;++d)
189 double scaled =
particles.R[i][d]/pred.getRange(d);
190 int pos =
mod(
int(
floor(scaled+offset[d])), f[d]);
191 for(
int dd = 0;dd<d;++dd)
205 for (
unsigned d=0; d<3; ++d)
217 return (m - ((-x)%m))%m;
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
PETE_TUTree< FnCeil, typename T::PETE_Expr_t > ceil(const PETE_Expr< T > &l)
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)
void bounds(const PETE_Expr< T1 > &expr, Vektor< T2, D > &minval, Vektor< T2, D > &maxval)
Inform & endl(Inform &inf)
void for_each(const Pred &pred, const OP &op)
Vektor< double, 3 > rmin_m
Vektor< double, 3 > rmax_m
int sum(int i, const Pred &pred, int f[], int offset[])
PBase::Position_t Position_t
int get_bucket_id(int i, const Pred &pred)
Vektor< int, 3 > buckets_per_dim
HashPairBuilder(PBase &p)