NetDEM v1.0
|
A class representing a wall object in a physics simulation. More...
#include <wall.hpp>
Public Member Functions | |
Wall () | |
Default constructor for Wall class. | |
Wall (Shape *const shape) | |
Constructor for Wall class that sets the shape of the wall. | |
Wall * | Clone () const |
Creates a copy of the wall object. | |
void | Init () |
Initializes the wall object with default values. | |
void | SetShape (Shape *const shape) |
Sets the shape of the wall. | |
void | SetPosition (double pos_x, double pos_y, double pos_z) |
Sets the position of the wall. | |
void | SetRodrigues (double angle, double axis_x, double axis_y, double axis_z) |
Sets the orientation of the wall using Rodrigues' formula. | |
void | SetQuaternion (double q_0, double q_1, double q_2, double q_3) |
Sets the orientation of the wall using a quaternion. | |
void | SetVelocity (double v_x, double v_y, double v_z) |
Sets the translational velocity of the wall. | |
void | SetSpin (double spin_x, double spin_y, double spin_z) |
Sets the rotational velocity of the wall. | |
void | SetVelocitySpin (double spin_x, double spin_y, double spin_z) |
Sets the combined translational and rotational velocities of the wall. | |
Vec3d | GetVelocity (Vec3d const &cnt_pos) |
Gets the velocity of a point within the wall. | |
void | SetDynamicProperty (std::string const &key, double value) |
Sets a dynamic property for the wall. | |
double | GetDynamicProperty (std::string const &key) |
Gets the value of a dynamic property for the wall. | |
void | AddForce (const Vec3d &f) |
Adds a force to the wall object. | |
void | AddMoment (const Vec3d &m) |
Adds a moment to the wall object. | |
void | AddForceAtomic (const Vec3d &f) |
Adds a force to the wall object atomically. | |
void | AddMomentAtomic (const Vec3d &m) |
Adds a moment to the wall object atomically. | |
void | ClearForce () |
Clears the accumulated force on the wall object. | |
void | ClearMoment () |
Clears the accumulated moment on the wall object. | |
void | ApplyContactForce (ContactPW const *cnt) |
Applies a contact force to the wall object. | |
void | UpdateContactForce () |
Updates the contact forces for the wall object. | |
void | UpdateMotion (double timestep) |
Updates the motion of the wall object over a specified time step. | |
void | UpdateMotion (const Vec3d &v, const Vec3d &s, double timestep) |
Updates the motion of the wall object using a specified velocity and spin over a specified time step. | |
void | UpdateMotion (const Vec3d &dpos, const Vec4d &dquat) |
Updates the motion of the wall object using a specified displacement position and quaternion. | |
void | UpdateBoundFast () |
Updates the bounding box for the wall object. Wall has a skin and if the movement of particle has not exceed this skin, the bounding box will not be updated. | |
void | UpdateBound () |
Update the bounding box of the wall, which is useful for collision detection. The bounding box will be updated regardless of the wall movement. | |
void | ClearLinkedCells () |
Clears the linked cell list for the wall object. | |
void | ClearLinkedNeighs () |
Clears the linked neighbor list for the wall object. | |
void | BuildContactRefTable () |
Builds the contact lookup table for the wall object. | |
void | ClearContactRefTable () |
Clears the contact lookup table for the wall object. | |
void | UpdateLinkedCells (CellManager *const cm) |
Updates the linked cells for the wall object. | |
void | UpdateLinkedNeighs (Domain *const domain) |
Updates the linked neighbor list for the wall object. | |
VecXT< ContactPW * > | GetContactPWs () |
Gets a vector of pointers to ContactPW objects representing the contact forces on the wall object. | |
VecXT< std::pair< Cell *, int > > const & | GetLinkedCells () |
Gets a vector of pointers to the cells that may be potentially overlapped this wall. | |
VecXT< NeighPofW > const & | GetLinkedParticles () |
Gets a vector of pointers to the particles that may be potentially overlapped this wall. | |
NeighPofW *const | GetLinkedParticle (int lookup_id) |
Gets the neigh obj by look-up id. | |
void | UpdateSTLModel () |
Updates the STL model for the wall object. | |
STLModel | GetSTLModel (int num_nodes=200) |
Gets the STL model for the wall object. | |
STLModel * | GetSTLModelInternal () |
Gets the STL model for the wall object. | |
void | SaveAsVTK (std::string const &filename) |
Saves the wall object as a VTK file. | |
void | Print () |
Prints the properties and state of the wall object to the console. | |
~Wall () | |
Destructor for Wall class. | |
int | FindLinkedParticle (Particle *const p) |
Find linked particle, return the index. | |
int | LinkToCell (Cell *const cell) |
Create a link between this wall and the given cell and return the look up id. | |
NeighPofW * | LinkToParticle (Particle *const p) |
Create a link between this wall and the given particle and return the look up id. | |
Public Attributes | |
int | id {0} |
The index of the wall in the wall list. | |
int | id_in_list {0} |
The label or name of the wall. | |
std::string | label {"default"} |
Pointer to the shape of the wall. | |
Shape * | shape |
The material type of the wall. | |
int | material_type {0} |
Boolean flags for enabling wall rotation and AABB bounds. | |
bool | enable_rotation {false} |
bool | enable_bound_aabb {true} |
Vec3d | bound_min |
Vec3d | bound_max |
Vec3d | bound_disp {0, 0, 0} |
The position of the wall. | |
Vec3d | pos {0, 0, 0} |
The quaternion representing the orientation of the wall. | |
Vec4d | quaternion {1, 0, 0, 0} |
Forces and moments in the global coordinate system. | |
Vec3d | force {0, 0, 0} |
Vec3d | moment {0, 0, 0} |
Translational, rotational, and combined velocities of the wall. | |
Vec3d | vel {0, 0, 0} |
Vec3d | spin {0, 0, 0} |
Vec3d | vel_spin {0, 0, 0} |
Customized properties for the wall. | |
MiniMap< std::string, double > | dynamic_properties |
Boolean flag for updating the linked list algorithm. | |
bool | need_update_linked_list {true} |
bool | need_update_stl_model {false} |
< Boolean flag for updating the STL model. | |
Protected Member Functions | |
void | RemoveLinkedCell (int lookup_id) |
Reomve a linked cell by look-up id. | |
void | RemoveLinkedParticle (int lookup_id) |
Reomve a linked neighbor by look-up id. | |
void | RemoveContactRefPW (int lookup_id) |
Reomve a p-w contact by look-up id. | |
NeighPofW *const | GetLinkedContactRefPW (int lookup_id) |
Gets the neigh obj by look-up id. | |
int | FindContactRefPW (Particle *const p) |
Find a contact in the look up table, return the index. | |
Protected Attributes | |
VecXT< std::pair< Cell *, int > > | linked_cell_list |
< A list of linked cells for the wall. | |
VecXT< NeighPofW > | linked_particle_list |
A lookup table for contact history reference reconstruction. | |
VecXT< NeighPofW > | contact_pw_ref_table |
STLModel | stl_model |
Friends | |
class | Particle |
class | Cell |
class | Domain |
class | MPIManager |
class | DEMSolver |
class | NeighPofW |
class | NeighWofP |
The ID number of the wall. | |
A class representing a wall object in a physics simulation.
This class defines the properties and behaviors of a wall object, including its position and orientation, shape, and material type. The class also contains methods for updating the wall's state and resolving collisions.
Wall::Wall | ( | ) |
Default constructor for Wall class.
Initializes member variables to default values.
Wall::Wall | ( | Shape *const | shape | ) |
Constructor for Wall class that sets the shape of the wall.
shape | Pointer to the shape of the wall. |
Wall::~Wall | ( | ) |
Destructor for Wall class.
Frees any dynamically allocated memory used by the class.
void Wall::AddForce | ( | const Vec3d & | f | ) |
Adds a force to the wall object.
f | The force vector to be added. |
void Wall::AddForceAtomic | ( | const Vec3d & | f | ) |
Adds a force to the wall object atomically.
This method ensures atomicity when adding forces to the wall object in a multithreaded environment.
f | The force vector to be added. |
void Wall::AddMoment | ( | const Vec3d & | m | ) |
Adds a moment to the wall object.
m | The moment vector to be added. |
void Wall::AddMomentAtomic | ( | const Vec3d & | m | ) |
Adds a moment to the wall object atomically.
This method ensures atomicity when adding moments to the wall object in a multithreaded environment.
m | The moment vector to be added. |
void Wall::ApplyContactForce | ( | ContactPW const * | cnt | ) |
Applies a contact force to the wall object.
cnt | Pointer to the ContactPW object representing the contact force. |
void Wall::BuildContactRefTable | ( | ) |
Builds the contact lookup table for the wall object.
void Wall::ClearContactRefTable | ( | ) |
Clears the contact lookup table for the wall object.
void Wall::ClearForce | ( | ) |
Clears the accumulated force on the wall object.
void Wall::ClearLinkedCells | ( | ) |
Clears the linked cell list for the wall object.
void Wall::ClearLinkedNeighs | ( | ) |
Clears the linked neighbor list for the wall object.
void Wall::ClearMoment | ( | ) |
Clears the accumulated moment on the wall object.
Wall * Wall::Clone | ( | ) | const |
Creates a copy of the wall object.
|
protected |
Find a contact in the look up table, return the index.
int Wall::FindLinkedParticle | ( | Particle *const | p | ) |
Find linked particle, return the index.
double Wall::GetDynamicProperty | ( | std::string const & | key | ) |
Gets the value of a dynamic property for the wall.
key | The name of |
the 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.
NeighPofW *const Wall::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.
STLModel Wall::GetSTLModel | ( | int | num_nodes = 200 | ) |
Gets the STL model for the wall object.
num_nodes | The number of nodes to be used in the model. |
STLModel * Wall::GetSTLModelInternal | ( | ) |
Gets the STL model for the wall object.
num_facet | The number of facets to be used in the model. |
Gets the velocity of a point within the wall.
cnt_pos | The position of the point within the wall. |
void Wall::Init | ( | ) |
Initializes the wall object with default values.
This method sets all member variables to their default values.
int Wall::LinkToCell | ( | Cell *const | cell | ) |
Create a link between this wall and the given cell and return the look up id.
cell | A pointer to the cell to which a link is being created. |
Create a link between this wall and the given particle and return the look up id.
p | A pointer to the particle to which a link is being created. |
void Wall::Print | ( | ) |
Prints the properties and state of the wall object to the console.
|
protected |
Reomve a p-w contact by look-up id.
|
protected |
Reomve a linked cell by look-up id.
|
protected |
Reomve a linked neighbor by look-up id.
void Wall::SaveAsVTK | ( | std::string const & | filename | ) |
Saves the wall object as a VTK file.
filename | The name |
of the file to be saved.
void Wall::SetDynamicProperty | ( | std::string const & | key, |
double | value ) |
Sets a dynamic property for the wall.
key | The name of the property. |
value | The value of the property. |
void Wall::SetPosition | ( | double | pos_x, |
double | pos_y, | ||
double | pos_z ) |
Sets the position of the wall.
pos_x | The x-coordinate of the position. |
pos_y | The y-coordinate of the position. |
pos_z | The z-coordinate of the position. |
void Wall::SetQuaternion | ( | double | q_0, |
double | q_1, | ||
double | q_2, | ||
double | q_3 ) |
Sets the orientation of the wall using a quaternion.
q_0 | The scalar component of the quaternion. |
q_1 | The x-coordinate of the vector component of the quaternion. |
q_2 | The y-coordinate of the vector component of the quaternion. |
q_3 | The z-coordinate of the vector component of the quaternion. |
void Wall::SetRodrigues | ( | double | angle, |
double | axis_x, | ||
double | axis_y, | ||
double | axis_z ) |
Sets the orientation of the wall using Rodrigues' formula.
angle | The rotation angle in radians. |
axis_x | The x-coordinate of the rotation axis. |
axis_y | The y-coordinate of the rotation axis. |
axis_z | The z-coordinate of the rotation axis. |
void Wall::SetShape | ( | Shape *const | shape | ) |
Sets the shape of the wall.
shape | Pointer to the shape of the wall. |
void Wall::SetSpin | ( | double | spin_x, |
double | spin_y, | ||
double | spin_z ) |
Sets the rotational velocity of the wall.
spin_x | The x-component of the rotational velocity. |
spin_y | The y-component of the rotational velocity. |
spin_z | The z-component of the rotational velocity. |
void Wall::SetVelocity | ( | double | v_x, |
double | v_y, | ||
double | v_z ) |
Sets the translational velocity of the wall.
v_x | The x-component of the velocity. |
v_y | The y-component of the velocity. |
v_z | The z-component of the velocity. |
void Wall::SetVelocitySpin | ( | double | spin_x, |
double | spin_y, | ||
double | spin_z ) |
Sets the combined translational and rotational velocities of the wall.
This method allows the velocity to vary according to the radius using the cross product of spin and the position.
spin_x | The x-component of the rotational velocity. |
spin_y | The y-component of the rotational velocity. |
spin_z | The z-component of the rotational velocity. |
void Wall::UpdateBound | ( | ) |
Update the bounding box of the wall, which is useful for collision detection. The bounding box will be updated regardless of the wall movement.
void Wall::UpdateBoundFast | ( | ) |
Updates the bounding box for the wall object. Wall has a skin and if the movement of particle has not exceed this skin, the bounding box will not be updated.
void Wall::UpdateContactForce | ( | ) |
Updates the contact forces for the wall object.
This method updates the contact forces for the wall object based on its current state.
void Wall::UpdateLinkedCells | ( | CellManager *const | cm | ) |
Updates the linked cells for the wall object.
cm | Pointer to the CellManager object used for the update. |
void Wall::UpdateLinkedNeighs | ( | Domain *const | domain | ) |
Updates the linked neighbor list for the wall object.
domain | Pointer to the Domain object used for the update. |
Updates the motion of the wall object using a specified displacement position and quaternion.
dpos | The displacement position. |
dquat | The new orientation quaternion. |
Updates the motion of the wall object using a specified velocity and spin over a specified time step.
v | The translational velocity for the update. |
s | The rotational velocity (spin) for the update. |
timestep | The time step for the update. |
void Wall::UpdateMotion | ( | double | timestep | ) |
Updates the motion of the wall object over a specified time step.
timestep | The time step for the update. |
void Wall::UpdateSTLModel | ( | ) |
Updates the STL model for the wall object.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
The ID number of the wall.
|
friend |
Vec3d netdem::Wall::bound_disp {0, 0, 0} |
The position of the wall.
Vec3d netdem::Wall::bound_max |
Vec3d netdem::Wall::bound_min |
MiniMap<std::string, double> netdem::Wall::dynamic_properties |
Boolean flag for updating the linked list algorithm.
bool netdem::Wall::enable_bound_aabb {true} |
The minimum and maximum bounds of the wall, with a skin displacement for broad-phase contact detection.
bool netdem::Wall::enable_rotation {false} |
Vec3d netdem::Wall::force {0, 0, 0} |
int netdem::Wall::id {0} |
The index of the wall in the wall list.
int netdem::Wall::id_in_list {0} |
The label or name of the wall.
std::string netdem::Wall::label {"default"} |
Pointer to the shape of the wall.
< A list of linked cells for the wall.
A list of linked particles for the wall.
A lookup table for contact history reference reconstruction.
int netdem::Wall::material_type {0} |
Boolean flags for enabling wall rotation and AABB bounds.
Vec3d netdem::Wall::moment {0, 0, 0} |
Translational, rotational, and combined velocities of the wall.
bool netdem::Wall::need_update_linked_list {true} |
bool netdem::Wall::need_update_stl_model {false} |
< Boolean flag for updating the STL model.
Vec3d netdem::Wall::pos {0, 0, 0} |
The quaternion representing the orientation of the wall.
Vec4d netdem::Wall::quaternion {1, 0, 0, 0} |
Forces and moments in the global coordinate system.
Shape* netdem::Wall::shape |
The material type of the wall.
Vec3d netdem::Wall::spin {0, 0, 0} |
|
protected |
< The STL model used for intersection-based contact detection and resolution.
Vec3d netdem::Wall::vel {0, 0, 0} |
Vec3d netdem::Wall::vel_spin {0, 0, 0} |
Customized properties for the wall.