31 #ifdef CONSTUCTOR_OUTPUT
32 std::cerr <<
"HGRID_base() finished"<<std::endl;
43 #ifdef CONSTUCTOR_OUTPUT
44 std::cerr <<
"HGRID_base(MD& other) finished " << std::endl;
73 if (new_num_buckets>0)
79 std::cerr <<
"Error in set_HGRID_num_buckets" << std::endl;
92 while (NUM_BUCKETS<2*N)
103 std::stringstream line (std::stringstream::in | std::stringstream::out);
149 std::vector<double> cellSizes;
156 std::cout<<
"HGrid: using a linear cell size distribution from "<<minCellSize<<
" to "<<maxCellSize<<
" over "<<
hGridMaxLevels_<<
" levels"<<std::endl;
159 cellSizes.push_back(minCellSize+(maxCellSize-minCellSize)*(i+1.0)/hGridMaxLevels_);
167 std::cout<<
"HGrid: using an exponential cell size distribution from "<<minCellSize<<
" to "<<maxCellSize<<
" over "<<
hGridMaxLevels_<<
" levels"<<std::endl;
170 cellSizes.push_back(minCellSize*pow(maxCellSize/minCellSize,(i+1.0)/hGridMaxLevels_));
179 cellSizes.push_back(minCellSize*pow(2,i));
208 (*it)->set_HGRID_x(9999);
223 static int stepsBeforeUpdate=0;
232 #ifndef ContactListHgrid
279 if (!strcmp(argv[i],
"-NUM_BUCKETS"))
283 else if (!strcmp(argv[i],
"-hGridMaxLevels"))
287 else if (!strcmp(argv[i],
"-cellOverSizeRatio"))
330 if (hGridMaxLevels>0)
336 std::cout<<
"Error in void HGRID_base::set_HGridMaxLevel(int hGridMaxLevels), hGridMaxLevels should be strictly positive, while it is now "<<hGridMaxLevels<<std::endl;
HGridMethod getHGridMethod()
void HGRID_actions_after_integration()
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 getHGridCellOverSizeRatio()
void setHGridCellOverSizeRatio(Mdouble cellOverSizeRatio)
void setHGridUpdateEachTimeStep(bool updateEachTimeStep)
Mdouble get_InteractionRadius() const
void set_HGRID_num_buckets_to_power()
set number of buckets to the smallest power of two bigger than the number of particles ...
void getLineFromStringStream(std::istream &in, std::stringstream &out)
void set_HGRID_num_buckets(unsigned int new_num_buckets)
This sets the number of buckets for the HGRID.
void setHGridMethod(HGridMethod hGridMethod)
void InitBroadPhase()
This sets up the parameters required for the contact model.
void setHGridMaxLevels(int HGridMaxLevels)
void print(std::ostream &os, bool print_all)
This function outputs all HGRID data.
virtual BaseParticle * getLargestParticle()
Mdouble currentMaxRelativeDisplacement_
virtual void write(std::ostream &os)
Writes all MD data.
Mdouble getHGridCurrentMaxRelativeDisplacement()
void constructor()
This is the actually constructor it is called do both constructors above.
int NUM_BUCKETS
Number of buckets used for hashing.
std::vector< double > cellSizes_
HGRID_base()
This is the default constructor. All it does is set senible defaults.
void write(std::ostream &os)
This function writes all HGRID data.
Mdouble cellOverSizeRatio_
This is the HGRID class - This is the actually HGRID code.
void HGRID_actions_before_integration()
virtual int readNextArgument(unsigned int &i, unsigned int argc, char *argv[])
virtual bool TestObject(BaseParticle *pI, BaseParticle *pJ)
criterium for inserting a particle (returns false, if particles overlap;)
~HGRID_base()
This is the default destructor.
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
virtual void HGRID_UpdateParticleInHgrid(BaseParticle *obj UNUSED)
void Initialize_inv_size()
void setHGridDistribution(HGridDistribution hGridDistribution)
const Vec3D & get_Position() const
bool * bucketIsChecked
bucketIsChecked[b] stores if hash bucket b is checked already; initially all zero ...
int readNextArgument(unsigned int &i, unsigned int argc, char *argv[])
virtual void read(std::istream &is)
Reads all MD data.
A class that defines and solves a MD problem.
HGridDistribution hGridDistribution_
bool getHGridUpdateEachTimeStep()
void HGRID_InsertParticleToHgrid(BaseParticle *obj)
Inserts a single Particle to current grid.
int occupiedLevelsMask
l-th bit of occupiedLevelsMask is 1 if level l is contains particles; initially zero (Implies max 32 ...
ParticleHandler & getParticleHandler()
void read(std::istream &is)
This function reads all HGRID data.
virtual BaseParticle * getSmallestParticle()
Mdouble getHGridTotalCurrentMaxRelativeDisplacement()
void HGRID_actions_before_time_step()
This resets all the bucket information.
void HGRID_actions_before_time_loop()
This sets up the broad phase information, has to be done at this stage becuase it requires the partcl...
Mdouble totalCurrentMaxRelativeDisplacement_
HGridDistribution getHGridDistribution()
int get_HGRID_Level() const
BaseParticle ** objectBucket
objectBucket[b] stores pointer to first element in hash bucket b; initially all NULL ...
virtual void print(std::ostream &os, bool print_all=false)
Outputs MD.
void HGRID_update_move(BaseParticle *iP, Mdouble move)