NetDEM v1.0
Loading...
Searching...
No Matches
bonded_voronois.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "bond_solver_pp.hpp"
4#include "contact_model.hpp"
5#include "contact_pp.hpp"
6#include "particle.hpp"
7#include "shape_trimesh.hpp"
8#include "voronoi.hpp"
9#include <string>
10
11namespace netdem {
12
13class Scene;
14
20public:
25
30
35
40
44 int cvt_max_iters{1000};
45
49 double cvt_tol{1.0e-3};
50
55
60
67
74
82
90
97 void SetBondModel(ContactModel *cnt_model);
98
106 void Translate(double pos_x, double pos_y, double pos_z);
107
117 void RotateByRodrigues(double rot_angle, double rot_axis_x, double rot_axis_y,
118 double rot_axis_z);
119
126
134 void InitFromSTL(std::string const &filename, int num_voros);
135
143 void InitFromSTL(STLModel const &stl_model, int num_voros);
144
150 void MakePorosity(double porosity);
151
155 void InitBonds();
156
162 void SaveAsVTK(std::string const &file_name);
163
169 void ImportToScene(Scene *const scene) const;
170
171private:
180 VecXT<Vec3d> FindSharedVertices(STLModel const &stl_1, STLModel const &stl_2);
181
188 Vec3d PolyNormal(VecXT<Vec3d> const &verts);
189
196 void PolySortVertices(VecXT<Vec3d> *const pos_vec, Vec3d const &dir_n);
197
206 std::tuple<Vec3d, double> PolyCentroid(const VecXT<Vec3d> &verts);
207
212 void RefreshPointers();
213};
214
215} // namespace netdem
A class representing a set of bonded Voronoi cells generated from an STL file.
Definition bonded_voronois.hpp:19
void InitFromSTL(std::string const &filename, int num_voros)
Initialize the Voronoi cells from an STL file with the given number of cells.
VecXT< TriMesh > trimesh_list
The list of TriMesh objects representing the Voronoi cells.
Definition bonded_voronois.hpp:24
void SetBondModel(ContactModel *cnt_model)
Set the contact model used to calculate the forces between particles.
Definition bonded_voronois.cpp:69
ContactModel * bond_model
The contact model used to calculate the forces between particles.
Definition bonded_voronois.hpp:54
void SaveAsVTK(std::string const &file_name)
Save the Voronoi cells as a VTK file.
Definition bonded_voronois.cpp:212
VecXT< Vec2i > bond_pair_list
The list of bonded pairs between particles.
Definition bonded_voronois.hpp:39
BondedVoronois & operator=(BondedVoronois const &bp)
Copy assignment operator for the BondedVoronois class.
Definition bonded_voronois.cpp:39
int cvt_max_iters
The maximum number of iterations for the CVT algorithm.
Definition bonded_voronois.hpp:44
void Translate(double pos_x, double pos_y, double pos_z)
Translate the Voronoi cells by a given amount.
Definition bonded_voronois.cpp:79
Vec3d GetCentroid()
Calculate the centroid of the Voronoi cells.
Definition bonded_voronois.cpp:132
VecXT< Particle > particle_list
The list of particles in the Voronoi cells.
Definition bonded_voronois.hpp:29
BondedVoronois()
Default constructor for the BondedVoronois class.
Definition bonded_voronois.cpp:11
VecXT< ContactPP > contact_list
The list of contact pairs between particles.
Definition bonded_voronois.hpp:34
void InitBonds()
Initialize the bonded pairs between particles.
Definition bonded_voronois.cpp:289
void ImportToScene(Scene *const scene) const
Import the BondedVoronois object to a Scene object.
Definition bonded_voronois.cpp:335
void RotateByRodrigues(double rot_angle, double rot_axis_x, double rot_axis_y, double rot_axis_z)
Rotate the Voronoi cells by a given angle around a given axis using the Rodrigues formula.
Definition bonded_voronois.cpp:99
void MakePorosity(double porosity)
Make the Voronoi cells porous by adding gaps between particles.
Definition bonded_voronois.cpp:193
double cvt_tol
The tolerance for convergence of the CVT algorithm.
Definition bonded_voronois.hpp:49
An abstract base class for contact models.
Definition contact_model.hpp:25
Class for working with STL models.
Definition stl_model.hpp:17
A class for managing the elements in a DEM simulation. Scene behaves as a std container:
Definition scene.hpp:56
Definition bond_entry.hpp:7
std::vector< T > VecXT
Definition utils_macros.hpp:31
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18
dir_n
Definition json_serilization.hpp:19