7#include <unordered_map>
288 virtual void SetForce(
double fx,
double fy,
double fz);
297 virtual void SetMoment(
double mx,
double my,
double mz);
306 virtual void SetPosition(
double pos_x,
double pos_y,
double pos_z);
317 virtual void SetRodrigues(
double angle,
double axis_x,
double axis_y,
328 virtual void SetQuaternion(
double q_0,
double q_1,
double q_2,
double q_3);
337 virtual void SetVelocity(
double v_x,
double v_y,
double v_z);
346 virtual void SetSpin(
double spin_x,
double spin_y,
double spin_z);
629 virtual void SaveAsVTK(std::string
const &filename);
634 virtual void Print()
const;
A class representing a cell in a simulation grid.
Definition cell.hpp:19
A class responsible for managing cells in a simulation grid.
Definition cell_manager.hpp:16
A solver class for performing discrete element method (DEM) simulations.
Definition dem_solver.hpp:23
Class for managing the simulation domain and particles that belong to it.
Definition domain.hpp:24
A class that manages the domain and sub-domains for a DEM simulation.
Definition domain_manager.hpp:18
Manages the data exchange in a DEM simulation.
Definition mpi_manager.hpp:39
Definition mini_map.hpp:17
A class representing a particle in contact with another particle or wall.
Definition neigh_tuple.hpp:25
A class representing a particle in contact with a wall.
Definition neigh_tuple.hpp:175
A class representing a wall in contact with a particle.
Definition neigh_tuple.hpp:99
Definition particle.hpp:26
void ClearLinkedNeighs()
Clear the linked neighbors of the particle.
Definition particle.cpp:530
Vec3d bound_disp
The displacement of the particle's bounds for the linked list.
Definition particle.hpp:65
VecXT< NeighWofP > const & GetLinkedWalls()
Gets a vector of pointers to the walls that may be potentially overlapped this wall.
Definition particle.cpp:775
int LinkToDomain(Domain *const domain)
Create a link between this particle and the given domain and return the look up id.
Definition particle.cpp:942
virtual void ClearMoment()
Clear all moments applied to the particle.
Definition particle.cpp:180
virtual void SetQuaternion(double q_0, double q_1, double q_2, double q_3)
Sets the orientation of the particle using a quaternion.
Definition particle.cpp:103
NeighPofP * BuildContactRefPP(Particle *const q, ContactPP *const cnt)
Create a new contact lookup table entry for the given pair of particles q and cnt,...
Definition particle.cpp:953
virtual STLModel GetSTLModel(int num_nodes=200)
Get a copy of the particle's STL model as an object of type STLModel.
Definition particle.cpp:793
void ClearLinkedDomains()
Clear the linked domains of the particle.
Definition particle.cpp:521
MiniMap< std::string, double > dynamic_properties
Map of dynamic properties of the particle.
Definition particle.hpp:143
virtual void SetRodrigues(double angle, double axis_x, double axis_y, double axis_z)
Sets the orientation of the particle using a Rodrigues rotation vector.
Definition particle.cpp:95
VecXT< NeighPofP > linked_particle_list
List of linked particles used for narrow-phase contact detection with particles.
Definition particle.hpp:167
VecXT< NeighPofP > const & GetLinkedParticles()
Gets a vector of pointers to the particles that may be potentially overlapped this wall.
Definition particle.cpp:771
int LinkToCell(Cell *const cell)
Create a link between this particle and the given cell and return the look up id.
Definition particle.cpp:932
NeighPofP * LinkToParticle(Particle *const q)
Create a new neighbor tuple between this particle and the given particle q, and return the newly crea...
Definition particle.cpp:912
virtual void UpdateMotion(double timestep)
Update the motion of the particle based on the applied forces and moments over a time step.
Definition particle.cpp:245
virtual void UpdateBound()
Update the bounding box of the particle, which is useful for collision detection. The bounding box wi...
Definition particle.cpp:435
virtual void SetDensity(double dens)
Sets the density of the particle.
Definition particle.cpp:52
NeighWofP *const GetLinkedWall(int lookup_id)
Gets the neigh obj by look-up id.
Definition particle.cpp:781
int FindLinkedParticle(Particle *const q)
Find the index of the neighbor tuple belonging to this particle that is linked to the given particle ...
Definition particle.cpp:970
bool need_send_out
Flag indicating whether data needs to be sent out to linked domains.
Definition particle.hpp:195
void ClearContactRefTable()
Clear the look-up table for contacts between particles.
Definition particle.cpp:573
VecXT< NeighWofP > contact_pw_ref_table
Lookup table used to reconstruct reference of contact history with walls.
Definition particle.hpp:185
VecXT< std::pair< Cell *, int > > linked_cell_list
List of linked cells used for broad-phase contact detection.
Definition particle.hpp:161
virtual void ApplyContactForce(ContactPP const *cnt)
Apply a contact force to the particle when it is in contact with another particle.
Definition particle.cpp:186
virtual void SetDynamicProperty(std::string const &key, double value)
Set the value of a dynamic property identified by the given key.
Definition particle.cpp:136
bool is_on_edge
Flag indicating whether particle is on domain edge.
Definition particle.hpp:190
virtual void SetShape(Shape *const shape)
Sets the Shape object representing the particle's shape.
Definition particle.cpp:29
virtual void SetPosition(double pos_x, double pos_y, double pos_z)
Sets the position of the particle.
Definition particle.cpp:83
Particle()
Default constructor for the Particle class.
Definition particle.cpp:18
Vec4d quaternion
The quaternion of the particle.
Definition particle.hpp:108
STLModel stl_model
STLModel object used for intersection-based contact detection and resolution.
Definition particle.hpp:214
virtual double GetDensity() const
Gets the density of the particle.
Definition particle.cpp:62
virtual void Print() const
Print information about the particle to the console.
Definition particle.cpp:891
Vec3d vel_m0p5
The square root velocity of the particle for half-step integration.
Definition particle.hpp:123
bool need_update_linked_list
Flag indicating whether linked-list algorithm should be used for broad-phase contact detection.
Definition particle.hpp:155
void UpdateLinkedNeighs(Domain *const domain)
Update the linked neighbors of the particle based on the given domain.
Definition particle.cpp:643
NeighWofP * BuildContactRefPW(Wall *const w, ContactPW *const cnt)
Create a new contact lookup table entry for the given wall w and contact point cnt,...
Definition particle.cpp:962
VecXT< ContactPW * > GetContactPWs()
Get a vector of pointers to all contact points between particles and walls.
Definition particle.cpp:748
virtual void UpdateBoundFast()
Update the bounding box of the particle, which is useful for collision detection. Particle has a skin...
Definition particle.cpp:414
virtual Vec3d GetVelocity(Vec3d const &cnt_pos)
Get the current velocity of the particle at the given position.
Definition particle.cpp:132
virtual void SaveAsVTK(std::string const &filename)
Save the particle's current state to a VTK file with the given filename.
Definition particle.cpp:803
void UpdateLinkedCells(CellManager *const cm)
Update the linked cells of the particle based on the given cell manager.
Definition particle.cpp:616
virtual double GetDynamicProperty(std::string const &key)
Get the value of a dynamic property identified by the given key.
Definition particle.cpp:140
void RemoveLinkedWall(int lookup_id)
Reomve a linked neighbor by look-up id.
Definition particle.cpp:482
virtual void SetVelocity(double v_x, double v_y, double v_z)
Sets the velocity of the particle.
Definition particle.cpp:112
virtual void AddMoment(const Vec3d &moment)
Add a moment (torque) to the particle.
Definition particle.cpp:150
double margin
The margin of the particle's shape.
Definition particle.hpp:60
int FindContactRefPW(Wall *const w)
Find the index of the contact lookup table entry belonging to this particle that references the given...
Definition particle.cpp:997
Vec3d moi_principal
The principal moment of inertia of the particle.
Definition particle.hpp:88
void RemoveLinkedCell(int lookup_id)
Reomve a linked cell by look-up id.
Definition particle.cpp:452
virtual STLModel * GetSTLModelInternal()
Get a copy of the particle's STL model as an object of type STLModel.
Definition particle.cpp:801
void RemoveContactRefPP(int lookup_id)
Reomve a p-p contact by look-up id.
Definition particle.cpp:492
double damp_numerical
The numerical damping coefficient of the particle.
Definition particle.hpp:98
NeighPofP *const GetLinkedParticle(int lookup_id)
Gets the neigh obj by look-up id.
Definition particle.cpp:777
VecXT< NeighPofP > contact_pp_ref_table
Lookup table used to reconstruct reference of contact history with particles.
Definition particle.hpp:179
virtual void AddMomentAtomic(const Vec3d &m)
Add a moment (torque) to the particle atomically.
Definition particle.cpp:165
void BuildContactRefTable()
Build a look-up table for contacts between particles.
Definition particle.cpp:556
void RemoveLinkedParticle(int lookup_id)
Reomve a linked neighbor by look-up id.
Definition particle.cpp:472
Vec3d pos
The position of the particle.
Definition particle.hpp:103
Vec3d bound_max
The maximum bounds of the particle's shape.
Definition particle.hpp:55
VecXT< ContactPP * > GetContactPPs()
Get a vector of pointers to all contact points between particles.
Definition particle.cpp:733
virtual void SetMargin(double m)
Sets the margin of the particle.
Definition particle.cpp:64
Vec3d spin_principal
The principal spin axis of the particle.
Definition particle.hpp:128
double damp_viscous
The viscous damping coefficient of the particle.
Definition particle.hpp:93
VecXT< NeighWofP > linked_wall_list
List of linked walls used for narrow-phase contact detection with walls.
Definition particle.hpp:173
double density
The density of the particle. Please use SetDensity to change its value.
Definition particle.hpp:77
virtual void ClearForce()
Clear all forces applied to the particle.
Definition particle.cpp:174
double mass
The mass of the particle.
Definition particle.hpp:83
void RemoveLinkedDomain(int lookup_id)
Reomve a linked domain by look-up id.
Definition particle.cpp:462
virtual double GetMargin() const
Gets the margin of the particle.
Definition particle.cpp:69
virtual void SetMoment(double mx, double my, double mz)
Sets the moment acting on the particle.
Definition particle.cpp:77
virtual void AddForce(const Vec3d &force)
Add a force to the particle.
Definition particle.cpp:144
int FindLinkedWall(Wall *const w)
Find the index of the neighbor tuple belonging to this particle that is linked to the given wall w.
Definition particle.cpp:979
NeighWofP * LinkToWall(Wall *const w)
Create a new neighbor tuple between this particle and the given wall w, and return the newly created ...
Definition particle.cpp:922
Vec3d moment
The moment acting on the particle.
Definition particle.hpp:138
virtual void SetSpin(double spin_x, double spin_y, double spin_z)
Sets the angular velocity (spin) of the particle.
Definition particle.cpp:122
virtual Particle * Clone() const
Creates a new instance of the Particle class that is a copy of the current instance.
Definition particle.cpp:25
void RemoveContactRefPW(int lookup_id)
Reomve a p-w contact by look-up id.
Definition particle.cpp:502
Shape * shape
The shape of the particle.
Definition particle.hpp:45
Vec3d vel
The velocity of the particle.
Definition particle.hpp:113
int material_type
The material type of the particle.
Definition particle.hpp:70
virtual void UpdateContactForce()
Update the contact forces applied to the particle.
Definition particle.cpp:221
virtual ~Particle()
Destroy the particle object and free any resources it might be holding.
Definition particle.cpp:905
Vec3d bound_min
The minimum bounds of the particle's shape.
Definition particle.hpp:50
VecXT< std::pair< Cell *, int > > const & GetLinkedCells()
Gets a vector of pointers to the cells that may be potentially overlapped this wall.
Definition particle.cpp:767
bool enable_bound_aabb
Flag indicating whether bounding sphere should be used to approximate axis-aligned bounding box (AABB...
Definition particle.hpp:149
VecXT< std::pair< Domain *, int > > linked_domain_list
List of linked domains that overlap with the particle.
Definition particle.hpp:200
virtual void Init()
Initializes the particle by setting default values for all properties.
Definition particle.cpp:27
virtual void AddForceAtomic(const Vec3d &f)
Add a force to the particle atomically.
Definition particle.cpp:156
int FindContactRefPP(Particle *const q)
Find the index of the contact lookup table entry belonging to this particle that references the given...
Definition particle.cpp:988
Vec3d force
The force acting on the particle.
Definition particle.hpp:133
NeighWofP *const GetLinkedContactRefPW(int lookup_id)
Gets the neigh obj by look-up id.
Definition particle.cpp:789
void ClearLinkedCells()
Clear the linked cells of the particle.
Definition particle.cpp:512
VecXT< std::pair< Domain *, int > > const & GetLinkedDomains()
Gets a vector of pointers to the domains that may be potentially overlapped this wall.
Definition particle.cpp:763
virtual void UpdateSTLModel()
Update the geometry of the particle's STL model.
Definition particle.cpp:726
void UpdateLinkedDomains(DomainManager *const dm)
Update the linked domains of the particle based on the given domain manager.
Definition particle.cpp:601
virtual void SetForce(double fx, double fy, double fz)
Sets the force acting on the particle.
Definition particle.cpp:71
bool need_update_stl_model
Flag indicating whether STl model intersection-based contact detection and resolution is needed.
Definition particle.hpp:207
NeighPofP *const GetLinkedContactRefPP(int lookup_id)
Gets the neigh obj by look-up id.
Definition particle.cpp:785
Vec3d spin
The spin of the particle.
Definition particle.hpp:118
Class for working with STL models.
Definition stl_model.hpp:17
This class represents different types of shapes and performs various calculations on them.
Definition shape.hpp:15
A class representing a wall object in a physics simulation.
Definition wall.hpp:32
Definition bond_entry.hpp:7
std::vector< T > VecXT
Definition utils_macros.hpp:31
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18
std::array< double, 4 > Vec4d
Definition utils_macros.hpp:19