3 #include <spdlog/formatter.h>
8 const std::array<double, 3UL>& force,
double start_time,
double end_time)
9 :
TargettedForceSource(targetIndices), force(force), start_time(start_time), end_time(end_time) {}
12 if (curr_simulation_time < start_time || curr_simulation_time >
end_time) {
17 Particle& particle = particle_vector[index];
22 TargettedTemporaryConstantForce::operator std::string()
const {
23 return fmt::format(
"TargettedTemporaryConstantForce (start: {}, end: {}, force: [{}, {}, {}])", start_time, end_time, force[0],
Class to represent a particle.
void setF(const std::array< double, 3 > &f)
Sets the force of the particle.
const std::array< double, 3 > & getF() const
Gets the total force of the particle.
Interface for targetted force source classes.
std::vector< size_t > target_indices
Indices of the particles on which the force is applied.
const double end_time
End Time within the simulation until which the force is exerted.
TargettedTemporaryConstantForce(const std::vector< size_t > &targetIndices, const std::array< double, 3 > &force, double start_time, double end_time)
Construct a new Targetted Temporary Constant Force object.
void applyForce(std::vector< Particle > &particle_vector, double curr_simulation_time) const override
Applies the force directly to the particles with the specified indices within the vector.
const std::array< double, 3 > force
Force exerted on the particles.