MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MercuryBase.cc
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #include <limits>
27 #include <cstring>
28 
29 #include "MercuryBase.h"
30 
32 {
33  constructor();
34  logger(DEBUG, "MercuryBase::MercuryBase() constructor finished");
35 }
36 
38 {
39  if (grid != nullptr)
40  {
41  delete grid;
42  grid = nullptr;
43  }
44  logger(DEBUG, "MercuryBase::~MercuryBase() destructor finished.");
45 }
46 
56 {
57  grid = nullptr;
58  gridNeedsUpdate_ = true;
59 
60  hGridMethod_ = mercuryBase.hGridMethod_;
62 
65 
67  hGridMaxLevels_ = mercuryBase.hGridMaxLevels_;
69 
70  logger(DEBUG, "HGRID_base(HGrid_base& other) constructor finished.");
71 }
72 
78 {
79  grid = nullptr;
80  gridNeedsUpdate_ = true;
81  hGridMaxLevels_ = 3;
83  updateEachTimeStep_ = true;
88 }
89 
95 {
96 }
97 
104 void MercuryBase::read(std::istream& is, ReadOptions opt)
105 {
106  DPMBase::read(is, opt);
107 
108  std::stringstream line;
110 
111  std::string dummy;
112 
113  line >> dummy;
114  // if-statement is needed in case a DPMBase (which does not contain the hGrid data)
115  // is read into MercuryBase class
116  if (dummy == "hGrid")
117  {
118  line >> dummy >> hGridMethod_;
119  line >> dummy >> hGridDistribution_;
120  line >> dummy >> hGridCellOverSizeRatio_;
121  //the extra information here is not needed
122  do
123  {
124  line >> dummy;
125  } while (dummy != "gridNeedsUpdate");
126  line >> gridNeedsUpdate_;
127  line >> dummy >> updateEachTimeStep_;
128  line >> dummy >> currentMaxRelativeDisplacement_;
129  line >> dummy >> totalCurrentMaxRelativeDisplacement_;
130  }
131 }
132 
147 void MercuryBase::write(std::ostream& os, bool writeAllParticles) const
148 {
149  DPMBase::write(os, writeAllParticles);
150  hGridInfo(os);
151 }
152 
159 {
161 }
162 
168 {
170 }
171 
176 void MercuryBase::setHGridUpdateEachTimeStep(bool updateEachTimeStep)
177 {
178  updateEachTimeStep_ = updateEachTimeStep;
179 }
180 
185 {
186  return updateEachTimeStep_;
187 }
188 
205 {
206  std::vector<Mdouble> cellSizes;
207 
208  const Mdouble minParticleInteractionRadius = getHGridTargetMinInteractionRadius();
209  const Mdouble maxParticleInteractionRadius = getHGridTargetMaxInteractionRadius();
210  if (minParticleInteractionRadius == 0.0 || minParticleInteractionRadius == maxParticleInteractionRadius)
211  {
212  //this case is executed if the particleHandler is empty (minParticleInteractionRadius == 0)
213  //or if the particle distribution is monodispersed.
214  //nextafter(d,std::numeric_limits<Mdouble>::max()) chooses the smallest
215  // Mdouble that is bigger than d.
216  const Mdouble maxCellSize = nextafter(2.0 * maxParticleInteractionRadius * getHGridCellOverSizeRatio(),
217  std::numeric_limits<Mdouble>::max());
218  cellSizes.push_back(maxCellSize);
219  if (getHGridMaxLevels() != 1)
220  {
221 
222  logger(VERBOSE,
223  "While rebuilding the hgrid: the number of levels was set to one, as the particle distribution is monodispersed");
224  }
225  }
226  else
227  {
228  switch (getHGridDistribution())
229  {
230  case LINEAR:
231  {
232  const Mdouble minCellSize = nextafter(2.0 * minParticleInteractionRadius * getHGridCellOverSizeRatio(),
233  0.0);
234  const Mdouble maxCellSize = nextafter(2.0 * maxParticleInteractionRadius * getHGridCellOverSizeRatio(),
235  std::numeric_limits<Mdouble>::max());
236  //std::cout << "HGrid: using a linear cell size distribution from " << minCellSize << " to " << maxCellSize << " over " << getHGridMaxLevels() << " levels" << std::endl;
237  for (unsigned int i = 0; i + 1 < getHGridMaxLevels(); i++)
238  {
239  cellSizes.push_back(minCellSize + (maxCellSize - minCellSize)
240  * (static_cast<Mdouble>(i + 1)) / getHGridMaxLevels());
241  }
242  //The last cell is added separately because in some cases accuracy was lost when calculating it.
243  cellSizes.push_back(maxCellSize);
244  break;
245  }
246  case EXPONENTIAL:
247  {
248  const Mdouble minCellSize = nextafter(2.0 * minParticleInteractionRadius * getHGridCellOverSizeRatio(),
249  0.0);
250  const Mdouble maxCellSize = nextafter(2.0 * maxParticleInteractionRadius * getHGridCellOverSizeRatio(),
251  std::numeric_limits<Mdouble>::max());
252  logger(INFO,"HGrid: using exponential cell size distribution from % to % over % levels",
253  minCellSize,maxCellSize,getHGridMaxLevels());
254  for (unsigned int i = 0; i + 1 < getHGridMaxLevels(); i++)
255  {
256  cellSizes.push_back(minCellSize
257  * std::pow(maxCellSize / minCellSize, static_cast<Mdouble>(i + 1)
258  / getHGridMaxLevels()));
259  }
260  //The last cell is added separately because in some cases accuracy was lost when calculating it.
261  cellSizes.push_back(maxCellSize);
262  break;
263  }
264  case USER:
265  {
266  for (unsigned int i = 0; i < getHGridMaxLevels(); i++)
267  {
268  cellSizes.push_back(userHGridCellSize(i));
269  }
270  break;
271  }
272  case OLDHGRID:
273  {
274  const Mdouble minCellSize = nextafter(2.0 * minParticleInteractionRadius * getHGridCellOverSizeRatio(),
275  0.0);
276 
277  //std::cout<<"HGrid: using the old HGrid cell size distribution starting from " <<minCellSize<<std::endl;
278  for (unsigned int i = 0; i < getHGridMaxLevels(); i++)
279  {
280  cellSizes.push_back(minCellSize * std::pow(2, i));
281  }
282  break;
283  }
284  }
285  }
286 
287 // //Make sure the cell size is at less 10 times the smallest number
288 // for (unsigned int i = 0; i < getHGridMaxLevels(); i++)
289 // {
290 // if (cellSizes[i]<(10+i)*std::numeric_limits<double>::min()) cellSizes[i]=(10+i)*std::numeric_limits<double>::min();
291 // }
292 
293 
294  delete grid;
295 
297 
298  for (BaseParticle* const p : particleHandler)
299  {
302  p->setHGridX(9999);
304  }
305  gridNeedsUpdate_ = false;
306 }
307 
312 {
313  if (grid != nullptr)
314  {
316  }
317 }
318 
324 {
325  if (hGridNeedsRebuilding())
326  {
327  //logger(INFO, "HGrid needs rebuilding at nt=%",getNumberOfTimeSteps());
328  hGridRebuild();
329  }
330  else
331  {
332 #ifndef CONTACT_LIST_HGRID
334 #endif
337  {
338 #ifndef CONTACT_LIST_HGRID
340 #endif
341  //logger(INFO, "HGrid needs updating at nt=%",getNumberOfTimeSteps());
342  for (BaseParticle* const p : particleHandler)
343  {
345  }
347  }
348  }
349 }
350 
360 {
361  const Mdouble currentRelativeDisplacement = move / mathsFunc::square(getHGrid()->getCellSize(iP->getHGridLevel()));
362  if (currentRelativeDisplacement > currentMaxRelativeDisplacement_)
363  {
364  currentMaxRelativeDisplacement_ = currentRelativeDisplacement;
365  }
366 }
367 
372 {
374 }
375 
380 {
383 }
384 
390 {
391  logger(WARN, "In Mdouble MercuryBase::userHGridCellSize(unsigned int level) with level= %", level);
392  logger(WARN, "If you want to use user defined HGrid cell sizes, this function should be redefined");
393  return 0.0;
394 }
395 
402 bool MercuryBase::readNextArgument(int& i, int argc, char* argv[])
403 {
404  if (!strcmp(argv[i], "-hGridMaxLevels"))
405  {
406  setHGridMaxLevels(static_cast<unsigned int>(atoi(argv[i + 1])));
407  }
408  else if (!strcmp(argv[i], "-cellOverSizeRatio"))
409  {
410  setHGridCellOverSizeRatio(atof(argv[i + 1]));
411  }
412  else
413  {
414  return DPMBase::readNextArgument(i, argc, argv); //if argv[i] is not found, check the commands in MD
415  }
416  return true; //returns true if argv[i] is found
417 }
418 
419 
424 {
425  hGridMethod_ = hGridMethod;
426 }
427 
432 {
433  return hGridDistribution_;
434 }
435 
441 {
442  if (hGridDistribution_ != hGridDistribution)
443  {
444  gridNeedsUpdate_ = true;
445  hGridDistribution_ = hGridDistribution;
446  }
447 }
448 
454 {
456 }
457 
464 {
465  //If the hGridCellOverSizeRatio changes significantly, assign the given parameter.
466  if (!mathsFunc::isEqual(hGridCellOverSizeRatio_, hGridCellOverSizeRatio, 1e-10))
467  {
468  gridNeedsUpdate_ = true;
469  hGridCellOverSizeRatio_ = hGridCellOverSizeRatio;
470  }
471 }
472 
476 void MercuryBase::setHGridMaxLevels(unsigned int hGridMaxLevels)
477 {
478  if (hGridMaxLevels_ != hGridMaxLevels)
479  {
480  gridNeedsUpdate_ = true;
481  hGridMaxLevels_ = hGridMaxLevels;
482  }
483 }
484 
488 unsigned int MercuryBase::getHGridMaxLevels() const
489 {
490  return hGridMaxLevels_;
491 }
492 
497 {
498  if (grid == nullptr)
499  {
500  logger(VERBOSE, "HGrid needs updating, because there is no grid.");
501  return true;
502  }
503  else if (gridNeedsUpdate_)
504  {
505  logger(VERBOSE, "HGrid needs updating, because some of its initialisation parameters have changed.");
506  return true;
507  }
508  else if (grid->getNeedsRebuilding())
509  {
510  logger(VERBOSE, "HGrid needs updating, because said so by the grid itself");
511  return true;
512  }
513  else if (getHGrid()->getNumberOfBuckets() > 10 * getHGridTargetNumberOfBuckets() ||
514  10 * getHGrid()->getNumberOfBuckets() < getHGridTargetNumberOfBuckets())
515  {
516  logger(VERBOSE, "HGrid needs updating, because of number of buckets, current = %, target = %.",
518  return true;
519  }
520  else if (particleHandler.getLargestParticle() != nullptr &&
523  {
524  logger(VERBOSE, "HGrid needs updating, because of maximum cell size, current = %, required = %.",
527  return true;
528  }
529  else
530  {
531  //std::cout<<"HGrid does not need updating, because of number of buckets, current="<<grid->NUM_BUCKETS<<" target="<<particleHandler.getSize()<<std::endl;
532  //std::cout<<"HGrid does not need updating, because of maximum cell size, current="<<grid->cellSizes_.back()*grid->cellOverSizeRatio_<<" required="<<2.0*particleHandler.getLargestParticle()->getInteractionRadius()<<std::endl;
533  return false;
534  }
535 }
536 
541 {
542  unsigned int nParticles = particleHandler.getSize();
543  if (nParticles > 10)
544  {
546  return 10 * nParticles;
547  }
548  else
549  {
550  return 10;
551  }
552 }
553 
559 {
560  if (particleHandler.getSize() == 0)
561  {
562  return 0.0;
563  }
564  else
565  {
567  }
568 }
569 
575 {
576  if (particleHandler.getSize() == 0)
577  {
578  return 0.0;
579  }
580  else
581  {
583  }
584 }
585 
595 {
596 #ifdef MERCURY_USE_MPI
597  bool interaction;
598  if (NUMBER_OF_PROCESSORS == 1)
599  {
601  }
602  else
603  {
604  //check locally and then collectively come to a global conclusion
605  bool interactionLocal = checkParticleForInteractionLocal(p);
606 
607  MPIContainer::Instance().allReduce(interactionLocal, interaction, MPI_LAND);
608  }
609 #else
610  bool interaction = checkParticleForInteractionLocalPeriodic(p);
611 #endif
612  return interaction;
613 }
614 
623 {
624  Mdouble distance;
625  Vec3D normal;
626 
627  //Check if it has no collision with walls
628  for (BaseWall* w :wallHandler)
629  {
630  if (w->getDistanceAndNormal(p, distance, normal))
631  {
632  logger(VERBOSE, "Collision with wall %.", *w);
633  return false;
634  }
635  else
636  {
637  logger(VERBOSE, "No collision with wall %.", *w);
638  }
639  }
640 
641  //Check if it has no collision with other particles
642  if (hGridHasParticleContacts(&p))
643  {
644  logger(VERBOSE, "Collision with particle.");
645  return false;
646  }
647  else
648  {
649  logger(VERBOSE, "No collision with particles.");
650  }
651  return true;
652 }
653 
654 
655 void MercuryBase::hGridInfo(std::ostream& os) const
656 {
657 #ifdef MERCURY_USE_MPI
658  MPIContainer& communicator = MPIContainer::Instance();
659  int numberOfProcessors = communicator.getNumberOfProcessors();
660 #else
661  int numberOfProcessors = 1;
662 #endif
663  os << "hGrid"
664  << " method " << hGridMethod_
665  << " distribution " << hGridDistribution_
666  << " cellOverSizeRatio " << hGridCellOverSizeRatio_;
667  //os << " maxLevels " << hGridMaxLevels_;
668  if (numberOfProcessors == 1 && grid != nullptr)
669  {
670  os << " numberOfBuckets " << grid->getNumberOfBuckets()
671  << " cellSizes";
672  for (const auto p: grid->getCellSizes()) os << " " << p;
673  }
674  os << " gridNeedsUpdate " << gridNeedsUpdate_
675  << " updateEachTimeStep " << updateEachTimeStep_
676  << " currentMaxRelativeDisplacement " << currentMaxRelativeDisplacement_
677  << " totalCurrentMaxRelativeDisplacement " << totalCurrentMaxRelativeDisplacement_
678  << std::endl;
679 }
This class contains all information and functions required for communication between processors...
Definition: MpiContainer.h:129
BaseParticle * getLargestParticle() const
Returns the pointer of the largest particle in the particle handler. When mercury is running in paral...
virtual void write(std::ostream &os, bool writeAllParticles=true) const
Loads all MD data and plots statistics for all time steps in the .data file.
Definition: DPMBase.cc:3402
virtual void hGridUpdateParticle(BaseParticle *obj UNUSED)
Definition: DPMBase.cc:1688
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:134
bool hGridNeedsRebuilding()
Gets if the HGrid needs rebuilding before anything else happens.
Definition: MercuryBase.cc:496
Mdouble totalCurrentMaxRelativeDisplacement_
After each time step, this Mdouble is increased by 2*currentMaxRelativeDisplacement_.
Definition: MercuryBase.h:368
Mdouble getHGridCellOverSizeRatio() const
Gets the ratio of the smallest cell over the smallest particle.
Definition: MercuryBase.cc:453
~MercuryBase() override
This is the default destructor.
Definition: MercuryBase.cc:37
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
HGrid * grid
A pointer to the HGrid associated with this MercuryBase.
Definition: MercuryBase.h:336
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here...
double Mdouble
Definition: GeneralDefine.h:34
Mdouble getMaxInteractionRadius() const
Returns the particle's interaction radius, which might be different from radius_ (e.g., when dealing with wet particles)
Definition: BaseParticle.h:359
Mdouble getHGridCurrentMaxRelativeDisplacement() const
Returns hGridCurrentMaxRelativeDisplacement_.
Definition: MercuryBase.cc:158
void insertParticleToHgrid(BaseParticle *obj)
Inserts the given BaseParticle in to the HGrid.
Definition: HGrid.cc:89
virtual unsigned int getHGridTargetNumberOfBuckets() const
Gets the desired number of buckets, which is the maximum of the number of particles and 10...
Definition: MercuryBase.cc:540
void setHGridUpdateEachTimeStep(bool updateEachTimeStep)
Sets whether or not the HGrid must be updated every time step.
Definition: MercuryBase.cc:176
bool checkParticleForInteractionLocal(const BaseParticle &P) final
Checks if the given BaseParticle has an interaction with a BaseWall or other BaseParticles in a local...
Definition: MercuryBase.cc:622
void clearFirstBaseParticleInBucket()
For all buckets, it removes the pointer to the first BaseParticle in it, practically emptying the buc...
Definition: HGrid.cc:145
virtual Mdouble getHGridTargetMinInteractionRadius() const
Gets the desired size of the smallest cells of the HGrid.
Definition: MercuryBase.cc:558
HGridDistribution hGridDistribution_
Indicator for the distribution of the sizes of the cells of different levels of the HGrid...
Definition: MercuryBase.h:354
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
unsigned int hGridMaxLevels_
Unsigned integer that indicates the maximum number of levels of the HGrid.
Definition: MercuryBase.h:396
Mdouble getLargestInteractionRadiusLocal() const
Returns the largest interaction radius of the current domain.
std::size_t getNumberOfProcessors() const
Get the total number of processors participating in this simulation.
Mdouble getCellOverSizeRatio() const
Gets the maximum ratio of the cell to a particle it contains.
Definition: HGrid.h:139
Mdouble hGridCellOverSizeRatio_
The maximum ratio between the size of the cells and the BaseParticle they contain.
Definition: MercuryBase.h:404
unsigned int getHGridMaxLevels() const
Gets the maximum number of levels of the HGrid in this MercuryBase.
Definition: MercuryBase.cc:488
void hGridActionsBeforeTimeStep() override
Performs all necessary actions before a time-step, like updating the particles and resetting all the ...
Definition: MercuryBase.cc:323
bool isEqual(Mdouble v1, Mdouble v2, Mdouble absError)
Compares the difference of two Mdouble with an absolute error, useful in UnitTests.
const Mdouble inf
Definition: GeneralDefine.h:44
virtual Mdouble getHGridTargetMaxInteractionRadius() const
Gets the desired size of the largest cells of the HGrid.
Definition: MercuryBase.cc:574
HGridMethod
Enum class that indicates how particles in different levels (cross level checking) of the HGrid are c...
Definition: MercuryBase.h:43
void setHGridMethod(HGridMethod hGridMethod)
Sets the HGridMethod to either BOTTOMUP or TOPDOWN.
Definition: MercuryBase.cc:423
void hGridInsertParticle(BaseParticle *obj) final
Inserts a single Particle to current grid.
Definition: MercuryBase.cc:311
HGridMethod hGridMethod_
Indicator of which way the interactions between different levels are tested.
Definition: MercuryBase.h:348
bool checkParticleForInteraction(const BaseParticle &P) final
Checks if given BaseParticle has an interaction with a BaseWall or other BaseParticle.
Definition: MercuryBase.cc:594
This is the base class for both Mercury2D and Mercury3D. Note the actually abstract grid is defined i...
Definition: MercuryBase.h:125
Mdouble getHGridTotalCurrentMaxRelativeDisplacement() const
Returns hGridTotalCurrentMaxRelativeDisplacement_.
Definition: MercuryBase.cc:167
void hGridActionsAfterIntegration() override
This function has to be called before integrateBeforeForceComputation.
Definition: MercuryBase.cc:379
const std::vector< double > & getCellSizes() const
Gets the sizes of the cells at all levels as a vector.
Definition: HGrid.h:154
virtual void read(std::istream &is, ReadOptions opt=ReadOptions::ReadAll)
Reads all data from a restart file, e.g. domain data and particle data.
Definition: DPMBase.cc:3523
void write(std::ostream &os, bool writeAllParticles=true) const override
Writes all data into a restart file.
Definition: MercuryBase.cc:147
virtual bool readNextArgument(int &i, int argc, char *argv[])
Interprets the i^th command-line argument.
Definition: DPMBase.cc:4342
Mdouble getSmallestInteractionRadiusLocal() const
Returns the smallest interaction radius of the current domain.
void getLineFromStringStream(std::istream &in, std::stringstream &out)
Reads a line from one stringstream into another, and prepares the latter for reading in...
Definition: Helpers.cc:423
In the HGrid class, here all information about the HGrid is stored.
Definition: HGrid.h:42
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created...
Definition: DPMBase.h:1376
bool readNextArgument(int &i, int argc, char *argv[]) override
Reads the next command line argument.
Definition: MercuryBase.cc:402
void clearBucketIsChecked()
Sets all buckets to not-checked.
Definition: HGrid.cc:140
void setHGridCellOverSizeRatio(Mdouble cellOverSizeRatio)
Sets the ratio of the smallest cell over the smallest particle.
Definition: MercuryBase.cc:463
HGridDistribution
Enum that indicates what the ratio of the size of the cells in different levels is.
Definition: MercuryBase.h:83
bool updateEachTimeStep_
Boolean which indicates whether or not the cell in which a particle is must be updated every time ste...
Definition: MercuryBase.h:382
Basic class for walls.
Definition: BaseWall.h:47
void hGridUpdateMove(BaseParticle *iP, Mdouble move) final
Computes the relative displacement of the given BaseParticle and updates the currentMaxRelativeDispla...
Definition: MercuryBase.cc:359
void setHGridMaxLevels(unsigned int HGridMaxLevels)
Sets the maximum number of levels of the HGrid in this MercuryBase.
Definition: MercuryBase.cc:476
void hGridActionsBeforeTimeLoop() override
This sets up the broad phase information, has to be done at this stage because it requires the partic...
Definition: MercuryBase.cc:94
MercuryBase()
This is the default constructor. It sets sensible defaults.
Definition: MercuryBase.cc:31
#define NUMBER_OF_PROCESSORS
For the MPI communication routines this quantity is often required. defining this macro makes the cod...
Definition: GeneralDefine.h:62
void hGridRebuild()
This sets up the parameters required for the contact model.
Definition: MercuryBase.cc:204
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1386
virtual bool hGridHasParticleContacts(const BaseParticle *obj)=0
Purely virtual function that checks if the given particle has a possible contact with any other BaseP...
HGridDistribution getHGridDistribution() const
Gets how the sizes of the cells of different levels are distributed.
Definition: MercuryBase.cc:431
void constructor()
This is the actual constructor, it is called do both constructors above.
Definition: MercuryBase.cc:77
bool gridNeedsUpdate_
Boolean that indicates whether or not the grid needs to be updated.
Definition: MercuryBase.h:376
void hGridInfo(std::ostream &os=std::cout) const
Writes the info of the HGrid to the screen in a nice format.
Definition: MercuryBase.cc:655
HGrid * getHGrid()
Gets the HGrid used by this problem.
Definition: MercuryBase.h:311
bool checkParticleForInteractionLocalPeriodic(const BaseParticle &P)
Definition: DPMBase.cc:4680
bool getNeedsRebuilding() const
Gets whether or not the grid needs to be rebuilt before something else is done with it...
Definition: HGrid.h:192
bool getHGridUpdateEachTimeStep() const final
Gets whether or not the HGrid is updated every time step.
Definition: MercuryBase.cc:184
Definition: Vector.h:49
T square(const T val)
squares a number
Definition: ExtendedMath.h:105
virtual Mdouble userHGridCellSize(unsigned int level)
Virtual function that enables inheriting classes to implement a function to let the user set the cell...
Definition: MercuryBase.cc:389
unsigned int getHGridLevel() const
Returns particle's HGrid level.
Definition: BaseParticle.h:234
void read(std::istream &is, ReadOptions opt=ReadOptions::ReadAll) override
Reads the MercuryBase from an input stream, for example a restart file.
Definition: MercuryBase.cc:104
void setHGridDistribution(HGridDistribution hGridDistribution)
Sets how the sizes of the cells of different levels are distributed.
Definition: MercuryBase.cc:440
Mdouble currentMaxRelativeDisplacement_
Mdouble that denotes the maximum of the displacement of a particle divided by the cell size of the le...
Definition: MercuryBase.h:362
ReadOptions
Definition: DPMBase.h:241
void hGridActionsBeforeIntegration() override
Resets the currentMaxRelativeDisplacement_ to 0.
Definition: MercuryBase.cc:371
unsigned int getNumberOfBuckets() const
Gets the number of buckets of this HGrid.
Definition: HGrid.h:199