NetDEM v1.0
Loading...
Searching...
No Matches
netdem::ParticleEnergyEvaluator Class Reference

A class used to evaluate the energy of particles in a DEM simulation. More...

#include <particle_energy_evaluator.hpp>

Inheritance diagram for netdem::ParticleEnergyEvaluator:
netdem::ParticleGroup netdem::Modifier

Public Member Functions

 ParticleEnergyEvaluator ()
 Default constructor for ParticleEnergyEvaluator class.
 
ParticleEnergy GetEnergy ()
 Calculates the energy for all particles in the particle list.
 
ParticleEnergy GetEnergy (Particle *const p)
 Calculates the energy for a specific particle.
 
ModifierClone () const override
 Clones the current ParticleEnergyEvaluator instance.
 
void Execute () override
 Executes the ParticleEnergyEvaluator instance.
 
void Update () override
 Updates the ParticleEnergyEvaluator instance.
 
- Public Member Functions inherited from netdem::ParticleGroup
 ParticleGroup ()
 Default constructor for ParticleGroup class.
 
VecXT< Particle * > const & GetParticles ()
 Get the particles.
 
void AddParticle (int id)
 Adds a particle to the group.
 
void RemoveParticle (int id)
 Removes a particle from the group.
 
void AddParticle (const VecXT< int > &ids)
 Adds multiple particles to the group.
 
void RemoveParticle (const VecXT< int > &ids)
 Removes multiple particles from the group.
 
void AddParticle (const std::initializer_list< int > &ids)
 Adds multiple particles to the group.
 
void RemoveParticle (const std::initializer_list< int > &ids)
 Removes multiple particles from the group.
 
void SetParticle (int id)
 Sets a particle to the group.
 
void SetParticle (const VecXT< int > &ids)
 Sets multiple particles to the group.
 
void SetParticle (const std::initializer_list< int > &ids)
 Sets multiple particles to the group.
 
void SetParticleFromScene ()
 Sets the particles to all the particles in the scene scene.
 
void Clear ()
 Clears all particles from the group.
 
ModifierClone () const override
 Clones the current ParticleGroup instance.
 
void Execute () override
 Executes the ParticleGroup instance.
 
void Update () override
 Updates the ParticleGroup instance.
 
- Public Member Functions inherited from netdem::Modifier
 Modifier ()
 Default constructor for Modifier class.
 
virtual void Init (Simulation *sim)
 Initializes the Modifier instance.
 
virtual void Enable ()
 Enables the Modifier instance.
 
virtual void Disable ()
 Disables the Modifier instance.
 
virtual ~Modifier ()
 Destructor for Modifier class.
 

Static Public Member Functions

static VecXT< ParticleEnergyExecute (const VecXT< Particle * > &p_list, Vec3d gravity_coef)
 Executes the ParticleEnergyEvaluator instance for a given list of particles.
 

Public Attributes

VecXT< ParticleEnergyparticle_energy_list
 
- Public Attributes inherited from netdem::ParticleGroup
bool use_particles_in_scene {false}
 A flag indicating whether to group all particle in the scene.
 
- Public Attributes inherited from netdem::Modifier
std::string label {"default"}
 
DEMSolver::CyclePoint cycle_point {DEMSolver::CyclePoint::pre}
 
Simulationsim {nullptr}
 
Scenescene {nullptr}
 
bool update_with_scene {false}
 
bool enable_logging {true}
 

Additional Inherited Members

- Protected Attributes inherited from netdem::ParticleGroup
std::unordered_set< int > particle_id_list
 The list of particle IDs.
 
VecXT< Particle * > particle_list
 The list of particles.
 

Detailed Description

A class used to evaluate the energy of particles in a DEM simulation.

The ParticleEnergyEvaluator class calculates the energy of a specified set of particles, and stores this information in a list of ParticleEnergy structs.

Examples
02_energy_test.cpp.

Constructor & Destructor Documentation

◆ ParticleEnergyEvaluator()

netdem::ParticleEnergyEvaluator::ParticleEnergyEvaluator ( )

Default constructor for ParticleEnergyEvaluator class.

Member Function Documentation

◆ Clone()

Modifier * netdem::ParticleEnergyEvaluator::Clone ( ) const
overridevirtual

Clones the current ParticleEnergyEvaluator instance.

Returns
A pointer to the cloned ParticleEnergyEvaluator instance.

Reimplemented from netdem::Modifier.

◆ Execute() [1/2]

void netdem::ParticleEnergyEvaluator::Execute ( )
overridevirtual

Executes the ParticleEnergyEvaluator instance.

Calls Execute(particle_list) if use_particles_in_scene is true, otherwise calls Execute(particle_id_list).

Reimplemented from netdem::Modifier.

◆ Execute() [2/2]

VecXT< ParticleEnergy > netdem::ParticleEnergyEvaluator::Execute ( const VecXT< Particle * > & p_list,
Vec3d gravity_coef )
static

Executes the ParticleEnergyEvaluator instance for a given list of particles.

Parameters
p_listThe list of particles to evaluate energy for.
gravity_coefThe gravitational coefficient.
Returns
The list of particle energy.

◆ GetEnergy() [1/2]

ParticleEnergy netdem::ParticleEnergyEvaluator::GetEnergy ( )

Calculates the energy for all particles in the particle list.

Returns
A ParticleEnergy struct containing the total energy for all particles.

◆ GetEnergy() [2/2]

ParticleEnergy netdem::ParticleEnergyEvaluator::GetEnergy ( Particle *const p)

Calculates the energy for a specific particle.

Parameters
pPointer to the particle to calculate energy for.
Returns
A ParticleEnergy struct containing the energy for the specified particle.

◆ Update()

void netdem::ParticleEnergyEvaluator::Update ( )
overridevirtual

Updates the ParticleEnergyEvaluator instance.

Clears the particle_energy_list and recalculates energy for all particles in the particle list.

Reimplemented from netdem::Modifier.

Member Data Documentation

◆ particle_energy_list

VecXT<ParticleEnergy> netdem::ParticleEnergyEvaluator::particle_energy_list

The documentation for this class was generated from the following files: