libMesh::Parallel::Utils Namespace Reference

Functions

template<typename KeyType >
bool is_sorted (const std::vector< KeyType > &v)
 
template<typename KeyType >
double to_double (const KeyType &k)
 
template<typename KeyType >
KeyType to_key_type (const double f)
 
template<>
double to_double (const Hilbert::HilbertIndices &bvt)
 
template<>
Hilbert::HilbertIndices to_key_type (const double f)
 

Function Documentation

template<typename KeyType >
bool libMesh::Parallel::Utils::is_sorted ( const std::vector< KeyType > &  v)
inline

Utility function that returns true if the vector v is sorted, false otherwise. O(N), the length of the vector. This is implemented solely because the std::is_sorted appears to be an STL extension.

Definition at line 50 of file parallel_conversion_utils.h.

Referenced by libMesh::Parallel::BinSorter< KeyType, IdxType >::BinSorter(), and libMesh::Parallel::Histogram< KeyType, IdxType >::Histogram().

51  {
52  if (v.empty())
53  return true;
54 
55  for (unsigned int i=1; i<v.size(); i++)
56  if (v[i] < v[i-1])
57  return false;
58 
59  return true;
60  }
template<typename KeyType >
double libMesh::Parallel::Utils::to_double ( const KeyType &  k)
inline

A utility function which converts whatever KeyType is to a double for the histogram bounds

Definition at line 68 of file parallel_conversion_utils.h.

Referenced by libMesh::Parallel::BinSorter< KeyType, IdxType >::binsort(), and libMesh::Parallel::Histogram< KeyType, IdxType >::make_histogram().

69  {
70  return static_cast<double>(k);
71  }
template<>
double libMesh::Parallel::Utils::to_double ( const Hilbert::HilbertIndices &  bvt)
inline

Definition at line 90 of file parallel_conversion_utils.h.

91  {
92  return static_cast<double>(bvt.rack2);
93  }
template<typename KeyType >
KeyType libMesh::Parallel::Utils::to_key_type ( const double  f)
inline

A utility to convert a double to some sort of KeyType, for interpreting how histogram bounds relate to KeyType positions.

Definition at line 81 of file parallel_conversion_utils.h.

82  {
83  return static_cast<KeyType>(f);
84  }
template<>
Hilbert::HilbertIndices libMesh::Parallel::Utils::to_key_type ( const double  f)
inline

Definition at line 98 of file parallel_conversion_utils.h.

99  {
100  Hilbert::HilbertIndices bvt;
101 
102  bvt.rack0 = 0;
103  bvt.rack1 = 0;
104  bvt.rack2 = static_cast<Hilbert::inttype>(f);
105 
106  return bvt;
107  }

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:33 UTC

Hosted By:
SourceForge.net Logo