94 for (
unsigned int level = startLevel; level < grid->
cellSizes_.size(); occupiedLevelsMask >>= 1, level++)
97 if (occupiedLevelsMask == 0)
break;
100 if ((occupiedLevelsMask & 1) == 0)
continue;
102 if (level == startLevel)
134 for (
unsigned int level = 0; level <= startLevel; occupiedLevelsMask >>= 1, level++)
137 if (occupiedLevelsMask == 0)
break;
140 if ((occupiedLevelsMask & 1) == 0)
continue;
142 if (level == startLevel)
187 #ifdef ContactListHgrid
198 getPossibleContactList().remove_ParticlePosibleContacts(obj);
211 InsertObjAgainstGrid(
grid, obj);
252 while (Test && p!=NULL)
277 for (
unsigned int level = 0; level < grid->
cellSizes_.size() && Test; occupiedLevelsMask >>= 1, level++)
280 if (occupiedLevelsMask == 0)
break;
283 if ((occupiedLevelsMask & 1) == 0)
continue;
292 &&
TestCell(x , y , level, obj, grid)
293 &&
TestCell(x , y-1, level, obj, grid)
294 &&
TestCell(x , y+1, level, obj, grid)
295 &&
TestCell(x-1, y , level, obj, grid)
296 &&
TestCell(x+1, y , level, obj, grid)
297 &&
TestCell(x-1, y-1, level, obj, grid)
298 &&
TestCell(x-1, y+1, level, obj, grid)
299 &&
TestCell(x+1, y-1, level, obj, grid)
300 &&
TestCell(x+1, y+1, level, obj, grid);
306 #ifdef ContactListHgrid
317 getPossibleContactList().add_PossibleContact(obj,p);
337 for (
int level = 0; level < grid->HGRID_MAX_LEVELS; occupiedLevelsMask >>= 1, level++)
340 if (occupiedLevelsMask == 0)
break;
343 if ((occupiedLevelsMask & 1) == 0)
continue;
346 inv_size = grid->inv_size[level];
348 xmin=(
int)floor(ownXMin*inv_size-0.5);
349 xmax=(
int)floor(ownXMax*inv_size+0.5);
350 ymin=(
int)floor(ownYMin*inv_size-0.5);
351 ymax=(
int)floor(ownYMax*inv_size+0.5);
353 for(
int i=xmin;i<=
xmax;i++)
354 for(
int j=ymin;j<=
ymax;j++)
355 InsertCell(i, j, level, obj, grid);
HGridMethod getHGridMethod()
void set_HGRID_x(const int _new)
void set_HGRID_PrevObject(BaseParticle *_new)
BaseParticle * get_HGRID_PrevObject() const
Mdouble get_InteractionRadius() const
BaseParticle * get_PeriodicFromParticle() const
BaseParticle * get_HGRID_NextObject() const
std::vector< double > invCellSizes_
std::vector< double > cellSizes_
void HGRID_UpdateParticleInHgrid(BaseParticle *obj)
This adds a partcile to the Grid, called in the grid setup routies.
This is the HGRID class - This is the actually HGRID code.
virtual bool TestObject(BaseParticle *pI, BaseParticle *pJ)
criterium for inserting a particle (returns false, if particles overlap;)
void set_HGRID_y(const int _new)
virtual void CheckCell_current(int x, int y, int l, HGrid *grid)
Checks for a collision in the particles own cell.
int ComputeHashBucketIndex(int x, int y, int z, int l)
Computes hash bucket index in range [0, NUM_BUCKETS-1].
const Vec3D & get_Position() const
bool * bucketIsChecked
bucketIsChecked[b] stores if hash bucket b is checked already; initially all zero ...
void CheckObjAgainstGrid(HGrid *grid, BaseParticle *obj)
Check if an Particle has a collision in the grid; avoids multiple checks.
int occupiedLevelsMask
l-th bit of occupiedLevelsMask is 1 if level l is contains particles; initially zero (Implies max 32 ...
void HGRID_RemoveParticleFromHgrid(BaseParticle *obj)
Mdouble xmin
These store the size of the domain, assume walls at the ends.
void set_HGRID_NextObject(BaseParticle *_new)
bool TestCell(int x, int y, int l, BaseParticle *obj, HGrid *grid)
Tests obj against all particles in cell similar to CheckCell, but links to TestObject instead of comp...
int get_HGRID_Level() const
bool TestObjAgainstGrid(HGrid *grid, BaseParticle *obj)
Tests obj against all neighbouring particles similar to CheckObjAgainstGrid, but links to TestCell in...
virtual void compute_internal_forces(BaseParticle *i)
Computes the forces between particles (internal in the sence that the sum over all these forces is ze...
BaseParticle ** objectBucket
objectBucket[b] stores pointer to first element in hash bucket b; initially all NULL ...
virtual void CheckCell(int x, int y, int l, BaseParticle *obj, HGrid *grid)
Check collisions for a general cell.