NetDEM v1.0
Loading...
Searching...
No Matches
wall.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "mini_map.hpp"
4#include "neigh_tuple.hpp"
5#include "shape.hpp"
6#include "shape_trimesh.hpp"
7
8#include <unordered_map>
9
10namespace netdem {
11
12class Particle;
13class ContactPW;
14
15class Cell;
16class CellManager;
17class Domain;
18class DomainManager;
19class MPIManager;
20class DEMSolver;
21
22class NeighPofW;
23class NeighWofP;
24
32class Wall {
33public:
34 friend class Particle;
35 friend class Cell;
36 friend class Domain;
37 friend class MPIManager;
38 friend class DEMSolver;
39 friend class NeighPofW;
40 friend class NeighWofP;
41
43 int id{0};
44
46 int id_in_list{0};
47
49 std::string label{"default"};
50
53
56
59
63
65 Vec3d pos{0, 0, 0};
66
68 Vec4d quaternion{1, 0, 0, 0};
69
71 Vec3d force{0, 0, 0}, moment{0, 0, 0};
72
74 Vec3d vel{0, 0, 0}, spin{0, 0, 0}, vel_spin{0, 0, 0};
75
78
81
82protected:
85
88
91
92public:
95
96protected:
100
101public:
107 Wall();
108
114 Wall(Shape *const shape);
115
121 Wall *Clone() const;
122
128 void Init();
129
135 void SetShape(Shape *const shape);
136
144 void SetPosition(double pos_x, double pos_y, double pos_z);
145
154 void SetRodrigues(double angle, double axis_x, double axis_y, double axis_z);
155
164 void SetQuaternion(double q_0, double q_1, double q_2, double q_3);
165
173 void SetVelocity(double v_x, double v_y, double v_z);
174
182 void SetSpin(double spin_x, double spin_y, double spin_z);
183
195 void SetVelocitySpin(double spin_x, double spin_y, double spin_z);
196
204 Vec3d GetVelocity(Vec3d const &cnt_pos);
205
212 void SetDynamicProperty(std::string const &key, double value);
213
223 double GetDynamicProperty(std::string const &key);
224
230 void AddForce(const Vec3d &f);
231
237 void AddMoment(const Vec3d &m);
238
247 void AddForceAtomic(const Vec3d &f);
248
257 void AddMomentAtomic(const Vec3d &m);
258
262 void ClearForce();
263
267 void ClearMoment();
268
274 void ApplyContactForce(ContactPW const *cnt);
275
282 void UpdateContactForce();
283
289 void UpdateMotion(double timestep);
290
299 void UpdateMotion(const Vec3d &v, const Vec3d &s, double timestep);
300
308 void UpdateMotion(const Vec3d &dpos, const Vec4d &dquat);
309
315 void UpdateBoundFast();
316
322 void UpdateBound();
323
324protected:
328 void RemoveLinkedCell(int lookup_id);
329
333 void RemoveLinkedParticle(int lookup_id);
334
338 void RemoveContactRefPW(int lookup_id);
339
340public:
344 void ClearLinkedCells();
345
349 void ClearLinkedNeighs();
350
355
360
366 void UpdateLinkedCells(CellManager *const cm);
367
373 void UpdateLinkedNeighs(Domain *const domain);
374
383
389
395
399 NeighPofW *const GetLinkedParticle(int lookup_id);
400
401protected:
405 NeighPofW *const GetLinkedContactRefPW(int lookup_id);
406
407public:
411 void UpdateSTLModel();
412
420 STLModel GetSTLModel(int num_nodes = 200);
421
430
438 void SaveAsVTK(std::string const &filename);
439
443 void Print();
444
450 ~Wall();
451
452public:
456 int FindLinkedParticle(Particle *const p);
457
458protected:
462 int FindContactRefPW(Particle *const p);
463
464public:
472 int LinkToCell(Cell *const cell);
473
483};
484
485} // namespace netdem
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 class representing a contact between a particle and a wall.
Definition contact_pw.hpp:22
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
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 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
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
void SetQuaternion(double q_0, double q_1, double q_2, double q_3)
Sets the orientation of the wall using a quaternion.
Definition wall.cpp:61
void RemoveLinkedParticle(int lookup_id)
Reomve a linked neighbor by look-up id.
Definition wall.cpp:274
void Print()
Prints the properties and state of the wall object to the console.
Definition wall.cpp:517
STLModel GetSTLModel(int num_nodes=200)
Gets the STL model for the wall object.
Definition wall.cpp:445
void RemoveContactRefPW(int lookup_id)
Reomve a p-w contact by look-up id.
Definition wall.cpp:284
void UpdateBound()
Update the bounding box of the wall, which is useful for collision detection. The bounding box will b...
Definition wall.cpp:242
void SetSpin(double spin_x, double spin_y, double spin_z)
Sets the rotational velocity of the wall.
Definition wall.cpp:76
STLModel * GetSTLModelInternal()
Gets the STL model for the wall object.
Definition wall.cpp:453
void SetShape(Shape *const shape)
Sets the shape of the wall.
Definition wall.cpp:27
Vec3d force
Definition wall.hpp:71
Wall()
Default constructor for Wall class.
Definition wall.cpp:16
VecXT< NeighPofW > contact_pw_ref_table
Definition wall.hpp:90
void ClearForce()
Clears the accumulated force on the wall object.
Definition wall.cpp:145
void UpdateMotion(double timestep)
Updates the motion of the wall object over a specified time step.
Definition wall.cpp:183
void SaveAsVTK(std::string const &filename)
Saves the wall object as a VTK file.
Definition wall.cpp:455
VecXT< ContactPW * > GetContactPWs()
Gets a vector of pointers to ContactPW objects representing the contact forces on the wall object.
Definition wall.cpp:411
Vec4d quaternion
Forces and moments in the global coordinate system.
Definition wall.hpp:68
void Init()
Initializes the wall object with default values.
Definition wall.cpp:25
void ClearLinkedCells()
Clears the linked cell list for the wall object.
Definition wall.cpp:294
void AddMoment(const Vec3d &m)
Adds a moment to the wall object.
Definition wall.cpp:121
void UpdateLinkedNeighs(Domain *const domain)
Updates the linked neighbor list for the wall object.
Definition wall.cpp:360
void SetRodrigues(double angle, double axis_x, double axis_y, double axis_z)
Sets the orientation of the wall using Rodrigues' formula.
Definition wall.cpp:53
Vec3d moment
Translational, rotational, and combined velocities of the wall.
Definition wall.hpp:71
void SetDynamicProperty(std::string const &key, double value)
Sets a dynamic property for the wall.
Definition wall.cpp:107
Vec3d GetVelocity(Vec3d const &cnt_pos)
Gets the velocity of a point within the wall.
Definition wall.cpp:103
Shape * shape
The material type of the wall.
Definition wall.hpp:52
void BuildContactRefTable()
Builds the contact lookup table for the wall object.
Definition wall.cpp:318
VecXT< NeighPofW > linked_particle_list
A lookup table for contact history reference reconstruction.
Definition wall.hpp:87
void SetVelocitySpin(double spin_x, double spin_y, double spin_z)
Sets the combined translational and rotational velocities of the wall.
Definition wall.cpp:87
VecXT< std::pair< Cell *, int > > linked_cell_list
< A list of linked cells for the wall.
Definition wall.hpp:84
void UpdateContactForce()
Updates the contact forces for the wall object.
Definition wall.cpp:174
std::string label
Pointer to the shape of the wall.
Definition wall.hpp:49
void UpdateSTLModel()
Updates the STL model for the wall object.
Definition wall.cpp:438
void ClearMoment()
Clears the accumulated moment on the wall object.
Definition wall.cpp:151
int FindLinkedParticle(Particle *const p)
Find linked particle, return the index.
Definition wall.cpp:535
MiniMap< std::string, double > dynamic_properties
Boolean flag for updating the linked list algorithm.
Definition wall.hpp:77
bool need_update_stl_model
< Boolean flag for updating the STL model.
Definition wall.hpp:94
NeighPofW * LinkToParticle(Particle *const p)
Create a link between this wall and the given particle and return the look up id.
Definition wall.cpp:563
Vec3d bound_disp
The position of the wall.
Definition wall.hpp:62
void AddForceAtomic(const Vec3d &f)
Adds a force to the wall object atomically.
Definition wall.cpp:127
VecXT< NeighPofW > const & GetLinkedParticles()
Gets a vector of pointers to the particles that may be potentially overlapped this wall.
Definition wall.cpp:426
void SetVelocity(double v_x, double v_y, double v_z)
Sets the translational velocity of the wall.
Definition wall.cpp:70
Vec3d pos
The quaternion representing the orientation of the wall.
Definition wall.hpp:65
Vec3d bound_max
Definition wall.hpp:62
void SetPosition(double pos_x, double pos_y, double pos_z)
Sets the position of the wall.
Definition wall.cpp:41
Vec3d vel_spin
Customized properties for the wall.
Definition wall.hpp:74
void UpdateBoundFast()
Updates the bounding box for the wall object. Wall has a skin and if the movement of particle has not...
Definition wall.cpp:214
NeighPofW *const GetLinkedParticle(int lookup_id)
Gets the neigh obj by look-up id.
Definition wall.cpp:430
void UpdateLinkedCells(CellManager *const cm)
Updates the linked cells for the wall object.
Definition wall.cpp:343
STLModel stl_model
Definition wall.hpp:99
Vec3d bound_min
Definition wall.hpp:62
~Wall()
Destructor for Wall class.
Definition wall.cpp:529
void RemoveLinkedCell(int lookup_id)
Reomve a linked cell by look-up id.
Definition wall.cpp:264
void ClearLinkedNeighs()
Clears the linked neighbor list for the wall object.
Definition wall.cpp:303
int id_in_list
The label or name of the wall.
Definition wall.hpp:46
VecXT< std::pair< Cell *, int > > const & GetLinkedCells()
Gets a vector of pointers to the cells that may be potentially overlapped this wall.
Definition wall.cpp:422
void ClearContactRefTable()
Clears the contact lookup table for the wall object.
Definition wall.cpp:328
bool enable_bound_aabb
Definition wall.hpp:58
void ApplyContactForce(ContactPW const *cnt)
Applies a contact force to the wall object.
Definition wall.cpp:157
void AddMomentAtomic(const Vec3d &m)
Adds a moment to the wall object atomically.
Definition wall.cpp:136
Vec3d spin
Definition wall.hpp:74
void AddForce(const Vec3d &f)
Adds a force to the wall object.
Definition wall.cpp:115
Vec3d vel
Definition wall.hpp:74
bool enable_rotation
Definition wall.hpp:58
int material_type
Boolean flags for enabling wall rotation and AABB bounds.
Definition wall.hpp:55
int LinkToCell(Cell *const cell)
Create a link between this wall and the given cell and return the look up id.
Definition wall.cpp:553
Wall * Clone() const
Creates a copy of the wall object.
Definition wall.cpp:23
double GetDynamicProperty(std::string const &key)
Gets the value of a dynamic property for the wall.
Definition wall.cpp:111
NeighPofW *const GetLinkedContactRefPW(int lookup_id)
Gets the neigh obj by look-up id.
Definition wall.cpp:434
int FindContactRefPW(Particle *const p)
Find a contact in the look up table, return the index.
Definition wall.cpp:544
bool need_update_linked_list
Definition wall.hpp:80
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