VTK: Common/Core/vtkDataArrayTupleRange_Generic.h Source File

| VTK 9.3.1

vtkDataArrayTupleRange_Generic.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
8 #ifndef vtkDataArrayTupleRange_Generic_h
9 #define vtkDataArrayTupleRange_Generic_h
10
11 #include "vtkAssume.h"
12 #include "vtkDataArrayAccessor.h"
13 #include "vtkDataArrayMeta.h"
14
15 #include <algorithm>
16 #include <cassert>
17 #include <iterator>
18 #include <type_traits>
19
20 VTK_ITER_OPTIMIZE_START
21
22 namespace vtk
23 {
24 namespace detail
25 {
26 VTK_ABI_NAMESPACE_BEGIN
27
28 // Forward decs for friends/args
29 template <typename ArrayType, ComponentIdType>
30 struct ConstComponentReference;
31 template <typename ArrayType, ComponentIdType>
32 struct ComponentReference;
33 template <typename ArrayType, ComponentIdType>
34 struct ConstComponentIterator;
35 template <typename ArrayType, ComponentIdType>
36 struct ComponentIterator;
37 template <typename ArrayType, ComponentIdType>
38 struct ConstTupleReference;
39 template <typename ArrayType, ComponentIdType>
40 struct TupleReference;
41 template <typename ArrayType, ComponentIdType>
42 struct ConstTupleIterator;
43 template <typename ArrayType, ComponentIdType>
44 struct TupleIterator;
45 template <typename ArrayType, ComponentIdType>
46 struct TupleRange;
47
48 //------------------------------------------------------------------------------
49 // Const component reference
50 template <typename ArrayType, ComponentIdType TupleSize>
51 struct ConstComponentReference
52 {
53 private:
54 static_assert(IsValidTupleSize<TupleSize>::value, "Invalid tuple size.");
55 static_assert(IsVtkDataArray<ArrayType>::value, "Invalid array type.");
56
57 using NumCompsType = GenericTupleSize<TupleSize>;
58 using APIType = GetAPIType<ArrayType>;
59
60 public:
61 using value_type = APIType;
62
63 VTK_ITER_INLINE
64 ConstComponentReference() noexcept
65 : Array{ nullptr }
66 , NumComps{}
67 , TupleId{ 0 }
68 , ComponentId{ 0 }
69 {
70 }
71
72 VTK_ITER_INLINE
73 ConstComponentReference(
74 ArrayType* array, NumCompsType numComps, TupleIdType tuple, ComponentIdType comp) noexcept
75 : Array{ array }
76 , NumComps{ numComps }
77 , TupleId{ tuple }
78 , ComponentId{ comp }
79 {
80 VTK_ITER_ASSERT(array != nullptr, "Invalid array.");
81 VTK_ITER_ASSERT(numComps.value > 0, "Invalid number of components.");
82 VTK_ITER_ASSERT(
83 tuple >= 0 && tuple <= array->GetNumberOfTuples(), "Invalid tuple accessed by iterator.");
84 VTK_ITER_ASSERT(comp >= 0 && comp <= array->GetNumberOfComponents(),
85 "Invalid component accessed by iterator.");
86 }
87
88 VTK_ITER_INLINE
89 ConstComponentReference(const ComponentReference<ArrayType, TupleSize>& o)
90 : Array{ o.Array }
91 , NumComps{ o.NumComps }
92 , TupleId{ o.TupleId }
93 , ComponentId{ o.ComponentId }
94 {
95 }
96
97 VTK_ITER_INLINE
98 ConstComponentReference(const ConstComponentReference& o) noexcept = default;
99
100 VTK_ITER_INLINE
101 ConstComponentReference(ConstComponentReference&& o) noexcept = default;
102
103 VTK_ITER_INLINE
104 ConstComponentReference& operator=(const ConstComponentReference& o) noexcept
105 {
106 VTK_ITER_ASSERT(!this->Array, "Const reference already initialized.");
107 // Initialize the reference.
108 this->Array = o.Array;
109 this->NumComps = o.NumComps;
110 this->TupleId = o.TupleId;
111 this->ComponentId = o.ComponentId;
112 }
113
114 VTK_ITER_INLINE
115 ConstComponentReference& operator=(ConstComponentReference&& o) noexcept
116 {
117 VTK_ITER_ASSERT(!this->Array, "Const reference already initialized.");
118 // Initialize the reference.
119 this->Array = std::move(o.Array);
120 this->NumComps = std::move(o.NumComps);
121 this->TupleId = std::move(o.TupleId);
122 this->ComponentId = std::move(o.ComponentId);
123 }
124
125 VTK_ITER_INLINE
126 operator APIType() const noexcept
127 {
128 VTK_ITER_ASSUME(this->NumComps.value > 0);
129 VTK_ITER_ASSUME(this->Array->GetNumberOfComponents() == this->NumComps.value);
130 vtkDataArrayAccessor<ArrayType> acc{ this->Array };
131 return acc.Get(this->TupleId, this->ComponentId);
132 }
133
134 protected:
135 mutable ArrayType* Array;
136 NumCompsType NumComps;
137 TupleIdType TupleId;
138 ComponentIdType ComponentId;
139 };
140
141 //------------------------------------------------------------------------------
142 // Component reference
143 template <typename ArrayType, ComponentIdType TupleSize>
144 struct ComponentReference
145 {
146 private:
147 static_assert(IsValidTupleSize<TupleSize>::value, "Invalid tuple size.");
148 static_assert(IsVtkDataArray<ArrayType>::value, "Invalid array type.");
149
150 using NumCompsType = GenericTupleSize<TupleSize>;
151 using APIType = GetAPIType<ArrayType>;
152
153 public:
154 using value_type = APIType;
155
156 VTK_ITER_INLINE
157 ComponentReference() noexcept
158 : Array{ nullptr }
159 , NumComps{}
160 , TupleId{ 0 }
161 , ComponentId{ 0 }
162 {
163 }
164
165 VTK_ITER_INLINE
166 ComponentReference(
167 ArrayType* array, NumCompsType numComps, TupleIdType tuple, ComponentIdType comp) noexcept
168 : Array{ array }
169 , NumComps{ numComps }
170 , TupleId{ tuple }
171 , ComponentId{ comp }
172 {
173 VTK_ITER_ASSERT(array != nullptr, "Invalid array.");
174 VTK_ITER_ASSERT(numComps.value > 0, "Invalid number of components.");
175 VTK_ITER_ASSERT(
176 tuple >= 0 && tuple <= array->GetNumberOfTuples(), "Invalid tuple accessed by iterator.");
177 VTK_ITER_ASSERT(comp >= 0 && comp <= array->GetNumberOfComponents(),
178 "Invalid component accessed by iterator.");
179 }
180
181 VTK_ITER_INLINE
182 ComponentReference(const ComponentReference& o) noexcept = default;
183 VTK_ITER_INLINE
184 ComponentReference(ComponentReference&& o) noexcept = default;
185
186 VTK_ITER_INLINE
187 ComponentReference operator=(const ComponentReference& o) noexcept
188 {
189 if (this->Array)
190 { // Already initialized. Assign the value, not the reference
191 return *this = static_cast<APIType>(o);
192 }
193 else
194 { // Initialize the reference.
195 this->Array = o.Array;
196 this->NumComps = o.NumComps;
197 this->TupleId = o.TupleId;
198 this->ComponentId = o.ComponentId;
199
200 return *this;
201 }
202 }
203
204 VTK_ITER_INLINE
205 ComponentReference operator=(ComponentReference&& o) noexcept
206 {
207 if (this->Array)
208 { // Already initialized. Assign the value, not the reference
209 return *this = std::move(static_cast<APIType>(o));
210 }
211 else
212 { // Initialize the reference.
213 this->Array = std::move(o.Array);
214 this->NumComps = std::move(o.NumComps);
215 this->TupleId = std::move(o.TupleId);
216 this->ComponentId = std::move(o.ComponentId);
217
218 return *this;
219 }
220 }
221
222 template <typename OArray, ComponentIdType OSize>
223 VTK_ITER_INLINE ComponentReference operator=(const ComponentReference<OArray, OSize>& o) noexcept
224 { // Always copy the value for different reference types:
225 const APIType tmp = o;
226 return *this = std::move(tmp);
227 }
228
229 VTK_ITER_INLINE
230 operator APIType() const noexcept
231 {
232 VTK_ITER_ASSUME(this->NumComps.value > 0);
233 VTK_ITER_ASSUME(this->Array->GetNumberOfComponents() == this->NumComps.value);
234 vtkDataArrayAccessor<ArrayType> acc{ this->Array };
235 return acc.Get(this->TupleId, this->ComponentId);
236 }
237
238 VTK_ITER_INLINE
239 ComponentReference operator=(APIType val) noexcept
240 {
241 VTK_ITER_ASSUME(this->NumComps.value > 0);
242 VTK_ITER_ASSUME(this->Array->GetNumberOfComponents() == this->NumComps.value);
243 vtkDataArrayAccessor<ArrayType> acc{ this->Array };
244 acc.Set(this->TupleId, this->ComponentId, val);
245 return *this;
246 }
247
248 friend VTK_ITER_INLINE void swap(ComponentReference lhs, ComponentReference rhs) noexcept
249 { // Swap values, not references:
250 APIType tmp = std::move(static_cast<APIType>(lhs));
251 lhs = std::move(static_cast<APIType>(rhs));
252 rhs = std::move(tmp);
253 }
254
255 template <typename OArray, ComponentIdType OSize>
256 friend VTK_ITER_INLINE void swap(
257 ComponentReference lhs, ComponentReference<OArray, OSize> rhs) noexcept
258 { // Swap values, not references:
259 using OAPIType = GetAPIType<OArray>;
260 static_assert(
261 std::is_same<APIType, OAPIType>::value, "Cannot swap components with different types.");
262
263 APIType tmp = std::move(static_cast<APIType>(lhs));
264 lhs = std::move(static_cast<APIType>(rhs));
265 rhs = std::move(tmp);
266 }
267
268 friend VTK_ITER_INLINE void swap(ComponentReference lhs, APIType& rhs) noexcept
269 {
270 APIType tmp = std::move(static_cast<APIType>(lhs));
271 lhs = std::move(rhs);
272 rhs = std::move(tmp);
273 }
274
275 friend VTK_ITER_INLINE void swap(APIType& lhs, ComponentReference rhs) noexcept
276 {
277 APIType tmp = std::move(lhs);
278 lhs = std::move(static_cast<APIType>(rhs));
279 rhs = std::move(tmp);
280 }
281
282 VTK_ITER_INLINE
283 ComponentReference operator++() noexcept // prefix
284 {
285 const APIType newVal = *this + 1;
286 *this = newVal;
287 return *this;
288 }
289
290 VTK_ITER_INLINE
291 APIType operator++(int) noexcept // postfix
292 {
293 const APIType retVal = *this;
294 *this = *this + 1;
295 return retVal;
296 }
297
298 VTK_ITER_INLINE
299 ComponentReference operator--() noexcept // prefix
300 {
301 const APIType newVal = *this - 1;
302 *this = newVal;
303 return *this;
304 }
305
306 VTK_ITER_INLINE
307 APIType operator--(int) noexcept // postfix
308 {
309 const APIType retVal = *this;
310 *this = *this - 1;
311 return retVal;
312 }
313
314 #define VTK_REF_OP_OVERLOADS(Op, ImplOp) \
315 friend VTK_ITER_INLINE ComponentReference operator Op( \
316 ComponentReference lhs, APIType val) noexcept \
317 { \
318 const APIType newVal = lhs ImplOp val; \
319 lhs = newVal; \
320 return lhs; \
321 } \
322 friend VTK_ITER_INLINE ComponentReference operator Op( \
323 ComponentReference lhs, ComponentReference val) noexcept \
324 { \
325 const APIType newVal = lhs ImplOp val; \
326 lhs = newVal; \
327 return lhs; \
328 } \
329 friend VTK_ITER_INLINE APIType& operator Op(APIType& lhs, ComponentReference val) noexcept \
330 { \
331 const APIType newVal = lhs ImplOp val; \
332 lhs = newVal; \
333 return lhs; \
334 }
335
336 VTK_REF_OP_OVERLOADS(+=, +)
337 VTK_REF_OP_OVERLOADS(-=, -)
338 VTK_REF_OP_OVERLOADS(*=, *)
339 VTK_REF_OP_OVERLOADS(/=, /)
340
341 #undef VTK_REF_OP_OVERLOADS
342
343 friend struct ConstComponentReference<ArrayType, TupleSize>;
344 friend struct ComponentIterator<ArrayType, TupleSize>;
345
346 protected:
347 VTK_ITER_INLINE
348 void CopyReference(const ComponentReference& o) noexcept
349 {
350 this->Array = o.Array;
351 this->NumComps = o.NumComps;
352 this->TupleId = o.TupleId;
353 this->ComponentId = o.ComponentId;
354 }
355
356 mutable ArrayType* Array;
357 NumCompsType NumComps;
358 TupleIdType TupleId;
359 ComponentIdType ComponentId;
360 };
361
362 //------------------------------------------------------------------------------
363 // Const component iterator
364 template <typename ArrayType, ComponentIdType TupleSize>
365 struct ConstComponentIterator
366 {
367 private:
368 static_assert(IsValidTupleSize<TupleSize>::value, "Invalid tuple size.");
369 static_assert(IsVtkDataArray<ArrayType>::value, "Invalid array type.");
370
371 using NumCompsType = GenericTupleSize<TupleSize>;
372
373 public:
374 using iterator_category = std::random_access_iterator_tag;
375 using value_type = GetAPIType<ArrayType>;
376 using difference_type = ComponentIdType;
377 using pointer = void;
378 using reference = ConstComponentReference<ArrayType, TupleSize>;
379
380 VTK_ITER_INLINE
381 ConstComponentIterator() noexcept
382 : Array{ nullptr }
383 , TupleId{ 0 }
384 , ComponentId{ 0 }
385 {
386 }
387
388 VTK_ITER_INLINE
389 ConstComponentIterator(
390 ArrayType* array, NumCompsType numComps, TupleIdType tupleId, ComponentIdType comp) noexcept
391 : Array(array)
392 , NumComps(numComps)
393 , TupleId(tupleId)
394 , ComponentId(comp)
395 {
396 VTK_ITER_ASSERT(array != nullptr, "Invalid array.");
397 VTK_ITER_ASSERT(numComps.value > 0, "Invalid number of components.");
398 VTK_ITER_ASSERT(tupleId >= 0 && tupleId <= array->GetNumberOfTuples(),
399 "Const component iterator at invalid tuple id.");
400 VTK_ITER_ASSERT(comp >= 0 && comp <= this->NumComps.value,
401 "Const component iterator at invalid component id.");
402 }
403
404 VTK_ITER_INLINE
405 ConstComponentIterator(const ComponentIterator<ArrayType, TupleSize>& o) noexcept
406 : Array{ o.GetArray() }
407 , NumComps{ o.GetNumComps() }
408 , TupleId{ o.GetTupleId() }
409 , ComponentId{ o.GetComponentId() }
410 {
411 }
412
413 VTK_ITER_INLINE
414 ConstComponentIterator(const ConstComponentIterator& o) noexcept = default;
415 VTK_ITER_INLINE
416 ConstComponentIterator& operator=(const ConstComponentIterator& o) noexcept = default;
417
418 VTK_ITER_INLINE
419 ConstComponentIterator& operator++() noexcept // prefix
420 {
421 ++this->ComponentId;
422 VTK_ITER_ASSERT(this->ComponentId >= 0 && this->ComponentId <= this->NumComps.value,
423 "Const component iterator at invalid component id.");
424 return *this;
425 }
426
427 VTK_ITER_INLINE
428 ConstComponentIterator operator++(int) noexcept // postfix
429 {
430 return ConstComponentIterator{ this->Array, this->NumComps, this->TupleId,
431 this->ComponentId++ };
432 }
433
434 VTK_ITER_INLINE
435 ConstComponentIterator& operator--() noexcept // prefix
436 {
437 --this->ComponentId;
438 VTK_ITER_ASSERT(this->ComponentId >= 0 && this->ComponentId <= this->NumComps.value,
439 "Const component iterator at invalid component id.");
440 return *this;
441 }
442
443 VTK_ITER_INLINE
444 ConstComponentIterator operator--(int) noexcept // postfix
445 {
446 return ConstComponentIterator{ this->Array, this->NumComps, this->TupleId,
447 this->ComponentId-- };
448 }
449
450 VTK_ITER_INLINE
451 reference operator[](difference_type i) const noexcept
452 {
453 return reference{ this->Array, this->NumComps, this->TupleId, this->ComponentId + i };
454 }
455
456 VTK_ITER_INLINE
457 reference operator*() const noexcept
458 {
459 return reference{ this->Array, this->NumComps, this->TupleId, this->ComponentId };
460 }
461
462 #define VTK_TMP_MAKE_OPERATOR(OP) \
463 friend VTK_ITER_INLINE bool operator OP( \
464 const ConstComponentIterator& lhs, const ConstComponentIterator& rhs) noexcept \
465 { \
466 VTK_ITER_ASSERT(lhs.Array == rhs.Array, "Mismatched arrays in iterator comparison."); \
467 VTK_ITER_ASSERT(lhs.TupleId == rhs.TupleId, "Mismatched tuple ids in iterator comparison."); \
468 VTK_ITER_ASSUME(lhs.NumComps.value > 0); \
469 VTK_ITER_ASSUME(lhs.NumComps.value == rhs.NumComps.value); \
470 return lhs.ComponentId OP rhs.ComponentId; \
471 }
472
473 VTK_TMP_MAKE_OPERATOR(==)
474 VTK_TMP_MAKE_OPERATOR(!=)
475 VTK_TMP_MAKE_OPERATOR(<)
476 VTK_TMP_MAKE_OPERATOR(>)
477 VTK_TMP_MAKE_OPERATOR(<=)
478 VTK_TMP_MAKE_OPERATOR(>=)
479
480 #undef VTK_TMP_MAKE_OPERATOR
481
482 VTK_ITER_INLINE
483 ConstComponentIterator& operator+=(difference_type offset) noexcept
484 {
485 this->ComponentId += offset;
486 VTK_ITER_ASSERT(this->ComponentId >= 0 && this->ComponentId <= this->NumComps.value,
487 "Const component iterator at invalid component id.");
488 return *this;
489 }
490
491 friend VTK_ITER_INLINE ConstComponentIterator operator+(
492 const ConstComponentIterator& it, difference_type offset) noexcept
493 {
494 return ConstComponentIterator{ it.Array, it.NumComps, it.TupleId, it.ComponentId + offset };
495 }
496
497 friend VTK_ITER_INLINE ConstComponentIterator operator+(
498 difference_type offset, const ConstComponentIterator& it) noexcept
499 {
500 return ConstComponentIterator{ it.Array, it.NumComps, it.TupleId, it.ComponentId + offset };
501 }
502
503 VTK_ITER_INLINE
504 ConstComponentIterator& operator-=(difference_type offset) noexcept
505 {
506 this->ComponentId -= offset;
507 VTK_ITER_ASSERT(this->ComponentId >= 0 && this->ComponentId <= this->NumComps.value,
508 "Const component iterator at invalid component id.");
509 return *this;
510 }
511
512 friend VTK_ITER_INLINE ConstComponentIterator operator-(
513 const ConstComponentIterator& it, difference_type offset) noexcept
514 {
515 return ConstComponentIterator{ it.Array, it.NumComps, it.TupleId, it.ComponentId - offset };
516 }
517
518 friend VTK_ITER_INLINE difference_type operator-(
519 const ConstComponentIterator& it1, const ConstComponentIterator& it2) noexcept
520 {
521 VTK_ITER_ASSERT(it1.Array == it2.Array, "Cannot do math with iterators from different arrays.");
522 VTK_ITER_ASSERT(it1.TupleId == it2.TupleId,
523 "Cannot do math with component iterators from different "
524 "tuples.");
525 return it1.ComponentId - it2.ComponentId;
526 }
527
528 friend VTK_ITER_INLINE void swap(
529 ConstComponentIterator& lhs, ConstComponentIterator& rhs) noexcept
530 {
531 // Different arrays may use different iterator implementations.
532 VTK_ITER_ASSERT(lhs.Array == rhs.Array, "Cannot swap iterators from different arrays.");
533
534 using std::swap;
535 swap(lhs.TupleId, rhs.TupleId);
536 swap(lhs.ComponentId, rhs.ComponentId);
537 }
538
539 private:
540 mutable ArrayType* Array;
541 NumCompsType NumComps;
542 TupleIdType TupleId;
543 ComponentIdType ComponentId;
544 };
545
546 //------------------------------------------------------------------------------
547 // Component iterator
548 template <typename ArrayType, ComponentIdType TupleSize>
549 struct ComponentIterator
550 {
551 private:
552 static_assert(IsValidTupleSize<TupleSize>::value, "Invalid tuple size.");
553 static_assert(IsVtkDataArray<ArrayType>::value, "Invalid array type.");
554
555 using NumCompsType = GenericTupleSize<TupleSize>;
556 using APIType = GetAPIType<ArrayType>;
557
558 public:
559 using iterator_category = std::random_access_iterator_tag;
560 using value_type = APIType;
561 using difference_type = ComponentIdType;
562 using pointer = ComponentReference<ArrayType, TupleSize>;
563 using reference = ComponentReference<ArrayType, TupleSize>;
564
565 VTK_ITER_INLINE
566 ComponentIterator() noexcept = default;
567
568 VTK_ITER_INLINE
569 ComponentIterator(
570 ArrayType* array, NumCompsType numComps, TupleIdType tupleId, ComponentIdType comp) noexcept
571 : Ref(array, numComps, tupleId, comp)
572 {
573 VTK_ITER_ASSERT(array != nullptr, "Invalid array.");
574 VTK_ITER_ASSERT(numComps.value > 0, "Invalid number of components.");
575 VTK_ITER_ASSERT(tupleId >= 0 && tupleId <= array->GetNumberOfTuples(),
576 "Component iterator at invalid tuple id.");
577 VTK_ITER_ASSERT(
578 comp >= 0 && comp <= numComps.value, "Component iterator at invalid component id.");
579 }
580
581 VTK_ITER_INLINE
582 ComponentIterator(const ComponentIterator& o) noexcept = default;
583
584 VTK_ITER_INLINE
585 ComponentIterator& operator=(const ComponentIterator& o) noexcept
586 {
587 this->Ref.CopyReference(o.Ref);
588 return *this;
589 }
590
591 VTK_ITER_INLINE
592 ComponentIterator& operator++() noexcept // prefix
593 {
594 ++this->Ref.ComponentId;
595 VTK_ITER_ASSERT(this->Ref.ComponentId >= 0 && this->Ref.ComponentId <= this->Ref.NumComps.value,
596 "Component iterator at invalid component id.");
597 return *this;
598 }
599
600 VTK_ITER_INLINE
601 ComponentIterator operator++(int) noexcept // postfix
602 {
603 return ComponentIterator{ this->Ref.Array, this->Ref.NumComps, this->Ref.TupleId,
604 this->Ref.ComponentId++ };
605 }
606
607 VTK_ITER_INLINE
608 ComponentIterator& operator--() noexcept // prefix
609 {
610 --this->Ref.ComponentId;
611 VTK_ITER_ASSERT(this->Ref.ComponentId >= 0 && this->Ref.ComponentId <= this->Ref.NumComps.value,
612 "Component iterator at invalid component id.");
613 return *this;
614 }
615
616 VTK_ITER_INLINE
617 ComponentIterator operator--(int) noexcept // postfix
618 {
619 return ComponentIterator{ this->Ref.Array, this->Ref.NumComps, this->Ref.TupleId,
620 this->Ref.ComponentId-- };
621 }
622
623 VTK_ITER_INLINE
624 reference operator[](difference_type i) const noexcept
625 {
626 return reference{ this->Ref.Array, this->Ref.NumComps, this->Ref.TupleId,
627 this->Ref.ComponentId + i };
628 }
629
630 VTK_ITER_INLINE
631 reference operator*() const noexcept { return this->Ref; }
632
633 VTK_ITER_INLINE
634 const pointer& operator->() const noexcept { return this->Ref; }
635
636 #define VTK_TMP_MAKE_OPERATOR(OP) \
637 friend VTK_ITER_INLINE bool operator OP( \
638 const ComponentIterator& lhs, const ComponentIterator& rhs) noexcept \
639 { \
640 VTK_ITER_ASSERT( \
641 lhs.GetArray() == rhs.GetArray(), "Mismatched arrays in iterator comparison."); \
642 VTK_ITER_ASSERT( \
643 lhs.GetTupleId() == rhs.GetTupleId(), "Mismatched tuple ids in iterator comparison."); \
644 VTK_ITER_ASSUME(lhs.GetNumComps().value > 0); \
645 VTK_ITER_ASSUME(lhs.GetNumComps().value == rhs.GetNumComps().value); \
646 return lhs.GetComponentId() OP rhs.GetComponentId(); \
647 }
648
649 VTK_TMP_MAKE_OPERATOR(==)
650 VTK_TMP_MAKE_OPERATOR(!=)
651 VTK_TMP_MAKE_OPERATOR(<)
652 VTK_TMP_MAKE_OPERATOR(>)
653 VTK_TMP_MAKE_OPERATOR(<=)
654 VTK_TMP_MAKE_OPERATOR(>=)
655
656 #undef VTK_TMP_MAKE_OPERATOR
657
658 VTK_ITER_INLINE
659 ComponentIterator& operator+=(difference_type offset) noexcept
660 {
661 this->Ref.ComponentId += offset;
662 VTK_ITER_ASSERT(this->Ref.ComponentId >= 0 && this->Ref.ComponentId <= this->Ref.NumComps.value,
663 "Component iterator at invalid component id.");
664 return *this;
665 }
666
667 friend VTK_ITER_INLINE ComponentIterator operator+(
668 const ComponentIterator& it, difference_type offset) noexcept
669 {
670 return ComponentIterator{ it.GetArray(), it.GetNumComps(), it.GetTupleId(),
671 it.GetComponentId() + offset };
672 }
673
674 friend VTK_ITER_INLINE ComponentIterator operator+(
675 difference_type offset, const ComponentIterator& it) noexcept
676 {
677 return ComponentIterator{ it.GetArray(), it.GetNumComps(), it.GetTupleId(),
678 it.GetComponentId() + offset };
679 }
680
681 VTK_ITER_INLINE
682 ComponentIterator& operator-=(difference_type offset) noexcept
683 {
684 this->Ref.ComponentId -= offset;
685 VTK_ITER_ASSERT(this->Ref.ComponentId >= 0 && this->Ref.ComponentId <= this->Ref.NumComps.value,
686 "Component iterator at invalid component id.");
687 return *this;
688 }
689
690 friend VTK_ITER_INLINE ComponentIterator operator-(
691 const ComponentIterator& it, difference_type offset) noexcept
692 {
693 return ComponentIterator{ it.GetArray(), it.GetNumComps(), it.GetTupleId(),
694 it.GetComponentId() - offset };
695 }
696
697 friend VTK_ITER_INLINE difference_type operator-(
698 const ComponentIterator& it1, const ComponentIterator& it2) noexcept
699 {
700 VTK_ITER_ASSERT(it1.GetArray() == it2.GetArray(),
701 "Cannot do math with component iterators from different "
702 "arrays.");
703 VTK_ITER_ASSERT(it1.GetTupleId() == it2.GetTupleId(),
704 "Cannot do math with component iterators from different "
705 "tuples.");
706 return it1.GetComponentId() - it2.GetComponentId();
707 }
708
709 friend VTK_ITER_INLINE void swap(ComponentIterator& lhs, ComponentIterator& rhs) noexcept
710 {
711 // Different arrays may use different iterator implementations.
712 VTK_ITER_ASSERT(
713 lhs.GetArray() == rhs.GetArray(), "Cannot swap iterators from different arrays.");
714
715 using std::swap;
716 swap(lhs.GetTupleId(), rhs.GetTupleId());
717 swap(lhs.GetComponentId(), rhs.GetComponentId());
718 }
719
720 friend struct ConstComponentIterator<ArrayType, TupleSize>;
721
722 protected:
723 // Needed for access from friend functions. We could just store the array
724 // and ID here instead of the ref, but meh.
725 ArrayType* GetArray() const noexcept { return this->Ref.Array; }
726 TupleIdType& GetTupleId() noexcept { return this->Ref.TupleId; }
727 const TupleIdType& GetTupleId() const noexcept { return this->Ref.TupleId; }
728 ComponentIdType& GetComponentId() noexcept { return this->Ref.ComponentId; }
729 const ComponentIdType& GetComponentId() const noexcept { return this->Ref.ComponentId; }
730 NumCompsType& GetNumComps() noexcept { return this->Ref.NumComps; }
731 const NumCompsType& GetNumComps() const noexcept { return this->Ref.NumComps; }
732
733 ComponentReference<ArrayType, TupleSize> Ref;
734 };
735
736 //------------------------------------------------------------------------------
737 // Const tuple reference
738 template <typename ArrayType, ComponentIdType TupleSize>
739 struct ConstTupleReference
740 {
741 private:
742 static_assert(IsValidTupleSize<TupleSize>::value, "Invalid tuple size.");
743 static_assert(IsVtkDataArray<ArrayType>::value, "Invalid array type.");
744
745 using NumCompsType = GenericTupleSize<TupleSize>;
746 using APIType = GetAPIType<ArrayType>;
747
748 public:
749 using size_type = ComponentIdType;
750 using value_type = APIType;
751 using iterator = ConstComponentIterator<ArrayType, TupleSize>;
752 using const_iterator = ConstComponentIterator<ArrayType, TupleSize>;
753 using const_reference = ConstComponentReference<ArrayType, TupleSize>;
754
755 VTK_ITER_INLINE
756 ConstTupleReference() noexcept
757 : Array(nullptr)
758 , TupleId(0)
759 {
760 }
761
762 VTK_ITER_INLINE
763 ConstTupleReference(ArrayType* array, NumCompsType numComps, TupleIdType tupleId) noexcept
764 : Array(array)
765 , NumComps(numComps)
766 , TupleId(tupleId)
767 {
768 VTK_ITER_ASSERT(array != nullptr, "Invalid array.");
769 VTK_ITER_ASSERT(numComps.value > 0, "Invalid number of components.");
770 VTK_ITER_ASSERT(tupleId >= 0 && tupleId <= array->GetNumberOfTuples(),
771 "Const tuple reference at invalid tuple id.");
772 }
773
774 VTK_ITER_INLINE
775 ConstTupleReference(const TupleReference<ArrayType, TupleSize>& o) noexcept
776 : Array{ o.Array }
777 , NumComps{ o.NumComps }
778 , TupleId{ o.TupleId }
779 {
780 }
781
782 VTK_ITER_INLINE
783 ConstTupleReference(const ConstTupleReference&) noexcept = default;
784 VTK_ITER_INLINE
785 ConstTupleReference(ConstTupleReference&&) noexcept = default;
786
787 // Allow this type to masquerade as a pointer, so that tupleIiter->foo works.
788 VTK_ITER_INLINE
789 ConstTupleReference* operator->() noexcept { return this; }
790 VTK_ITER_INLINE
791 const ConstTupleReference* operator->() const noexcept { return this; }
792
793 // Caller must ensure that there are size() elements in array.
794 VTK_ITER_INLINE
795 void GetTuple(APIType* tuple) const noexcept
796 {
797 VTK_ITER_ASSUME(this->NumComps.value > 0);
798 VTK_ITER_ASSUME(this->Array->GetNumberOfComponents() == this->NumComps.value);
799 vtkDataArrayAccessor<ArrayType> acc{ this->Array };
800 acc.Get(this->TupleId, tuple);
801 }
802
803 // skips some runtime checks when both sizes are fixed:
804 template <typename OArrayType, ComponentIdType OSize>
805 VTK_ITER_INLINE EnableIfStaticTupleSizes<TupleSize, OSize, bool> operator==(
806 const TupleReference<OArrayType, OSize>& other) const noexcept
807 {
808 // Check that types are convertible:
809 using OAPIType = GetAPIType<OArrayType>;
810 static_assert(
811 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when comparing tuples.");
812
813 // SFINAE guarantees that the tuple sizes are not dynamic in this overload:
814 static_assert(TupleSize == OSize, "Cannot compare tuples with different sizes.");
815
816 return std::equal(this->cbegin(), this->cend(), other.cbegin());
817 }
818
819 // Needs a runtime check:
820 template <typename OArrayType, ComponentIdType OSize>
821 VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic<TupleSize, OSize, bool> operator==(
822 const TupleReference<OArrayType, OSize>& other) const noexcept
823 {
824 // Check that types are convertible:
825 using OAPIType = GetAPIType<OArrayType>;
826 static_assert(
827 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when comparing tuples.");
828
829 VTK_ITER_ASSERT(
830 other.size() == this->NumComps.value, "Cannot compare tuples with different sizes.");
831
832 return std::equal(this->cbegin(), this->cend(), other.cbegin());
833 }
834
835 // skips some runtime checks when both sizes are fixed:
836 template <typename OArrayType, ComponentIdType OSize>
837 VTK_ITER_INLINE EnableIfStaticTupleSizes<TupleSize, OSize, bool> operator==(
838 const ConstTupleReference<OArrayType, OSize>& other) const noexcept
839 {
840 // Check that types are convertible:
841 using OAPIType = GetAPIType<OArrayType>;
842 static_assert(
843 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when comparing tuples.");
844
845 // SFINAE guarantees that the tuple sizes are not dynamic in this overload:
846 static_assert(TupleSize == OSize, "Cannot compare tuples with different sizes.");
847
848 return std::equal(this->cbegin(), this->cend(), other.cbegin());
849 }
850
851 // Needs a runtime check:
852 template <typename OArrayType, ComponentIdType OSize>
853 VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic<TupleSize, OSize, bool> operator==(
854 const ConstTupleReference<OArrayType, OSize>& other) const noexcept
855 {
856 // Check that types are convertible:
857 using OAPIType = GetAPIType<OArrayType>;
858 static_assert(
859 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when comparing tuples.");
860
861 VTK_ITER_ASSERT(
862 other.size() == this->NumComps.value, "Cannot compare tuples with different sizes.");
863
864 return std::equal(this->cbegin(), this->cend(), other.cbegin());
865 }
866
867 template <typename OArrayType, ComponentIdType OSize>
868 VTK_ITER_INLINE bool operator!=(const TupleReference<OArrayType, OSize>& o) const noexcept
869 {
870 return !(*this == o);
871 }
872
873 template <typename OArrayT, ComponentIdType OSize>
874 VTK_ITER_INLINE bool operator!=(const ConstTupleReference<OArrayT, OSize>& o) const noexcept
875 {
876 return !(*this == o);
877 }
878
879 VTK_ITER_INLINE
880 const_reference operator[](size_type i) const noexcept
881 {
882 return const_reference{ this->Array, this->NumComps, this->TupleId, i };
883 }
884
885 VTK_ITER_INLINE
886 size_type size() const noexcept { return this->NumComps.value; }
887
888 VTK_ITER_INLINE
889 const_iterator begin() const noexcept { return this->NewConstIterator(0); }
890 VTK_ITER_INLINE
891 const_iterator end() const noexcept { return this->NewConstIterator(this->NumComps.value); }
892
893 VTK_ITER_INLINE
894 const_iterator cbegin() const noexcept { return this->NewConstIterator(0); }
895 VTK_ITER_INLINE
896 const_iterator cend() const noexcept { return this->NewConstIterator(this->NumComps.value); }
897
898 friend struct ConstTupleIterator<ArrayType, TupleSize>;
899
900 protected:
901 // Intentionally hidden:
902 VTK_ITER_INLINE
903 ConstTupleReference& operator=(const ConstTupleReference&) noexcept = default;
904
905 VTK_ITER_INLINE
906 const_iterator NewConstIterator(ComponentIdType comp) const noexcept
907 {
908 VTK_ITER_ASSUME(this->NumComps.value > 0);
909 return const_iterator{ this->Array, this->NumComps, this->TupleId, comp };
910 }
911
912 VTK_ITER_INLINE
913 void CopyReference(const ConstTupleReference& o) noexcept
914 {
915 // Must use same array, other array types may use different implementations.
916 VTK_ITER_ASSERT(this->Array == o.Array, "Cannot copy reference objects between arrays.");
917 this->NumComps = o.NumComps;
918 this->TupleId = o.TupleId;
919 }
920
921 mutable ArrayType* Array;
922 NumCompsType NumComps;
923 TupleIdType TupleId;
924 };
925
926 //------------------------------------------------------------------------------
927 // Tuple reference
928 template <typename ArrayType, ComponentIdType TupleSize>
929 struct TupleReference
930 {
931 private:
932 static_assert(IsValidTupleSize<TupleSize>::value, "Invalid tuple size.");
933 static_assert(IsVtkDataArray<ArrayType>::value, "Invalid array type.");
934
935 using NumCompsType = GenericTupleSize<TupleSize>;
936 using APIType = GetAPIType<ArrayType>;
937
938 public:
939 using size_type = ComponentIdType;
940 using value_type = APIType;
941 using iterator = ComponentIterator<ArrayType, TupleSize>;
942 using const_iterator = ConstComponentIterator<ArrayType, TupleSize>;
943 using reference = ComponentReference<ArrayType, TupleSize>;
944 using const_reference = ConstComponentReference<ArrayType, TupleSize>;
945
946 VTK_ITER_INLINE
947 TupleReference() noexcept
948 : Array(nullptr)
949 , TupleId(0)
950 {
951 }
952
953 VTK_ITER_INLINE
954 TupleReference(ArrayType* array, NumCompsType numComps, TupleIdType tupleId) noexcept
955 : Array(array)
956 , NumComps(numComps)
957 , TupleId(tupleId)
958 {
959 VTK_ITER_ASSERT(array != nullptr, "Invalid array.");
960 VTK_ITER_ASSERT(numComps.value > 0, "Invalid number of components.");
961 VTK_ITER_ASSERT(tupleId >= 0 && tupleId <= array->GetNumberOfTuples(),
962 "Tuple reference at invalid tuple id.");
963 }
964
965 VTK_ITER_INLINE
966 TupleReference(const TupleReference&) = default;
967 VTK_ITER_INLINE
968 TupleReference(TupleReference&&) noexcept = default;
969
970 // Allow this type to masquerade as a pointer, so that tupleIiter->foo works.
971 VTK_ITER_INLINE
972 TupleReference* operator->() noexcept { return this; }
973 VTK_ITER_INLINE
974 const TupleReference* operator->() const noexcept { return this; }
975
976 // Caller must ensure that there are size() elements in array.
977 VTK_ITER_INLINE
978 void GetTuple(APIType* tuple) const noexcept
979 {
980 VTK_ITER_ASSUME(this->NumComps.value > 0);
981 VTK_ITER_ASSUME(this->Array->GetNumberOfComponents() == this->NumComps.value);
982 vtkDataArrayAccessor<ArrayType> acc{ this->Array };
983 acc.Get(this->TupleId, tuple);
984 }
985
986 // Caller must ensure that there are size() elements in array.
987 VTK_ITER_INLINE
988 void SetTuple(const APIType* tuple) noexcept
989 {
990 VTK_ITER_ASSUME(this->NumComps.value > 0);
991 VTK_ITER_ASSUME(this->Array->GetNumberOfComponents() == this->NumComps.value);
992 vtkDataArrayAccessor<ArrayType> acc{ this->Array };
993 acc.Set(this->TupleId, tuple);
994 }
995
996 VTK_ITER_INLINE
997 TupleReference& operator=(const TupleReference& other) noexcept
998 {
999 std::copy_n(other.cbegin(), this->NumComps.value, this->begin());
1000 return *this;
1001 }
1002
1003 // skips some runtime checks when both sizes are fixed:
1004 template <typename OArrayType, ComponentIdType OSize>
1005 VTK_ITER_INLINE EnableIfStaticTupleSizes<TupleSize, OSize, TupleReference&> operator=(
1006 const TupleReference<OArrayType, OSize>& other) noexcept
1007 {
1008 // Check that types are convertible:
1009 using OAPIType = GetAPIType<OArrayType>;
1010 static_assert(
1011 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when assigning tuples.");
1012
1013 // SFINAE guarantees that the tuple sizes are not dynamic in this overload:
1014 static_assert(TupleSize == OSize, "Cannot assign tuples with different sizes.");
1015
1016 std::copy_n(other.cbegin(), OSize, this->begin());
1017 return *this;
1018 }
1019
1020 // Needs a runtime check:
1021 template <typename OArrayType, ComponentIdType OSize>
1022 VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic<TupleSize, OSize, TupleReference&> operator=(
1023 const TupleReference<OArrayType, OSize>& other) noexcept
1024 {
1025 // Check that types are convertible:
1026 using OAPIType = GetAPIType<OArrayType>;
1027 static_assert(
1028 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when assigning tuples.");
1029
1030 VTK_ITER_ASSERT(
1031 other.size() == this->NumComps.value, "Cannot assign tuples with different sizes.");
1032
1033 std::copy_n(other.cbegin(), this->NumComps.value, this->begin());
1034 return *this;
1035 }
1036
1037 // skips some runtime checks when both sizes are fixed:
1038 template <typename OArrayType, ComponentIdType OSize>
1039 VTK_ITER_INLINE EnableIfStaticTupleSizes<TupleSize, OSize, TupleReference&> operator=(
1040 const ConstTupleReference<OArrayType, OSize>& other) noexcept
1041 {
1042 // Check that types are convertible:
1043 using OAPIType = GetAPIType<OArrayType>;
1044 static_assert(
1045 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when assigning tuples.");
1046
1047 // SFINAE guarantees that the tuple sizes are not dynamic in this overload:
1048 static_assert(TupleSize == OSize, "Cannot assign tuples with different sizes.");
1049
1050 std::copy_n(other.cbegin(), OSize, this->begin());
1051 return *this;
1052 }
1053
1054 // Needs a runtime check:
1055 template <typename OArrayType, ComponentIdType OSize>
1056 VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic<TupleSize, OSize, TupleReference&> operator=(
1057 const ConstTupleReference<OArrayType, OSize>& other) noexcept
1058 {
1059 // Check that types are convertible:
1060 using OAPIType = GetAPIType<OArrayType>;
1061 static_assert(
1062 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when assigning tuples.");
1063
1064 VTK_ITER_ASSERT(
1065 other.size() == this->NumComps.value, "Cannot assign tuples with different sizes.");
1066
1067 std::copy_n(other.cbegin(), this->NumComps.value, this->begin());
1068 return *this;
1069 }
1070
1071 // skips some runtime checks when both sizes are fixed:
1072 template <typename OArrayType, ComponentIdType OSize>
1073 VTK_ITER_INLINE EnableIfStaticTupleSizes<TupleSize, OSize, bool> operator==(
1074 const TupleReference<OArrayType, OSize>& other) const noexcept
1075 {
1076 // Check that types are convertible:
1077 using OAPIType = GetAPIType<OArrayType>;
1078 static_assert(
1079 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when comparing tuples.");
1080
1081 // SFINAE guarantees that the tuple sizes are not dynamic in this overload:
1082 static_assert(TupleSize == OSize, "Cannot compare tuples with different sizes.");
1083
1084 return std::equal(this->cbegin(), this->cend(), other.cbegin());
1085 }
1086
1087 // Needs a runtime check:
1088 template <typename OArrayType, ComponentIdType OSize>
1089 VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic<TupleSize, OSize, bool> operator==(
1090 const TupleReference<OArrayType, OSize>& other) const noexcept
1091 {
1092 // Check that types are convertible:
1093 using OAPIType = GetAPIType<OArrayType>;
1094 static_assert(
1095 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when comparing tuples.");
1096
1097 VTK_ITER_ASSERT(
1098 other.size() == this->NumComps.value, "Cannot compare tuples with different sizes.");
1099
1100 return std::equal(this->cbegin(), this->cend(), other.cbegin());
1101 }
1102
1103 // skips some runtime checks when both sizes are fixed:
1104 template <typename OArrayType, ComponentIdType OSize>
1105 VTK_ITER_INLINE EnableIfStaticTupleSizes<TupleSize, OSize, bool> operator==(
1106 const ConstTupleReference<OArrayType, OSize>& other) const noexcept
1107 {
1108 // Check that types are convertible:
1109 using OAPIType = GetAPIType<OArrayType>;
1110 static_assert(
1111 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when comparing tuples.");
1112
1113 // SFINAE guarantees that the tuple sizes are not dynamic in this overload:
1114 static_assert(TupleSize == OSize, "Cannot compare tuples with different sizes.");
1115
1116 return std::equal(this->cbegin(), this->cend(), other.cbegin());
1117 }
1118
1119 // Needs a runtime check:
1120 template <typename OArrayType, ComponentIdType OSize>
1121 VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic<TupleSize, OSize, bool> operator==(
1122 const ConstTupleReference<OArrayType, OSize>& other) const noexcept
1123 {
1124 // Check that types are convertible:
1125 using OAPIType = GetAPIType<OArrayType>;
1126 static_assert(
1127 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when comparing tuples.");
1128
1129 VTK_ITER_ASSERT(
1130 other.size() == this->NumComps.value, "Cannot compare tuples with different sizes.");
1131
1132 return std::equal(this->cbegin(), this->cend(), other.cbegin());
1133 }
1134
1135 template <typename OArrayType, ComponentIdType OSize>
1136 VTK_ITER_INLINE bool operator!=(const TupleReference<OArrayType, OSize>& o) const noexcept
1137 {
1138 return !(*this == o);
1139 }
1140
1141 template <typename OArray, ComponentIdType OSize>
1142 VTK_ITER_INLINE bool operator!=(const ConstTupleReference<OArray, OSize>& o) const noexcept
1143 {
1144 return !(*this == o);
1145 }
1146
1147 // skips some runtime checks:
1148 template <typename OArrayType, ComponentIdType OSize>
1149 VTK_ITER_INLINE EnableIfStaticTupleSizes<TupleSize, OSize, void> swap(
1150 TupleReference<OArrayType, OSize> other) noexcept
1151 {
1152 // Check that types are convertible:
1153 using OAPIType = GetAPIType<OArrayType>;
1154 static_assert(
1155 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when swapping tuples.");
1156
1157 // SFINAE guarantees that the tuple sizes are not dynamic in this overload:
1158 static_assert(TupleSize == OSize, "Cannot swap tuples with different sizes.");
1159
1160 std::swap_ranges(this->begin(), this->end(), other.begin());
1161 }
1162
1163 // Needs a runtime check:
1164 template <typename OArrayType, ComponentIdType OSize>
1165 VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic<TupleSize, OSize, void> swap(
1166 TupleReference<OArrayType, OSize> other) noexcept
1167 {
1168 // Check that types are convertible:
1169 using OAPIType = GetAPIType<OArrayType>;
1170 static_assert(
1171 (std::is_convertible<OAPIType, APIType>{}), "Incompatible types when swapping tuples.");
1172
1173 VTK_ITER_ASSERT(
1174 other.size() == this->NumComps.value, "Cannot swap tuples with different sizes.");
1175
1176 std::swap_ranges(this->begin(), this->end(), other.begin());
1177 }
1178
1179 friend VTK_ITER_INLINE void swap(TupleReference a, TupleReference b) noexcept { a.swap(b); }
1180
1181 template <typename OArray, ComponentIdType OSize>
1182 friend VTK_ITER_INLINE void swap(TupleReference a, TupleReference<OArray, OSize> b) noexcept
1183 {
1184 a.swap(b);
1185 }
1186
1187 VTK_ITER_INLINE
1188 reference operator[](size_type i) noexcept
1189 {
1190 return reference{ this->Array, this->NumComps, this->TupleId, i };
1191 }
1192
1193 VTK_ITER_INLINE
1194 const_reference operator[](size_type i) const noexcept
1195 {
1196 // Let the reference type do the lookup during implicit conversion.
1197 return const_reference{ this->Array, this->NumComps, this->TupleId, i };
1198 }
1199
1200 VTK_ITER_INLINE
1201 void fill(const value_type& v) noexcept { std::fill(this->begin(), this->end(), v); }
1202
1203 VTK_ITER_INLINE
1204 size_type size() const noexcept { return this->NumComps.value; }
1205
1206 VTK_ITER_INLINE
1207 iterator begin() noexcept { return this->NewIterator(0); }
1208 VTK_ITER_INLINE
1209 iterator end() noexcept { return this->NewIterator(this->NumComps.value); }
1210
1211 VTK_ITER_INLINE
1212 const_iterator begin() const noexcept { return this->NewConstIterator(0); }
1213 VTK_ITER_INLINE
1214 const_iterator end() const noexcept { return this->NewConstIterator(this->NumComps.value); }
1215
1216 VTK_ITER_INLINE
1217 const_iterator cbegin() const noexcept { return this->NewConstIterator(0); }
1218 VTK_ITER_INLINE
1219 const_iterator cend() const noexcept { return this->NewConstIterator(this->NumComps.value); }
1220
1221 friend struct ConstTupleReference<ArrayType, TupleSize>;
1222 friend struct TupleIterator<ArrayType, TupleSize>;
1223
1224 protected:
1225 VTK_ITER_INLINE
1226 iterator NewIterator(ComponentIdType comp) const noexcept
1227 {
1228 VTK_ITER_ASSUME(this->NumComps.value > 0);
1229 return iterator{ this->Array, this->NumComps, this->TupleId, comp };
1230 }
1231
1232 VTK_ITER_INLINE
1233 const_iterator NewConstIterator(ComponentIdType comp) const noexcept
1234 {
1235 VTK_ITER_ASSUME(this->NumComps.value > 0);
1236 return const_iterator{ this->Array, this->NumComps, this->TupleId, comp };
1237 }
1238
1239 VTK_ITER_INLINE
1240 void CopyReference(const TupleReference& o) noexcept
1241 {
1242 // Must use same array, other array types may use different implementations.
1243 VTK_ITER_ASSERT(this->Array == o.Array, "Cannot copy reference objects between arrays.");
1244 this->NumComps = o.NumComps;
1245 this->TupleId = o.TupleId;
1246 }
1247
1248 mutable ArrayType* Array;
1249 NumCompsType NumComps;
1250 TupleIdType TupleId;
1251 };
1252
1253 //------------------------------------------------------------------------------
1254 // Const tuple iterator
1255 template <typename ArrayType, ComponentIdType TupleSize>
1256 struct ConstTupleIterator
1257 {
1258 private:
1259 static_assert(IsValidTupleSize<TupleSize>::value, "Invalid tuple size.");
1260 static_assert(IsVtkDataArray<ArrayType>::value, "Invalid array type.");
1261
1262 using NumCompsType = GenericTupleSize<TupleSize>;
1263
1264 public:
1265 using iterator_category = std::random_access_iterator_tag;
1266 using value_type = ConstTupleReference<ArrayType, TupleSize>;
1267 using difference_type = TupleIdType;
1268 using pointer = ConstTupleReference<ArrayType, TupleSize>;
1269 using reference = ConstTupleReference<ArrayType, TupleSize>;
1270
1271 VTK_ITER_INLINE
1272 ConstTupleIterator() noexcept = default;
1273
1274 VTK_ITER_INLINE
1275 ConstTupleIterator(ArrayType* array, NumCompsType numComps, TupleIdType tupleId) noexcept
1276 : Ref(array, numComps, tupleId)
1277 {
1278 VTK_ITER_ASSERT(array != nullptr, "Invalid array.");
1279 VTK_ITER_ASSERT(numComps.value > 0, "Invalid number of components.");
1280 VTK_ITER_ASSERT(tupleId >= 0 && tupleId <= array->GetNumberOfTuples(),
1281 "Const tuple iterator at invalid tuple id.");
1282 }
1283
1284 VTK_ITER_INLINE
1285 ConstTupleIterator(const TupleIterator<ArrayType, TupleSize>& o) noexcept
1286 : Ref{ o.Ref }
1287 {
1288 }
1289
1290 VTK_ITER_INLINE
1291 ConstTupleIterator(const ConstTupleIterator& o) noexcept = default;
1292 VTK_ITER_INLINE
1293 ConstTupleIterator& operator=(const ConstTupleIterator& o) noexcept
1294 {
1295 this->Ref.CopyReference(o.Ref);
1296 return *this;
1297 }
1298
1299 VTK_ITER_INLINE
1300 ConstTupleIterator& operator++() noexcept // prefix
1301 {
1302 ++this->Ref.TupleId;
1303 VTK_ITER_ASSERT(
1304 this->Ref.TupleId >= 0 && this->Ref.TupleId <= this->Ref.Array->GetNumberOfTuples(),
1305 "Const tuple iterator at invalid component id.");
1306 return *this;
1307 }
1308
1309 VTK_ITER_INLINE
1310 ConstTupleIterator operator++(int) noexcept // postfix
1311 {
1312 return ConstTupleIterator{ this->Ref.Array, this->Ref.NumComps, this->Ref.TupleId++ };
1313 }
1314
1315 VTK_ITER_INLINE
1316 ConstTupleIterator& operator--() noexcept // prefix
1317 {
1318 --this->Ref.TupleId;
1319 VTK_ITER_ASSERT(
1320 this->Ref.TupleId >= 0 && this->Ref.TupleId <= this->Ref.Array->GetNumberOfTuples(),
1321 "Const tuple iterator at invalid component id.");
1322 return *this;
1323 }
1324
1325 VTK_ITER_INLINE
1326 ConstTupleIterator operator--(int) noexcept // postfix
1327 {
1328 return ConstTupleIterator{ this->Ref.Array, this->Ref.NumComps, this->Ref.TupleId-- };
1329 }
1330
1331 VTK_ITER_INLINE
1332 reference operator[](difference_type i) noexcept
1333 {
1334 return reference{ this->GetArray(), this->GetNumComps(), this->GetTupleId() + i };
1335 }
1336
1337 VTK_ITER_INLINE
1338 reference operator*() noexcept { return this->Ref; }
1339
1340 VTK_ITER_INLINE
1341 pointer operator->() noexcept { return this->Ref; }
1342
1343 #define VTK_TMP_MAKE_OPERATOR(OP) \
1344 friend VTK_ITER_INLINE bool operator OP( \
1345 const ConstTupleIterator& lhs, const ConstTupleIterator& rhs) noexcept \
1346 { \
1347 VTK_ITER_ASSERT( \
1348 lhs.GetArray() == rhs.GetArray(), "Cannot compare iterators from different arrays."); \
1349 VTK_ITER_ASSUME(lhs.GetNumComps().value > 0); \
1350 VTK_ITER_ASSUME(lhs.GetNumComps().value == rhs.GetNumComps().value); \
1351 return lhs.GetTupleId() OP rhs.GetTupleId(); \
1352 }
1353
1354 VTK_TMP_MAKE_OPERATOR(==)
1355 VTK_TMP_MAKE_OPERATOR(!=)
1356 VTK_TMP_MAKE_OPERATOR(<)
1357 VTK_TMP_MAKE_OPERATOR(>)
1358 VTK_TMP_MAKE_OPERATOR(<=)
1359 VTK_TMP_MAKE_OPERATOR(>=)
1360
1361 #undef VTK_TMP_MAKE_OPERATOR
1362
1363 VTK_ITER_INLINE
1364 ConstTupleIterator& operator+=(difference_type offset) noexcept
1365 {
1366 this->Ref.TupleId += offset;
1367 VTK_ITER_ASSERT(
1368 this->Ref.TupleId >= 0 && this->Ref.TupleId <= this->Ref.Array->GetNumberOfTuples(),
1369 "Const tuple iterator at invalid component id.");
1370 return *this;
1371 }
1372
1373 friend VTK_ITER_INLINE ConstTupleIterator operator+(
1374 const ConstTupleIterator& it, difference_type offset) noexcept
1375 {
1376 return ConstTupleIterator{ it.GetArray(), it.GetNumComps(), it.GetTupleId() + offset };
1377 }
1378
1379 friend VTK_ITER_INLINE ConstTupleIterator operator+(
1380 difference_type offset, const ConstTupleIterator& it) noexcept
1381 {
1382 return ConstTupleIterator{ it.GetArray(), it.GetNumComps(), it.GetTupleId() + offset };
1383 }
1384
1385 VTK_ITER_INLINE
1386 ConstTupleIterator& operator-=(difference_type offset) noexcept
1387 {
1388 this->Ref.TupleId -= offset;
1389 VTK_ITER_ASSERT(
1390 this->Ref.TupleId >= 0 && this->Ref.TupleId <= this->Ref.Array->GetNumberOfTuples(),
1391 "Const tuple iterator at invalid component id.");
1392 return *this;
1393 }
1394
1395 friend VTK_ITER_INLINE ConstTupleIterator operator-(
1396 const ConstTupleIterator& it, difference_type offset) noexcept
1397 {
1398 return ConstTupleIterator{ it.GetArray(), it.GetNumComps(), it.GetTupleId() - offset };
1399 }
1400
1401 friend VTK_ITER_INLINE difference_type operator-(
1402 const ConstTupleIterator& it1, const ConstTupleIterator& it2) noexcept
1403 {
1404 VTK_ITER_ASSERT(it1.GetArray() == it2.GetArray(),
1405 "Cannot do math with tuple iterators from different "
1406 "arrays.");
1407 return it1.GetTupleId() - it2.GetTupleId();
1408 }
1409
1410 friend VTK_ITER_INLINE void swap(ConstTupleIterator& lhs, ConstTupleIterator& rhs) noexcept
1411 {
1412 // Different arrays may use different iterator implementations.
1413 VTK_ITER_ASSERT(
1414 lhs.GetArray() == rhs.GetArray(), "Cannot swap iterators from different arrays.");
1415
1416 using std::swap;
1417 swap(lhs.GetTupleId(), rhs.GetTupleId());
1418 }
1419
1420 private:
1421 VTK_ITER_INLINE
1422 ArrayType* GetArray() const noexcept { return this->Ref.Array; }
1423 VTK_ITER_INLINE
1424 ArrayType*& GetArray() noexcept { return this->Ref.Array; }
1425 VTK_ITER_INLINE
1426 NumCompsType GetNumComps() const noexcept { return this->Ref.NumComps; }
1427 VTK_ITER_INLINE
1428 NumCompsType& GetNumComps() noexcept { return this->Ref.NumComps; }
1429 VTK_ITER_INLINE
1430 TupleIdType GetTupleId() const noexcept { return this->Ref.TupleId; }
1431 VTK_ITER_INLINE
1432 TupleIdType& GetTupleId() noexcept { return this->Ref.TupleId; }
1433
1434 ConstTupleReference<ArrayType, TupleSize> Ref;
1435 };
1436
1437 //------------------------------------------------------------------------------
1438 // Tuple iterator
1439 template <typename ArrayType, ComponentIdType TupleSize>
1440 struct TupleIterator
1441 {
1442 private:
1443 static_assert(IsValidTupleSize<TupleSize>::value, "Invalid tuple size.");
1444 static_assert(IsVtkDataArray<ArrayType>::value, "Invalid array type.");
1445
1446 using NumCompsType = GenericTupleSize<TupleSize>;
1447
1448 public:
1449 using iterator_category = std::random_access_iterator_tag;
1450 using value_type = TupleReference<ArrayType, TupleSize>;
1451 using difference_type = TupleIdType;
1452 using pointer = TupleReference<ArrayType, TupleSize>;
1453 using reference = TupleReference<ArrayType, TupleSize>;
1454
1455 VTK_ITER_INLINE
1456 TupleIterator() noexcept = default;
1457
1458 VTK_ITER_INLINE
1459 TupleIterator(ArrayType* array, NumCompsType numComps, TupleIdType tupleId) noexcept
1460 : Ref(array, numComps, tupleId)
1461 {
1462 VTK_ITER_ASSERT(array != nullptr, "Invalid array.");
1463 VTK_ITER_ASSERT(numComps.value > 0, "Invalid number of components.");
1464 VTK_ITER_ASSERT(
1465 tupleId >= 0 && tupleId <= array->GetNumberOfTuples(), "Tuple iterator at invalid tuple id.");
1466 }
1467
1468 VTK_ITER_INLINE
1469 TupleIterator(const TupleIterator& o) noexcept = default;
1470
1471 VTK_ITER_INLINE
1472 TupleIterator& operator=(const TupleIterator& o) noexcept
1473 {
1474 this->Ref.CopyReference(o.Ref);
1475 return *this;
1476 }
1477
1478 VTK_ITER_INLINE
1479 TupleIterator& operator++() noexcept // prefix
1480 {
1481 ++this->Ref.TupleId;
1482 VTK_ITER_ASSERT(
1483 this->Ref.TupleId >= 0 && this->Ref.TupleId <= this->Ref.Array->GetNumberOfTuples(),
1484 "Tuple iterator at invalid component id.");
1485 return *this;
1486 }
1487
1488 VTK_ITER_INLINE
1489 TupleIterator operator++(int) noexcept // postfix
1490 {
1491 return TupleIterator{ this->Ref.Array, this->Ref.NumComps, this->Ref.TupleId++ };
1492 }
1493
1494 VTK_ITER_INLINE
1495 TupleIterator& operator--() noexcept // prefix
1496 {
1497 --this->Ref.TupleId;
1498 VTK_ITER_ASSERT(
1499 this->Ref.TupleId >= 0 && this->Ref.TupleId <= this->Ref.Array->GetNumberOfTuples(),
1500 "Tuple iterator at invalid component id.");
1501 return *this;
1502 }
1503
1504 VTK_ITER_INLINE
1505 TupleIterator operator--(int) noexcept // postfix
1506 {
1507 return TupleIterator{ this->Ref.Array, this->Ref.NumComps, this->Ref.TupleId-- };
1508 }
1509
1510 VTK_ITER_INLINE
1511 reference operator[](difference_type i) noexcept
1512 {
1513 return reference{ this->Ref.Array, this->Ref.NumComps, this->Ref.TupleId + i };
1514 }
1515
1516 VTK_ITER_INLINE
1517 reference operator*() noexcept { return this->Ref; }
1518
1519 VTK_ITER_INLINE
1520 pointer& operator->() noexcept { return this->Ref; }
1521
1522 #define VTK_TMP_MAKE_OPERATOR(OP) \
1523 friend VTK_ITER_INLINE bool operator OP( \
1524 const TupleIterator& lhs, const TupleIterator& rhs) noexcept \
1525 { \
1526 VTK_ITER_ASSERT( \
1527 lhs.GetArray() == rhs.GetArray(), "Cannot compare iterators from different arrays."); \
1528 VTK_ITER_ASSUME(lhs.GetNumComps().value > 0); \
1529 VTK_ITER_ASSUME(lhs.GetNumComps().value == rhs.GetNumComps().value); \
1530 return lhs.GetTupleId() OP rhs.GetTupleId(); \
1531 }
1532
1533 VTK_TMP_MAKE_OPERATOR(==)
1534 VTK_TMP_MAKE_OPERATOR(!=)
1535 VTK_TMP_MAKE_OPERATOR(<)
1536 VTK_TMP_MAKE_OPERATOR(>)
1537 VTK_TMP_MAKE_OPERATOR(<=)
1538 VTK_TMP_MAKE_OPERATOR(>=)
1539
1540 #undef VTK_TMP_MAKE_OPERATOR
1541
1542 VTK_ITER_INLINE
1543 TupleIterator& operator+=(difference_type offset) noexcept
1544 {
1545 this->Ref.TupleId += offset;
1546 VTK_ITER_ASSERT(
1547 this->Ref.TupleId >= 0 && this->Ref.TupleId <= this->Ref.Array->GetNumberOfTuples(),
1548 "Tuple iterator at invalid component id.");
1549 return *this;
1550 }
1551
1552 friend VTK_ITER_INLINE TupleIterator operator+(
1553 const TupleIterator& it, difference_type offset) noexcept
1554 {
1555 return TupleIterator{ it.GetArray(), it.GetNumComps(), it.GetTupleId() + offset };
1556 }
1557
1558 friend VTK_ITER_INLINE TupleIterator operator+(
1559 difference_type offset, const TupleIterator& it) noexcept
1560 {
1561 return TupleIterator{ it.GetArray(), it.GetNumComps(), it.GetTupleId() + offset };
1562 }
1563
1564 VTK_ITER_INLINE
1565 TupleIterator& operator-=(difference_type offset) noexcept
1566 {
1567 this->Ref.TupleId -= offset;
1568 VTK_ITER_ASSERT(
1569 this->Ref.TupleId >= 0 && this->Ref.TupleId <= this->Ref.Array->GetNumberOfTuples(),
1570 "Tuple iterator at invalid component id.");
1571 return *this;
1572 }
1573
1574 friend VTK_ITER_INLINE TupleIterator operator-(
1575 const TupleIterator& it, difference_type offset) noexcept
1576 {
1577 return TupleIterator{ it.GetArray(), it.GetNumComps(), it.GetTupleId() - offset };
1578 }
1579
1580 friend VTK_ITER_INLINE difference_type operator-(
1581 const TupleIterator& it1, const TupleIterator& it2) noexcept
1582 {
1583 VTK_ITER_ASSERT(it1.GetArray() == it2.GetArray(),
1584 "Cannot do math with tuple iterators from different "
1585 "arrays.");
1586 return it1.GetTupleId() - it2.GetTupleId();
1587 }
1588
1589 friend VTK_ITER_INLINE void swap(TupleIterator& lhs, TupleIterator& rhs) noexcept
1590 {
1591 // Different arrays may use different iterator implementations.
1592 VTK_ITER_ASSERT(
1593 lhs.GetArray() == rhs.GetArray(), "Cannot swap iterators from different arrays.");
1594
1595 using std::swap;
1596 swap(lhs.GetTupleId(), rhs.GetTupleId());
1597 }
1598
1599 friend struct ConstTupleIterator<ArrayType, TupleSize>;
1600 friend struct ConstTupleReference<ArrayType, TupleSize>;
1601
1602 protected:
1603 VTK_ITER_INLINE
1604 ArrayType* GetArray() const noexcept { return this->Ref.Array; }
1605 VTK_ITER_INLINE
1606 ArrayType*& GetArray() noexcept { return this->Ref.Array; }
1607 VTK_ITER_INLINE
1608 NumCompsType GetNumComps() const noexcept { return this->Ref.NumComps; }
1609 VTK_ITER_INLINE
1610 NumCompsType& GetNumComps() noexcept { return this->Ref.NumComps; }
1611 VTK_ITER_INLINE
1612 TupleIdType GetTupleId() const noexcept { return this->Ref.TupleId; }
1613 VTK_ITER_INLINE
1614 TupleIdType& GetTupleId() noexcept { return this->Ref.TupleId; }
1615
1616 TupleReference<ArrayType, TupleSize> Ref;
1617 };
1618
1619 //------------------------------------------------------------------------------
1620 // Tuple range
1621 template <typename ArrayTypeT, ComponentIdType TupleSize>
1622 struct TupleRange
1623 {
1624 private:
1625 using NumCompsType = GenericTupleSize<TupleSize>;
1626 static_assert(IsValidTupleSize<TupleSize>::value, "Invalid tuple size.");
1627 static_assert(IsVtkDataArray<ArrayTypeT>::value, "Invalid array type.");
1628
1629 public:
1630 using ArrayType = ArrayTypeT;
1631 using APIType = GetAPIType<ArrayType>;
1632 using TupleIteratorType = TupleIterator<ArrayType, TupleSize>;
1633 using ConstTupleIteratorType = ConstTupleIterator<ArrayType, TupleSize>;
1634 using TupleReferenceType = TupleReference<ArrayType, TupleSize>;
1635 using ConstTupleReferenceType = ConstTupleReference<ArrayType, TupleSize>;
1636 using ComponentIteratorType = ComponentIterator<ArrayType, TupleSize>;
1637 using ConstComponentIteratorType = ConstComponentIterator<ArrayType, TupleSize>;
1638 using ComponentReferenceType = ComponentReference<ArrayType, TupleSize>;
1639 using ConstComponentReferenceType = ConstComponentReference<ArrayType, TupleSize>;
1640 using ComponentType = APIType;
1641
1642 // May be DynamicTupleSize, or the actual tuple size.
1643 constexpr static ComponentIdType TupleSizeTag = TupleSize;
1644
1645 using size_type = TupleIdType;
1646 using iterator = TupleIteratorType;
1647 using const_iterator = ConstTupleIteratorType;
1648 using reference = TupleReferenceType;
1649 using const_reference = ConstTupleReferenceType;
1650
1651 VTK_ITER_INLINE
1652 TupleRange() noexcept = default;
1653
1654 VTK_ITER_INLINE
1655 TupleRange(ArrayType* arr, TupleIdType beginTuple, TupleIdType endTuple) noexcept
1656 : Array(arr)
1657 , NumComps(arr)
1658 , BeginTuple(beginTuple)
1659 , EndTuple(endTuple)
1660 {
1661 assert(this->Array);
1662 assert(beginTuple >= 0 && beginTuple <= endTuple);
1663 assert(endTuple >= 0 && endTuple <= this->Array->GetNumberOfTuples());
1664 }
1665
1666 VTK_ITER_INLINE
1667 TupleRange GetSubRange(TupleIdType beginTuple = 0, TupleIdType endTuple = -1) const noexcept
1668 {
1669 const TupleIdType realBegin = this->BeginTuple + beginTuple;
1670 const TupleIdType realEnd = endTuple >= 0 ? this->BeginTuple + endTuple : this->EndTuple;
1671
1672 return TupleRange{ this->Array, realBegin, realEnd };
1673 }
1674
1675 VTK_ITER_INLINE
1676 ArrayType* GetArray() const noexcept { return this->Array; }
1677 VTK_ITER_INLINE
1678 ComponentIdType GetTupleSize() const noexcept { return this->NumComps.value; }
1679 VTK_ITER_INLINE
1680 TupleIdType GetBeginTupleId() const noexcept { return this->BeginTuple; }
1681 VTK_ITER_INLINE
1682 TupleIdType GetEndTupleId() const noexcept { return this->EndTuple; }
1683
1684 VTK_ITER_INLINE
1685 size_type size() const noexcept { return this->EndTuple - this->BeginTuple; }
1686
1687 VTK_ITER_INLINE
1688 iterator begin() noexcept { return this->NewIter(this->BeginTuple); }
1689 VTK_ITER_INLINE
1690 iterator end() noexcept { return this->NewIter(this->EndTuple); }
1691
1692 VTK_ITER_INLINE
1693 const_iterator begin() const noexcept { return this->NewCIter(this->BeginTuple); }
1694 VTK_ITER_INLINE
1695 const_iterator end() const noexcept { return this->NewCIter(this->EndTuple); }
1696
1697 VTK_ITER_INLINE
1698 const_iterator cbegin() const noexcept { return this->NewCIter(this->BeginTuple); }
1699 VTK_ITER_INLINE
1700 const_iterator cend() const noexcept { return this->NewCIter(this->EndTuple); }
1701
1702 VTK_ITER_INLINE
1703 reference operator[](size_type i) noexcept
1704 {
1705 return reference{ this->Array, this->NumComps, this->BeginTuple + i };
1706 }
1707
1708 VTK_ITER_INLINE
1709 const_reference operator[](size_type i) const noexcept
1710 {
1711 return const_reference{ this->Array, this->NumComps, this->BeginTuple + i };
1712 }
1713
1714 private:
1715 VTK_ITER_INLINE
1716 iterator NewIter(TupleIdType t) const { return iterator{ this->Array, this->NumComps, t }; }
1717
1718 VTK_ITER_INLINE
1719 const_iterator NewCIter(TupleIdType t) const
1720 {
1721 return const_iterator{ this->Array, this->NumComps, t };
1722 }
1723
1724 mutable ArrayType* Array{ nullptr };
1725 NumCompsType NumComps{};
1726 TupleIdType BeginTuple{ 0 };
1727 TupleIdType EndTuple{ 0 };
1728 };
1729
1730 // Unimplemented, only used inside decltype in SelectTupleRange:
1731 template <typename ArrayType, ComponentIdType TupleSize>
1732 TupleRange<ArrayType, TupleSize> DeclareTupleRangeSpecialization(vtkDataArray*);
1733
1734 VTK_ABI_NAMESPACE_END
1735 } // end namespace detail
1736 } // end namespace vtk
1737
1738 VTK_ITER_OPTIMIZE_END
1739
1740 #endif // __VTK_WRAP__
1741
1742 // VTK-HeaderTest-Exclude: vtkDataArrayTupleRange_Generic.h
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
detail
Definition: vtkCellTreeLocator.h:59
vtkX3D::value
@ value
Definition: vtkX3D.h:220
vtkX3D::offset
@ offset
Definition: vtkX3D.h:438
vtk::detail::EnableIfStaticTupleSizes
typename std::enable_if< AreStaticTupleSizes< S1, S2 >::value, T >::type EnableIfStaticTupleSizes
Definition: vtkDataArrayMeta.h:112
vtk::detail::DeclareTupleRangeSpecialization
TupleRange< AOSArrayType, TupleSize > DeclareTupleRangeSpecialization(ArrayType *)
vtk::detail::EnableIfEitherTupleSizeIsDynamic
typename std::enable_if< IsEitherTupleSizeDynamic< S1, S2 >::value, T >::type EnableIfEitherTupleSizeIsDynamic
Definition: vtkDataArrayMeta.h:124
vtk
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
Definition: vtkSMPThreadLocalAPI.h:30
vtk::GetAPIType
typename detail::GetAPITypeImpl< ArrayType >::APIType GetAPIType
Definition: vtkDataArrayMeta.h:184
vtk::TupleIdType
vtkIdType TupleIdType
Definition: vtkDataArrayMeta.h:60
vtk::ComponentIdType
int ComponentIdType
Definition: vtkDataArrayMeta.h:59
vtkDataArrayAccessor
Efficient templated access to vtkDataArray.
Definition: vtkDataArrayAccessor.h:95
vtk::detail::ComponentIterator
Definition: vtkDataArrayTupleRange_Generic.h:550
vtk::detail::ComponentIterator::Ref
ComponentReference< ArrayType, TupleSize > Ref
Definition: vtkDataArrayTupleRange_Generic.h:733
vtk::detail::ComponentIterator::GetTupleId
TupleIdType & GetTupleId() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:726
vtk::detail::ComponentIterator::GetArray
ArrayType * GetArray() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:725
vtk::detail::ComponentIterator::GetComponentId
ComponentIdType & GetComponentId() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:728
vtk::detail::ComponentIterator::ComponentIterator
VTK_ITER_INLINE ComponentIterator(const ComponentIterator &o) noexcept=default
vtk::detail::ComponentIterator::operator[]
VTK_ITER_INLINE reference operator[](difference_type i) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:624
vtk::detail::ComponentIterator::GetNumComps
NumCompsType & GetNumComps() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:730
vtk::detail::ComponentIterator::operator->
VTK_ITER_INLINE const pointer & operator->() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:634
vtk::detail::ComponentIterator::value_type
APIType value_type
Definition: vtkDataArrayTupleRange_Generic.h:560
vtk::detail::ComponentIterator::operator-
friend VTK_ITER_INLINE difference_type operator-(const ComponentIterator &it1, const ComponentIterator &it2) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:697
vtk::detail::ComponentIterator::operator++
VTK_ITER_INLINE ComponentIterator operator++(int) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:601
vtk::detail::ComponentIterator::GetComponentId
const ComponentIdType & GetComponentId() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:729
vtk::detail::ComponentIterator::swap
friend VTK_ITER_INLINE void swap(ComponentIterator &lhs, ComponentIterator &rhs) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:709
vtk::detail::ComponentIterator::operator--
VTK_ITER_INLINE ComponentIterator operator--(int) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:617
vtk::detail::ComponentIterator::iterator_category
std::random_access_iterator_tag iterator_category
Definition: vtkDataArrayTupleRange_Generic.h:559
vtk::detail::ComponentIterator::operator-=
VTK_ITER_INLINE ComponentIterator & operator-=(difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:682
vtk::detail::ComponentIterator::operator=
VTK_ITER_INLINE ComponentIterator & operator=(const ComponentIterator &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:585
vtk::detail::ComponentIterator::operator+
friend VTK_ITER_INLINE ComponentIterator operator+(const ComponentIterator &it, difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:667
vtk::detail::ComponentIterator::GetNumComps
const NumCompsType & GetNumComps() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:731
vtk::detail::ComponentIterator::ComponentIterator
VTK_ITER_INLINE ComponentIterator() noexcept=default
vtk::detail::ComponentIterator::operator+=
VTK_ITER_INLINE ComponentIterator & operator+=(difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:659
vtk::detail::ComponentIterator::operator++
VTK_ITER_INLINE ComponentIterator & operator++() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:592
vtk::detail::ComponentIterator::operator*
VTK_ITER_INLINE reference operator*() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:631
vtk::detail::ComponentIterator::operator--
VTK_ITER_INLINE ComponentIterator & operator--() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:608
vtk::detail::ComponentIterator::operator+
friend VTK_ITER_INLINE ComponentIterator operator+(difference_type offset, const ComponentIterator &it) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:674
vtk::detail::ComponentIterator::operator-
friend VTK_ITER_INLINE ComponentIterator operator-(const ComponentIterator &it, difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:690
vtk::detail::ComponentIterator::difference_type
ComponentIdType difference_type
Definition: vtkDataArrayTupleRange_Generic.h:561
vtk::detail::ComponentIterator::GetTupleId
const TupleIdType & GetTupleId() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:727
vtk::detail::ComponentReference
Definition: vtkDataArrayTupleRange_Generic.h:145
vtk::detail::ComponentReference::operator++
VTK_ITER_INLINE ComponentReference operator++() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:283
vtk::detail::ComponentReference::ComponentReference
VTK_ITER_INLINE ComponentReference(ComponentReference &&o) noexcept=default
vtk::detail::ComponentReference::NumComps
NumCompsType NumComps
Definition: vtkDataArrayTupleRange_Generic.h:357
vtk::detail::ComponentReference::operator=
VTK_ITER_INLINE ComponentReference operator=(ComponentReference &&o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:205
vtk::detail::ComponentReference::operator++
VTK_ITER_INLINE APIType operator++(int) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:291
vtk::detail::ComponentReference::operator--
VTK_ITER_INLINE ComponentReference operator--() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:299
vtk::detail::ComponentReference::swap
friend VTK_ITER_INLINE void swap(ComponentReference lhs, ComponentReference rhs) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:248
vtk::detail::ComponentReference::ComponentId
ComponentIdType ComponentId
Definition: vtkDataArrayTupleRange_Generic.h:359
vtk::detail::ComponentReference::ComponentReference
VTK_ITER_INLINE ComponentReference() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:157
vtk::detail::ComponentReference::ComponentReference
VTK_ITER_INLINE ComponentReference(const ComponentReference &o) noexcept=default
vtk::detail::ComponentReference::swap
friend VTK_ITER_INLINE void swap(APIType &lhs, ComponentReference rhs) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:275
vtk::detail::ComponentReference::operator=
VTK_ITER_INLINE ComponentReference operator=(APIType val) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:239
vtk::detail::ComponentReference::swap
friend VTK_ITER_INLINE void swap(ComponentReference lhs, ComponentReference< OArray, OSize > rhs) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:256
vtk::detail::ComponentReference::ComponentReference
VTK_ITER_INLINE ComponentReference(ArrayType *array, NumCompsType numComps, TupleIdType tuple, ComponentIdType comp) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:166
vtk::detail::ComponentReference::value_type
APIType value_type
Definition: vtkDataArrayTupleRange_Generic.h:154
vtk::detail::ComponentReference::operator=
VTK_ITER_INLINE ComponentReference operator=(const ComponentReference< OArray, OSize > &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:223
vtk::detail::ComponentReference::swap
friend VTK_ITER_INLINE void swap(ComponentReference lhs, APIType &rhs) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:268
vtk::detail::ComponentReference::operator=
VTK_ITER_INLINE ComponentReference operator=(const ComponentReference &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:187
vtk::detail::ComponentReference::TupleId
TupleIdType TupleId
Definition: vtkDataArrayTupleRange_Generic.h:358
vtk::detail::ComponentReference::CopyReference
VTK_ITER_INLINE void CopyReference(const ComponentReference &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:348
vtk::detail::ComponentReference::Array
ArrayType * Array
Definition: vtkDataArrayTupleRange_Generic.h:356
vtk::detail::ConstComponentIterator
Definition: vtkDataArrayTupleRange_Generic.h:366
vtk::detail::ConstComponentIterator::operator+
friend VTK_ITER_INLINE ConstComponentIterator operator+(difference_type offset, const ConstComponentIterator &it) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:497
vtk::detail::ConstComponentIterator::operator-=
VTK_ITER_INLINE ConstComponentIterator & operator-=(difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:504
vtk::detail::ConstComponentIterator::ConstComponentIterator
VTK_ITER_INLINE ConstComponentIterator(const ConstComponentIterator &o) noexcept=default
vtk::detail::ConstComponentIterator::operator-
friend VTK_ITER_INLINE difference_type operator-(const ConstComponentIterator &it1, const ConstComponentIterator &it2) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:518
vtk::detail::ConstComponentIterator::operator+=
VTK_ITER_INLINE ConstComponentIterator & operator+=(difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:483
vtk::detail::ConstComponentIterator::iterator_category
std::random_access_iterator_tag iterator_category
Definition: vtkDataArrayTupleRange_Generic.h:374
vtk::detail::ConstComponentIterator::operator*
VTK_ITER_INLINE reference operator*() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:457
vtk::detail::ConstComponentIterator::operator--
VTK_ITER_INLINE ConstComponentIterator operator--(int) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:444
vtk::detail::ConstComponentIterator::operator++
VTK_ITER_INLINE ConstComponentIterator & operator++() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:419
vtk::detail::ConstComponentIterator::swap
friend VTK_ITER_INLINE void swap(ConstComponentIterator &lhs, ConstComponentIterator &rhs) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:528
vtk::detail::ConstComponentIterator::difference_type
ComponentIdType difference_type
Definition: vtkDataArrayTupleRange_Generic.h:376
vtk::detail::ConstComponentIterator::ConstComponentIterator
VTK_ITER_INLINE ConstComponentIterator(const ComponentIterator< ArrayType, TupleSize > &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:405
vtk::detail::ConstComponentIterator::operator=
VTK_ITER_INLINE ConstComponentIterator & operator=(const ConstComponentIterator &o) noexcept=default
vtk::detail::ConstComponentIterator::operator--
VTK_ITER_INLINE ConstComponentIterator & operator--() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:435
vtk::detail::ConstComponentIterator::operator-
friend VTK_ITER_INLINE ConstComponentIterator operator-(const ConstComponentIterator &it, difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:512
vtk::detail::ConstComponentIterator::ConstComponentIterator
VTK_ITER_INLINE ConstComponentIterator(ArrayType *array, NumCompsType numComps, TupleIdType tupleId, ComponentIdType comp) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:389
vtk::detail::ConstComponentIterator::operator++
VTK_ITER_INLINE ConstComponentIterator operator++(int) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:428
vtk::detail::ConstComponentIterator::ConstComponentIterator
VTK_ITER_INLINE ConstComponentIterator() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:381
vtk::detail::ConstComponentIterator::operator+
friend VTK_ITER_INLINE ConstComponentIterator operator+(const ConstComponentIterator &it, difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:491
vtk::detail::ConstComponentIterator::operator[]
VTK_ITER_INLINE reference operator[](difference_type i) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:451
vtk::detail::ConstComponentIterator::pointer
void pointer
Definition: vtkDataArrayTupleRange_Generic.h:377
vtk::detail::ConstComponentIterator::value_type
GetAPIType< ArrayType > value_type
Definition: vtkDataArrayTupleRange_Generic.h:375
vtk::detail::ConstComponentReference
Definition: vtkDataArrayTupleRange_Generic.h:52
vtk::detail::ConstComponentReference::value_type
APIType value_type
Definition: vtkDataArrayTupleRange_Generic.h:61
vtk::detail::ConstComponentReference::ConstComponentReference
VTK_ITER_INLINE ConstComponentReference(const ConstComponentReference &o) noexcept=default
vtk::detail::ConstComponentReference::ConstComponentReference
VTK_ITER_INLINE ConstComponentReference(const ComponentReference< ArrayType, TupleSize > &o)
Definition: vtkDataArrayTupleRange_Generic.h:89
vtk::detail::ConstComponentReference::operator=
VTK_ITER_INLINE ConstComponentReference & operator=(const ConstComponentReference &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:104
vtk::detail::ConstComponentReference::ConstComponentReference
VTK_ITER_INLINE ConstComponentReference(ArrayType *array, NumCompsType numComps, TupleIdType tuple, ComponentIdType comp) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:73
vtk::detail::ConstComponentReference::ConstComponentReference
VTK_ITER_INLINE ConstComponentReference() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:64
vtk::detail::ConstComponentReference::ConstComponentReference
VTK_ITER_INLINE ConstComponentReference(ConstComponentReference &&o) noexcept=default
vtk::detail::ConstComponentReference::operator=
VTK_ITER_INLINE ConstComponentReference & operator=(ConstComponentReference &&o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:115
vtk::detail::ConstComponentReference::Array
ArrayType * Array
Definition: vtkDataArrayTupleRange_Generic.h:135
vtk::detail::ConstComponentReference::TupleId
TupleIdType TupleId
Definition: vtkDataArrayTupleRange_Generic.h:137
vtk::detail::ConstComponentReference::NumComps
NumCompsType NumComps
Definition: vtkDataArrayTupleRange_Generic.h:136
vtk::detail::ConstComponentReference::ComponentId
ComponentIdType ComponentId
Definition: vtkDataArrayTupleRange_Generic.h:138
vtk::detail::ConstTupleIterator
Definition: vtkDataArrayTupleRange_Generic.h:1257
vtk::detail::ConstTupleIterator::difference_type
TupleIdType difference_type
Definition: vtkDataArrayTupleRange_Generic.h:1267
vtk::detail::ConstTupleIterator::swap
friend VTK_ITER_INLINE void swap(ConstTupleIterator &lhs, ConstTupleIterator &rhs) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1410
vtk::detail::ConstTupleIterator::operator--
VTK_ITER_INLINE ConstTupleIterator operator--(int) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1326
vtk::detail::ConstTupleIterator::operator+
friend VTK_ITER_INLINE ConstTupleIterator operator+(difference_type offset, const ConstTupleIterator &it) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1379
vtk::detail::ConstTupleIterator::operator*
VTK_ITER_INLINE reference operator*() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1338
vtk::detail::ConstTupleIterator::ConstTupleIterator
VTK_ITER_INLINE ConstTupleIterator() noexcept=default
vtk::detail::ConstTupleIterator::operator->
VTK_ITER_INLINE pointer operator->() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1341
vtk::detail::ConstTupleIterator::iterator_category
std::random_access_iterator_tag iterator_category
Definition: vtkDataArrayTupleRange_Generic.h:1265
vtk::detail::ConstTupleIterator::operator+
friend VTK_ITER_INLINE ConstTupleIterator operator+(const ConstTupleIterator &it, difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1373
vtk::detail::ConstTupleIterator::operator[]
VTK_ITER_INLINE reference operator[](difference_type i) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1332
vtk::detail::ConstTupleIterator::operator--
VTK_ITER_INLINE ConstTupleIterator & operator--() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1316
vtk::detail::ConstTupleIterator::operator-=
VTK_ITER_INLINE ConstTupleIterator & operator-=(difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1386
vtk::detail::ConstTupleIterator::operator-
friend VTK_ITER_INLINE ConstTupleIterator operator-(const ConstTupleIterator &it, difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1395
vtk::detail::ConstTupleIterator::ConstTupleIterator
VTK_ITER_INLINE ConstTupleIterator(const ConstTupleIterator &o) noexcept=default
vtk::detail::ConstTupleIterator::operator+=
VTK_ITER_INLINE ConstTupleIterator & operator+=(difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1364
vtk::detail::ConstTupleIterator::ConstTupleIterator
VTK_ITER_INLINE ConstTupleIterator(const TupleIterator< ArrayType, TupleSize > &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1285
vtk::detail::ConstTupleIterator::operator=
VTK_ITER_INLINE ConstTupleIterator & operator=(const ConstTupleIterator &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1293
vtk::detail::ConstTupleIterator::operator-
friend VTK_ITER_INLINE difference_type operator-(const ConstTupleIterator &it1, const ConstTupleIterator &it2) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1401
vtk::detail::ConstTupleIterator::operator++
VTK_ITER_INLINE ConstTupleIterator & operator++() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1300
vtk::detail::ConstTupleIterator::operator++
VTK_ITER_INLINE ConstTupleIterator operator++(int) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1310
vtk::detail::ConstTupleReference
Definition: vtkDataArrayTupleRange_Generic.h:740
vtk::detail::ConstTupleReference::TupleId
TupleIdType TupleId
Definition: vtkDataArrayTupleRange_Generic.h:923
vtk::detail::ConstTupleReference::operator!=
VTK_ITER_INLINE bool operator!=(const TupleReference< OArrayType, OSize > &o) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:868
vtk::detail::ConstTupleReference::operator==
VTK_ITER_INLINE EnableIfStaticTupleSizes< TupleSize, OSize, bool > operator==(const TupleReference< OArrayType, OSize > &other) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:805
vtk::detail::ConstTupleReference::Array
ArrayType * Array
Definition: vtkDataArrayTupleRange_Generic.h:921
vtk::detail::ConstTupleReference::operator==
VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic< TupleSize, OSize, bool > operator==(const TupleReference< OArrayType, OSize > &other) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:821
vtk::detail::ConstTupleReference::size
VTK_ITER_INLINE size_type size() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:886
vtk::detail::ConstTupleReference::operator==
VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic< TupleSize, OSize, bool > operator==(const ConstTupleReference< OArrayType, OSize > &other) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:853
vtk::detail::ConstTupleReference::ConstTupleReference
VTK_ITER_INLINE ConstTupleReference(ConstTupleReference &&) noexcept=default
vtk::detail::ConstTupleReference::NumComps
NumCompsType NumComps
Definition: vtkDataArrayTupleRange_Generic.h:922
vtk::detail::ConstTupleReference::ConstTupleReference
VTK_ITER_INLINE ConstTupleReference() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:756
vtk::detail::ConstTupleReference::operator->
VTK_ITER_INLINE const ConstTupleReference * operator->() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:791
vtk::detail::ConstTupleReference::end
VTK_ITER_INLINE const_iterator end() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:891
vtk::detail::ConstTupleReference::operator==
VTK_ITER_INLINE EnableIfStaticTupleSizes< TupleSize, OSize, bool > operator==(const ConstTupleReference< OArrayType, OSize > &other) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:837
vtk::detail::ConstTupleReference::begin
VTK_ITER_INLINE const_iterator begin() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:889
vtk::detail::ConstTupleReference::CopyReference
VTK_ITER_INLINE void CopyReference(const ConstTupleReference &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:913
vtk::detail::ConstTupleReference::size_type
ComponentIdType size_type
Definition: vtkDataArrayTupleRange_Generic.h:749
vtk::detail::ConstTupleReference::operator[]
VTK_ITER_INLINE const_reference operator[](size_type i) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:880
vtk::detail::ConstTupleReference::ConstTupleReference
VTK_ITER_INLINE ConstTupleReference(ArrayType *array, NumCompsType numComps, TupleIdType tupleId) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:763
vtk::detail::ConstTupleReference::ConstTupleReference
VTK_ITER_INLINE ConstTupleReference(const ConstTupleReference &) noexcept=default
vtk::detail::ConstTupleReference::GetTuple
VTK_ITER_INLINE void GetTuple(APIType *tuple) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:795
vtk::detail::ConstTupleReference::operator!=
VTK_ITER_INLINE bool operator!=(const ConstTupleReference< OArrayT, OSize > &o) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:874
vtk::detail::ConstTupleReference::value_type
APIType value_type
Definition: vtkDataArrayTupleRange_Generic.h:750
vtk::detail::ConstTupleReference::NewConstIterator
VTK_ITER_INLINE const_iterator NewConstIterator(ComponentIdType comp) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:906
vtk::detail::ConstTupleReference::operator=
VTK_ITER_INLINE ConstTupleReference & operator=(const ConstTupleReference &) noexcept=default
vtk::detail::ConstTupleReference::cbegin
VTK_ITER_INLINE const_iterator cbegin() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:894
vtk::detail::ConstTupleReference::ConstTupleReference
VTK_ITER_INLINE ConstTupleReference(const TupleReference< ArrayType, TupleSize > &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:775
vtk::detail::ConstTupleReference::cend
VTK_ITER_INLINE const_iterator cend() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:896
vtk::detail::GenericTupleSize
Definition: vtkDataArrayMeta.h:131
vtk::detail::IsValidTupleSize
Definition: vtkDataArrayMeta.h:86
vtk::detail::IsVtkDataArray
Definition: vtkDataArrayMeta.h:76
vtk::detail::TupleIterator
Definition: vtkDataArrayTupleRange_Generic.h:1441
vtk::detail::TupleIterator::GetTupleId
VTK_ITER_INLINE TupleIdType & GetTupleId() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1614
vtk::detail::TupleIterator::operator+
friend VTK_ITER_INLINE TupleIterator operator+(const TupleIterator &it, difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1552
vtk::detail::TupleIterator::GetArray
VTK_ITER_INLINE ArrayType *& GetArray() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1606
vtk::detail::TupleIterator::difference_type
TupleIdType difference_type
Definition: vtkDataArrayTupleRange_Generic.h:1451
vtk::detail::TupleIterator::swap
friend VTK_ITER_INLINE void swap(TupleIterator &lhs, TupleIterator &rhs) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1589
vtk::detail::TupleIterator::GetNumComps
VTK_ITER_INLINE NumCompsType GetNumComps() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1608
vtk::detail::TupleIterator::TupleIterator
VTK_ITER_INLINE TupleIterator(const TupleIterator &o) noexcept=default
vtk::detail::TupleIterator::operator=
VTK_ITER_INLINE TupleIterator & operator=(const TupleIterator &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1472
vtk::detail::TupleIterator::operator-
friend VTK_ITER_INLINE TupleIterator operator-(const TupleIterator &it, difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1574
vtk::detail::TupleIterator::operator->
VTK_ITER_INLINE pointer & operator->() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1520
vtk::detail::TupleIterator::GetTupleId
VTK_ITER_INLINE TupleIdType GetTupleId() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1612
vtk::detail::TupleIterator::operator--
VTK_ITER_INLINE TupleIterator & operator--() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1495
vtk::detail::TupleIterator::Ref
TupleReference< ArrayType, TupleSize > Ref
Definition: vtkDataArrayTupleRange_Generic.h:1616
vtk::detail::TupleIterator::operator-=
VTK_ITER_INLINE TupleIterator & operator-=(difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1565
vtk::detail::TupleIterator::GetArray
VTK_ITER_INLINE ArrayType * GetArray() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1604
vtk::detail::TupleIterator::operator[]
VTK_ITER_INLINE reference operator[](difference_type i) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1511
vtk::detail::TupleIterator::operator+
friend VTK_ITER_INLINE TupleIterator operator+(difference_type offset, const TupleIterator &it) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1558
vtk::detail::TupleIterator::operator*
VTK_ITER_INLINE reference operator*() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1517
vtk::detail::TupleIterator::GetNumComps
VTK_ITER_INLINE NumCompsType & GetNumComps() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1610
vtk::detail::TupleIterator::operator++
VTK_ITER_INLINE TupleIterator & operator++() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1479
vtk::detail::TupleIterator::operator++
VTK_ITER_INLINE TupleIterator operator++(int) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1489
vtk::detail::TupleIterator::operator--
VTK_ITER_INLINE TupleIterator operator--(int) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1505
vtk::detail::TupleIterator::operator-
friend VTK_ITER_INLINE difference_type operator-(const TupleIterator &it1, const TupleIterator &it2) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1580
vtk::detail::TupleIterator::iterator_category
std::random_access_iterator_tag iterator_category
Definition: vtkDataArrayTupleRange_Generic.h:1449
vtk::detail::TupleIterator::TupleIterator
VTK_ITER_INLINE TupleIterator() noexcept=default
vtk::detail::TupleIterator::operator+=
VTK_ITER_INLINE TupleIterator & operator+=(difference_type offset) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1543
vtk::detail::TupleRange
Definition: vtkDataArrayTupleRange_Generic.h:1623
vtk::detail::TupleRange::begin
VTK_ITER_INLINE const_iterator begin() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1693
vtk::detail::TupleRange::APIType
GetAPIType< ArrayType > APIType
Definition: vtkDataArrayTupleRange_Generic.h:1631
vtk::detail::TupleRange::GetBeginTupleId
VTK_ITER_INLINE TupleIdType GetBeginTupleId() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1680
vtk::detail::TupleRange::GetEndTupleId
VTK_ITER_INLINE TupleIdType GetEndTupleId() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1682
vtk::detail::TupleRange::ComponentType
APIType ComponentType
Definition: vtkDataArrayTupleRange_Generic.h:1640
vtk::detail::TupleRange::TupleIteratorType
TupleIterator< ArrayType, TupleSize > TupleIteratorType
Definition: vtkDataArrayTupleRange_Generic.h:1632
vtk::detail::TupleRange::TupleRange
VTK_ITER_INLINE TupleRange() noexcept=default
vtk::detail::TupleRange::size_type
TupleIdType size_type
Definition: vtkDataArrayTupleRange_Generic.h:1645
vtk::detail::TupleRange::operator[]
VTK_ITER_INLINE const_reference operator[](size_type i) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1709
vtk::detail::TupleRange::end
VTK_ITER_INLINE const_iterator end() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1695
vtk::detail::TupleRange::size
VTK_ITER_INLINE size_type size() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1685
vtk::detail::TupleRange::ConstTupleIteratorType
ConstTupleIterator< ArrayType, TupleSize > ConstTupleIteratorType
Definition: vtkDataArrayTupleRange_Generic.h:1633
vtk::detail::TupleRange::operator[]
VTK_ITER_INLINE reference operator[](size_type i) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1703
vtk::detail::TupleRange::const_iterator
ConstTupleIteratorType const_iterator
Definition: vtkDataArrayTupleRange_Generic.h:1647
vtk::detail::TupleRange::cend
VTK_ITER_INLINE const_iterator cend() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1700
vtk::detail::TupleRange::TupleReferenceType
TupleReference< ArrayType, TupleSize > TupleReferenceType
Definition: vtkDataArrayTupleRange_Generic.h:1634
vtk::detail::TupleRange::GetTupleSize
VTK_ITER_INLINE ComponentIdType GetTupleSize() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1678
vtk::detail::TupleRange::TupleSizeTag
constexpr static ComponentIdType TupleSizeTag
Definition: vtkDataArrayTupleRange_Generic.h:1643
vtk::detail::TupleRange::ArrayType
ArrayTypeT ArrayType
Definition: vtkDataArrayTupleRange_Generic.h:1630
vtk::detail::TupleRange::cbegin
VTK_ITER_INLINE const_iterator cbegin() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1698
vtk::detail::TupleRange::end
VTK_ITER_INLINE iterator end() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1690
vtk::detail::TupleRange::ConstTupleReferenceType
ConstTupleReference< ArrayType, TupleSize > ConstTupleReferenceType
Definition: vtkDataArrayTupleRange_Generic.h:1635
vtk::detail::TupleRange::iterator
TupleIteratorType iterator
Definition: vtkDataArrayTupleRange_Generic.h:1646
vtk::detail::TupleRange::GetSubRange
VTK_ITER_INLINE TupleRange GetSubRange(TupleIdType beginTuple=0, TupleIdType endTuple=-1) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1667
vtk::detail::TupleRange::GetArray
VTK_ITER_INLINE ArrayType * GetArray() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1676
vtk::detail::TupleRange::begin
VTK_ITER_INLINE iterator begin() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1688
vtk::detail::TupleReference
Definition: vtkDataArrayTupleRange_Generic.h:930
vtk::detail::TupleReference::operator=
VTK_ITER_INLINE TupleReference & operator=(const TupleReference &other) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:997
vtk::detail::TupleReference::SetTuple
VTK_ITER_INLINE void SetTuple(const APIType *tuple) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:988
vtk::detail::TupleReference::begin
VTK_ITER_INLINE const_iterator begin() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1212
vtk::detail::TupleReference::operator[]
VTK_ITER_INLINE reference operator[](size_type i) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1188
vtk::detail::TupleReference::value_type
APIType value_type
Definition: vtkDataArrayTupleRange_Generic.h:940
vtk::detail::TupleReference::TupleReference
VTK_ITER_INLINE TupleReference(const TupleReference &)=default
vtk::detail::TupleReference::GetTuple
VTK_ITER_INLINE void GetTuple(APIType *tuple) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:978
vtk::detail::TupleReference::cbegin
VTK_ITER_INLINE const_iterator cbegin() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1217
vtk::detail::TupleReference::swap
VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic< TupleSize, OSize, void > swap(TupleReference< OArrayType, OSize > other) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1165
vtk::detail::TupleReference::operator==
VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic< TupleSize, OSize, bool > operator==(const TupleReference< OArrayType, OSize > &other) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1089
vtk::detail::TupleReference::operator->
VTK_ITER_INLINE const TupleReference * operator->() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:974
vtk::detail::TupleReference::swap
friend VTK_ITER_INLINE void swap(TupleReference a, TupleReference b) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1179
vtk::detail::TupleReference::size_type
ComponentIdType size_type
Definition: vtkDataArrayTupleRange_Generic.h:939
vtk::detail::TupleReference::TupleReference
VTK_ITER_INLINE TupleReference(ArrayType *array, NumCompsType numComps, TupleIdType tupleId) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:954
vtk::detail::TupleReference::TupleReference
VTK_ITER_INLINE TupleReference(TupleReference &&) noexcept=default
vtk::detail::TupleReference::NewIterator
VTK_ITER_INLINE iterator NewIterator(ComponentIdType comp) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1226
vtk::detail::TupleReference::cend
VTK_ITER_INLINE const_iterator cend() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1219
vtk::detail::TupleReference::size
VTK_ITER_INLINE size_type size() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1204
vtk::detail::TupleReference::operator!=
VTK_ITER_INLINE bool operator!=(const TupleReference< OArrayType, OSize > &o) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1136
vtk::detail::TupleReference::TupleId
TupleIdType TupleId
Definition: vtkDataArrayTupleRange_Generic.h:1250
vtk::detail::TupleReference::CopyReference
VTK_ITER_INLINE void CopyReference(const TupleReference &o) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1240
vtk::detail::TupleReference::begin
VTK_ITER_INLINE iterator begin() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1207
vtk::detail::TupleReference::operator==
VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic< TupleSize, OSize, bool > operator==(const ConstTupleReference< OArrayType, OSize > &other) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1121
vtk::detail::TupleReference::swap
VTK_ITER_INLINE EnableIfStaticTupleSizes< TupleSize, OSize, void > swap(TupleReference< OArrayType, OSize > other) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1149
vtk::detail::TupleReference::operator[]
VTK_ITER_INLINE const_reference operator[](size_type i) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1194
vtk::detail::TupleReference::operator==
VTK_ITER_INLINE EnableIfStaticTupleSizes< TupleSize, OSize, bool > operator==(const ConstTupleReference< OArrayType, OSize > &other) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1105
vtk::detail::TupleReference::TupleReference
VTK_ITER_INLINE TupleReference() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:947
vtk::detail::TupleReference::Array
ArrayType * Array
Definition: vtkDataArrayTupleRange_Generic.h:1248
vtk::detail::TupleReference::operator=
VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic< TupleSize, OSize, TupleReference & > operator=(const TupleReference< OArrayType, OSize > &other) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1022
vtk::detail::TupleReference::operator=
VTK_ITER_INLINE EnableIfStaticTupleSizes< TupleSize, OSize, TupleReference & > operator=(const ConstTupleReference< OArrayType, OSize > &other) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1039
vtk::detail::TupleReference::end
VTK_ITER_INLINE const_iterator end() const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1214
vtk::detail::TupleReference::end
VTK_ITER_INLINE iterator end() noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1209
vtk::detail::TupleReference::operator=
VTK_ITER_INLINE EnableIfStaticTupleSizes< TupleSize, OSize, TupleReference & > operator=(const TupleReference< OArrayType, OSize > &other) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1005
vtk::detail::TupleReference::operator=
VTK_ITER_INLINE EnableIfEitherTupleSizeIsDynamic< TupleSize, OSize, TupleReference & > operator=(const ConstTupleReference< OArrayType, OSize > &other) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1056
vtk::detail::TupleReference::operator==
VTK_ITER_INLINE EnableIfStaticTupleSizes< TupleSize, OSize, bool > operator==(const TupleReference< OArrayType, OSize > &other) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1073
vtk::detail::TupleReference::fill
VTK_ITER_INLINE void fill(const value_type &v) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1201
vtk::detail::TupleReference::NumComps
NumCompsType NumComps
Definition: vtkDataArrayTupleRange_Generic.h:1249
vtk::detail::TupleReference::NewConstIterator
VTK_ITER_INLINE const_iterator NewConstIterator(ComponentIdType comp) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1233
vtk::detail::TupleReference::operator!=
VTK_ITER_INLINE bool operator!=(const ConstTupleReference< OArray, OSize > &o) const noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1142
vtk::detail::TupleReference::swap
friend VTK_ITER_INLINE void swap(TupleReference a, TupleReference< OArray, OSize > b) noexcept
Definition: vtkDataArrayTupleRange_Generic.h:1182
vtkAssume.h
vtkDataArrayAccessor.h
vtkDataArrayMeta.h
This file contains a variety of metaprogramming constructs for working with vtkDataArrays.
VTK_ITER_OPTIMIZE_START
#define VTK_ITER_OPTIMIZE_START
Definition: vtkDataArrayMeta.h:42
VTK_ITER_INLINE
#define VTK_ITER_INLINE
Definition: vtkDataArrayMeta.h:40
VTK_ITER_OPTIMIZE_END
#define VTK_ITER_OPTIMIZE_END
Definition: vtkDataArrayMeta.h:43
VTK_ITER_ASSERT
#define VTK_ITER_ASSERT(x, msg)
Definition: vtkDataArrayMeta.h:31
VTK_ITER_ASSUME
#define VTK_ITER_ASSUME
Definition: vtkDataArrayMeta.h:41
VTK_TMP_MAKE_OPERATOR
#define VTK_TMP_MAKE_OPERATOR(OP)
Definition: vtkDataArrayTupleRange_Generic.h:1522
VTK_REF_OP_OVERLOADS
#define VTK_REF_OP_OVERLOADS(Op, ImplOp)
Definition: vtkDataArrayTupleRange_Generic.h:314