$extrastylesheet
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().

{
  if (v.empty())
    return true;

  for (unsigned int i=1; i<v.size(); i++)
    if (v[i] < v[i-1])
      return false;

  return true;
}
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().

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

Definition at line 90 of file parallel_conversion_utils.h.

{
  return static_cast<double>(bvt.rack2);
}
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.

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

Definition at line 98 of file parallel_conversion_utils.h.

{
  Hilbert::HilbertIndices bvt;

  bvt.rack0 = 0;
  bvt.rack1 = 0;
  bvt.rack2 = static_cast<Hilbert::inttype>(f);

  return bvt;
}