34 template<
typename >
class BUFFER_TYPE >
199 using ParentClass::operator[];
200 using ParentClass::operator();
246 template<
typename ITER >
247 INDEX_TYPE
insert( ITER
const first, ITER
const last )
254 this->
m_size += nInserted;
264 bool remove( T
const & value )
282 template<
typename ITER >
283 INDEX_TYPE
remove( ITER
const first, ITER
const last )
343 { this->
m_values.template setName< decltype( *this ) >( name ); }
375 INDEX_TYPE
const nToAdd )
const 405 template<
typename >
class BUFFER_TYPE >
406 constexpr
bool isSortedArray< SortedArray< T, INDEX_TYPE, BUFFER_TYPE > > =
true;
#define LVARRAY_UNUSED_VARIABLE(X)
Mark X as an unused variable, used to silence compiler warnings.
Definition: Macros.hpp:51
LVARRAY_HOST_DEVICE void resize(BUFFER &buf, std::ptrdiff_t const size, std::ptrdiff_t const newSize, ARGS &&... args)
Resize the buffer to the given size.
Definition: bufferManipulation.hpp:272
LVARRAY_HOST_DEVICE constexpr SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > toViewConst() const
Definition: SortedArrayView.hpp:150
SortedArrayView & operator=(SortedArrayView const &src)=default
Default copy assignment operator, this does a shallow copy.
void move(MemorySpace const space, bool touch=true) const
Moves the SortedArrayView to the given execution space.
Definition: SortedArrayView.hpp:273
BUFFER_TYPE< T > m_values
Holds the array of values.
Definition: SortedArrayView.hpp:295
SortedArray & operator=(SortedArray const &src)
Copy assignment operator, performs a deep copy.
Definition: SortedArray.hpp:101
INDEX_TYPE m_size
The number of values.
Definition: SortedArrayView.hpp:298
void move(MemorySpace const space, bool const touch=true) const
Moves the SortedArrayView to the given execution space.
Definition: SortedArray.hpp:333
void dynamicReserve(BUFFER &buf, std::ptrdiff_t const size, std::ptrdiff_t const newCapacity)
If the buffer's capacity is greater than newCapacity this is a no-op. Otherwise the buffer's capacity...
Definition: bufferManipulation.hpp:251
DISABLE_HD_WARNING LVARRAY_HOST_DEVICE bool 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.
Definition: sortedArrayManipulation.hpp:473
This class provides an interface similar to an std::set.
Definition: SortedArray.hpp:35
~SortedArray()
Destructor, frees the values array.
Definition: SortedArray.hpp:92
SortedArray()
Default constructor.
Definition: SortedArray.hpp:68
constexpr bool isSortedArray
True if the template type is a SortedArray.
Definition: SortedArray.hpp:395
LVARRAY_HOST_DEVICE constexpr SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > toView() const
Definition: SortedArrayView.hpp:142
bool insert(T const &value)
Insert the given value into the array if it doesn't already exist.
Definition: SortedArray.hpp:228
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE size() const
Definition: SortedArray.hpp:186
INDEX_TYPE size_type
The integer type used for indexing, here for stl compatability.
Definition: SortedArrayView.hpp:72
LVARRAY_HOST_DEVICE bool contains(T const &value) const
Definition: SortedArrayView.hpp:196
SortedArray(SortedArray const &src)
The copy constructor, performs a deep copy.
Definition: SortedArray.hpp:77
This class provides a no-op callbacks interface for the ArrayManipulation sorted routines.
Definition: sortedArrayManipulation.hpp:72
CallBacks(BUFFER_TYPE< T > &buffer, INDEX_TYPE const size)
Constructor.
Definition: SortedArray.hpp:361
LVARRAY_HOST_DEVICE bool count(T const &value) const
Definition: SortedArrayView.hpp:205
DISABLE_HD_WARNING LVARRAY_HOST_DEVICE void free(BUFFER &buf, std::ptrdiff_t const size)
Destroy the values in the buffer and free it's memory.
Definition: bufferManipulation.hpp:188
T value_type
The type of the values contained in the SortedArrayView, here for stl compatability.
Definition: SortedArrayView.hpp:69
LVARRAY_HOST_DEVICE constexpr T const * end() const
Definition: SortedArrayView.hpp:255
camp::resources::Platform MemorySpace
an alias for camp::resources::Platform.
Definition: bufferManipulation.hpp:31
INDEX_TYPE insert(ITER const first, ITER const last)
Insert the values in [ first, last ) into the array if they don't already exist.
Definition: SortedArray.hpp:247
LVARRAY_HOST_DEVICE constexpr T const * data() const
Definition: SortedArrayView.hpp:241
This class provides the callbacks for the sortedArrayManipulation sorted routines.
Definition: SortedArray.hpp:351
The top level namespace.
Definition: Array.hpp:24
LVARRAY_HOST_DEVICE void reserve(BUFFER &buf, std::ptrdiff_t const size, MemorySpace const space, std::ptrdiff_t const newCapacity)
Reserve space in the buffer for at least the given capacity.
Definition: bufferManipulation.hpp:230
SortedArray & operator=(SortedArray &&src)
Default move assignment operator, performs a shallow copy.
Definition: SortedArray.hpp:114
void setName(std::string const &name)
Set the name to be displayed whenever the underlying Buffer's user call back is called.
Definition: SortedArray.hpp:342
Contains the implementation of LvArray::SortedArrayView.
LVARRAY_HOST_DEVICE SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > toViewConst() const &
Definition: SortedArray.hpp:155
T * incrementSize(T *const curPtr, INDEX_TYPE const nToAdd) const
Callback signaling that the size of the array has increased.
Definition: SortedArray.hpp:374
LVARRAY_HOST_DEVICE constexpr ArraySlice< T const, 1, 0, INDEX_TYPE > toSlice() const &
Definition: SortedArrayView.hpp:157
void clear()
Remove all the values from the array.
Definition: SortedArray.hpp:305
INDEX_TYPE IndexType
The integer type used for indexing.
Definition: SortedArrayView.hpp:66
LVARRAY_HOST_DEVICE constexpr T const * data() const
Definition: SortedArray.hpp:209
T ValueType
The type of the values contained in the SortedArrayView.
Definition: SortedArrayView.hpp:63
DISABLE_HD_WARNING LVARRAY_HOST_DEVICE void copyInto(DST_BUFFER &dst, std::ptrdiff_t const dstSize, SRC_BUFFER const &src, std::ptrdiff_t const srcSize)
Copy values from the source buffer into the destination buffer.
Definition: bufferManipulation.hpp:393
void reserve(INDEX_TYPE const nVals)
Reserve space to store the given number of values without resizing.
Definition: SortedArray.hpp:316
LVARRAY_HOST_DEVICE constexpr T const * begin() const
Definition: SortedArrayView.hpp:248
LVARRAY_HOST_DEVICE constexpr bool empty() const
Definition: SortedArrayView.hpp:181
BUFFER_TYPE< T > & m_buffer
The buffer associated with the callback.
Definition: SortedArray.hpp:384
INDEX_TYPE const m_size
The number of values in the buffer.
Definition: SortedArray.hpp:387
LVARRAY_HOST_DEVICE SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > toView() const &
Definition: SortedArray.hpp:135
This class provides a view into a SortedArray.
Definition: SortedArrayView.hpp:58
DISABLE_HD_WARNING LVARRAY_HOST_DEVICE bool 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.
Definition: sortedArrayManipulation.hpp:620
#define LVARRAY_HOST_DEVICE
Mark a function for both host and device usage.
Definition: Macros.hpp:549
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE size() const
Definition: SortedArrayView.hpp:188