The LogicHandler takes care of the containers s.t. More...
#include <LogicHandler.h>
Public Member Functions | |
LogicHandler (std::unordered_map< InteractionTypeOption::Value, std::unique_ptr< AutoTuner > > &autotuners, const LogicHandlerInfo &logicHandlerInfo, unsigned int rebuildFrequency, const std::string &outputSuffix) | |
Constructor of the LogicHandler. | |
autopas::ParticleContainerInterface< Particle_T > & | getContainer () |
Returns a non-const reference to the currently selected particle container. | |
std::vector< Particle_T > | collectLeavingParticlesFromBuffer (bool insertOwnedParticlesToContainer) |
Collects leaving particles from buffer and potentially inserts owned particles to the container. | |
std::vector< Particle_T > | updateContainer () |
Updates the container. | |
std::vector< Particle_T > | resizeBox (const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax) |
Pass values to the actual container. | |
void | reserve (size_t numParticles) |
Estimates number of halo particles via autopas::utils::NumParticlesEstimator::estimateNumHalosUniform() then calls LogicHandler::reserve(size_t numParticles, size_t numHaloParticles). | |
void | reserve (size_t numParticles, size_t numHaloParticles) |
Reserves space in the particle buffers and the container. | |
void | addParticle (const Particle_T &p) |
Adds a particle to the container. | |
void | addHaloParticle (const Particle_T &haloParticle) |
Adds a particle to the container that lies in the halo region of the container. | |
void | deleteAllParticles () |
Deletes all particles. | |
std::tuple< bool, bool > | deleteParticleFromBuffers (Particle_T &particle) |
Takes a particle, checks if it is in any of the particle buffers, and deletes it from them if found. | |
void | decreaseParticleCounter (Particle_T &particle) |
Decrease the correct internal particle counters. | |
template<class Functor > | |
bool | computeInteractionsPipeline (Functor *functor, const InteractionTypeOption &interactionType) |
This function covers the full pipeline of all mechanics happening during the computation of particle interactions. | |
template<class Iterator > | |
Iterator::ParticleVecType | gatherAdditionalVectors (IteratorBehavior behavior) |
Create the additional vectors vector for a given iterator behavior. | |
autopas::ContainerIterator< Particle_T, true, false > | begin (IteratorBehavior behavior) |
Iterate over all particles by using for(auto iter = autoPas.begin(); iter.isValid(); ++iter) | |
autopas::ContainerIterator< Particle_T, false, false > | begin (IteratorBehavior behavior) const |
Iterate over all particles by using for(auto iter = autoPas.begin(); iter.isValid(); ++iter) | |
autopas::ContainerIterator< Particle_T, true, true > | getRegionIterator (const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior) |
Iterate over all particles in a specified region. | |
autopas::ContainerIterator< Particle_T, false, true > | getRegionIterator (const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior) const |
Iterate over all particles in a specified region. | |
unsigned long | getNumberOfParticlesOwned () const |
Get the number of owned particles. | |
unsigned long | getNumberOfParticlesHalo () const |
Get the number of halo particles. | |
bool | checkTuningStates (const InteractionTypeOption &interactionType) |
Check if other autotuners for any other interaction types are still in a tuning phase. | |
template<class Functor > | |
std::tuple< std::optional< std::unique_ptr< TraversalInterface > >, bool > | isConfigurationApplicable (const Configuration &conf, Functor &functor, const InteractionTypeOption &interactionType) |
Checks if the given configuration can be used with the given functor and the current state of the simulation. | |
void | setParticleBuffers (const std::vector< FullParticleCell< Particle_T > > &particleBuffers, const std::vector< FullParticleCell< Particle_T > > &haloParticleBuffers) |
Directly exchange the internal particle and halo buffers with the given vectors and update particle counters. | |
std::tuple< const std::vector< FullParticleCell< Particle_T > > &, const std::vector< FullParticleCell< Particle_T > > & > | getParticleBuffers () const |
Getter for the particle buffers. | |
double | getMeanRebuildFrequency (bool considerOnlyLastNonTuningPhase=false) const |
Getter for the mean rebuild frequency. | |
bool | getNeighborListsInvalidDoDynamicRebuild () |
getter function for _neighborListInvalidDoDynamicRebuild | |
void | checkNeighborListsInvalidDoDynamicRebuild () |
Checks if any particle has moved more than skin/2. | |
void | resetNeighborListsInvalidDoDynamicRebuild () |
Checks if any particle has moved more than skin/2. | |
bool | neighborListsAreValid () |
Checks if in the next iteration the neighbor lists have to be rebuilt. | |
The LogicHandler takes care of the containers s.t.
they are all in the same valid state. This is mainly done by incorporating a global container rebuild frequency, which defines when containers and their neighbor lists will be rebuilt.
|
inline |
Constructor of the LogicHandler.
autotuners | Unordered map with interaction types and respective autotuner instances. |
logicHandlerInfo | |
rebuildFrequency | |
outputSuffix |
|
inline |
Adds a particle to the container that lies in the halo region of the container.
haloParticle | Particle to be added. |
|
inline |
Adds a particle to the container.
This is only allowed if the neighbor lists are not valid.
p | Reference to the particle to be added |
|
inline |
Iterate over all particles by using for(auto iter = autoPas.begin(); iter.isValid(); ++iter)
behavior | The behavior of the iterator. You can specify whether to iterate over owned particles, halo particles, or both. |
|
inline |
Iterate over all particles by using for(auto iter = autoPas.begin(); iter.isValid(); ++iter)
behavior | The behavior of the iterator. You can specify whether to iterate over owned particles, halo particles, or both. |
void autopas::LogicHandler< Particle_T >::checkNeighborListsInvalidDoDynamicRebuild |
Checks if any particle has moved more than skin/2.
updates bool: _neighborListInvalidDoDynamicRebuild
|
inline |
Check if other autotuners for any other interaction types are still in a tuning phase.
interactionType |
|
inline |
Collects leaving particles from buffer and potentially inserts owned particles to the container.
insertOwnedParticlesToContainer | Decides whether to insert owned particles to the container. |
bool autopas::LogicHandler< Particle_T >::computeInteractionsPipeline | ( | Functor * | functor, |
const InteractionTypeOption & | interactionType | ||
) |
This function covers the full pipeline of all mechanics happening during the computation of particle interactions.
This includes:
Functor |
functor | |
interactionType |
Selection of configuration (tuning if necessary)
Computing the particle interactions
Debug Output
Pass on measurements
|
inline |
Decrease the correct internal particle counters.
This function should always be called if individual particles are deleted.
particle | reference to particles that should be deleted |
|
inline |
Deletes all particles.
|
inline |
Takes a particle, checks if it is in any of the particle buffers, and deletes it from them if found.
particle | Particle to delete. If something was deleted this reference might point to a different particle or invalid memory. |
|
inline |
Create the additional vectors vector for a given iterator behavior.
Iterator |
behavior |
|
inline |
Returns a non-const reference to the currently selected particle container.
|
inline |
Getter for the mean rebuild frequency.
Helpful for determining the frequency for the dynamic containers This function is only used for dynamic containers currently but returns user defined rebuild frequency for static case for safety.
considerOnlyLastNonTuningPhase | Bool to determine if mean rebuild frequency is to be calculated over entire iterations or only during the last non-tuning phase. The mean rebuild frequency over the non-tuning phase is required by the autoTuner for weighting the rebuild and non-rebuild samples. |
bool autopas::LogicHandler< Particle_T >::getNeighborListsInvalidDoDynamicRebuild |
getter function for _neighborListInvalidDoDynamicRebuild
|
inline |
Get the number of halo particles.
|
inline |
Get the number of owned particles.
std::tuple< const std::vector< FullParticleCell< Particle_T > > &, const std::vector< FullParticleCell< Particle_T > > & > autopas::LogicHandler< Particle_T >::getParticleBuffers |
Getter for the particle buffers.
|
inline |
Iterate over all particles in a specified region.
lowerCorner | lower corner of the region |
higherCorner | higher corner of the region |
behavior | the behavior of the iterator. You can specify whether to iterate over owned particles, halo particles, or both. |
|
inline |
Iterate over all particles in a specified region.
lowerCorner | lower corner of the region |
higherCorner | higher corner of the region |
behavior | the behavior of the iterator. You can specify whether to iterate over owned particles, halo particles, or both. |
std::tuple< std::optional< std::unique_ptr< TraversalInterface > >, bool > autopas::LogicHandler< Particle_T >::isConfigurationApplicable | ( | const Configuration & | conf, |
Functor & | functor, | ||
const InteractionTypeOption & | interactionType | ||
) |
Checks if the given configuration can be used with the given functor and the current state of the simulation.
Functor |
conf | |
functor | |
interactionType |
bool autopas::LogicHandler< Particle_T >::neighborListsAreValid |
Checks if in the next iteration the neighbor lists have to be rebuilt.
This can be the case either because we hit the rebuild frequency or the dynamic rebuild criteria or because the auto tuner tests a new configuration.
|
inline |
Estimates number of halo particles via autopas::utils::NumParticlesEstimator::estimateNumHalosUniform() then calls LogicHandler::reserve(size_t numParticles, size_t numHaloParticles).
numParticles | Total number of owned particles. |
|
inline |
Reserves space in the particle buffers and the container.
numParticles | Total number of owned particles. |
numHaloParticles | Total number of halo particles. |
void autopas::LogicHandler< Particle_T >::resetNeighborListsInvalidDoDynamicRebuild |
Checks if any particle has moved more than skin/2.
resets bool: _neighborListInvalidDoDynamicRebuild to false
|
inline |
Pass values to the actual container.
boxMin | |
boxMax |
void autopas::LogicHandler< Particle_T >::setParticleBuffers | ( | const std::vector< FullParticleCell< Particle_T > > & | particleBuffers, |
const std::vector< FullParticleCell< Particle_T > > & | haloParticleBuffers | ||
) |
Directly exchange the internal particle and halo buffers with the given vectors and update particle counters.
particleBuffers | |
haloParticleBuffers |
|
inline |
Updates the container.
On an update, halo particles are deleted and particles that do no longer belong into the container will be removed and returned.