NetDEM v1.0
Loading...
Searching...
No Matches
particle_group.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "modifier.hpp"
4#include "particle.hpp"
5
6#include <unordered_set>
7
8namespace netdem {
9
16class ParticleGroup : public Modifier {
17protected:
19 std::unordered_set<int> particle_id_list;
20
23
24public:
27
28public:
33
38
44 void AddParticle(int id);
45
51 void RemoveParticle(int id);
52
58 void AddParticle(const VecXT<int> &ids);
59
65 void RemoveParticle(const VecXT<int> &ids);
66
72 void AddParticle(const std::initializer_list<int> &ids);
73
79 void RemoveParticle(const std::initializer_list<int> &ids);
80
86 void SetParticle(int id);
87
93 void SetParticle(const VecXT<int> &ids);
94
100 void SetParticle(const std::initializer_list<int> &ids);
101
106
110 void Clear();
111
117 Modifier *Clone() const override;
118
122 void Execute() override;
123
129 void Update() override;
130};
131
132} // namespace netdem
An interface class used to modify a DEM simulation.
Definition modifier.hpp:18
A class used to group particles in a DEM simulation.
Definition particle_group.hpp:16
void Clear()
Clears all particles from the group.
Definition particle_group.cpp:86
void Update() override
Updates the ParticleGroup instance.
Definition particle_group.cpp:95
VecXT< Particle * > const & GetParticles()
Get the particles.
Definition particle_group.cpp:16
void RemoveParticle(const std::initializer_list< int > &ids)
Removes multiple particles from the group.
ParticleGroup()
Default constructor for ParticleGroup class.
Definition particle_group.cpp:10
VecXT< Particle * > particle_list
The list of particles.
Definition particle_group.hpp:22
void AddParticle(int id)
Adds a particle to the group.
Definition particle_group.cpp:18
void SetParticle(int id)
Sets a particle to the group.
Definition particle_group.cpp:56
void RemoveParticle(int id)
Removes a particle from the group.
Definition particle_group.cpp:23
void SetParticle(const std::initializer_list< int > &ids)
Sets multiple particles to the group.
Modifier * Clone() const override
Clones the current ParticleGroup instance.
Definition particle_group.cpp:91
bool use_particles_in_scene
A flag indicating whether to group all particle in the scene.
Definition particle_group.hpp:26
void Execute() override
Executes the ParticleGroup instance.
Definition particle_group.cpp:93
void AddParticle(const std::initializer_list< int > &ids)
Adds multiple particles to the group.
std::unordered_set< int > particle_id_list
The list of particle IDs.
Definition particle_group.hpp:19
void SetParticleFromScene()
Sets the particles to all the particles in the scene scene.
Definition particle_group.cpp:75
Definition bond_entry.hpp:7
std::vector< T > VecXT
Definition utils_macros.hpp:31