RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
IndexSet.hpp
Go to the documentation of this file.
1 
11 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
12 // Copyright (c) Lawrence Livermore National Security, LLC and other
13 // RAJA Project Developers. See top-level LICENSE and COPYRIGHT
14 // files for dates and other details. No copyright assignment is required
15 // to contribute to RAJA.
16 //
17 // SPDX-License-Identifier: (BSD-3-Clause)
18 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
19 
20 #ifndef RAJA_IndexSet_HPP
21 #define RAJA_IndexSet_HPP
22 
23 #include "RAJA/config.hpp"
24 
27 
30 
32 
33 #include "RAJA/util/Operators.hpp"
34 #include "RAJA/util/concepts.hpp"
35 
36 namespace RAJA
37 {
38 
39 enum PushEnd
40 {
42  PUSH_BACK
43 };
44 
46 {
49 };
50 
51 template<typename... TALL>
53 
54 namespace policy
55 {
56 namespace indexset
57 {
58 
66 template<typename SEG_ITER_POLICY_T, typename SEG_EXEC_POLICY_T = void>
67 struct ExecPolicy
68  : public RAJA::make_policy_pattern_t<SEG_EXEC_POLICY_T::policy,
69  RAJA::Pattern::forall>
70 {
71  using seg_it = SEG_ITER_POLICY_T;
72  using seg_exec = SEG_EXEC_POLICY_T;
73 };
74 
75 } // end namespace indexset
76 } // end namespace policy
77 
79 
88 template<typename T0, typename... TREST>
89 class TypedIndexSet<T0, TREST...> : public TypedIndexSet<TREST...>
90 {
91  using PARENT = TypedIndexSet<TREST...>;
92  static const int T0_TypeId = sizeof...(TREST);
93 
94 public:
95  // Adopt the value type of the first segment type
96  using value_type = typename T0::value_type;
97 
98  // Ensure that all value types in all segments are the same
99  static_assert(std::is_same<value_type, typename PARENT::value_type>::value ||
100  T0_TypeId == 0,
101  "All segments must have the same value_type");
102 
104 #if _MSC_VER < 1910
105  // this one instance of constexpr does not work on VS2012 or VS2015
106  RAJA_INLINE TypedIndexSet() : PARENT() {}
107 #else
108  RAJA_INLINE constexpr TypedIndexSet() : PARENT() {}
109 #endif
110 
112  RAJA_INLINE
114  {
115  size_t num = c.data.size();
116  data.resize(num);
117  for (size_t i = 0; i < num; ++i)
118  {
119  data[i] = c.data[i];
120  }
121  // mark all as not owned by us
122  owner.resize(num, 0);
123  }
124 
127  {
128  if (&rhs != this)
129  {
130  TypedIndexSet<T0, TREST...> copy(rhs);
131  this->swap(copy);
132  }
133  return *this;
134  }
135 
137  RAJA_INLINE ~TypedIndexSet()
138  {
139  size_t num_seg = data.size();
140  for (size_t i = 0; i < num_seg; ++i)
141  {
142  // Only free segment of we allocated it
143  if (owner[i])
144  {
145  delete data[i];
146  }
147  }
148  }
149 
152  {
153  // Swap parents data
154  PARENT::swap((PARENT&)other);
155  // Swap our data
156  using std::swap;
157  swap(data, other.data);
158  swap(owner, other.owner);
159  }
160 
166  template<typename P0, typename... PREST>
167  RAJA_INLINE bool compareSegmentById(
168  size_t segid,
169  const TypedIndexSet<P0, PREST...>& other) const
170  {
171  // drill down our types until we have the right type
172  if (getSegmentTypes()[segid] != T0_TypeId)
173  {
174  // peel off T0
175  return PARENT::compareSegmentById(segid, other);
176  }
177 
178  // Check that other's segid is of type T0
179  if (!other.template checkSegmentType<T0>(segid))
180  {
181  return false;
182  }
183 
184  // Compare to others segid
185  Index_type offset = getSegmentOffsets()[segid];
186  return *data[offset] == other.template getSegment<T0>(segid);
187  }
188 
189  template<typename P0>
190  RAJA_INLINE bool checkSegmentType(size_t segid) const
191  {
192  if (getSegmentTypes()[segid] == T0_TypeId)
193  {
194  return std::is_same<T0, P0>::value;
195  }
196  return PARENT::template checkSegmentType<P0>(segid);
197  }
198 
200  template<typename P0>
201  RAJA_INLINE P0& getSegment(size_t segid)
202  {
203  if (getSegmentTypes()[segid] == T0_TypeId)
204  {
205  Index_type offset = getSegmentOffsets()[segid];
206  return *reinterpret_cast<P0 const*>(data[offset]);
207  }
208  return PARENT::template getSegment<P0>(segid);
209  }
210 
212  template<typename P0>
213  RAJA_INLINE P0 const& getSegment(size_t segid) const
214  {
215  if (getSegmentTypes()[segid] == T0_TypeId)
216  {
217  Index_type offset = getSegmentOffsets()[segid];
218  return *reinterpret_cast<P0 const*>(data[offset]);
219  }
220  return PARENT::template getSegment<P0>(segid);
221  }
222 
224  RAJA_INLINE
225  constexpr size_t getNumTypes() const { return 1 + PARENT::getNumTypes(); }
226 
227  /*
228  * IMPORTANT: Some methods to add a segment to an index set
229  * make a copy of the segment object passed in. Others do not.
230  *
231  * The no-copy method names indicate the choice.
232  * The copy/no-copy methods are further distinguished
233  * by taking a const reference (copy) or non-const
234  * pointer (no-copy).
235  *
236  * Each method returns true if segment is added successfully;
237  * false otherwise.
238  */
239 
248 
249 private:
250  template<typename... CALL>
251  RAJA_INLINE void push_into(TypedIndexSet<CALL...>& c,
252  PushEnd pend = PUSH_BACK,
253  PushCopy pcopy = PUSH_COPY)
254  {
255  Index_type num = getNumSegments();
256 
257  if (pend == PUSH_BACK)
258  {
259  for (Index_type i = 0; i < num; ++i)
260  {
261  segment_push_into(i, c, pend, pcopy);
262  }
263  }
264  else
265  {
266  for (Index_type i = num - 1; i > -1; --i)
267  {
268  segment_push_into(i, c, pend, pcopy);
269  }
270  }
271  }
272 
273  static constexpr int value_for(PushEnd end, PushCopy copy)
274  {
275  return (end == PUSH_BACK) << 1 | (copy == PUSH_COPY);
276  }
277 
278 public:
279  template<typename... CALL>
280  RAJA_INLINE void segment_push_into(size_t segid,
282  PushEnd pend = PUSH_BACK,
283  PushCopy pcopy = PUSH_COPY)
284  {
285  if (getSegmentTypes()[segid] != T0_TypeId)
286  {
287  PARENT::segment_push_into(segid, c, pend, pcopy);
288  return;
289  }
290  Index_type offset = getSegmentOffsets()[segid];
291  switch (value_for(pend, pcopy))
292  {
293  case value_for(PUSH_BACK, PUSH_COPY):
294  c.push_back(*data[offset]);
295  break;
296  case value_for(PUSH_BACK, PUSH_NOCOPY):
297  c.push_back_nocopy(data[offset]);
298  break;
299  case value_for(PUSH_FRONT, PUSH_COPY):
300  c.push_front(*data[offset]);
301  break;
302  case value_for(PUSH_FRONT, PUSH_NOCOPY):
303  c.push_front_nocopy(data[offset]);
304  break;
305  }
306  }
307 
309  template<typename Tnew>
310  RAJA_INLINE void push_back_nocopy(Tnew* val)
311  {
312  push_internal(val, PUSH_BACK, PUSH_NOCOPY);
313  }
314 
316  template<typename Tnew>
317  RAJA_INLINE void push_front_nocopy(Tnew* val)
318  {
319  push_internal(val, PUSH_FRONT, PUSH_NOCOPY);
320  }
321 
323  template<typename Tnew>
324  RAJA_INLINE void push_back(Tnew&& val)
325  {
326  push_internal(new typename std::decay<Tnew>::type(std::forward<Tnew>(val)),
328  }
329 
331  template<typename Tnew>
332  RAJA_INLINE void push_front(Tnew&& val)
333  {
334  push_internal(new typename std::decay<Tnew>::type(std::forward<Tnew>(val)),
336  }
337 
339  RAJA_INLINE size_t getLength() const
340  {
341  size_t total = PARENT::getLength();
342  size_t num = data.size();
343  for (size_t i = 0; i < num; ++i)
344  {
345  total += data[i]->size();
346  }
347  return total;
348  }
349 
351  RAJA_INLINE constexpr size_t getNumSegments() const
352  {
353  return data.size() + PARENT::getNumSegments();
354  }
355 
365  template<typename BODY, typename... ARGS>
366  RAJA_HOST_DEVICE void segmentCall(size_t segid,
367  BODY&& body,
368  ARGS&&... args) const
369  {
370  if (getSegmentTypes()[segid] != T0_TypeId)
371  {
372  PARENT::segmentCall(segid, std::forward<BODY>(body),
373  std::forward<ARGS>(args)...);
374  return;
375  }
376  Index_type offset = getSegmentOffsets()[segid];
377  body(*data[offset], std::forward<ARGS>(args)...);
378  }
379 
380 protected:
382  template<typename Tnew>
383  RAJA_INLINE void push_internal(Tnew* val,
384  PushEnd pend = PUSH_BACK,
385  PushCopy pcopy = PUSH_COPY)
386  {
387  static_assert(sizeof...(TREST) > 0, "Invalid type for this TypedIndexSet");
388  PARENT::push_internal(val, pend, pcopy);
389  }
390 
392  RAJA_INLINE void push_internal(T0* val,
393  PushEnd pend = PUSH_BACK,
394  PushCopy pcopy = PUSH_COPY)
395  {
396  data.push_back(val);
397  owner.push_back(pcopy == PUSH_COPY);
398 
399  // Determine if we push at the front or back of the segment list
400  if (pend == PUSH_BACK)
401  {
402  // Store the segment type
403  getSegmentTypes().push_back(T0_TypeId);
404 
405  // Store the segment offset in data[]
406  getSegmentOffsets().push_back(data.size() - 1);
407 
408  // Store the segment icount
409  size_t icount = val->size();
410  getSegmentIcounts().push_back(getTotalLength());
411  increaseTotalLength(icount);
412  }
413  else
414  {
415  // Store the segment type
416  getSegmentTypes().push_front(T0_TypeId);
417 
418  // Store the segment offset in data[]
419  getSegmentOffsets().push_front(data.size() - 1);
420 
421  // Store the segment icount
422  getSegmentIcounts().push_front(0);
423  size_t icount = val->size();
424  for (size_t i = 1; i < getSegmentIcounts().size(); ++i)
425  {
426  getSegmentIcounts()[i] += icount;
427  }
428  increaseTotalLength(icount);
429  }
430  }
431 
433  RAJA_INLINE Index_type& getTotalLength() { return PARENT::getTotalLength(); }
434 
436  RAJA_INLINE void setTotalLength(int n) { return PARENT::setTotalLength(n); }
437 
439  RAJA_INLINE void increaseTotalLength(int n)
440  {
441  return PARENT::increaseTotalLength(n);
442  }
443 
444 public:
446 
448  iterator end() const { return iterator(getNumSegments()); }
449 
451  iterator begin() const { return iterator(0); }
452 
454  Index_type size() const { return getNumSegments(); }
455 
464  TypedIndexSet<T0, TREST...> createSlice(int begin, int end)
465  {
466  TypedIndexSet<T0, TREST...> retVal;
467 
468  int minSeg = RAJA::operators::maximum<int> {}(0, begin);
469  int maxSeg = RAJA::operators::minimum<int> {}(end, getNumSegments());
470  for (int i = minSeg; i < maxSeg; ++i)
471  {
472  segment_push_into(i, retVal, PUSH_BACK, PUSH_NOCOPY);
473  }
474  return retVal;
475  }
476 
484  TypedIndexSet<T0, TREST...> createSlice(const int* segIds, int len)
485  {
486  TypedIndexSet<T0, TREST...> retVal;
487 
488  int numSeg = getNumSegments();
489  for (int i = 0; i < len; ++i)
490  {
491  if (segIds[i] >= 0 && segIds[i] < numSeg)
492  {
493  segment_push_into(segIds[i], retVal, PUSH_BACK, PUSH_NOCOPY);
494  }
495  }
496  return retVal;
497  }
498 
509  template<typename T>
510  TypedIndexSet<T0, TREST...> createSlice(const T& segIds)
511  {
512  TypedIndexSet<T0, TREST...> retVal;
513  int numSeg = getNumSegments();
514  for (auto& seg : segIds)
515  {
516  if (seg >= 0 && seg < numSeg)
517  {
518  segment_push_into(seg, retVal, PUSH_BACK, PUSH_NOCOPY);
519  }
520  }
521  return retVal;
522  }
523 
525  void setSegmentInterval(size_t interval_id, int begin, int end)
526  {
527  m_seg_interval_begin[interval_id] = begin;
528  m_seg_interval_end[interval_id] = end;
529  }
530 
532  int getSegmentIntervalBegin(size_t interval_id) const
533  {
534  return m_seg_interval_begin[interval_id];
535  }
536 
538  int getSegmentIntervalEnd(size_t interval_id) const
539  {
540  return m_seg_interval_end[interval_id];
541  }
542 
543 protected:
546  {
547  return PARENT::getSegmentTypes();
548  }
549 
551  RAJA_INLINE RAJA::RAJAVec<Index_type> const& getSegmentTypes() const
552  {
553  return PARENT::getSegmentTypes();
554  }
555 
558  {
559  return PARENT::getSegmentOffsets();
560  }
561 
563  RAJA_INLINE RAJA::RAJAVec<Index_type> const& getSegmentOffsets() const
564  {
565  return PARENT::getSegmentOffsets();
566  }
567 
570  {
571  return PARENT::getSegmentIcounts();
572  }
573 
575  RAJA_INLINE RAJA::RAJAVec<Index_type> const& getSegmentIcounts() const
576  {
577  return PARENT::getSegmentIcounts();
578  }
579 
580 public:
587  template<typename P0, typename... PREST>
588  RAJA_INLINE bool operator==(const TypedIndexSet<P0, PREST...>& other) const
589  {
590  size_t num_seg = getNumSegments();
591  if (num_seg != other.getNumSegments()) return false;
592 
593  for (size_t segid = 0; segid < num_seg; ++segid)
594  {
595  if (!compareSegmentById(segid, other))
596  {
597  return false;
598  }
599  }
600  return true;
601  }
602 
604  template<typename P0, typename... PREST>
605  RAJA_INLINE bool operator!=(const TypedIndexSet<P0, PREST...>& other) const
606  {
607  return (!(*this == other));
608  }
609 
610 private:
612  RAJA::RAJAVec<T0*> data;
613 
616 
618  RAJA::RAJAVec<Index_type> m_seg_interval_begin;
619 
621  RAJA::RAJAVec<Index_type> m_seg_interval_end;
622 };
623 
624 template<>
626 {
627 public:
628  // termination case, just to make static_assert work
630 
632  RAJA_INLINE TypedIndexSet() : m_len(0) {}
633 
635  RAJA_INLINE
637 
639  RAJA_INLINE
641  {
642  segment_types = c.segment_types;
643  segment_offsets = c.segment_offsets;
644  segment_icounts = c.segment_icounts;
645  m_len = c.m_len;
646  }
647 
649  void swap(TypedIndexSet& other)
650  {
651  using std::swap;
652  swap(segment_types, other.segment_types);
653  swap(segment_offsets, other.segment_offsets);
654  swap(segment_icounts, other.segment_icounts);
655  swap(m_len, other.m_len);
656  }
657 
658 protected:
659  RAJA_INLINE static size_t getNumTypes() { return 0; }
660 
661  template<typename T>
662  RAJA_INLINE constexpr bool isValidSegmentType(T const&) const
663  {
664  // Segment type wasn't found
665  return false;
666  }
667 
668  RAJA_INLINE static int getNumSegments() { return 0; }
669 
670  RAJA_INLINE static size_t getLength() { return 0; }
671 
672  template<typename BODY, typename... ARGS>
673  RAJA_INLINE void segmentCall(size_t, BODY, ARGS...) const
674  {}
675 
677  {
678  return segment_types;
679  }
680 
681  RAJA_INLINE RAJA::RAJAVec<Index_type> const& getSegmentTypes() const
682  {
683  return segment_types;
684  }
685 
687  {
688  return segment_offsets;
689  }
690 
691  RAJA_INLINE RAJA::RAJAVec<Index_type> const& getSegmentOffsets() const
692  {
693  return segment_offsets;
694  }
695 
697  {
698  return segment_icounts;
699  }
700 
701  RAJA_INLINE RAJA::RAJAVec<Index_type> const& getSegmentIcounts() const
702  {
703  return segment_icounts;
704  }
705 
706  RAJA_INLINE Index_type& getTotalLength() { return m_len; }
707 
708  RAJA_INLINE void setTotalLength(int n) { m_len = n; }
709 
710  RAJA_INLINE void increaseTotalLength(int n) { m_len += n; }
711 
712  template<typename P0, typename... PREST>
713  RAJA_INLINE bool compareSegmentById(size_t,
714  const TypedIndexSet<P0, PREST...>&) const
715  {
716  return false;
717  }
718 
719  template<typename P0>
720  RAJA_INLINE bool checkSegmentType(size_t) const
721  {
722  return false;
723  }
724 
725  template<typename P0>
726  RAJA_INLINE P0& getSegment(size_t)
727  {
728  return *((P0*)(this - this));
729  }
730 
731  template<typename P0>
732  RAJA_INLINE P0 const& getSegment(size_t) const
733  {
734  return *((P0*)(this - this));
735  }
736 
737  template<typename... CALL>
739  {}
740 
741  template<typename... CALL>
742  RAJA_INLINE void segment_push_into(size_t,
744  PushEnd,
745  PushCopy) const
746  {}
747 
748  template<typename Tnew>
749  RAJA_INLINE void push(Tnew const&, PushEnd, PushCopy)
750  {}
751 
752 public:
754 
755  RAJA_INLINE int getStartingIcount(int segid)
756  {
757  return segment_icounts[segid];
758  }
759 
760  RAJA_INLINE int getStartingIcount(int segid) const
761  {
762  return segment_icounts[segid];
763  }
764 
766  iterator end() const { return iterator(getNumSegments()); }
767 
769  iterator begin() const { return iterator(0); }
770 
772  Index_type size() const { return getNumSegments(); }
773 
774 private:
776  RAJA::RAJAVec<Index_type> segment_types;
777 
780  RAJA::RAJAVec<Index_type> segment_offsets;
781 
783  RAJA::RAJAVec<Index_type> segment_icounts;
784 
786  Index_type m_len;
787 };
788 
789 namespace type_traits
790 {
791 
792 template<typename T>
794  : ::RAJA::type_traits::SpecializationOf<RAJA::TypedIndexSet,
795  typename std::decay<T>::type>
796 {};
797 
798 template<typename T>
800  : ::RAJA::type_traits::SpecializationOf<RAJA::ExecPolicy,
801  typename std::decay<T>::type>
802 {};
803 } // namespace type_traits
804 
805 } // namespace RAJA
806 
807 #endif // closing endif for header file include guard
Header file for RAJA iterator constructs.
Header file containing definition of RAJA list segment class.
Header file for RAJA operator definitions.
Header file for basic RAJA policy mechanics.
RAJA header file for simple vector template class that enables RAJA to be used with or without the C+...
Header file containing definitions of RAJA range segment classes.
Definition: Iterators.hpp:114
RAJA_INLINE void resize(size_type new_size)
Definition: RAJAVec.hpp:232
size_type size() const
Definition: RAJAVec.hpp:199
Class representing an index set which is a collection of segment objects.
Definition: IndexSet.hpp:90
iterator end() const
Get an iterator to the end.
Definition: IndexSet.hpp:448
RAJA_INLINE size_t getLength() const
Return total length – sum of lengths of all segments.
Definition: IndexSet.hpp:339
RAJA_INLINE bool operator!=(const TypedIndexSet< P0, PREST... > &other) const
Inequality operator returns true if any segment is not equal, else false.
Definition: IndexSet.hpp:605
RAJA_INLINE RAJA::RAJAVec< Index_type > & getSegmentIcounts()
Returns the icount of segments.
Definition: IndexSet.hpp:569
RAJA_INLINE bool operator==(const TypedIndexSet< P0, PREST... > &other) const
Definition: IndexSet.hpp:588
RAJA_INLINE P0 & getSegment(size_t segid)
get specified segment by ID
Definition: IndexSet.hpp:201
RAJA_INLINE RAJA::RAJAVec< Index_type > & getSegmentOffsets()
Returns the mapping of segment_index -> segment_offset.
Definition: IndexSet.hpp:557
int getSegmentIntervalEnd(size_t interval_id) const
get upper bound of segment identified with interval_id
Definition: IndexSet.hpp:538
RAJA_SUPPRESS_HD_WARN RAJA_HOST_DEVICE void segmentCall(size_t segid, BODY &&body, ARGS &&... args) const
Definition: IndexSet.hpp:366
RAJA_INLINE P0 const & getSegment(size_t segid) const
get specified segment by ID
Definition: IndexSet.hpp:213
RAJA_INLINE void setTotalLength(int n)
set total length of the indexset
Definition: IndexSet.hpp:436
RAJA_INLINE TypedIndexSet(TypedIndexSet< T0, TREST... > const &c)
Copy-constructor for index set.
Definition: IndexSet.hpp:113
RAJA_INLINE void push_back_nocopy(Tnew *val)
Add segment to back end of index set without making a copy.
Definition: IndexSet.hpp:310
RAJA_INLINE void increaseTotalLength(int n)
increase the total stored size of the indexset
Definition: IndexSet.hpp:439
RAJA_INLINE RAJA::RAJAVec< Index_type > const & getSegmentIcounts() const
Returns the icount of segments.
Definition: IndexSet.hpp:575
RAJA_INLINE void push_front(Tnew &&val)
Add copy of segment to front end of index set.
Definition: IndexSet.hpp:332
TypedIndexSet< T0, TREST... > createSlice(int begin, int end)
Definition: IndexSet.hpp:464
RAJA_INLINE bool compareSegmentById(size_t segid, const TypedIndexSet< P0, PREST... > &other) const
Definition: IndexSet.hpp:167
RAJA_INLINE void push_internal(Tnew *val, PushEnd pend=PUSH_BACK, PushCopy pcopy=PUSH_COPY)
Internal logic to add a new segment – catch invalid type insertion.
Definition: IndexSet.hpp:383
RAJA_INLINE RAJA::RAJAVec< Index_type > const & getSegmentOffsets() const
Returns the mapping of segment_index -> segment_offset.
Definition: IndexSet.hpp:563
TypedIndexSet< T0, TREST... > createSlice(const T &segIds)
Definition: IndexSet.hpp:510
RAJA_INLINE void push_internal(T0 *val, PushEnd pend=PUSH_BACK, PushCopy pcopy=PUSH_COPY)
Internal logic to add a new segment.
Definition: IndexSet.hpp:392
iterator begin() const
Get an iterator to the beginning.
Definition: IndexSet.hpp:451
int getSegmentIntervalBegin(size_t interval_id) const
get lower bound of segment identified with interval_id
Definition: IndexSet.hpp:532
void swap(TypedIndexSet< T0, TREST... > &other)
Swap function for copy-and-swap idiom.
Definition: IndexSet.hpp:151
RAJA_INLINE ~TypedIndexSet()
Destroy index set including all index set segments.
Definition: IndexSet.hpp:137
RAJA_INLINE void push_front_nocopy(Tnew *val)
Add segment to front end of index set without making a copy.
Definition: IndexSet.hpp:317
RAJA_INLINE bool checkSegmentType(size_t segid) const
Definition: IndexSet.hpp:190
TypedIndexSet< T0, TREST... > & operator=(const TypedIndexSet< T0, TREST... > &rhs)
Copy-assignment operator for index set.
Definition: IndexSet.hpp:126
TypedIndexSet< T0, TREST... > createSlice(const int *segIds, int len)
Definition: IndexSet.hpp:484
RAJA_INLINE void push_back(Tnew &&val)
Add copy of segment to back end of index set.
Definition: IndexSet.hpp:324
RAJA_INLINE void segment_push_into(size_t segid, TypedIndexSet< CALL... > &c, PushEnd pend=PUSH_BACK, PushCopy pcopy=PUSH_COPY)
Definition: IndexSet.hpp:280
typename T0::value_type value_type
Definition: IndexSet.hpp:96
RAJA_INLINE RAJA::RAJAVec< Index_type > const & getSegmentTypes() const
Returns the mapping of segment_index -> segment_type.
Definition: IndexSet.hpp:551
RAJA_INLINE Index_type & getTotalLength()
Returns the number of indices (the total icount of segments.
Definition: IndexSet.hpp:433
RAJA_INLINE TypedIndexSet()
Construct empty index set.
Definition: IndexSet.hpp:106
constexpr RAJA_INLINE size_t getNumTypes() const
Returns the number of types this TypedIndexSet can store.
Definition: IndexSet.hpp:225
RAJA_INLINE RAJA::RAJAVec< Index_type > & getSegmentTypes()
Returns the mapping of segment_index -> segment_type.
Definition: IndexSet.hpp:545
void setSegmentInterval(size_t interval_id, int begin, int end)
Set [begin, end) interval of segments identified by interval_id.
Definition: IndexSet.hpp:525
constexpr RAJA_INLINE size_t getNumSegments() const
Return total number of segments in index set.
Definition: IndexSet.hpp:351
Index_type size() const
Return the number of elements in the range.
Definition: IndexSet.hpp:454
RAJA_INLINE RAJA::RAJAVec< Index_type > & getSegmentIcounts()
Definition: IndexSet.hpp:696
RAJA_INLINE RAJA::RAJAVec< Index_type > const & getSegmentTypes() const
Definition: IndexSet.hpp:681
RAJA_INLINE P0 const & getSegment(size_t) const
Definition: IndexSet.hpp:732
RAJA_INLINE void increaseTotalLength(int n)
Definition: IndexSet.hpp:710
static RAJA_INLINE size_t getNumTypes()
Definition: IndexSet.hpp:659
RAJA_INLINE P0 & getSegment(size_t)
Definition: IndexSet.hpp:726
constexpr RAJA_INLINE bool isValidSegmentType(T const &) const
Definition: IndexSet.hpp:662
RAJA_INLINE void segment_push_into(size_t, TypedIndexSet< CALL... > &, PushEnd, PushCopy) const
Definition: IndexSet.hpp:742
RAJA_INLINE int getStartingIcount(int segid)
Definition: IndexSet.hpp:755
RAJA_INLINE RAJA::RAJAVec< Index_type > const & getSegmentOffsets() const
Definition: IndexSet.hpp:691
RAJA::Index_type value_type
Definition: IndexSet.hpp:629
iterator begin() const
Get an iterator to the beginning.
Definition: IndexSet.hpp:769
RAJA_INLINE Index_type & getTotalLength()
Definition: IndexSet.hpp:706
RAJA_INLINE void setTotalLength(int n)
Definition: IndexSet.hpp:708
RAJA_INLINE RAJA::RAJAVec< Index_type > const & getSegmentIcounts() const
Definition: IndexSet.hpp:701
static RAJA_INLINE size_t getLength()
Definition: IndexSet.hpp:670
RAJA_INLINE void push_into(TypedIndexSet< CALL... > &, PushEnd, PushCopy) const
Definition: IndexSet.hpp:738
RAJA_INLINE int getStartingIcount(int segid) const
Definition: IndexSet.hpp:760
RAJA_INLINE RAJA::RAJAVec< Index_type > & getSegmentTypes()
Definition: IndexSet.hpp:676
void swap(TypedIndexSet &other)
Swap function for copy-and-swap idiom (deep copy).
Definition: IndexSet.hpp:649
RAJA_INLINE void push(Tnew const &, PushEnd, PushCopy)
Definition: IndexSet.hpp:749
RAJA_INLINE TypedIndexSet()
create empty TypedIndexSet
Definition: IndexSet.hpp:632
RAJA_INLINE TypedIndexSet(TypedIndexSet const &c)
Copy-constructor.
Definition: IndexSet.hpp:640
iterator end() const
Get an iterator to the end.
Definition: IndexSet.hpp:766
static RAJA_INLINE int getNumSegments()
Definition: IndexSet.hpp:668
RAJA_INLINE bool compareSegmentById(size_t, const TypedIndexSet< P0, PREST... > &) const
Definition: IndexSet.hpp:713
RAJA_INLINE ~TypedIndexSet()
dtor cleans up segements that we own (none)
Definition: IndexSet.hpp:636
RAJA_INLINE void segmentCall(size_t, BODY, ARGS...) const
Definition: IndexSet.hpp:673
RAJA_INLINE RAJA::RAJAVec< Index_type > & getSegmentOffsets()
Definition: IndexSet.hpp:686
Index_type size() const
Return the number of elements in the range.
Definition: IndexSet.hpp:772
RAJA_INLINE bool checkSegmentType(size_t) const
Definition: IndexSet.hpp:720
Definition: IndexSet.hpp:52
Header file for RAJA concept definitions.
#define RAJA_HOST_DEVICE
Definition: macros.hpp:65
#define RAJA_SUPPRESS_HD_WARN
Definition: macros.hpp:68
Args args
Definition: WorkRunner.hpp:212
Definition: AlignedRangeIndexSetBuilders.cpp:35
std::ptrdiff_t Index_type
Definition: types.hpp:226
auto & body
Definition: launch.hpp:177
PushEnd
Definition: IndexSet.hpp:40
@ PUSH_FRONT
Definition: IndexSet.hpp:41
@ PUSH_BACK
Definition: IndexSet.hpp:42
PushCopy
Definition: IndexSet.hpp:46
@ PUSH_COPY
Definition: IndexSet.hpp:47
@ PUSH_NOCOPY
Definition: IndexSet.hpp:48
RAJA_INLINE void swap(RAJA::TypedListSegment< StorageT > &a, RAJA::TypedListSegment< StorageT > &b)
Specialization of std::swap for TypedListSegment.
Definition: ListSegment.hpp:420
Definition: PolicyBase.hpp:75
Definition: Operators.hpp:580
Definition: Operators.hpp:559
Definition: IndexSet.hpp:70
SEG_EXEC_POLICY_T seg_exec
Definition: IndexSet.hpp:72
SEG_ITER_POLICY_T seg_it
Definition: IndexSet.hpp:71
Definition: IndexSet.hpp:796
Definition: IndexSet.hpp:802