GEOSX
Classes | Namespaces | Enumerations | Functions
sortedArrayManipulation.hpp File Reference

This file contains common sorted array manipulation routines. Aside from the functions that take a callback every function assumes that the array has a capacity large enough for the given operation. More...

#include "Macros.hpp"
#include "arrayManipulation.hpp"
#include "sortedArrayManipulationHelpers.hpp"
#include <cstdlib>
#include <algorithm>

Go to the source code of this file.

Classes

class  LvArray::sortedArrayManipulation::CallBacks< T >
 This class provides a no-op callbacks interface for the ArrayManipulation sorted routines. More...
 
class  LvArray::sortedArrayManipulation::less< T >
 This class operates as functor similar to std::less. More...
 
class  LvArray::sortedArrayManipulation::greater< T >
 This class operates as functor similar to std::greater. More...
 

Namespaces

 LvArray
 The top level namespace.
 
 LvArray::sortedArrayManipulation
 Contains functions for operating on a contiguous sorted unique array of values.
 

Enumerations

enum  LvArray::sortedArrayManipulation::Description { SORTED_UNIQUE, UNSORTED_NO_DUPLICATES, SORTED_WITH_DUPLICATES, UNSORTED_WITH_DUPLICATES }
 Describes an as some combination of sorted/unsorted and unique/with duplicates.
 

Functions

constexpr bool LvArray::sortedArrayManipulation::isSorted (Description const desc)
 
constexpr bool LvArray::sortedArrayManipulation::isUnique (Description const desc)
 
template<typename RandomAccessIterator , typename Compare = less< typename std::iterator_traits< RandomAccessIterator >::value_type >>
void LvArray::sortedArrayManipulation::makeSorted (RandomAccessIterator const first, RandomAccessIterator const last, Compare &&comp=Compare())
 Sort the given values in place using the given comparator. More...
 
template<typename RandomAccessIteratorA , typename RandomAccessIteratorB , typename Compare = less< typename std::iterator_traits< RandomAccessIteratorA >::value_type >>
void LvArray::sortedArrayManipulation::dualSort (RandomAccessIteratorA valueFirst, RandomAccessIteratorA valueLast, RandomAccessIteratorB dataFirst, Compare &&comp=Compare())
 Sort the given values in place using the given comparator and perform the same operations on the data array thus preserving the mapping between values[i] and data[i]. More...
 
template<typename ITER , typename Compare = less< typename std::iterator_traits< ITER >::value_type >>
bool LvArray::sortedArrayManipulation::isSorted (ITER first, ITER const last, Compare &&comp=Compare())
 
template<typename ITER , typename Compare = less< typename std::iterator_traits< ITER >::value_type >>
std::ptrdiff_t LvArray::sortedArrayManipulation::removeDuplicates (ITER first, ITER const last, Compare &&comp=Compare())
 Remove duplicates from the array, duplicates aren't destroyed but they're moved out of. More...
 
template<typename ITER , typename Compare = less< typename std::iterator_traits< ITER >::value_type >>
std::ptrdiff_t LvArray::sortedArrayManipulation::makeSortedUnique (ITER const first, ITER const last, Compare &&comp=Compare())
 Sort and remove duplicates from the array, duplicates aren't destroyed but they're moved out of. More...
 
template<typename ITER , typename Compare = less< typename std::iterator_traits< ITER >::value_type >>
bool LvArray::sortedArrayManipulation::isSortedUnique (ITER first, ITER const last, Compare &&comp=Compare())
 
template<typename T , typename Compare = less< T >>
std::ptrdiff_t LvArray::sortedArrayManipulation::find (T const *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, T const &value, Compare &&comp=Compare())
 
template<typename T , typename Compare = less< T >>
bool LvArray::sortedArrayManipulation::contains (T const *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, T const &value, Compare &&comp=Compare())
 
template<typename T , typename CALLBACKS >
bool LvArray::sortedArrayManipulation::remove (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, T const &value, CALLBACKS &&callBacks)
 Remove the given value from the array if it exists. More...
 
template<typename T , typename ITER , typename CALLBACKS = CallBacks< T >>
std::ptrdiff_t LvArray::sortedArrayManipulation::remove (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, ITER const first, ITER const last, CALLBACKS &&callBacks=CALLBACKS())
 Remove the given values from the array if they exist. More...
 
template<typename T , typename CALLBACKS = CallBacks< T >>
bool LvArray::sortedArrayManipulation::insert (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, T const &value, CALLBACKS &&callBacks=CALLBACKS())
 Insert the given value into the array if it doesn't already exist. More...
 
template<typename T , typename ITER , typename CALLBACKS = CallBacks< T >>
std::ptrdiff_t LvArray::sortedArrayManipulation::insert (T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, ITER const first, ITER const last, CALLBACKS &&callBacks=CALLBACKS())
 Insert the given values into the array if they don't already exist. More...
 

Detailed Description

This file contains common sorted array manipulation routines. Aside from the functions that take a callback every function assumes that the array has a capacity large enough for the given operation.

Definition in file sortedArrayManipulation.hpp.