36 HGrid::HGrid(
int num_buckets,
double cellOverSizeRatio, std::vector<double>& cellSizes)
44 for(
int i=0;i<cellSizes.size();i++)
47 std::cout<<
"Level="<<i<<
" Grid size="<<
cellSizes_.back()<<std::endl;
60 for (
unsigned int level = 0; level<
cellSizes_.size(); level++)
81 std::cerr <<
"ATTENTION !!! Object is larger (d=" << diameter <<
", cellOverSizeRatio=" <<
cellOverSizeRatio_ <<
") than largest grid cell allows (" <<
cellSizes_.back() <<
")!" << std::endl;
95 const int h1 = 0x8da6b343;
96 const int h2 = 0xd8163841;
97 const int h3 = 0xcb1ab31f;
98 const int h4 = 0x165667b1;
100 int n = h1 * x + h2 * y + h3 * z + h4 * l;
110 const int h1 = 0x8da6b343;
111 const int h2 = 0xd8163841;
112 const int h4 = 0x165667b1;
114 int n = h1 * x + h2 * y + h4 * l;
void InsertParticleToHgrid(BaseParticle *obj)
This insert a particle given by CParticle in to the HGrid (i.e. it sets up the particle grid properts...
Mdouble get_InteractionRadius() const
Mdouble cellOverSizeRatio_
~HGrid()
constructor: initializes parameters and allocates space for internal variables
void reset_num_buckets(int new_num_buckets)
int NUM_BUCKETS
Number of buckets used for hashing.
std::vector< double > invCellSizes_
std::vector< double > cellSizes_
int ComputeHashBucketIndex(int x, int y, int z, int l)
Computes hash bucket index in range [0, NUM_BUCKETS-1].
void set_HGRID_Level(const int _new)
void Initialize_inv_size()
bool * bucketIsChecked
bucketIsChecked[b] stores if hash bucket b is checked already; initially all zero ...
int occupiedLevelsMask
l-th bit of occupiedLevelsMask is 1 if level l is contains particles; initially zero (Implies max 32 ...
BaseParticle ** objectBucket
objectBucket[b] stores pointer to first element in hash bucket b; initially all NULL ...