AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
autopas::utils::ParticleBinStructure Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ParticleBinStructure() [1/2]

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.

Parameters
numBinsPerDimNumber of bins per dimension.
binLengthDimensions of each bin.
boxMinLower left corner of region considered for particle binning.
boxMaxUpper right corner of region considered for particle binning.
cutoffNot needed for particle counting, but needed for estimatedNumberOfNeighborInteractions statistic.

◆ ParticleBinStructure() [2/2]

autopas::utils::ParticleBinStructure::ParticleBinStructure ( size_t  numBinsPerDim,
std::array< double, 3 >  binLength,
std::array< double, 3 >  boxMin,
std::array< double, 3 >  boxMax,
double  cutoff 
)
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.

Parameters
numBinsPerDimNumber of bins per dimension
binLengthDimensions of each bin.
boxMinLower left corner of region considered for particle binning.
boxMaxUpper right corner of region considered for particle binning.
cutoffNot needed for particle counting, but needed for estimatedNumberOfNeighborInteractions statistic.

Member Function Documentation

◆ calculateStatistics()

void autopas::utils::ParticleBinStructure::calculateStatistics ( )

Calculates the following statistics:

  • Mean number of particles per bin
  • Standard deviation in number of particles per bin
  • Standard deviation in number of particles per bin relative to the mean.
  • Maximum number of particles per bin
  • Minimum number of particles per bin
  • Median number of particles per bin
  • Lower quartile number of particles per bin
  • Upper quartile number of particles per bin
  • Number of bins that are empty
  • Estimated number of neighbor interactions

◆ countParticle()

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.

Parameters
particlePosition

◆ getBinLength()

const std::array< double, 3 > & autopas::utils::ParticleBinStructure::getBinLength ( ) const

Getter for the dimensions of each bin.

Returns

◆ getBinLengthReciprocal()

const std::array< double, 3 > & autopas::utils::ParticleBinStructure::getBinLengthReciprocal ( ) const

Getter for the reciprocal of the dimensions of each bin.

Returns

◆ getBinVolume()

double autopas::utils::ParticleBinStructure::getBinVolume ( ) const

Getter for the volume of each bin.

Returns

◆ getBoxMax()

const std::array< double, 3 > & autopas::utils::ParticleBinStructure::getBoxMax ( ) const

Getter for the box max.

Returns

◆ getBoxMin()

const std::array< double, 3 > & autopas::utils::ParticleBinStructure::getBoxMin ( ) const

Getter for the box min.

Returns

◆ getEstimatedNumberOfNeighborInteractions()

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.

Returns
The estimated number of neighbor interactions.

◆ getLowerQuartileParticlesPerBin()

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.

Returns
The lower quartile of the number of particles per bin.

◆ getMaxDensity()

double autopas::utils::ParticleBinStructure::getMaxDensity ( ) const

Returns the maximum density of any bin.

Returns

◆ getMaxParticlesPerBin()

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.

Returns
The maximum number of particles in any bin.

◆ getMeanDensity()

double autopas::utils::ParticleBinStructure::getMeanDensity ( ) const

Returns the mean density of particles per bins.

Logs a warning if statistics have not been calculated yet.

Returns
The mean density of particles.

◆ getMeanParticlesPerBin()

double autopas::utils::ParticleBinStructure::getMeanParticlesPerBin ( ) const

Returns the mean number of particles per bins.

Logs a warning if statistics have not been calculated yet.

Returns
The mean number of particles per bin.

◆ getMedianParticlesPerBin()

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.

Returns
The median number of particles per bin.

◆ getMinParticlesPerBin()

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.

Returns
The minimum number of particles in any bin.

◆ getNumberOfBins()

std::size_t autopas::utils::ParticleBinStructure::getNumberOfBins ( ) const

Getter for the number of bins.

Returns

◆ getNumBinsPerDim()

const std::array< std::size_t, 3 > & autopas::utils::ParticleBinStructure::getNumBinsPerDim ( ) const

Getter for the number of bins per dimension.

Returns

◆ getNumEmptyBins()

size_t autopas::utils::ParticleBinStructure::getNumEmptyBins ( ) const

Returns the number of empty bins.

Logs a warning if statistics have not been calculated yet.

Returns
The empty bin ratio.

◆ getParticleCounts()

const std::vector< size_t > & autopas::utils::ParticleBinStructure::getParticleCounts ( ) const

Getter for the particle counts.

Returns

◆ getRelStdDevParticlesPerBin()

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.

Returns
The relative standard deviation of the number of particles per bin.

◆ getStdDevDensity()

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.

Returns
The standard deviation of densities.

◆ getStdDevParticlesPerBin()

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.

Returns
The standard deviation of the number of particles per bin.

◆ getTotalParticleCount()

const size_t & autopas::utils::ParticleBinStructure::getTotalParticleCount ( ) const

Getter for the total number of particles counted.

Returns

◆ getUpperQuartileParticlesPerBin()

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.

Returns
The upper quartile of the number of particles per bin.

◆ setBinLength()

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.

Parameters
binLength

◆ setBoxMax()

void autopas::utils::ParticleBinStructure::setBoxMax ( const std::array< double, 3 > &  boxMax)

Setter for the box max.

Parameters
boxMax

◆ setBoxMin()

void autopas::utils::ParticleBinStructure::setBoxMin ( const std::array< double, 3 > &  boxMin)

Setter for the box min.

Parameters
boxMin

◆ setCellsPerDim()

void autopas::utils::ParticleBinStructure::setCellsPerDim ( const std::array< std::size_t, 3 > &  numBinsPerDim)

Setter for the number of bins per dimension.

Parameters
numBinsPerDim

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