Particle-counting bin structure. More...
#include <ParticleBinStructure.h>
Public Member Functions | |
ParticleBinStructure (std::array< size_t, 3 > numBinsPerDim, std::array< double, 3 > binLength, std::array< double, 3 > boxMin, std::array< double, 3 > boxMax, double cutoff) | |
Constructor, that takes 3D array of the number of bins in each dimension and the dimensions of each bin, and resizes space in the particle count structure as well as setting other relevant statistics. | |
ParticleBinStructure (size_t numBinsPerDim, std::array< double, 3 > binLength, std::array< double, 3 > boxMin, std::array< double, 3 > boxMax, double cutoff) | |
Constructor, for if there are the same number of bins in each dimension. | |
void | countParticle (const std::array< double, 3 > &particlePosition) |
Determines the appropriate bin for the particle based on its position, and increments the corresponding bin counter to reflect one more particle in that bin. | |
void | calculateStatistics () |
Calculates the following statistics: | |
void | resetCounters () |
Resets all counters to zero. | |
const size_t & | getTotalParticleCount () const |
Getter for the total number of particles counted. | |
const std::vector< size_t > & | getParticleCounts () const |
Getter for the particle counts. | |
const std::array< std::size_t, 3 > & | getNumBinsPerDim () const |
Getter for the number of bins per dimension. | |
void | setCellsPerDim (const std::array< std::size_t, 3 > &numBinsPerDim) |
Setter for the number of bins per dimension. | |
const std::array< double, 3 > & | getBinLength () const |
Getter for the dimensions of each bin. | |
const std::array< double, 3 > & | getBinLengthReciprocal () const |
Getter for the reciprocal of the dimensions of each bin. | |
void | setBinLength (const std::array< double, 3 > &binLength) |
Setter for the dimension of each bin. | |
const std::array< double, 3 > & | getBoxMin () const |
Getter for the box min. | |
void | setBoxMin (const std::array< double, 3 > &boxMin) |
Setter for the box min. | |
const std::array< double, 3 > & | getBoxMax () const |
Getter for the box max. | |
void | setBoxMax (const std::array< double, 3 > &boxMax) |
Setter for the box max. | |
std::size_t | getNumberOfBins () const |
Getter for the number of bins. | |
void | resize () |
Resizes the particle count structure. | |
double | getBinVolume () const |
Getter for the volume of each bin. | |
double | getMeanParticlesPerBin () const |
Returns the mean number of particles per bins. | |
double | getStdDevParticlesPerBin () const |
Returns the standard deviation of the number of particles per bins. | |
double | getRelStdDevParticlesPerBin () const |
Returns the standard deviation of the number of particles per bins relative to the mean. | |
double | getMeanDensity () const |
Returns the mean density of particles per bins. | |
double | getStdDevDensity () const |
Returns the standard deviation of the density per bins. | |
double | getMaxDensity () const |
Returns the maximum density of any bin. | |
size_t | getMaxParticlesPerBin () const |
Returns the maximum number of particles in a single bin. | |
size_t | getMinParticlesPerBin () const |
Returns the minimum number of particles in a single bin. | |
size_t | getMedianParticlesPerBin () const |
Returns the median number of particles across all bins. | |
size_t | getLowerQuartileParticlesPerBin () const |
Returns the lower quartile (25th percentile) number of particles across all bins. | |
size_t | getUpperQuartileParticlesPerBin () const |
Returns the upper quartile (75th percentile) number of particles across all bins. | |
size_t | getNumEmptyBins () const |
Returns the number of empty bins. | |
double | getEstimatedNumberOfNeighborInteractions () const |
Returns the estimated number of neighbor interactions across all bins. | |
Particle-counting bin structure.
Stores all relevant information about the bins and a counter per bin. Provides a particle counting function and can return statistics based on the particle count. Assumes all bins are of the same shape.
Expected use order: 1) Constructed 2) Particles counted 3) Statistics calculated 4) Statistics can be extracted from getters
A flag ensures (4) cannot be done before (3) and that if particles are added to the count after (3), (3) must be called again before (4).
The purpose of this is to calculate all statistics together because it is rather trivial and efficient but provides getters for individual statistics in case some are not desired.
autopas::utils::ParticleBinStructure::ParticleBinStructure | ( | std::array< size_t, 3 > | numBinsPerDim, |
std::array< double, 3 > | binLength, | ||
std::array< double, 3 > | boxMin, | ||
std::array< double, 3 > | boxMax, | ||
double | cutoff | ||
) |
Constructor, that takes 3D array of the number of bins in each dimension and the dimensions of each bin, and resizes space in the particle count structure as well as setting other relevant statistics.
numBinsPerDim | Number of bins per dimension. |
binLength | Dimensions of each bin. |
boxMin | Lower left corner of region considered for particle binning. |
boxMax | Upper right corner of region considered for particle binning. |
cutoff | Not needed for particle counting, but needed for estimatedNumberOfNeighborInteractions statistic. |
|
inline |
Constructor, for if there are the same number of bins in each dimension.
Takes a number of bins and the dimensions of each bin, and resizes space in the particle count structure as well as setting other relevant statistics.
numBinsPerDim | Number of bins per dimension |
binLength | Dimensions of each bin. |
boxMin | Lower left corner of region considered for particle binning. |
boxMax | Upper right corner of region considered for particle binning. |
cutoff | Not needed for particle counting, but needed for estimatedNumberOfNeighborInteractions statistic. |
void autopas::utils::ParticleBinStructure::calculateStatistics | ( | ) |
Calculates the following statistics:
void autopas::utils::ParticleBinStructure::countParticle | ( | const std::array< double, 3 > & | particlePosition | ) |
Determines the appropriate bin for the particle based on its position, and increments the corresponding bin counter to reflect one more particle in that bin.
particlePosition |
const std::array< double, 3 > & autopas::utils::ParticleBinStructure::getBinLength | ( | ) | const |
Getter for the dimensions of each bin.
const std::array< double, 3 > & autopas::utils::ParticleBinStructure::getBinLengthReciprocal | ( | ) | const |
Getter for the reciprocal of the dimensions of each bin.
double autopas::utils::ParticleBinStructure::getBinVolume | ( | ) | const |
Getter for the volume of each bin.
const std::array< double, 3 > & autopas::utils::ParticleBinStructure::getBoxMax | ( | ) | const |
Getter for the box max.
const std::array< double, 3 > & autopas::utils::ParticleBinStructure::getBoxMin | ( | ) | const |
Getter for the box min.
double autopas::utils::ParticleBinStructure::getEstimatedNumberOfNeighborInteractions | ( | ) | const |
Returns the estimated number of neighbor interactions across all bins.
This takes the assumption that particles are evenly distributed within a bin and that this even distribution extends into neighboring bins and that newton3 isn't used. Logs a warning if statistics have not been calculated yet.
size_t autopas::utils::ParticleBinStructure::getLowerQuartileParticlesPerBin | ( | ) | const |
Returns the lower quartile (25th percentile) number of particles across all bins.
Logs a warning if statistics have not been calculated yet.
double autopas::utils::ParticleBinStructure::getMaxDensity | ( | ) | const |
Returns the maximum density of any bin.
size_t autopas::utils::ParticleBinStructure::getMaxParticlesPerBin | ( | ) | const |
Returns the maximum number of particles in a single bin.
Logs a warning if statistics have not been calculated yet.
double autopas::utils::ParticleBinStructure::getMeanDensity | ( | ) | const |
Returns the mean density of particles per bins.
Logs a warning if statistics have not been calculated yet.
double autopas::utils::ParticleBinStructure::getMeanParticlesPerBin | ( | ) | const |
Returns the mean number of particles per bins.
Logs a warning if statistics have not been calculated yet.
size_t autopas::utils::ParticleBinStructure::getMedianParticlesPerBin | ( | ) | const |
Returns the median number of particles across all bins.
Logs a warning if statistics have not been calculated yet.
size_t autopas::utils::ParticleBinStructure::getMinParticlesPerBin | ( | ) | const |
Returns the minimum number of particles in a single bin.
Logs a warning if statistics have not been calculated yet.
std::size_t autopas::utils::ParticleBinStructure::getNumberOfBins | ( | ) | const |
Getter for the number of bins.
const std::array< std::size_t, 3 > & autopas::utils::ParticleBinStructure::getNumBinsPerDim | ( | ) | const |
Getter for the number of bins per dimension.
size_t autopas::utils::ParticleBinStructure::getNumEmptyBins | ( | ) | const |
Returns the number of empty bins.
Logs a warning if statistics have not been calculated yet.
const std::vector< size_t > & autopas::utils::ParticleBinStructure::getParticleCounts | ( | ) | const |
Getter for the particle counts.
double autopas::utils::ParticleBinStructure::getRelStdDevParticlesPerBin | ( | ) | const |
Returns the standard deviation of the number of particles per bins relative to the mean.
Logs a warning if statistics have not been calculated yet.
double autopas::utils::ParticleBinStructure::getStdDevDensity | ( | ) | const |
Returns the standard deviation of the density per bins.
Logs a warning if statistics have not been calculated yet.
double autopas::utils::ParticleBinStructure::getStdDevParticlesPerBin | ( | ) | const |
Returns the standard deviation of the number of particles per bins.
Logs a warning if statistics have not been calculated yet.
const size_t & autopas::utils::ParticleBinStructure::getTotalParticleCount | ( | ) | const |
Getter for the total number of particles counted.
size_t autopas::utils::ParticleBinStructure::getUpperQuartileParticlesPerBin | ( | ) | const |
Returns the upper quartile (75th percentile) number of particles across all bins.
Logs a warning if statistics have not been calculated yet.
void autopas::utils::ParticleBinStructure::setBinLength | ( | const std::array< double, 3 > & | binLength | ) |
Setter for the dimension of each bin.
Also sets the reciprocal of these lengths.
binLength |
void autopas::utils::ParticleBinStructure::setBoxMax | ( | const std::array< double, 3 > & | boxMax | ) |
Setter for the box max.
boxMax |
void autopas::utils::ParticleBinStructure::setBoxMin | ( | const std::array< double, 3 > & | boxMin | ) |
Setter for the box min.
boxMin |
void autopas::utils::ParticleBinStructure::setCellsPerDim | ( | const std::array< std::size_t, 3 > & | numBinsPerDim | ) |
Setter for the number of bins per dimension.
numBinsPerDim |