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

00051       {
00052         if (v.empty())
00053           return true;
00054 
00055         for (unsigned int i=1; i<v.size(); i++)
00056           if (v[i] < v[i-1])
00057             return false;
00058 
00059         return true;
00060       }

template<>
double libMesh::Parallel::Utils::to_double ( const Hilbert::HilbertIndices &  bvt  )  [inline]

Definition at line 90 of file parallel_conversion_utils.h.

00091       {
00092         return static_cast<double>(bvt.rack2);
00093       }

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

00069       {
00070         return static_cast<double>(k);
00071       }

template<>
Hilbert::HilbertIndices libMesh::Parallel::Utils::to_key_type ( const double  f  )  [inline]

Definition at line 98 of file parallel_conversion_utils.h.

00099       {
00100         Hilbert::HilbertIndices bvt;
00101 
00102         bvt.rack0 = 0;
00103         bvt.rack1 = 0;
00104         bvt.rack2 = static_cast<Hilbert::inttype>(f);
00105 
00106         return bvt;
00107       }

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.

00082       {
00083         return static_cast<KeyType>(f);
00084       }


Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:45 UTC

Hosted By:
SourceForge.net Logo