NetDEM v1.0
|
#include <particle.hpp>
Public Member Functions | |
Particle () | |
Default constructor for the Particle class. | |
Particle (Shape *const shape) | |
Constructor for the Particle class which specifies the shape of the particle. | |
virtual Particle * | Clone () const |
Creates a new instance of the Particle class that is a copy of the current instance. | |
virtual void | Init () |
Initializes the particle by setting default values for all properties. | |
virtual void | SetShape (Shape *const shape) |
Sets the Shape object representing the particle's shape. | |
virtual void | SetDensity (double dens) |
Sets the density of the particle. | |
virtual double | GetDensity () const |
Gets the density of the particle. | |
virtual void | SetMargin (double m) |
Sets the margin of the particle. | |
virtual double | GetMargin () const |
Gets the margin of the particle. | |
virtual void | SetForce (double fx, double fy, double fz) |
Sets the force acting on the particle. | |
virtual void | SetMoment (double mx, double my, double mz) |
Sets the moment acting on the particle. | |
virtual void | SetPosition (double pos_x, double pos_y, double pos_z) |
Sets the position of the particle. | |
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. | |
virtual void | SetQuaternion (double q_0, double q_1, double q_2, double q_3) |
Sets the orientation of the particle using a quaternion. | |
virtual void | SetVelocity (double v_x, double v_y, double v_z) |
Sets the velocity of the particle. | |
virtual void | SetSpin (double spin_x, double spin_y, double spin_z) |
Sets the angular velocity (spin) of the particle. | |
virtual Vec3d | GetVelocity (Vec3d const &cnt_pos) |
Get the current velocity of the particle at the given position. | |
virtual void | SetDynamicProperty (std::string const &key, double value) |
Set the value of a dynamic property identified by the given key. | |
virtual double | GetDynamicProperty (std::string const &key) |
Get the value of a dynamic property identified by the given key. | |
virtual void | AddForce (const Vec3d &force) |
Add a force to the particle. | |
virtual void | AddMoment (const Vec3d &moment) |
Add a moment (torque) to the particle. | |
virtual void | AddForceAtomic (const Vec3d &f) |
Add a force to the particle atomically. | |
virtual void | AddMomentAtomic (const Vec3d &m) |
Add a moment (torque) to the particle atomically. | |
virtual void | ClearForce () |
Clear all forces applied to the particle. | |
virtual void | ClearMoment () |
Clear all moments applied to the particle. | |
virtual void | ApplyContactForce (ContactPP const *cnt) |
Apply a contact force to the particle when it is in contact with another particle. | |
virtual void | ApplyContactForce (ContactPW const *cnt) |
Apply a contact force to the particle when it is in contact with a wall. | |
virtual void | UpdateContactForce () |
Update the contact forces applied to the particle. | |
virtual void | UpdateMotion (double timestep) |
Update the motion of the particle based on the applied forces and moments over a time step. | |
virtual void | UpdateBoundFast () |
Update the bounding box of the particle, which is useful for collision detection. Particle has a skin and if the movement of particle has not exceed this skin, the bounding box will not be updated. | |
virtual void | UpdateBound () |
Update the bounding box of the particle, which is useful for collision detection. The bounding box will be updated regardless of the particle movement. | |
void | ClearLinkedCells () |
Clear the linked cells of the particle. | |
void | ClearLinkedDomains () |
Clear the linked domains of the particle. | |
void | ClearLinkedNeighs () |
Clear the linked neighbors of the particle. | |
void | BuildContactRefTable () |
Build a look-up table for contacts between particles. | |
void | ClearContactRefTable () |
Clear the look-up table for contacts between particles. | |
void | UpdateLinkedDomains (DomainManager *const dm) |
Update the linked domains of the particle based on the given domain manager. | |
void | UpdateLinkedCells (CellManager *const cm) |
Update the linked cells of the particle based on the given cell manager. | |
void | UpdateLinkedNeighs (Domain *const domain) |
Update the linked neighbors of the particle based on the given domain. | |
VecXT< ContactPP * > | GetContactPPs () |
Get a vector of pointers to all contact points between particles. | |
VecXT< ContactPW * > | GetContactPWs () |
Get a vector of pointers to all contact points between particles and walls. | |
VecXT< std::pair< Domain *, int > > const & | GetLinkedDomains () |
Gets a vector of pointers to the domains that may be potentially overlapped this wall. | |
VecXT< std::pair< Cell *, int > > const & | GetLinkedCells () |
Gets a vector of pointers to the cells that may be potentially overlapped this wall. | |
VecXT< NeighPofP > const & | GetLinkedParticles () |
Gets a vector of pointers to the particles that may be potentially overlapped this wall. | |
VecXT< NeighWofP > const & | GetLinkedWalls () |
Gets a vector of pointers to the walls that may be potentially overlapped this wall. | |
NeighPofP *const | GetLinkedParticle (int lookup_id) |
Gets the neigh obj by look-up id. | |
NeighWofP *const | GetLinkedWall (int lookup_id) |
Gets the neigh obj by look-up id. | |
virtual void | UpdateSTLModel () |
Update the geometry of the particle's STL model. | |
virtual STLModel | GetSTLModel (int num_nodes=200) |
Get a copy of the particle's STL model as an object of type STLModel . | |
virtual STLModel * | GetSTLModelInternal () |
Get a copy of the particle's STL model as an object of type STLModel . | |
virtual void | SaveAsVTK (std::string const &filename) |
Save the particle's current state to a VTK file with the given filename. | |
virtual void | Print () const |
Print information about the particle to the console. | |
virtual | ~Particle () |
Destroy the particle object and free any resources it might be holding. | |
NeighPofP * | LinkToParticle (Particle *const q) |
Create a new neighbor tuple between this particle and the given particle q , and return the newly created tuple. | |
NeighWofP * | LinkToWall (Wall *const w) |
Create a new neighbor tuple between this particle and the given wall w , and return the newly created tuple. | |
int | LinkToCell (Cell *const cell) |
Create a link between this particle and the given cell and return the look up id. | |
int | LinkToDomain (Domain *const domain) |
Create a link between this particle and the given domain and return the look up id. | |
int | FindLinkedParticle (Particle *const q) |
Find the index of the neighbor tuple belonging to this particle that is linked to the given particle q . | |
int | FindLinkedWall (Wall *const w) |
Find the index of the neighbor tuple belonging to this particle that is linked to the given wall w . | |
Public Attributes | |
int | id {0} |
The ID of the particle. | |
Shape * | shape {nullptr} |
The shape of the particle. | |
Vec3d | bound_min {0, 0, 0} |
The minimum bounds of the particle's shape. | |
Vec3d | bound_max {0, 0, 0} |
The maximum bounds of the particle's shape. | |
double | margin {0} |
The margin of the particle's shape. | |
Vec3d | bound_disp {0, 0, 0} |
The displacement of the particle's bounds for the linked list. | |
int | material_type {0} |
The material type of the particle. | |
double | mass {0.0} |
The mass of the particle. | |
Vec3d | moi_principal {0, 0, 0} |
The principal moment of inertia of the particle. | |
double | damp_viscous {0} |
The viscous damping coefficient of the particle. | |
double | damp_numerical {0} |
The numerical damping coefficient of the particle. | |
Vec3d | pos {0, 0, 0} |
The position of the particle. | |
Vec4d | quaternion {1, 0, 0, 0} |
The quaternion of the particle. | |
Vec3d | vel {0, 0, 0} |
The velocity of the particle. | |
Vec3d | spin {0, 0, 0} |
The spin of the particle. | |
Vec3d | vel_m0p5 {0, 0, 0} |
The square root velocity of the particle for half-step integration. | |
Vec3d | spin_principal {0, 0, 0} |
The principal spin axis of the particle. | |
Vec3d | force {0, 0, 0} |
The force acting on the particle. | |
Vec3d | moment {0, 0, 0} |
The moment acting on the particle. | |
MiniMap< std::string, double > | dynamic_properties |
Map of dynamic properties of the particle. | |
bool | enable_bound_aabb {false} |
Flag indicating whether bounding sphere should be used to approximate axis-aligned bounding box (AABB). | |
bool | need_update_linked_list {true} |
Flag indicating whether linked-list algorithm should be used for broad-phase contact detection. | |
bool | need_update_stl_model {false} |
Flag indicating whether STl model intersection-based contact detection and resolution is needed. | |
Protected Member Functions | |
void | RemoveLinkedCell (int lookup_id) |
Reomve a linked cell by look-up id. | |
void | RemoveLinkedDomain (int lookup_id) |
Reomve a linked domain by look-up id. | |
void | RemoveLinkedParticle (int lookup_id) |
Reomve a linked neighbor by look-up id. | |
void | RemoveLinkedWall (int lookup_id) |
Reomve a linked neighbor by look-up id. | |
void | RemoveContactRefPP (int lookup_id) |
Reomve a p-p contact by look-up id. | |
void | RemoveContactRefPW (int lookup_id) |
Reomve a p-w contact by look-up id. | |
NeighPofP *const | GetLinkedContactRefPP (int lookup_id) |
Gets the neigh obj by look-up id. | |
NeighWofP *const | GetLinkedContactRefPW (int lookup_id) |
Gets the neigh obj by look-up id. | |
NeighPofP * | BuildContactRefPP (Particle *const q, ContactPP *const cnt) |
Create a new contact lookup table entry for the given pair of particles q and cnt , and return the newly created entry. | |
NeighWofP * | BuildContactRefPW (Wall *const w, ContactPW *const cnt) |
Create a new contact lookup table entry for the given wall w and contact point cnt , and return the newly created entry. | |
int | FindContactRefPP (Particle *const q) |
Find the index of the contact lookup table entry belonging to this particle that references the given particle q . | |
int | FindContactRefPW (Wall *const w) |
Find the index of the contact lookup table entry belonging to this particle that references the given wall w . | |
Protected Attributes | |
double | density {2650} |
The density of the particle. Please use SetDensity to change its value. | |
VecXT< std::pair< Cell *, int > > | linked_cell_list |
List of linked cells used for broad-phase contact detection. | |
VecXT< NeighPofP > | linked_particle_list |
List of linked particles used for narrow-phase contact detection with particles. | |
VecXT< NeighWofP > | linked_wall_list |
List of linked walls used for narrow-phase contact detection with walls. | |
VecXT< NeighPofP > | contact_pp_ref_table |
Lookup table used to reconstruct reference of contact history with particles. | |
VecXT< NeighWofP > | contact_pw_ref_table |
Lookup table used to reconstruct reference of contact history with walls. | |
bool | is_on_edge {false} |
Flag indicating whether particle is on domain edge. | |
bool | need_send_out {false} |
Flag indicating whether data needs to be sent out to linked domains. | |
VecXT< std::pair< Domain *, int > > | linked_domain_list |
List of linked domains that overlap with the particle. | |
STLModel | stl_model |
STLModel object used for intersection-based contact detection and resolution. | |
Friends | |
class | Wall |
class | Cell |
class | Domain |
class | MPIManager |
class | DEMSolver |
class | NeighPofP |
class | NeighWofP |
class | NeighPofW |
Particle::Particle | ( | ) |
Default constructor for the Particle class.
Particle::Particle | ( | Shape *const | shape | ) |
|
virtual |
Destroy the particle object and free any resources it might be holding.
|
virtual |
Add a force to the particle.
force | The force to add. |
|
virtual |
Add a force to the particle atomically.
f | The force to add. |
|
virtual |
Add a moment (torque) to the particle.
moment | The moment (torque) to add. |
|
virtual |
Add a moment (torque) to the particle atomically.
m | The moment (torque) to add. |
|
virtual |
Apply a contact force to the particle when it is in contact with another particle.
cnt | A pointer to the ContactPP object representing the contact. |
Reimplemented in netdem::DeformableParticle.
|
virtual |
Apply a contact force to the particle when it is in contact with a wall.
cnt | A pointer to the ContactPW object representing the contact. |
Reimplemented in netdem::DeformableParticle.
Create a new contact lookup table entry for the given pair of particles q
and cnt
, and return the newly created entry.
q | A pointer to one of the particles in the contact pair. |
cnt | A pointer to the contact point between the two particles. |
Create a new contact lookup table entry for the given wall w
and contact point cnt
, and return the newly created entry.
w | A pointer to the wall in contact with the particle. |
cnt | A pointer to the contact point between the particle and the wall. |
void Particle::BuildContactRefTable | ( | ) |
Build a look-up table for contacts between particles.
void Particle::ClearContactRefTable | ( | ) |
Clear the look-up table for contacts between particles.
|
virtual |
Clear all forces applied to the particle.
Reimplemented in netdem::DeformableParticle.
void Particle::ClearLinkedCells | ( | ) |
Clear the linked cells of the particle.
void Particle::ClearLinkedDomains | ( | ) |
Clear the linked domains of the particle.
void Particle::ClearLinkedNeighs | ( | ) |
Clear the linked neighbors of the particle.
|
virtual |
Clear all moments applied to the particle.
|
virtual |
Creates a new instance of the Particle class that is a copy of the current instance.
Reimplemented in netdem::DeformableParticle.
|
protected |
Find the index of the contact lookup table entry belonging to this particle that references the given particle q
.
q | A pointer to one of the particles in the contact pair. |
q
, or -1 if the entry is not found.
|
protected |
Find the index of the contact lookup table entry belonging to this particle that references the given wall w
.
w | A pointer to the wall in contact with the particle. |
w
, or -1 if the entry is not found. int Particle::FindLinkedParticle | ( | Particle *const | q | ) |
Find the index of the neighbor tuple belonging to this particle that is linked to the given particle q
.
q | A pointer to the neighboring particle whose link is being searched. |
q
, or -1 if the tuple is not found. int Particle::FindLinkedWall | ( | Wall *const | w | ) |
Find the index of the neighbor tuple belonging to this particle that is linked to the given wall w
.
w | A pointer to the neighboring wall whose link is being searched. |
w
, or -1 if the tuple is not found. Get a vector of pointers to all contact points between particles.
Get a vector of pointers to all contact points between particles and walls.
|
virtual |
Gets the density of the particle.
|
virtual |
Get the value of a dynamic property identified by the given key.
key | The key identifying the dynamic property. |
Gets a vector of pointers to the cells that may be potentially overlapped this wall.
|
protected |
Gets the neigh obj by look-up id.
|
protected |
Gets the neigh obj by look-up id.
Gets a vector of pointers to the domains that may be potentially overlapped this wall.
NeighPofP *const Particle::GetLinkedParticle | ( | int | lookup_id | ) |
Gets the neigh obj by look-up id.
Gets a vector of pointers to the particles that may be potentially overlapped this wall.
NeighWofP *const Particle::GetLinkedWall | ( | int | lookup_id | ) |
Gets the neigh obj by look-up id.
Gets a vector of pointers to the walls that may be potentially overlapped this wall.
|
virtual |
Gets the margin of the particle.
|
virtual |
Get a copy of the particle's STL model as an object of type STLModel
.
num_nodes | The number of nodoes to include in the returned model (default value is 200). |
|
virtual |
Get a copy of the particle's STL model as an object of type STLModel
.
num_facet | The number of facets to include in the returned model (default value is 400). |
Get the current velocity of the particle at the given position.
cnt_pos | The position at which to get the velocity. |
Reimplemented in netdem::DeformableParticle.
|
virtual |
Initializes the particle by setting default values for all properties.
int Particle::LinkToCell | ( | Cell *const | cell | ) |
Create a link between this particle and the given cell and return the look up id.
cell | A pointer to the cell to which a link is being created. |
int Particle::LinkToDomain | ( | Domain *const | domain | ) |
Create a link between this particle and the given domain and return the look up id.
cell | A pointer to the domain to which a link is being created. |
Create a new neighbor tuple between this particle and the given particle q
, and return the newly created tuple.
q | A pointer to the neighboring particle to which a link is being created. |
Create a new neighbor tuple between this particle and the given wall w
, and return the newly created tuple.
w | A pointer to the neighboring wall to which a link is being created. |
|
virtual |
Print information about the particle to the console.
|
protected |
Reomve a p-p contact by look-up id.
|
protected |
Reomve a p-w contact by look-up id.
|
protected |
Reomve a linked cell by look-up id.
|
protected |
Reomve a linked domain by look-up id.
|
protected |
Reomve a linked neighbor by look-up id.
|
protected |
Reomve a linked neighbor by look-up id.
|
virtual |
Save the particle's current state to a VTK file with the given filename.
filename | The name of the VTK file to be saved. |
Reimplemented in netdem::DeformableParticle.
|
virtual |
Sets the density of the particle.
dens | The density of the particle in kg/m^3. |
Reimplemented in netdem::DeformableParticle.
|
virtual |
Set the value of a dynamic property identified by the given key.
key | The key identifying the dynamic property. |
value | The new value of the dynamic property. |
|
virtual |
Sets the force acting on the particle.
fx | The x-component of the force vector. |
fy | The y-component of the force vector. |
fz | The z-component of the force vector. |
|
virtual |
Sets the margin of the particle.
margin | The margin of the particle. |
|
virtual |
Sets the moment acting on the particle.
mx | The x-component of the moment vector. |
my | The y-component of the moment vector. |
mz | The z-component of the moment vector. |
|
virtual |
Sets the position of the particle.
pos_x | The x-coordinate of the location of the particle. |
pos_y | The y-coordinate of the location of the particle. |
pos_z | The z-coordinate of the location of the particle. |
Reimplemented in netdem::DeformableParticle.
|
virtual |
Sets the orientation of the particle using a quaternion.
q_0 | The scalar component of the quaternion. |
q_1 | The x-component of the quaternion. |
q_2 | The y-component of the quaternion. |
q_3 | The z-component of the quaternion. |
Reimplemented in netdem::DeformableParticle.
|
virtual |
Sets the orientation of the particle using a Rodrigues rotation vector.
angle | The magnitude of the rotation. |
axis_x | The x-component of the rotation vector. |
axis_y | The y-component of the rotation vector. |
axis_z | The z-component of the rotation vector. |
Reimplemented in netdem::DeformableParticle.
|
virtual |
Sets the Shape object representing the particle's shape.
shape | A pointer to the Shape object representing the particle's shape. |
Reimplemented in netdem::DeformableParticle.
|
virtual |
Sets the angular velocity (spin) of the particle.
spin_x | The x-component of the spin vector. |
spin_y | The y-component of the spin vector. |
spin_z | The z-component of the spin vector. |
|
virtual |
Sets the velocity of the particle.
v_x | The x-component of the velocity vector. |
v_y | The y-component of the velocity vector. |
v_z | The z-component of the velocity vector. |
Reimplemented in netdem::DeformableParticle.
|
virtual |
Update the bounding box of the particle, which is useful for collision detection. The bounding box will be updated regardless of the particle movement.
Reimplemented in netdem::DeformableParticle.
|
virtual |
Update the bounding box of the particle, which is useful for collision detection. Particle has a skin and if the movement of particle has not exceed this skin, the bounding box will not be updated.
Reimplemented in netdem::DeformableParticle.
|
virtual |
Update the contact forces applied to the particle.
void Particle::UpdateLinkedCells | ( | CellManager *const | cm | ) |
Update the linked cells of the particle based on the given cell manager.
cm | A pointer to the cell manager containing the cells to which the particle may belong. |
void Particle::UpdateLinkedDomains | ( | DomainManager *const | dm | ) |
Update the linked domains of the particle based on the given domain manager.
dm | A pointer to the domain manager containing the domains to which the particle may belong. |
void Particle::UpdateLinkedNeighs | ( | Domain *const | domain | ) |
Update the linked neighbors of the particle based on the given domain.
domain | A pointer to the domain in which the particle resides. |
|
virtual |
Update the motion of the particle based on the applied forces and moments over a time step.
timestep | The time step over which to update the motion. |
Reimplemented in netdem::DeformableParticle.
|
virtual |
Update the geometry of the particle's STL model.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
Vec3d netdem::Particle::bound_disp {0, 0, 0} |
The displacement of the particle's bounds for the linked list.
Vec3d netdem::Particle::bound_max {0, 0, 0} |
The maximum bounds of the particle's shape.
Vec3d netdem::Particle::bound_min {0, 0, 0} |
The minimum bounds of the particle's shape.
Lookup table used to reconstruct reference of contact history with particles.
Lookup table used to reconstruct reference of contact history with walls.
double netdem::Particle::damp_numerical {0} |
The numerical damping coefficient of the particle.
double netdem::Particle::damp_viscous {0} |
The viscous damping coefficient of the particle.
|
protected |
The density of the particle. Please use SetDensity to change its value.
MiniMap<std::string, double> netdem::Particle::dynamic_properties |
Map of dynamic properties of the particle.
bool netdem::Particle::enable_bound_aabb {false} |
Flag indicating whether bounding sphere should be used to approximate axis-aligned bounding box (AABB).
Vec3d netdem::Particle::force {0, 0, 0} |
The force acting on the particle.
int netdem::Particle::id {0} |
The ID of the particle.
|
protected |
Flag indicating whether particle is on domain edge.
List of linked cells used for broad-phase contact detection.
List of linked domains that overlap with the particle.
List of linked particles used for narrow-phase contact detection with particles.
List of linked walls used for narrow-phase contact detection with walls.
double netdem::Particle::margin {0} |
The margin of the particle's shape.
double netdem::Particle::mass {0.0} |
The mass of the particle.
int netdem::Particle::material_type {0} |
The material type of the particle.
Vec3d netdem::Particle::moi_principal {0, 0, 0} |
The principal moment of inertia of the particle.
Vec3d netdem::Particle::moment {0, 0, 0} |
The moment acting on the particle.
|
protected |
Flag indicating whether data needs to be sent out to linked domains.
bool netdem::Particle::need_update_linked_list {true} |
Flag indicating whether linked-list algorithm should be used for broad-phase contact detection.
bool netdem::Particle::need_update_stl_model {false} |
Flag indicating whether STl model intersection-based contact detection and resolution is needed.
Vec3d netdem::Particle::pos {0, 0, 0} |
The position of the particle.
Vec4d netdem::Particle::quaternion {1, 0, 0, 0} |
The quaternion of the particle.
Shape* netdem::Particle::shape {nullptr} |
The shape of the particle.
Vec3d netdem::Particle::spin {0, 0, 0} |
The spin of the particle.
Vec3d netdem::Particle::spin_principal {0, 0, 0} |
The principal spin axis of the particle.
|
protected |
STLModel object used for intersection-based contact detection and resolution.
Vec3d netdem::Particle::vel {0, 0, 0} |
The velocity of the particle.
Vec3d netdem::Particle::vel_m0p5 {0, 0, 0} |
The square root velocity of the particle for half-step integration.