Go to the documentation of this file.
21 #ifndef __indexContainer_hpp__
22 #define __indexContainer_hpp__
38 template<
typename IndexType>
51 using HostType =
typename HostViewType::device_type;
59 template<
typename ViewType>
77 return view_.extent(0);
110 static_cast<IndexType>(rng.begin()),
111 static_cast<IndexType>(rng.end())
132 views_(
"indexContainer", numElems)
252 bool findMinMax =
false;
253 if(
views_.template need_sync<DeviceType>())
256 views_.clear_sync_state();
259 else if(
views_.template need_sync<HostType>())
262 views_.clear_sync_state();
IndexType max_
max value in the indices
auto indicesDevice() const
Return index accessor that works on Device.
IndexType min_
min value in indices
indexContainer(const DeviceViewType &ind)
indexContainer(IndexType *data, int32 numElems)
From data and number of elements in data.
indexContainer(const Range< T > &rng)
Construct from a Range (half open)
INLINE_FUNCTION_HD IndexType max() const
Max value of indices.
DVType views_
views to hold indices on Host and Device
INLINE_FUNCTION_H void copy(const ViewType1D< dType, dProperties... > &dst, const ViewType1D< sType, sProperties... > &src)
~indexContainer()=default
Destructor.
uint32 size_
number/size of index vector
DualViewType1D< IndexType > DVType
T max(const internalField< T, MemorySpace > &iField)
void syncViews()
synchronize views
void modifyOnHost()
Mark host is modified.
typename DVType::t_dev DeviceViewType
Device type on device.
indexContainer(IndexType begin, IndexType end)
Construct half open [begin,end)
typename DeviceViewType::device_type DeviceType
Device memory ype.
Kokkos::DualView< T *, properties... > DualViewType1D
1D dual view as a vector
typename HostViewType::device_type HostType
Host memory type.
indexContainer(std::vector< IndexType > &ind)
DeviceViewType & deviceView()
Return Device veiw.
indexContainer & operator=(const indexContainer &)=default
Copy assignment.
INLINE_FUNCTION_HD IndexType min() const
Min value of indices.
void syncViews(uint32 newSize)
TypeInfoTemplateNV11("indexContainer", IndexType)
HostViewType & hostView()
Return Host veiw.
const HostViewType & hostView() const
Return Host veiw.
IndexAccessor(ViewType v)
void modifyOnDevice()
Mark device is modified.
auto indicesHost() const
Return index accessor that works on Host.
INLINE_FUNCTION_HD bool empty() const
If the container empty.
T min(const internalField< T, MemorySpace > &iField)
Range for elements in an vector [start,end)
INLINE_FUNCTION_HD auto size() const
Size.
INLINE_FUNCTION_HD IndexType operator()(uint32 i) const
void fillSequence(internalField< T, MemorySpace > &iField, const T &startVal)
#define INLINE_FUNCTION_HD
Helper class for accessing index on host or device.
typename DVType::t_host HostViewType
Host type on device.
It holds two vectors of indecis on Host and Device.
const DeviceViewType & deviceView() const
Return Device view.