89 typedef typename DeviceType::execution_space execution_space;
90 typedef typename DeviceType::memory_space memory_space;
91 typedef Kokkos::Device<execution_space, memory_space> device_type;
94 typedef typename hash_type::offset_type offset_type;
103 typedef typename Kokkos::View<
const offset_type*, Kokkos::LayoutLeft,
104 device_type> ptr_type;
111 typedef typename Kokkos::View<const Kokkos::pair<KeyType, ValueType>*,
112 Kokkos::LayoutLeft, device_type> val_type;
121 return contiguousValues_;
128 typedef Kokkos::View<const KeyType*, Kokkos::LayoutLeft, device_type>
keys_type;
235 const Teuchos::ArrayView<const ValueType>&
vals);
237 template<
class K,
class V,
class D>
245 template<
class InDeviceType>
247 typename std::enable_if<! std::is_same<DeviceType, InDeviceType>::value,
int>::type* =
NULL)
249 using Kokkos::ViewAllocateWithoutInitializing;
262 src.ptr_.extent (0));
265 src.val_.extent (0));
269 Kokkos::deep_copy (execution_space(),
val, src.val_);
273 this->minKey_ = src.minKey_;
274 this->maxKey_ = src.maxKey_;
275 this->minVal_ = src.minVal_;
276 this->maxVal_ = src.maxVal_;
277 this->firstContigKey_ = src.firstContigKey_;
278 this->lastContigKey_ = src.lastContigKey_;
279 this->contiguousValues_ = src.contiguousValues_;
280 this->checkedForDuplicateKeys_ = src.checkedForDuplicateKeys_;
281 this->hasDuplicateKeys_ = src.hasDuplicateKeys_;
286 const offset_type
size = this->getSize ();
290 return Tpetra::Details::OrdinalTraits<ValueType>::invalid ();
295 if (this->hasContiguousValues () &&
296 key >= firstContigKey_ &&
key <= lastContigKey_) {
300 const typename hash_type::result_type
hashVal =
301 hash_type::hashFunc (
key,
size);
303 const offset_type start = ptr_[
hashVal];
305 for (offset_type
k = start;
k <
end; ++
k) {
307 return val_[
k].second;
313 return Tpetra::Details::OrdinalTraits<ValueType>::invalid ();
325 if (this->hasContiguousValues ()) {
326 return val_.extent (0) +
static_cast<offset_type
> (lastContigKey_ - firstContigKey_);
329 return val_.extent (0);
405 const Teuchos::EVerbosityLevel
verbLevel=
406 Teuchos::Describable::verbLevel_default)
const;
420 KeyType minKey_ = ::Kokkos::Details::ArithTraits<KeyType>::max();
427 KeyType maxKey_ = ::Kokkos::Details::ArithTraits<KeyType>::is_integer ?
428 ::Kokkos::Details::ArithTraits<KeyType>::min() :
435 ValueType minVal_ = ::Kokkos::Details::ArithTraits<ValueType>::max();
441 ValueType maxVal_ = ::Kokkos::Details::ArithTraits<ValueType>::is_integer ?
442 ::Kokkos::Details::ArithTraits<ValueType>::min() :
451 KeyType firstContigKey_ = ::Kokkos::Details::ArithTraits<KeyType>::max();
459 KeyType lastContigKey_ = ::Kokkos::Details::ArithTraits<KeyType>::is_integer ?
460 ::Kokkos::Details::ArithTraits<KeyType>::min() :
469 bool contiguousValues_ =
true;
477 bool checkedForDuplicateKeys_ =
true;
482 bool hasDuplicateKeys_ =
false;
488 bool checkForDuplicateKeys ()
const;
492 return ptr_.extent (0) == 0 ?
493 static_cast<offset_type
> (0) :
497 typedef Kokkos::View<
const KeyType*,
498 typename ptr_type::HostMirror::array_layout,
499 typename ptr_type::HostMirror::execution_space,
500 Kokkos::MemoryUnmanaged> host_input_keys_type;
503 typename ptr_type::HostMirror::array_layout,
504 typename ptr_type::HostMirror::execution_space,
505 Kokkos::MemoryUnmanaged> host_input_vals_type;
529 init (
const host_input_keys_type&
keys,
530 const host_input_vals_type&
vals,
FixedHashTable(const FixedHashTable< KeyType, ValueType, InDeviceType > &src, typename std::enable_if<! std::is_same< DeviceType, InDeviceType >::value, int >::type *=NULL)
"Copy" constructor that takes a FixedHashTable with the same KeyType and ValueType,...