ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
Utils::Histogram< T, N, M, U > Class Template Reference

Histogram in Cartesian coordinates. More...

#include <Histogram.hpp>

+ Inheritance diagram for Utils::Histogram< T, N, M, U >:
+ Collaboration diagram for Utils::Histogram< T, N, M, U >:

Public Member Functions

 Histogram (std::array< std::size_t, M > n_bins, std::array< std::pair< U, U >, M > limits)
 Histogram constructor.
 
virtual ~Histogram ()=default
 
std::array< std::size_t, M > get_n_bins () const
 Get the number of bins for each dimension.
 
std::vector< T > get_histogram () const
 Get the histogram data.
 
std::vector< std::size_t > get_tot_count () const
 Get the histogram count data.
 
std::array< std::pair< U, U >, M > get_limits () const
 Get the ranges (min, max) for each dimension.
 
std::array< U, M > get_bin_sizes () const
 Get the bin sizes.
 
void update (std::span< const U > pos)
 Add data to the histogram.
 
void update (std::span< const U > pos, std::span< const T > value)
 Add data to the histogram.
 
virtual void normalize ()
 Normalize histogram.
 

Protected Types

using array_index = typename array_type::index
 

Protected Attributes

std::array< std::size_t, M > m_n_bins
 Number of bins for each dimension.
 
std::array< std::pair< U, U >, M > m_limits
 Min and max values for each dimension.
 
std::array< U, M > m_bin_sizes
 Bin sizes for each dimension.
 
array_type m_array
 Histogram data.
 
count_type m_count
 Track the number of total hits per bin entry.
 
std::array< T, N > m_ones
 

Detailed Description

template<typename T, std::size_t N, std::size_t M = 3, typename U = double>
class Utils::Histogram< T, N, M, U >

Histogram in Cartesian coordinates.

Template Parameters
THistogram data type.
NHistogram data dimensionality.
MCoordinates data dimensionality.
UCoordinates data type.

Definition at line 46 of file Histogram.hpp.

Member Typedef Documentation

◆ array_index

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
using Utils::Histogram< T, N, M, U >::array_index = typename array_type::index
protected

Definition at line 51 of file Histogram.hpp.

Constructor & Destructor Documentation

◆ Histogram()

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
Utils::Histogram< T, N, M, U >::Histogram ( std::array< std::size_t, M >  n_bins,
std::array< std::pair< U, U >, M >  limits 
)
inline

Histogram constructor.

Parameters
n_binsthe number of bins in each histogram dimension.
limitsthe minimum/maximum data values to consider for the histogram.

Definition at line 60 of file Histogram.hpp.

References Utils::Histogram< T, N, M, U >::m_ones.

◆ ~Histogram()

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
virtual Utils::Histogram< T, N, M, U >::~Histogram ( )
virtualdefault

Member Function Documentation

◆ get_bin_sizes()

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
std::array< U, M > Utils::Histogram< T, N, M, U >::get_bin_sizes ( ) const
inline

Get the bin sizes.

Definition at line 87 of file Histogram.hpp.

References Utils::Histogram< T, N, M, U >::m_bin_sizes.

◆ get_histogram()

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
std::vector< T > Utils::Histogram< T, N, M, U >::get_histogram ( ) const
inline

◆ get_limits()

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
std::array< std::pair< U, U >, M > Utils::Histogram< T, N, M, U >::get_limits ( ) const
inline

Get the ranges (min, max) for each dimension.

Definition at line 84 of file Histogram.hpp.

References Utils::Histogram< T, N, M, U >::m_limits.

◆ get_n_bins()

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
std::array< std::size_t, M > Utils::Histogram< T, N, M, U >::get_n_bins ( ) const
inline

Get the number of bins for each dimension.

Definition at line 71 of file Histogram.hpp.

References Utils::Histogram< T, N, M, U >::m_n_bins.

◆ get_tot_count()

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
std::vector< std::size_t > Utils::Histogram< T, N, M, U >::get_tot_count ( ) const
inline

Get the histogram count data.

Definition at line 79 of file Histogram.hpp.

References Utils::Histogram< T, N, M, U >::m_count.

◆ normalize()

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
virtual void Utils::Histogram< T, N, M, U >::normalize ( )
inlinevirtual

◆ update() [1/2]

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
void Utils::Histogram< T, N, M, U >::update ( std::span< const U >  pos)
inline

◆ update() [2/2]

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
void Utils::Histogram< T, N, M, U >::update ( std::span< const U >  pos,
std::span< const T >  value 
)
inline

Add data to the histogram.

Parameters
posPosition to update.
valueValue to add.

Definition at line 100 of file Histogram.hpp.

References Utils::Histogram< T, N, M, U >::m_array, Utils::Histogram< T, N, M, U >::m_bin_sizes, Utils::Histogram< T, N, M, U >::m_count, and Utils::Histogram< T, N, M, U >::m_limits.

Member Data Documentation

◆ m_array

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
array_type Utils::Histogram< T, N, M, U >::m_array
protected

◆ m_bin_sizes

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
std::array<U, M> Utils::Histogram< T, N, M, U >::m_bin_sizes
protected

◆ m_count

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
count_type Utils::Histogram< T, N, M, U >::m_count
protected

Track the number of total hits per bin entry.

Definition at line 183 of file Histogram.hpp.

Referenced by Utils::Histogram< T, N, M, U >::get_tot_count(), and Utils::Histogram< T, N, M, U >::update().

◆ m_limits

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
std::array<std::pair<U, U>, M> Utils::Histogram< T, N, M, U >::m_limits
protected

◆ m_n_bins

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
std::array<std::size_t, M> Utils::Histogram< T, N, M, U >::m_n_bins
protected

Number of bins for each dimension.

Definition at line 175 of file Histogram.hpp.

Referenced by Utils::Histogram< T, N, M, U >::get_n_bins(), and Utils::CylindricalHistogram< T, N, M, U >::normalize().

◆ m_ones

template<typename T , std::size_t N, std::size_t M = 3, typename U = double>
std::array<T, N> Utils::Histogram< T, N, M, U >::m_ones
protected

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