This is an example of how to use the netdem library.
#include <iostream>
#include <unordered_map>
using namespace std;
for (
auto &vert : cylinder_stl.
vertices) {
vert[2] *= 0.5;
}
cylinder_stl.
SaveAsSTL(
"tmp/tests/cylinder_outer.stl");
for (
auto &facet : cylinder_stl.
facets) {
}
for (
auto &vert : cylinder_stl.
vertices) {
vert[0] *= 0.15;
vert[1] *= 0.15;
vert[2] *= 0.64;
vert[2] -= 0.10;
}
cylinder_stl.
SaveAsSTL(
"tmp/tests/cylinder_inner.stl");
for (
auto &facet : cylinder_stl.
facets) {
}
propeller_stl.
InitFromSTL(
"data/copyleft/propeller.stl");
for (
auto &vert : propeller_stl.
vertices) {
vert[0] *= 0.14;
vert[1] *= 0.14;
vert[2] *= 0.8;
vert[2] -= 0.075;
}
propeller_stl.
SaveAsSTL(
"tmp/tests/propeller.stl");
for (
auto &facet : propeller_stl.
facets) {
auto [bound_aabb_min, bound_aabb_max] = shape_ptr->GetBoundAABB();
wall_ptr->
pos = 0.5 * (bound_aabb_min + bound_aabb_max);
shape_ptr->Translate(-1.0 * wall_ptr->pos);
}
}
int main(
int argc,
char **argv) {
for (auto &p : particle_list) {
p.SetVelocity(0, 0, -2.0);
p.damp_numerical = 0.7;
}
ImportWall(sim);
for (int i = 0; i < 20; i++) {
}
delete sim;
}
A class used to dump particle data into vtk files. This is a post-modifier, which will be executed at...
Definition data_dumper.hpp:12
bool dump_shape_info
A flag that determines whether to dump shape information.
Definition data_dumper.hpp:29
void Init(Simulation *sim) override
Initializes the DataDumper instance.
Definition data_dumper.cpp:24
bool dump_wall_info
A flag that determines whether to dump wall information.
Definition data_dumper.hpp:21
void SetSaveByCycles(double interval)
Sets the interval for saving data by cycles.
Definition data_dumper.cpp:39
void SetRootPath(std::string const &root_path)
Sets the root directory path for the output file.
Definition data_dumper.cpp:26
void SetBound(double bmin_x, double bmin_y, double bmin_z, double bmax_x, double bmax_y, double bmax_z)
Sets the lower and upper bounds of the domain.
Definition domain_manager.cpp:83
void SetCellSpacing(double s_x, double s_y, double s_z)
Sets the spacing between cells in each dimension.
Definition domain_manager.cpp:105
A class used to apply gravity to particles in a DEM simulation.
Definition gravity.hpp:10
void Init(Simulation *sim) override
Initializes the Gravity instance.
Definition gravity.cpp:14
Contact model that uses linear spring elements to evaluate contact forces and moments.
Definition model_linear_spring.hpp:16
std::string label
Definition modifier.hpp:20
Modifier * Insert(Modifier *e)
Inserts new modifier into the simulation.
Definition modifier_manager.cpp:17
void Enable(std::string const &label)
Enables a modifier in the simulation.
Class for working with STL models.
Definition stl_model.hpp:17
VecXT< Vec3i > facets
A M by 3 matrix. Each row defines a facet, with the row elements being the indices of the vertices.
Definition stl_model.hpp:28
VecXT< Vec3d > vertices
A N by 3 matrix that defines the points on the 3D model surface.
Definition stl_model.hpp:22
void Standardize()
Standardize the model.
Definition stl_model.cpp:290
void InitFromSTL(std::string const &file)
Initialize the model from an STL file.
Definition stl_model.cpp:25
void SaveAsSTL(std::string const &file) const
Save the model as an STL file.
Definition stl_model.cpp:205
ContactModel * InsertContactModel(const ContactModel *const cm_ptr)
Insert a contact model into this scene.
Definition scene.cpp:290
void SetNumberOfMaterials(int num)
Set the number of materials in this scene and initialize the contact lookup table accordingly.
Definition scene.cpp:346
Shape * InsertShape(const Shape *const s_ptr)
Insert a single shape into this scene.
Definition scene.cpp:19
void SetCollisionModel(int mat_type_1, int mat_type_2, ContactModel *const cnt_model)
Set the collision model between two materials.
Definition scene.cpp:397
Particle * InsertParticle(const Particle *const p_ptr)
Insert a single particle into this scene.
Definition scene.cpp:76
VecXT< Shape * > GetShapes()
Return a vector of pointers to all shapes in this scene.
Definition scene.cpp:316
Wall * InsertWall(const Wall *const w_ptr)
Insert a single wall into this scene.
Definition scene.cpp:194
virtual void SetSkinFactor(double sk_factor)
Set skin size factor (skin = size by skin size factor) of the shape.
Definition shape.cpp:279
Class for managing a DEM simulation.
Definition simulation.hpp:21
void Run(double time)
Runs the simulation for a specified period of time.
Definition simulation.cpp:28
DomainManager domain_manager
Manager for domain and sub-domain calculations.
Definition simulation.hpp:31
ModifierManager modifier_manager
Manages add-on features (i.e., customized evaluations not hard-coded in the DEM calculation cycle).
Definition simulation.hpp:53
Scene scene
Contains and manages basic DEM objects (e.g., shapes, particles, walls) for a DEM simulation.
Definition simulation.hpp:42
A class representing a sphere.
Definition shape_sphere.hpp:17
A class representing a triangle in 3D space.
Definition shape_triangle.hpp:19
A class representing a wall object in a physics simulation.
Definition wall.hpp:32
void SetShape(Shape *const shape)
Sets the shape of the wall.
Definition wall.cpp:27
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
Vec3d pos
The quaternion representing the orientation of the wall.
Definition wall.hpp:65
int main(int argc, char *argv[])
Definition main.cpp:18
Definition bond_entry.hpp:7
std::vector< T > VecXT
Definition utils_macros.hpp:31