NetDEM v1.0
|
A class for managing the elements in a DEM simulation. Scene behaves as a std container: More...
#include <scene.hpp>
Public Member Functions | |
Scene () | |
Default constructor for the scene class. | |
void | Init (Simulation *const sim) |
Initialize this scene with pointers to its owning simulation object. | |
Shape * | InsertShape (const Shape *const s_ptr) |
Insert a single shape into this scene. | |
VecXT< Shape * > | InsertShape (const VecXT< Shape * > &s_list) |
Insert a list of shapes into this scene. | |
Particle * | InsertParticleLocal (const Particle *const p_ptr) |
Insert a single particle into this scene. The particle will be forced inserted no mather which sub-domain it belongs to. | |
Particle * | InsertParticle (const Particle *const p_ptr) |
Insert a single particle into this scene. | |
Particle * | InsertParticle (Particle const &p) |
Insert a copy of the given particle into this scene. | |
VecXT< Particle * > | InsertParticle (const VecXT< Particle * > &p_list) |
Insert a list of particles into this scene. | |
VecXT< Particle * > | InsertParticle (const VecXT< Particle > &p_list) |
Insert a list of particles into this scene by copying the given particles. | |
void | InsertParticle (const BondedSpheres *const p_ptr) |
Insert a bonded-sphere particle into this scene. | |
void | InsertParticle (const VecXT< BondedSpheres * > &p_list) |
Insert a list of bonded-sphere particles into this scene. | |
void | InsertParticle (const VecXT< BondedSpheres > &p_list) |
Insert a list of bonded-sphere particles into this scene by copying the given particles. | |
void | InsertParticle (const BondedVoronois *const p_ptr) |
Insert a bonded-voronoi particle into this scene. | |
void | InsertParticle (const VecXT< BondedVoronois * > &p_list) |
Insert a list of bonded-voronoi particles into this scene. | |
void | InsertParticle (const VecXT< BondedVoronois > &p_list) |
Insert a list of bonded-voronoi particles into this scene by copying the given particles. | |
Particle * | InsertDerivedParticle (Particle const *p_ptr) |
Insert a derived particle into this scene by copying the given particle. | |
VecXT< Particle * > | InsertDerivedParticle (const VecXT< Particle * > &p_list) |
Insert a list of derived particles into this scene by copying the given particles. | |
Wall * | InsertWall (const Wall *const w_ptr) |
Insert a single wall into this scene. | |
Wall * | InsertWall (Wall const &w) |
Insert a copy of the given wall into this scene. | |
VecXT< Wall * > | InsertWall (const VecXT< Wall * > &w_list) |
Insert a list of walls into this scene. | |
VecXT< Wall * > | InsertWall (const VecXT< Wall > &w_list) |
Insert a list of walls into this scene by copying the given walls. | |
void | RemoveShape (Shape *s_ptr) |
Remove the given shape from this scene. | |
void | RemoveParticle (Particle *p_ptr) |
Remove the given particle from this scene. | |
void | RemoveParticle (int id) |
Remove the particle with the given ID from this scene. | |
void | RemoveWall (Wall *w_ptr) |
Remove the given wall from this scene. | |
void | RemoveWall (int id) |
Remove the wall with the given ID from this scene. | |
ContactModel * | InsertContactModel (const ContactModel *const cm_ptr) |
Insert a contact model into this scene. | |
VecXT< ContactModel * > | InsertContactModel (const VecXT< ContactModel * > &cm_list) |
Insert a list of contact models into this scene. | |
VecXT< Shape * > | GetShapes () |
Return a vector of pointers to all shapes in this scene. | |
bool | InScene (const Shape *const s_ptr) |
Check if the given shape is in this scene. | |
bool | InScene (const ContactModel *const cnt_ptr) |
Check if the given contact model is in this scene. | |
void | SetNumberOfMaterials (int num) |
Set the number of materials in this scene and initialize the contact lookup table accordingly. | |
void | SetBondModel (int mat_type_1, int mat_type_2, ContactModel *const cnt_model) |
Set the bond model between two materials. | |
void | SetBondModel (int mat_type_1, int mat_type_2, std::string const &label) |
Set the bond model between two materials using the label of the contact model. | |
void | SetCollisionModel (int mat_type_1, int mat_type_2, ContactModel *const cnt_model) |
Set the collision model between two materials. | |
void | SetCollisionModel (int mat_type_1, int mat_type_2, std::string const &label) |
Set the collision model between two materials using the label of the contact model. | |
void | SetGravity (double gx, double gy, double gz) |
Set the gravity acceleration vector for all particles in this scene. | |
ContactModel * | GetBondModel (Particle *p1, Particle *p2) |
Get the bond model between two particles. | |
Domain * | GetDomain () const |
Get the domain. | |
ContactModel * | GetBondModel (Particle *p, Wall *w) |
Get the bond model between a particle and a wall. | |
ContactModel * | GetCollisionModel (Particle *p1, Particle *p2) |
Get the collision model between two particles. | |
ContactModel * | GetCollisionModel (Particle *p, Wall *w) |
Get the collision model between a particle and a wall. | |
void | AutoReadRestart (std::string const &path, int mech_cyc, int shape_info_case=0, std::string filecase="vtk") |
Restart the simulation using output files. | |
void | ReadRestartShapesVTK (std::string const &file) |
Read in the particle shape information from a restart file. | |
void | ReadRestartParticlesVTK (std::string const &file) |
Read in the particle information from a restart file. | |
void | ReadRestartWallsVTK (std::string const &file) |
Read in the wall information from a restart file. | |
void | ReadRestartContactsVTK (std::string const &file) |
Read in the contact model information from a restart file. | |
void | ReadRestartShapesJSON (std::string const &file) |
Read in the particle shape information from a restart file. | |
void | ReadRestartParticlesJSON (std::string const &file) |
Read in the particle information from a restart file. | |
void | ReadRestartWallsJSON (std::string const &file) |
Read in the wall information from a restart file. | |
void | ReadRestartContactsJSON (std::string const &file) |
Read in the contact model information from a restart file. | |
VecXT< Particle * > const & | GetParticles () |
Get the particles in the scene. | |
VecXT< Wall * > const & | GetWalls () |
Get the walls in the scene. | |
VecXT< ContactPP * > | GetContactPPs () |
Get all particle-particle contacts in this scene. | |
VecXT< ContactPW * > | GetContactPWs () |
Get all particle-wall contacts in this scene. | |
std::unordered_map< int, Shape * > const & | GetShapeMap () |
Get the shape map in the scene. | |
VecXT< Particle * > | GetParticlesWithProxy () |
Get the particles, along with the particle proxyes, in the scene. (for debugging only) | |
void | ClearShape () |
Clear all shapes from this scene. | |
void | ClearParticle () |
Clear all particles from this scene. | |
void | ClearWall () |
Clear all walls from this scene. | |
void | ClearContactModels () |
Clear all contact models from this scene. | |
void | ClearContacts () |
Clear all contacts from this scene. | |
Particle * | FindParticle (int id) |
Find the particle with the given ID in this scene. | |
Particle * | FindParticleWithProxy (int id) |
Find the particle with the given ID in this scene. | |
Wall * | FindWall (int id) |
Find the wall with the given ID in this scene. | |
~Scene () | |
Destroy this scene and free all associated memory. | |
Public Attributes | |
Vec3d | gravity_coef {0, 0, -9.81} |
The gravity acceleration vector applied to all particles in this scene. | |
VecXT< Wall * > | wall_list |
A list of pointers to all walls assumed to exist in this scene. No MPI transfer is performed on wall data. | |
MiniMap< int, ContactModel * > | contact_model_map |
A map from integer IDs to pointers to contact models defined in this scene. | |
VecXT< VecXT< ContactModel * > > | bond_model_table |
A lookup table for contact models based on the two materials in contact. | |
VecXT< VecXT< ContactModel * > > | collision_model_table |
VecXT< Particle * > | particle_list |
A list of pointers to all particles that belong to this sub-domain (scene). | |
Protected Attributes | |
VecXT< Particle * > | particle_ghost_list |
A list of pointers to all particles that do not physically exist, but are introduced to provide well-defined contacts. | |
VecXT< Particle * > | particle_proxy_list |
A list of pointers to all proxy particles that belong to other domains, but may come into contact with particles in this domain. | |
VecXT< Wall * > | wall_ghost_list |
A list of pointers to all walls that do not physically exist, but are introduced to provide well-defined contacts. | |
std::unordered_map< int, Particle * > | particle_map |
A map from integer IDs to pointers to particles, used for MPI particle reconstruction. | |
std::unordered_map< int, Shape * > | shape_map |
A map from shape IDs to pointers to shapes defined in this scene. | |
VecXT< Shape * > | local_shape_list |
A list of pointers to all shapes that have been generated locally and not yet synced with other sub-domains. | |
Friends | |
class | DEMSolver |
class | MPIManager |
A class for managing the elements in a DEM simulation. Scene behaves as a std container:
Note and to-do: currently, the scene, dem_solver and mpi_manager are deeply coupuled with each other. Will need to re-consider the code design. e.g.,
Scene::Scene | ( | ) |
Default constructor for the scene
class.
Scene::~Scene | ( | ) |
Destroy this scene and free all associated memory.
void Scene::AutoReadRestart | ( | std::string const & | path, |
int | mech_cyc, | ||
int | shape_info_case = 0, | ||
std::string | filecase = "vtk" ) |
Restart the simulation using output files.
path | The path where the output files are located. |
mech_cyc | The mechanical time step cycle number at which the restart is initiated. |
shape_info_case | An integer value that specifies how much shape information should be read in for each particle during the restart. Valid values are 0 (for only 0-step json), 2 (for time-specific json). |
filecase | The filecase (vtk or json) of the output files. |
void Scene::ClearContactModels | ( | ) |
Clear all contact models from this scene.
void Scene::ClearContacts | ( | ) |
Clear all contacts from this scene.
void Scene::ClearParticle | ( | ) |
Clear all particles from this scene.
void Scene::ClearShape | ( | ) |
Clear all shapes from this scene.
void Scene::ClearWall | ( | ) |
Clear all walls from this scene.
Particle * Scene::FindParticle | ( | int | id | ) |
Find the particle with the given ID in this scene.
id | The ID of the particle to find. |
nullptr
if no such particle exists in this scene. Particle * Scene::FindParticleWithProxy | ( | int | id | ) |
Find the particle with the given ID in this scene.
id | The ID of the particle to find. |
nullptr
if no such particle exists in this scene. Wall * Scene::FindWall | ( | int | id | ) |
Find the wall with the given ID in this scene.
id | The ID of the wall to find. |
nullptr
if no such wall exists in this scene. ContactModel * Scene::GetBondModel | ( | Particle * | p, |
Wall * | w ) |
Get the bond model between a particle and a wall.
p | A pointer to the particle. |
w | A pointer to the wall. |
ContactModel * Scene::GetBondModel | ( | Particle * | p1, |
Particle * | p2 ) |
Get the bond model between two particles.
p1 | A pointer to the first particle. |
p2 | A pointer to the second particle. |
ContactModel * Scene::GetCollisionModel | ( | Particle * | p, |
Wall * | w ) |
Get the collision model between a particle and a wall.
p | A pointer to the particle. |
w | A pointer to the wall. |
ContactModel * Scene::GetCollisionModel | ( | Particle * | p1, |
Particle * | p2 ) |
Get the collision model between two particles.
p1 | A pointer to the first particle. |
p2 | A pointer to the second particle. |
Get all particle-particle contacts in this scene.
Get all particle-wall contacts in this scene.
Domain * Scene::GetDomain | ( | ) | const |
Get the domain.
Get the particles, along with the particle proxyes, in the scene. (for debugging only)
unordered_map< int, Shape * > const & Scene::GetShapeMap | ( | ) |
Get the shape map in the scene.
Return a vector of pointers to all shapes in this scene.
void Scene::Init | ( | Simulation *const | sim | ) |
Initialize this scene with pointers to its owning simulation object.
sim | A pointer to the Simulation instance that owns this scene . |
bool Scene::InScene | ( | const ContactModel *const | cnt_ptr | ) |
Check if the given contact model is in this scene.
cnt_ptr | A pointer to the contact model to check for existence in this scene. |
true
if the contact model is found in this scene, false
otherwise. bool Scene::InScene | ( | const Shape *const | s_ptr | ) |
Check if the given shape is in this scene.
s_ptr | A pointer to the shape to check for existence in this scene. |
true
if the shape is found in this scene, false
otherwise. ContactModel * Scene::InsertContactModel | ( | const ContactModel *const | cm_ptr | ) |
Insert a contact model into this scene.
cm_ptr | A pointer to the contact model to be inserted. |
VecXT< ContactModel * > Scene::InsertContactModel | ( | const VecXT< ContactModel * > & | cm_list | ) |
Insert a list of contact models into this scene.
cm_list | The vector of pointers to the contact models to be inserted. |
Insert a list of derived particles into this scene by copying the given particles.
p_list | The vector of particles to be copied and inserted into this scene. |
Insert a derived particle into this scene by copying the given particle.
p_ptr | The pointer to the particle to be copied and inserted into this scene. |
void Scene::InsertParticle | ( | const BondedSpheres *const | p_ptr | ) |
Insert a bonded-sphere particle into this scene.
p_ptr | A pointer to the BondedSpheres particle to be inserted. |
void Scene::InsertParticle | ( | const BondedVoronois *const | p_ptr | ) |
Insert a bonded-voronoi particle into this scene.
p_ptr | A pointer to the BondedVoronois particle to be inserted. |
Insert a single particle into this scene.
p_ptr | A pointer to the particle to be inserted. |
void Scene::InsertParticle | ( | const VecXT< BondedSpheres * > & | p_list | ) |
Insert a list of bonded-sphere particles into this scene.
p_list | The vector of pointers to the BondedSpheres particles to be inserted. |
void Scene::InsertParticle | ( | const VecXT< BondedSpheres > & | p_list | ) |
Insert a list of bonded-sphere particles into this scene by copying the given particles.
p_list | The vector of BondedSpheres particles to be copied and inserted into this scene. |
void Scene::InsertParticle | ( | const VecXT< BondedVoronois * > & | p_list | ) |
Insert a list of bonded-voronoi particles into this scene.
p_list | The vector of pointers to the BondedVoronois particles to be inserted. |
void Scene::InsertParticle | ( | const VecXT< BondedVoronois > & | p_list | ) |
Insert a list of bonded-voronoi particles into this scene by copying the given particles.
p_list | The vector of BondedVoronois particles to be copied and inserted into this scene. |
Insert a list of particles into this scene.
p_list | The vector of pointers to the particles to be inserted. |
Insert a list of particles into this scene by copying the given particles.
p_list | The vector of particles to be copied and inserted into this scene. |
Insert a copy of the given particle into this scene.
p | The particle to be copied and inserted into this scene. |
Insert a single particle into this scene. The particle will be forced inserted no mather which sub-domain it belongs to.
p_ptr | A pointer to the particle to be inserted. |
Insert a single shape into this scene.
s_ptr | A pointer to the shape to be inserted. |
Insert a list of shapes into this scene.
s_list | The vector of pointers to the shapes to be inserted. |
Insert a list of walls into this scene.
w_list | The vector of pointers to the walls to be inserted. |
Insert a list of walls into this scene by copying the given walls.
w_list | The vector of walls to be copied and inserted into this scene. |
Insert a single wall into this scene.
w_ptr | A pointer to the wall to be inserted. |
Insert a copy of the given wall into this scene.
w | The wall to be copied and inserted into this scene. |
void Scene::ReadRestartContactsJSON | ( | std::string const & | file | ) |
Read in the contact model information from a restart file.
file | The path to the restart file containing the contact model information. |
void Scene::ReadRestartContactsVTK | ( | std::string const & | file | ) |
Read in the contact model information from a restart file.
file | The path to the restart file containing the contact model information. |
void Scene::ReadRestartParticlesJSON | ( | std::string const & | file | ) |
Read in the particle information from a restart file.
file | The path to the restart file containing the particle information. |
void Scene::ReadRestartParticlesVTK | ( | std::string const & | file | ) |
Read in the particle information from a restart file.
file | The path to the restart file containing the particle information. |
void Scene::ReadRestartShapesJSON | ( | std::string const & | file | ) |
Read in the particle shape information from a restart file.
file | The path to the restart file containing the particle shape information. |
void Scene::ReadRestartShapesVTK | ( | std::string const & | file | ) |
Read in the particle shape information from a restart file.
file | The path to the restart file containing the particle shape information. |
void Scene::ReadRestartWallsJSON | ( | std::string const & | file | ) |
Read in the wall information from a restart file.
file | The path to the restart file containing the wall information. |
void Scene::ReadRestartWallsVTK | ( | std::string const & | file | ) |
Read in the wall information from a restart file.
file | The path to the restart file containing the wall information. |
void Scene::RemoveParticle | ( | int | id | ) |
Remove the particle with the given ID from this scene.
id | The ID of the particle to be removed. |
void Scene::RemoveParticle | ( | Particle * | p_ptr | ) |
Remove the given particle from this scene.
p_ptr | A pointer to the particle to be removed. |
void Scene::RemoveShape | ( | Shape * | s_ptr | ) |
Remove the given shape from this scene.
s_ptr | A pointer to the shape to be removed. |
void Scene::RemoveWall | ( | int | id | ) |
Remove the wall with the given ID from this scene.
id | The ID of the wall to be removed. |
void Scene::RemoveWall | ( | Wall * | w_ptr | ) |
Remove the given wall from this scene.
w_ptr | A pointer to the wall to be removed. |
void Scene::SetBondModel | ( | int | mat_type_1, |
int | mat_type_2, | ||
ContactModel *const | cnt_model ) |
Set the bond model between two materials.
mat_type_1 | The integer ID of the first material. |
mat_type_2 | The integer ID of the second material. |
cnt_model | A pointer to the contact model to set as the bond model between the two materials. |
void Scene::SetBondModel | ( | int | mat_type_1, |
int | mat_type_2, | ||
std::string const & | label ) |
Set the bond model between two materials using the label of the contact model.
mat_type_1 | The integer ID of the first material. |
mat_type_2 | The integer ID of the second material. |
label | The string label of the contact model to set as the bond model between the two materials. |
void Scene::SetCollisionModel | ( | int | mat_type_1, |
int | mat_type_2, | ||
ContactModel *const | cnt_model ) |
Set the collision model between two materials.
mat_type_1 | The integer ID of the first material. |
mat_type_2 | The integer ID of the second material. |
cnt_model | A pointer to the contact model to set as the collision model between the two materials. |
void Scene::SetCollisionModel | ( | int | mat_type_1, |
int | mat_type_2, | ||
std::string const & | label ) |
Set the collision model between two materials using the label of the contact model.
mat_type_1 | The integer ID of the first material. |
mat_type_2 | The integer ID of the second material. |
label | The string label of the contact model to set as the collision model between the two materials. |
void Scene::SetGravity | ( | double | gx, |
double | gy, | ||
double | gz ) |
Set the gravity acceleration vector for all particles in this scene.
gx | The x-component of the gravity acceleration vector. |
gy | The y-component of the gravity acceleration vector. |
gz | The z-component of the gravity acceleration vector. |
void Scene::SetNumberOfMaterials | ( | int | num | ) |
Set the number of materials in this scene and initialize the contact lookup table accordingly.
num | The number of materials to set. |
|
friend |
|
friend |
VecXT<VecXT<ContactModel *> > netdem::Scene::bond_model_table |
A lookup table for contact models based on the two materials in contact.
VecXT<VecXT<ContactModel *> > netdem::Scene::collision_model_table |
MiniMap<int, ContactModel *> netdem::Scene::contact_model_map |
A map from integer IDs to pointers to contact models defined in this scene.
Vec3d netdem::Scene::gravity_coef {0, 0, -9.81} |
The gravity acceleration vector applied to all particles in this scene.
A list of pointers to all shapes that have been generated locally and not yet synced with other sub-domains.
A list of pointers to all particles that do not physically exist, but are introduced to provide well-defined contacts.
A list of pointers to all particles that belong to this sub-domain (scene).
|
protected |
A map from integer IDs to pointers to particles, used for MPI particle reconstruction.
A list of pointers to all proxy particles that belong to other domains, but may come into contact with particles in this domain.
|
protected |
A map from shape IDs to pointers to shapes defined in this scene.
A list of pointers to all walls that do not physically exist, but are introduced to provide well-defined contacts.
A list of pointers to all walls assumed to exist in this scene. No MPI transfer is performed on wall data.