51 return os <<
"BOTTOMUP";
53 return os <<
"TOPDOWN";
62 else if (s ==
"TOPDOWN")
66 logger(
ERROR,
"HGridMethod could not be read: %", s);
91 return os <<
"OLDHGRID";
93 return os <<
"LINEAR";
95 return os <<
"EXPONENTIAL";
106 else if (s ==
"LINEAR")
108 else if (s ==
"EXPONENTIAL")
110 else if (s ==
"USER")
114 logger(
ERROR,
"HGridDistribution could not be read: %",s);
168 void write(std::ostream& os,
bool writeAllParticles =
true)
const override;
330 void hGridInfo(std::ostream& os = std::cout)
const;
std::ostream & operator<<(std::ostream &os, HGridMethod h)
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
bool hGridNeedsRebuilding()
Gets if the HGrid needs rebuilding before anything else happens.
Mdouble totalCurrentMaxRelativeDisplacement_
After each time step, this Mdouble is increased by 2*currentMaxRelativeDisplacement_.
Mdouble getHGridCellOverSizeRatio() const
Gets the ratio of the smallest cell over the smallest particle.
std::istream & operator>>(std::istream &is, HGridMethod &h)
~MercuryBase() override
This is the default destructor.
HGrid * grid
A pointer to the HGrid associated with this MercuryBase.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here...
Mdouble getHGridCurrentMaxRelativeDisplacement() const
Returns hGridCurrentMaxRelativeDisplacement_.
virtual unsigned int getHGridTargetNumberOfBuckets() const
Gets the desired number of buckets, which is the maximum of the number of particles and 10...
void setHGridUpdateEachTimeStep(bool updateEachTimeStep)
Sets whether or not the HGrid must be updated every time step.
bool checkParticleForInteractionLocal(const BaseParticle &P) final
Checks if the given BaseParticle has an interaction with a BaseWall or other BaseParticles in a local...
virtual Mdouble getHGridTargetMinInteractionRadius() const
Gets the desired size of the smallest cells of the HGrid.
HGridDistribution hGridDistribution_
Indicator for the distribution of the sizes of the cells of different levels of the HGrid...
const std::complex< Mdouble > i
unsigned int hGridMaxLevels_
Unsigned integer that indicates the maximum number of levels of the HGrid.
HGridMethod getHGridMethod() const
Gets whether the HGrid in this MercuryBase is BOTTOMUP or TOPDOWN.
Mdouble hGridCellOverSizeRatio_
The maximum ratio between the size of the cells and the BaseParticle they contain.
unsigned int getHGridMaxLevels() const
Gets the maximum number of levels of the HGrid in this MercuryBase.
void hGridActionsBeforeTimeStep() override
Performs all necessary actions before a time-step, like updating the particles and resetting all the ...
LL< Log::ERROR > ERROR
Error log level.
virtual std::vector< BaseParticle * > hGridFindParticleContacts(const BaseParticle *obj)=0
Purely virtual function that returns all particles that have a contact with a given particle...
virtual Mdouble getHGridTargetMaxInteractionRadius() const
Gets the desired size of the largest cells of the HGrid.
HGridMethod
Enum class that indicates how particles in different levels (cross level checking) of the HGrid are c...
void setHGridMethod(HGridMethod hGridMethod)
Sets the HGridMethod to either BOTTOMUP or TOPDOWN.
void hGridInsertParticle(BaseParticle *obj) final
Inserts a single Particle to current grid.
HGridMethod hGridMethod_
Indicator of which way the interactions between different levels are tested.
bool checkParticleForInteraction(const BaseParticle &P) final
Checks if given BaseParticle has an interaction with a BaseWall or other BaseParticle.
This is the base class for both Mercury2D and Mercury3D. Note the actually abstract grid is defined i...
Mdouble getHGridTotalCurrentMaxRelativeDisplacement() const
Returns hGridTotalCurrentMaxRelativeDisplacement_.
void hGridActionsAfterIntegration() override
This function has to be called before integrateBeforeForceComputation.
void write(std::ostream &os, bool writeAllParticles=true) const override
Writes all data into a restart file.
In the HGrid class, here all information about the HGrid is stored.
bool readNextArgument(int &i, int argc, char *argv[]) override
Reads the next command line argument.
void setHGridCellOverSizeRatio(Mdouble cellOverSizeRatio)
Sets the ratio of the smallest cell over the smallest particle.
HGridDistribution
Enum that indicates what the ratio of the size of the cells in different levels is.
bool updateEachTimeStep_
Boolean which indicates whether or not the cell in which a particle is must be updated every time ste...
void hGridUpdateMove(BaseParticle *iP, Mdouble move) final
Computes the relative displacement of the given BaseParticle and updates the currentMaxRelativeDispla...
void setHGridMaxLevels(unsigned int HGridMaxLevels)
Sets the maximum number of levels of the HGrid in this MercuryBase.
void hGridActionsBeforeTimeLoop() override
This sets up the broad phase information, has to be done at this stage because it requires the partic...
MercuryBase()
This is the default constructor. It sets sensible defaults.
void hGridRebuild()
This sets up the parameters required for the contact model.
const HGrid * getHGrid() const
Gets the HGrid used by this problem, const version.
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.
void constructor()
This is the actual constructor, it is called do both constructors above.
bool gridNeedsUpdate_
Boolean that indicates whether or not the grid needs to be updated.
void hGridInfo(std::ostream &os=std::cout) const
Writes the info of the HGrid to the screen in a nice format.
HGrid * getHGrid()
Gets the HGrid used by this problem.
bool getHGridUpdateEachTimeStep() const final
Gets whether or not the HGrid is updated every time step.
virtual Mdouble userHGridCellSize(unsigned int level)
Virtual function that enables inheriting classes to implement a function to let the user set the cell...
void read(std::istream &is, ReadOptions opt=ReadOptions::ReadAll) override
Reads the MercuryBase from an input stream, for example a restart file.
void setHGridDistribution(HGridDistribution hGridDistribution)
Sets how the sizes of the cells of different levels are distributed.
Mdouble currentMaxRelativeDisplacement_
Mdouble that denotes the maximum of the displacement of a particle divided by the cell size of the le...
void hGridActionsBeforeIntegration() override
Resets the currentMaxRelativeDisplacement_ to 0.