35 if (p.isLocked())
continue;
36 for (
auto& force : simple_force_sources) {
37 p.setF(p.getF() + force->calculateForce(p));
44 #pragma omp parallel for schedule(static)
47 std::array<double, 3> total_force{0, 0, 0};
50 if (it1 == it2)
continue;
51 if (it1->isLocked() && it2->isLocked())
continue;
52 for (
auto& force : force_sources) {
53 total_force = total_force + force->calculateForce(*it1, *it2);
56 it1->setF(it1->getF() + total_force);
61 double curr_simulation_time) {
62 for (
const auto& force_source : force_sources) {
63 force_source->applyForce(
particles, curr_simulation_time);
Particle & operator[](int i) override
Returns a particle.
std::size_t capacity() const
Returns the capacity of the container.
std::vector< Particle >::iterator begin() override
Returns an iterator to the first particle.
void applyTargettedForces(const std::vector< std::shared_ptr< TargettedForceSource >> &targetted_force_sources, double curr_simulation_time) override
Applies the given targetted force sources to the particles.
std::vector< Particle >::iterator end() override
Returns an end iterator for this container.
DirectSumContainer()=default
Default constructor.
void reserve(size_t n) override
Reserves memory for particles.
void applySimpleForces(const std::vector< std::shared_ptr< SimpleForceSource >> &simple_force_sources) override
Applies the given simple force sources to the particles.
std::vector< Particle > particles
Internal data structure for the particles.
void addParticle(const Particle &p) override
Adds a particle to the container.
void applyPairwiseForces(const std::vector< std::shared_ptr< PairwiseForceSource >> &pairwise_force_sources) override
Applies the given force sources to the particles.
void prepareForceCalculation() override
Prepares everything for the force calculations (must be called before applySimpleForces and applyPair...
std::size_t size() const override
Returns the amount of particles.
const std::vector< Particle > & getParticles() const override
Returns a vector of all particles in the container.
Class to represent a particle.