NetDEM v1.0
Loading...
Searching...
No Matches
external_force.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "modifier.hpp"
4#include "particle.hpp"
5#include "utils_math.hpp"
6#include <unordered_map>
7#include <unordered_set>
8
9namespace netdem {
10
16class ExternalForce : public Modifier {
17protected:
19 std::unordered_set<int> particle_id_list;
20
23
26
27 // List of particle moments to apply
29
30public:
35
44 void SetForce(int id, double fx, double fy, double fz);
45
54 void SetMoment(int id, double mx, double my, double mz);
55
64 void SetForce(const VecXT<int> &id_list, double fx, double fy, double fz);
65
74 void SetMoment(const VecXT<int> &id_list, double mx, double my, double mz);
75
84 void AddForce(int id, double fx, double fy, double fz);
85
94 void AddMoment(int id, double mx, double my, double mz);
95
104 void AddForce(const VecXT<int> &id_list, double fx, double fy, double fz);
105
114 void AddMoment(const VecXT<int> &id_list, double mx, double my, double mz);
115
122 Vec3d GetForce(int id);
123
130 Vec3d GetMoment(int id);
131
135 void Clear();
136
142 Modifier *Clone() const override;
143
148 void SyncToAllProcessors();
149
153 void Execute() override;
154
158 void Update() override;
159
160private:
161 std::unordered_map<int, VecNd<6>> id_force_map;
162};
163
164} // namespace netdem
A class used to add external forces to particles in a DEM simulation. This is a pre-modifier,...
Definition external_force.hpp:16
void SetMoment(int id, double mx, double my, double mz)
Sets the moment for a specific particle by ID.
Definition external_force.cpp:25
Modifier * Clone() const override
Clones the current ExternalForce instance.
Definition external_force.cpp:125
void Clear()
Clears all applied forces and moments from particles.
Definition external_force.cpp:118
ExternalForce()
Default constructor for ExternalForce class.
Definition external_force.cpp:12
Vec3d GetForce(int id)
Gets the total force on a specific particle by ID.
Definition external_force.cpp:88
std::unordered_set< int > particle_id_list
The list of particle IDs.
Definition external_force.hpp:19
void Update() override
Updates the ExternalForce instance.
Definition external_force.cpp:186
void SetForce(int id, double fx, double fy, double fz)
Sets the force for a specific particle by ID.
Definition external_force.cpp:18
Vec3d GetMoment(int id)
Gets the total moment on a specific particle by ID.
Definition external_force.cpp:103
void AddMoment(int id, double mx, double my, double mz)
Adds to the moment for a specific particle by ID.
Definition external_force.cpp:60
VecXT< Vec3d > moment_list
Definition external_force.hpp:28
VecXT< Vec3d > force_list
The list of particle forces to apply.
Definition external_force.hpp:25
VecXT< Particle * > particle_list
The list of particles.
Definition external_force.hpp:22
void SyncToAllProcessors()
Synchronizes applied forces and moments across all processors in a distributed simulation.
Definition external_force.cpp:127
void Execute() override
Executes the ExternalForce instance.
Definition external_force.cpp:178
void AddForce(int id, double fx, double fy, double fz)
Adds to the force for a specific particle by ID.
Definition external_force.cpp:46
An interface class used to modify a DEM simulation.
Definition modifier.hpp:18
Definition bond_entry.hpp:7
std::vector< T > VecXT
Definition utils_macros.hpp:31
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18