NetDEM v1.0
Loading...
Searching...
No Matches
deformable_particle.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "fem_simulator.hpp"
4#include "particle.hpp"
5#include "shape_trimesh.hpp"
6
7namespace netdem {
8
9class DeformationAnalysis;
10
22public:
24 TriMesh *trimesh{nullptr};
25
28
31
33 int mesh_res{20};
34
39
49 Particle *Clone() const override;
50
61 void SetShape(Shape *s) override;
62
66 void InitFEMMesh();
67
77 void SetDensity(double dens) override;
78
89 void SetPosition(double x, double y, double z) override;
90
103 void SetRodrigues(double angle, double axis_x, double axis_y,
104 double axis_z) override;
105
118 void SetQuaternion(double q_0, double q_1, double q_2, double q_3) override;
119
130 void SetVelocity(double v_x, double v_y, double v_z) override;
131
141 Vec3d GetVelocity(Vec3d const &pos) override;
142
152 void AddForce(int node_id, Vec3d const &f);
153
161 void ClearForce() override;
162
172 void ApplyContactForce(ContactPP const *cnt) override;
173
183 void ApplyContactForce(ContactPW const *cnt) override;
184
193 void UpdateMotion(double dt) override;
194
202 void UpdateShape();
203
211 void UpdateBoundFast() override;
212
220 void UpdateBound() override;
221
230 void SaveSurfaceAsVTK(std::string const &filename);
231
240 void SaveAsVTK(std::string const &filename) override;
241
246 ~DeformableParticle() override;
247
248private:
257 void InitFEMSimulator();
258};
259
260} // namespace netdem
A class representing a contact between two particles.
Definition contact_pp.hpp:20
A class representing a contact between a particle and a wall.
Definition contact_pw.hpp:22
A class representing a deformable particle simulated using the Finite Element Method (FEM).
Definition deformable_particle.hpp:21
void SetVelocity(double v_x, double v_y, double v_z) override
Sets the velocity of the particle.
Definition deformable_particle.cpp:114
void SetRodrigues(double angle, double axis_x, double axis_y, double axis_z) override
Sets the angle and axis of rotation for the particle.
Definition deformable_particle.cpp:100
void SetPosition(double x, double y, double z) override
Sets the position of the particle.
Definition deformable_particle.cpp:82
void ClearForce() override
Clears all forces on the particle's mesh.
Definition deformable_particle.cpp:150
void ApplyContactForce(ContactPP const *cnt) override
Applies a contact force to the particle.
Definition deformable_particle.cpp:158
void UpdateMotion(double dt) override
Updates the motion of the particle.
Definition deformable_particle.cpp:183
void UpdateBoundFast() override
Updates the bounding box of the particle.
Definition deformable_particle.cpp:203
Vec3d GetVelocity(Vec3d const &pos) override
Gets the velocity of the particle at a given position.
Definition deformable_particle.cpp:118
void SetShape(Shape *s) override
Sets the shape of the particle.
Definition deformable_particle.cpp:21
TriMesh * trimesh
Pointer to the triangular mesh shape of the particle.
Definition deformable_particle.hpp:24
TetMesh tetmesh
The tetrahedral mesh used for the simulation.
Definition deformable_particle.hpp:27
void SetDensity(double dens) override
Sets the density of the particle.
Definition deformable_particle.cpp:71
int mesh_res
The resolution of the tetrahedral mesh.
Definition deformable_particle.hpp:33
~DeformableParticle() override
Destroys the DeformableParticle object and frees any memory used by it.
Definition deformable_particle.cpp:273
void UpdateBound() override
Updates the bounding box of the particle.
Definition deformable_particle.cpp:220
Particle * Clone() const override
Creates a new instance of this object.
Definition deformable_particle.cpp:17
void SaveAsVTK(std::string const &filename) override
Saves the particle as a VTK file.
Definition deformable_particle.cpp:269
void InitFEMMesh()
Initialized the mesh for FEM analysis.
Definition deformable_particle.cpp:48
void SaveSurfaceAsVTK(std::string const &filename)
Saves the surface of the particle as a VTK file.
Definition deformable_particle.cpp:228
void AddForce(int node_id, Vec3d const &f)
Adds a force to a node on the particle's mesh.
Definition deformable_particle.cpp:135
FEMSimulator fem_simulator
The FEM simulator object used to simulate the particle.
Definition deformable_particle.hpp:30
void SetQuaternion(double q_0, double q_1, double q_2, double q_3) override
Sets the orientation of the particle using a quaternion.
Definition deformable_particle.cpp:107
void UpdateShape()
Updates the shape of the particle.
Definition deformable_particle.cpp:194
DeformableParticle()
Constructs a new DeformableParticle object.
Definition deformable_particle.cpp:10
A Finite Element Method (FEM) simulator used for simulating the deformation of objects.
Definition fem_simulator.hpp:18
Definition particle.hpp:26
Vec3d pos
The position of the particle.
Definition particle.hpp:103
This class represents different types of shapes and performs various calculations on them.
Definition shape.hpp:15
A class that represents a tetrahedral mesh.
Definition tetmesh.hpp:17
A class representing a triangular mesh in 3D space.
Definition shape_trimesh.hpp:23
Definition bond_entry.hpp:7
node_id
Definition json_serilization.hpp:23
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18