Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::SimpleStat< T > Struct Template Reference

Public Member Functions

 SimpleStat ()
 
void add (T value)
 
double avg () const
 
double rms () const
 
double dev () const
 

Public Attributes

min
 
max
 
sum
 
sqr
 
size_t count
 

Detailed Description

template<typename T>
struct moab::SimpleStat< T >

Definition at line 2091 of file AdaptiveKDTree.cpp.

Constructor & Destructor Documentation

◆ SimpleStat()

template<typename T >
moab::SimpleStat< T >::SimpleStat

Definition at line 2114 of file AdaptiveKDTree.cpp.

2115  : min( std::numeric_limits< T >::max() ), max( std::numeric_limits< T >::min() ), sum( 0 ), sqr( 0 ), count( 0 )
2116 {
2117 }

Member Function Documentation

◆ add()

template<typename T >
void moab::SimpleStat< T >::add ( value)

Definition at line 2120 of file AdaptiveKDTree.cpp.

2121 {
2122  if( value < min ) min = value;
2123  if( value > max ) max = value;
2124  sum += value;
2125  sqr += value * value;
2126  ++count;
2127 }

References moab::sum().

Referenced by moab::AdaptiveKDTree::print().

◆ avg()

template<typename T >
double moab::SimpleStat< T >::avg ( ) const
inline

Definition at line 2097 of file AdaptiveKDTree.cpp.

2098  {
2099  return (double)sum / count;
2100  }

References moab::SimpleStat< T >::count, and moab::SimpleStat< T >::sum.

Referenced by moab::AdaptiveKDTree::print().

◆ dev()

template<typename T >
double moab::SimpleStat< T >::dev ( ) const
inline

Definition at line 2105 of file AdaptiveKDTree.cpp.

2106  {
2107  return ( count > 1
2108  ? sqrt( ( count * (double)sqr - (double)sum * (double)sum ) / ( (double)count * ( count - 1 ) ) )
2109  : 0.0 );
2110  }

References moab::SimpleStat< T >::count, moab::SimpleStat< T >::sqr, and moab::SimpleStat< T >::sum.

Referenced by moab::AdaptiveKDTree::print().

◆ rms()

template<typename T >
double moab::SimpleStat< T >::rms ( ) const
inline

Definition at line 2101 of file AdaptiveKDTree.cpp.

2102  {
2103  return sqrt( (double)sqr / count );
2104  }

References moab::SimpleStat< T >::count, and moab::SimpleStat< T >::sqr.

Referenced by moab::AdaptiveKDTree::print().

Member Data Documentation

◆ count

◆ max

template<typename T >
T moab::SimpleStat< T >::max

Definition at line 2093 of file AdaptiveKDTree.cpp.

Referenced by moab::AdaptiveKDTree::print().

◆ min

template<typename T >
T moab::SimpleStat< T >::min

Definition at line 2093 of file AdaptiveKDTree.cpp.

Referenced by moab::AdaptiveKDTree::print().

◆ sqr

template<typename T >
T moab::SimpleStat< T >::sqr

Definition at line 2093 of file AdaptiveKDTree.cpp.

Referenced by moab::SimpleStat< T >::dev(), and moab::SimpleStat< T >::rms().

◆ sum

template<typename T >
T moab::SimpleStat< T >::sum

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