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 
146 void MercuryBase::write(std::ostream& os, bool writeAllParticles) const
147 {
148  DPMBase::write(os, writeAllParticles);
149  hGridInfo(os);
150 }
151 
158 {
160 }
161 
167 {
169 }
170 
175 void MercuryBase::setHGridUpdateEachTimeStep(bool updateEachTimeStep)
176 {
177  updateEachTimeStep_ = updateEachTimeStep;
178 }
179 
184 {
185  return updateEachTimeStep_;
186 }
187 
204 {
205  std::vector<Mdouble> cellSizes;
206 
207  const Mdouble minParticleInteractionRadius = getHGridTargetMinInteractionRadius();
208  const Mdouble maxParticleInteractionRadius = getHGridTargetMaxInteractionRadius();
209  if (minParticleInteractionRadius == 0.0 || minParticleInteractionRadius == maxParticleInteractionRadius)
210  {
211  //this case is executed if the particleHandler is empty (minParticleInteractionRadius == 0)
212  //or if the particle distribution is monodispersed.
213  //nextafter(d,std::numeric_limits<Mdouble>::max()) chooses the smallest
214  // Mdouble that is bigger than d.
215  const Mdouble maxCellSize = nextafter(2.0 * maxParticleInteractionRadius * getHGridCellOverSizeRatio(),
216  std::numeric_limits<Mdouble>::max());
217  cellSizes.push_back(maxCellSize);
218  if (getHGridMaxLevels() != 1)
219  {
220 
221  logger(VERBOSE,
222  "While rebuilding the hgrid: the number of levels was set to one, as the particle distribution is monodispersed");
223  }
224  }
225  else
226  {
227  switch (getHGridDistribution())
228  {
229  case LINEAR:
230  {
231  const Mdouble minCellSize = nextafter(2.0 * minParticleInteractionRadius * getHGridCellOverSizeRatio(),
232  0.0);
233  const Mdouble maxCellSize = nextafter(2.0 * maxParticleInteractionRadius * getHGridCellOverSizeRatio(),
234  std::numeric_limits<Mdouble>::max());
235  //std::cout << "HGrid: using a linear cell size distribution from " << minCellSize << " to " << maxCellSize << " over " << getHGridMaxLevels() << " levels" << std::endl;
236  for (unsigned int i = 0; i + 1 < getHGridMaxLevels(); i++)
237  {
238  cellSizes.push_back(minCellSize + (maxCellSize - minCellSize)
239  * (static_cast<Mdouble>(i + 1)) / getHGridMaxLevels());
240  }
241  //The last cell is added separately because in some cases accuracy was lost when calculating it.
242  cellSizes.push_back(maxCellSize);
243  break;
244  }
245  case EXPONENTIAL:
246  {
247  const Mdouble minCellSize = nextafter(2.0 * minParticleInteractionRadius * getHGridCellOverSizeRatio(),
248  0.0);
249  const Mdouble maxCellSize = nextafter(2.0 * maxParticleInteractionRadius * getHGridCellOverSizeRatio(),
250  std::numeric_limits<Mdouble>::max());
251  logger(INFO,"HGrid: using exponential cell size distribution from % to % over % levels",
252  minCellSize,maxCellSize,getHGridMaxLevels());
253  for (unsigned int i = 0; i + 1 < getHGridMaxLevels(); i++)
254  {
255  cellSizes.push_back(minCellSize
256  * std::pow(maxCellSize / minCellSize, static_cast<Mdouble>(i + 1)
257  / getHGridMaxLevels()));
258  }
259  //The last cell is added separately because in some cases accuracy was lost when calculating it.
260  cellSizes.push_back(maxCellSize);
261  break;
262  }
263  case USER:
264  {
265  for (unsigned int i = 0; i < getHGridMaxLevels(); i++)
266  {
267  cellSizes.push_back(userHGridCellSize(i));
268  }
269  break;
270  }
271  case OLDHGRID:
272  {
273  const Mdouble minCellSize = nextafter(2.0 * minParticleInteractionRadius * getHGridCellOverSizeRatio(),
274  0.0);
275 
276  //std::cout<<"HGrid: using the old HGrid cell size distribution starting from " <<minCellSize<<std::endl;
277  for (unsigned int i = 0; i < getHGridMaxLevels(); i++)
278  {
279  cellSizes.push_back(minCellSize * std::pow(2, i));
280  }
281  break;
282  }
283  }
284  }
285 
286 
287  delete grid;
288 
289 
291 
292  for (BaseParticle* const p : particleHandler)
293  {
296  p->setHGridX(9999);
298  }
299  gridNeedsUpdate_ = false;
300 }
301 
306 {
307  if (grid != nullptr)
308  {
310  }
311 }
312 
318 {
319  if (hGridNeedsRebuilding())
320  {
321  //logger(INFO, "HGrid needs rebuilding at nt=%",getNumberOfTimeSteps());
322  hGridRebuild();
323  }
324  else
325  {
326 #ifndef CONTACT_LIST_HGRID
328 #endif
331  {
332 #ifndef CONTACT_LIST_HGRID
334 #endif
335  //logger(INFO, "HGrid needs updating at nt=%",getNumberOfTimeSteps());
336  for (BaseParticle* const p : particleHandler)
337  {
339  }
341  }
342  }
343 }
344 
354 {
355  const Mdouble currentRelativeDisplacement = move / mathsFunc::square(getHGrid()->getCellSize(iP->getHGridLevel()));
356  if (currentRelativeDisplacement > currentMaxRelativeDisplacement_)
357  {
358  currentMaxRelativeDisplacement_ = currentRelativeDisplacement;
359  }
360 }
361 
366 {
368 }
369 
374 {
377 }
378 
384 {
385  logger(WARN, "In Mdouble MercuryBase::userHGridCellSize(unsigned int level) with level= %", level);
386  logger(WARN, "If you want to use user defined HGrid cell sizes, this function should be redefined");
387  return 0.0;
388 }
389 
396 bool MercuryBase::readNextArgument(int& i, int argc, char* argv[])
397 {
398  if (!strcmp(argv[i], "-hGridMaxLevels"))
399  {
400  setHGridMaxLevels(static_cast<unsigned int>(atoi(argv[i + 1])));
401  }
402  else if (!strcmp(argv[i], "-cellOverSizeRatio"))
403  {
404  setHGridCellOverSizeRatio(atof(argv[i + 1]));
405  }
406  else
407  {
408  return DPMBase::readNextArgument(i, argc, argv); //if argv[i] is not found, check the commands in MD
409  }
410  return true; //returns true if argv[i] is found
411 }
412 
413 
418 {
419  hGridMethod_ = hGridMethod;
420 }
421 
426 {
427  return hGridDistribution_;
428 }
429 
435 {
436  if (hGridDistribution_ != hGridDistribution)
437  {
438  gridNeedsUpdate_ = true;
439  hGridDistribution_ = hGridDistribution;
440  }
441 }
442 
448 {
450 }
451 
458 {
459  //If the hGridCellOverSizeRatio changes significantly, assign the given parameter.
460  if (!mathsFunc::isEqual(hGridCellOverSizeRatio_, hGridCellOverSizeRatio, 1e-10))
461  {
462  gridNeedsUpdate_ = true;
463  hGridCellOverSizeRatio_ = hGridCellOverSizeRatio;
464  }
465 }
466 
470 void MercuryBase::setHGridMaxLevels(unsigned int hGridMaxLevels)
471 {
472  if (hGridMaxLevels_ != hGridMaxLevels)
473  {
474  gridNeedsUpdate_ = true;
475  hGridMaxLevels_ = hGridMaxLevels;
476  }
477 }
478 
482 unsigned int MercuryBase::getHGridMaxLevels() const
483 {
484  return hGridMaxLevels_;
485 }
486 
491 {
492  if (grid == nullptr)
493  {
494  logger(VERBOSE, "HGrid needs updating, because there is no grid.");
495  return true;
496  }
497  else if (gridNeedsUpdate_)
498  {
499  logger(VERBOSE, "HGrid needs updating, because some of its initialisation parameters have changed.");
500  return true;
501  }
502  else if (grid->getNeedsRebuilding())
503  {
504  logger(VERBOSE, "HGrid needs updating, because said so by the grid itself");
505  return true;
506  }
507  else if (getHGrid()->getNumberOfBuckets() > 10 * getHGridTargetNumberOfBuckets() ||
508  10 * getHGrid()->getNumberOfBuckets() < getHGridTargetNumberOfBuckets())
509  {
510  logger(VERBOSE, "HGrid needs updating, because of number of buckets, current = %, target = %.",
512  return true;
513  }
514  else if (particleHandler.getLargestParticle() != nullptr &&
517  {
518  logger(VERBOSE, "HGrid needs updating, because of maximum cell size, current = %, required = %.",
521  return true;
522  }
523  else
524  {
525  //std::cout<<"HGrid does not need updating, because of number of buckets, current="<<grid->NUM_BUCKETS<<" target="<<particleHandler.getSize()<<std::endl;
526  //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;
527  return false;
528  }
529 }
530 
535 {
536  unsigned int nParticles = particleHandler.getSize();
537  if (nParticles > 10)
538  {
540  return 10 * nParticles;
541  }
542  else
543  {
544  return 10;
545  }
546 }
547 
553 {
554  if (particleHandler.getSize() == 0)
555  {
556  return 0.0;
557  }
558  else
559  {
561  }
562 }
563 
569 {
570  if (particleHandler.getSize() == 0)
571  {
572  return 0.0;
573  }
574  else
575  {
577  }
578 }
579 
589 {
590 #ifdef MERCURY_USE_MPI
591  bool interaction;
592  if (NUMBER_OF_PROCESSORS == 1)
593  {
595  }
596  else
597  {
598  //check locally and then collectively come to a global conclusion
599  bool interactionLocal = checkParticleForInteractionLocal(p);
600 
601  MPIContainer::Instance().allReduce(interactionLocal, interaction, MPI::LAND);
602  }
603 #else
604  bool interaction = checkParticleForInteractionLocalPeriodic(p);
605 #endif
606  return interaction;
607 }
608 
617 {
618  Mdouble distance;
619  Vec3D normal;
620 
621  //Check if it has no collision with walls
622  for (BaseWall* w :wallHandler)
623  {
624  if (w->getDistanceAndNormal(p, distance, normal))
625  {
626  logger(VERBOSE, "Collision with wall %.", *w);
627  return false;
628  }
629  else
630  {
631  logger(VERBOSE, "No collision with wall %.", *w);
632  }
633  }
634 
635  //Check if it has no collision with other particles
636  if (hGridHasParticleContacts(&p))
637  {
638  logger(VERBOSE, "Collision with particle.");
639  return false;
640  }
641  else
642  {
643  logger(VERBOSE, "No collision with particles.");
644  }
645  return true;
646 }
647 
648 
649 void MercuryBase::hGridInfo(std::ostream& os) const
650 {
651 #ifdef MERCURY_USE_MPI
652  MPIContainer& communicator = MPIContainer::Instance();
653  int numberOfProcessors = communicator.getNumberOfProcessors();
654 #else
655  int numberOfProcessors = 1;
656 #endif
657  os << "hGrid"
658  << " method " << hGridMethod_
659  << " distribution " << hGridDistribution_
660  << " cellOverSizeRatio " << hGridCellOverSizeRatio_;
661  //os << " maxLevels " << hGridMaxLevels_;
662  if (numberOfProcessors == 1 && grid != nullptr)
663  {
664  os << " numberOfBuckets " << grid->getNumberOfBuckets()
665  << " cellSizes";
666  for (const auto p: grid->getCellSizes()) os << " " << p;
667  }
668  os << " gridNeedsUpdate " << gridNeedsUpdate_
669  << " updateEachTimeStep " << updateEachTimeStep_
670  << " currentMaxRelativeDisplacement " << currentMaxRelativeDisplacement_
671  << " totalCurrentMaxRelativeDisplacement " << totalCurrentMaxRelativeDisplacement_
672  << std::endl;
673 }
This class contains all information and functions required for communication between processors...
Definition: MpiContainer.h:125
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:3375
virtual void hGridUpdateParticle(BaseParticle *obj UNUSED)
Definition: DPMBase.cc:1664
static MPIContainer & Instance()
fetch the instance to be used for communication
Definition: MpiContainer.h:130
bool hGridNeedsRebuilding()
Gets if the HGrid needs rebuilding before anything else happens.
Definition: MercuryBase.cc:490
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:447
~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")
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:157
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:534
void setHGridUpdateEachTimeStep(bool updateEachTimeStep)
Sets whether or not the HGrid must be updated every time step.
Definition: MercuryBase.cc:175
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:616
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:552
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:482
void hGridActionsBeforeTimeStep() override
Performs all necessary actions before a time-step, like updating the particles and resetting all the ...
Definition: MercuryBase.cc:317
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:568
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:417
void hGridInsertParticle(BaseParticle *obj) final
Inserts a single Particle to current grid.
Definition: MercuryBase.cc:305
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:588
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:166
void hGridActionsAfterIntegration() override
This function has to be called before integrateBeforeForceComputation.
Definition: MercuryBase.cc:373
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:3496
void write(std::ostream &os, bool writeAllParticles=true) const override
Writes the MercuryBase to an output stream, for example a restart file.
Definition: MercuryBase.cc:146
virtual bool readNextArgument(int &i, int argc, char *argv[])
Interprets the i^th command-line argument.
Definition: DPMBase.cc:4299
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:424
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:1329
bool readNextArgument(int &i, int argc, char *argv[]) override
Reads the next command line argument.
Definition: MercuryBase.cc:396
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:457
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:353
void setHGridMaxLevels(unsigned int HGridMaxLevels)
Sets the maximum number of levels of the HGrid in this MercuryBase.
Definition: MercuryBase.cc:470
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:203
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1339
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:425
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:649
HGrid * getHGrid()
Gets the HGrid used by this problem.
Definition: MercuryBase.h:311
bool checkParticleForInteractionLocalPeriodic(const BaseParticle &P)
Definition: DPMBase.cc:4637
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:183
Definition: Vector.h:49
T square(const T val)
squares a number
Definition: ExtendedMath.h:104
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:383
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:434
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:240
void hGridActionsBeforeIntegration() override
Resets the currentMaxRelativeDisplacement_ to 0.
Definition: MercuryBase.cc:365
unsigned int getNumberOfBuckets() const
Gets the number of buckets of this HGrid.
Definition: HGrid.h:199