UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ParticleIterator.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
5#include "Chaos/ParallelFor.h"
6#include "Chaos/Particles.h"
7#include "ChaosStats.h"
8
13
14namespace Chaos
15{
16template <typename TSOA>
17class TConstParticleView;
18
19template <typename TSOA>
20class TParticleView;
21
22template <typename TSOA>
23class TConstHandleView;
24
25template <typename TSOA>
26class THandleView;
27
28// The function ParticlesParallelFor may be called on ParticleViews, HandleViews,
29// or plain old manually curated arrays of either. In each case, the implementation
30// can differ. The following set of templates will select for the right case.
31//
32// Signatures:
33// Lambda: void(auto& Particle, int32 Index, const int32 ContextIndex)
34// ContextCreator: int32 (int32 WorkerIndex, int32 NumWorkers)
35//
36// There will be one context creation call per worker thread and they are all created prior
37// to starting the work. The ContextCreator should return the context index (which is
38// usually just the WorkerIndex but, for example, it can also be used to generate a single context
39// for use by all workers, assuming the context has appropriate locks in place.)
40//
41
42template <typename TParticleView, typename ContextCreatorType, typename Lambda>
43void ParticleViewParallelForImp(const TParticleView& Particles, const ContextCreatorType& ContextCreator, const Lambda& Func);
44
45template <typename THandleView, typename ContextCreatorType, typename Lambda>
46void HandleViewParallelForImp(const THandleView& HandleView, const ContextCreatorType& ContextCreator, const Lambda& Func);
47
48template <typename TSOA, typename ContextCreatorType, typename Lambda>
49void ParticlesParallelForImp(const TConstHandleView<TSOA>& Particles, const ContextCreatorType& ContextCreator, const Lambda& Func)
50{
52}
53
54template <typename TSOA, typename ContextCreatorType, typename Lambda>
55void ParticlesParallelForImp(const THandleView<TSOA>& Particles, const ContextCreatorType& ContextCreator, const Lambda& Func)
56{
58}
59
60template <typename TSOA, typename ContextCreatorType, typename Lambda>
62{
64}
65
66template <typename TSOA, typename ContextCreatorType, typename Lambda>
67void ParticlesParallelForImp(const TParticleView<TSOA>& Particles, const ContextCreatorType& ContextCreator, const Lambda& Func)
68{
70}
71
72template <typename TParticle, typename ContextCreatorType, typename Lambda>
73void ParticlesParallelForImp(const TArray<TParticle>& Particles, const ContextCreatorType& ContextCreator, const Lambda& Func)
74{
75 // When ParticlesParallelFor is called with a plain old TArray,
76 // just do normal parallelization.
77 const int32 Num = Particles.Num();
78 PhysicsParallelFor(Num, [&Func, &Particles](const int32 Index)
79 {
80 Func(Particles[Index], Index);
81 });
82}
83
84
85template <typename TView, typename ContextCreatorType, typename Lambda>
86void ParticlesSequentialFor(const TView& Particles, const ContextCreatorType& ContextCreator, const Lambda& Func)
87{
89
90 const int32 ContextIndex = ContextCreator(0, 1);
91 int32 Index = 0;
92 for (auto& Particle : Particles)
93 {
94 Func(Particle, Index++, ContextIndex);
95 }
96}
97
98template <typename TView, typename ContextCreatorType, typename Lambda>
99void ParticlesParallelFor(const TView& Particles, const ContextCreatorType& ContextCreator, const Lambda& Func, bool bForceSingleThreaded = false)
100{
102
104 {
106 }
107 else
108 {
110 }
111}
112
113template <typename TSOA>
115{
116public:
117 using THandle = typename TSOA::THandleType;
118
120 : Handles(nullptr)
121 , CurIdx(0)
122 {
123 }
124
127 , CurIdx(0)
128 {
130 {
131 operator++();
132 }
133 }
134
135 operator bool() const { return Handles && CurIdx < Handles->Num(); }
137 {
138 bool bFindNextHandle = true;
139 while(bFindNextHandle)
140 {
141 ++CurIdx;
143 }
144 return *this;
145 }
146
147 const THandle& operator*() const
148 {
149 return static_cast<const THandle&>(*(*Handles)[CurIdx]);
150 }
151
152 const THandle* operator->() const
153 {
154 return static_cast<const THandle*>((*Handles)[CurIdx]);
155 }
156
158 {
159 return Handles->Num();
160 }
161
162protected:
163 template <typename TSOA2>
164 friend class TConstHandleView;
165
168
170 {
171 return operator bool() && operator*().LightWeightDisabled();
172 }
173};
174
175template <typename TSOA>
177{
178public:
181 using Base::Handles;
182 using Base::CurIdx;
183
185 : Base()
186 {
187 }
188
193
195 {
196 return static_cast<THandle&>(*(*Handles)[CurIdx]);
197 }
198
200 {
201 return static_cast<THandle*>((*Handles)[CurIdx]);
202 }
203
204 template <typename TSOA2>
205 friend class THandleView;
206};
207
208template <typename THandle>
213
214template <typename THandle>
219
220template <typename TSOA>
222{
223public:
224 using THandle = typename TSOA::THandleType;
226 {
227 }
228
233
234 int32 Num() const
235 {
236 return Handles.Num();
237 }
238
241
243 TConstHandleIterator<TSOA> end() const { return End(); }
244
245 template <typename TParticleView, typename ContextCreatorType, typename Lambda>
246 friend void HandleViewParallelForImp(const TParticleView& Particles, const ContextCreatorType& ContextCreator, const Lambda& Func);
247
248 template <typename ContextCreatorType, typename Lambda>
249 void ParallelFor(const ContextCreatorType& ContextCreator, const Lambda& Func) const
250 {
252 }
253
254 template <typename Lambda>
255 void ParallelFor(const Lambda& Func) const
256 {
257 // Dummy context creator and a context-stripping function wrapper
258 auto EmptyContextCreator = [](int32 WorkerIndex, int32 NumWorkers) -> int32 { return WorkerIndex; };
259 auto ContextFunc = [&Func](auto& Particle, int32 Index, int32 WorkerIndex) { return Func(Particle, Index); };
261 }
262
263protected:
264
266};
267
268template <typename TSOA>
269class THandleView : public TConstHandleView<TSOA>
270{
271public:
274 using Base::Handles;
275 using Base::Num;
276
278 : Base()
279 {
280 }
281
286
288 THandleIterator<TSOA> begin() const { return Begin(); }
289
291 THandleIterator<TSOA> end() const { return End(); }
292
293 template <typename ContextCreatorType, typename Lambda>
294 void ParallelFor(const ContextCreatorType& ContextCreator, const Lambda& Func) const
295 {
297 }
298
299 template <typename Lambda>
300 void ParallelFor(const Lambda& Func) const
301 {
302 // Dummy context creator and a context-stripping function wrapper
303 auto EmptyContextCreator = [](int32 WorkerIndex, int32 NumWorkers) -> int32 { return WorkerIndex; };
304 auto ContextFunc = [&Func](auto& Particle, int32 Index, int32 WorkerIndex) { return Func(Particle, Index); };
306 }
307};
308
309template <typename THandle>
314
315template <typename THandle>
320
321template <typename TSOA>
323{
324 using THandle = typename TSOA::THandleType;
325
327 : SOA(nullptr)
328 , HandlesArray(nullptr)
329 {}
330
332 : SOA(InSOA)
333 , HandlesArray(nullptr)
334 {}
335
336 template <typename TDerivedHandle>
338 : SOA(nullptr)
339 {
340 static_assert(TIsDerivedFrom< TDerivedHandle, THandle >::IsDerived, "Trying to create a derived view on a base type");
341
342 //This is safe because the view is strictly read only in terms of the pointers
343 //I.e. we will never be in a case where we create a new base type and assign it to a derived pointer
344 //We are only using this to read data from the pointers and so having a more base API (which cannot modify the pointer) is safe
345 HandlesArray = reinterpret_cast<TArray<THandle*>*>(Handles);
346 }
347
348 TSOA* SOA;
350
351 int32 Size() const
352 {
353 return HandlesArray ? HandlesArray->Num() : SOA->Size();
354 }
355};
356
357template <typename TSOA>
359{
360public:
361 using THandle = typename TSOA::THandleType;
362 using THandleBase = typename THandle::THandleBase;
363 using TTransientHandle = typename THandle::TTransientHandle;
364
366 {
367 MoveToEnd();
368 }
369
372 , CurHandlesArray(nullptr)
373 , SOAIdx(0)
375 , DirtyValidationCount(INDEX_NONE)
376#endif
377 {
380 {
381 operator++();
382 }
383 }
384
386
387 operator bool() const { return TransientHandle.GeometryParticles != nullptr; }
388
389 // The non-parallel implementation of iteration should not deviate in behavior
390 // from the parallel implementation in \c ParticleViewParallelForImp(). They
391 // must be kept in sync.
393 {
395 bool bFindNextEnabledParticle = true;
397 {
398 if (CurHandlesArray == nullptr)
399 {
400 //SOA is packed efficiently for iteration
401 ++TransientHandle.ParticleIdx;
402 if (TransientHandle.ParticleIdx >= static_cast<int32>(CurSOASize))
403 {
404 IncSOAIdx();
405 }
406 }
407 else
408 {
409 ++CurHandleIdx;
411 {
412 // Reconstruct the TransientHandle so that it has a chance to update
413 // other data members, like the particle type in the case of geometry
414 // particles.
415 THandle* HandlePtr = (*CurHandlesArray)[CurHandleIdx];
416 THandleBase Handle(HandlePtr->GeometryParticles, HandlePtr->ParticleIdx);
417 TransientHandle = static_cast<TTransientHandle&>(Handle);
418 }
419 else
420 {
421 IncSOAIdx();
422 }
423 }
424
426 }
427
428 return *this;
429 }
430
432 {
434 return static_cast<const TTransientHandle&>(TransientHandle);
435 }
436
438 {
440 return static_cast<const TTransientHandle*>(&TransientHandle);
441 }
442
443protected:
444
446 {
447 return operator bool() && (operator*()).LightWeightDisabled();
448 }
449
451 {
452 SOAIdx = 0;
453 CurSOASize = 0;
454 CurHandleIdx = 0;
456 CurHandlesArray = nullptr;
457 }
458
460 {
461 while (SOAIdx < SOAViews->Num() && ((*SOAViews)[SOAIdx].Size() == 0))
462 {
463 ++SOAIdx;
464 }
465 CurHandleIdx = 0;
467 {
468 CurHandlesArray = (*SOAViews)[SOAIdx].HandlesArray;
469 TransientHandle = CurHandlesArray ? THandleBase((*CurHandlesArray)[0]->GeometryParticles, (*CurHandlesArray)[0]->ParticleIdx) : THandleBase((*SOAViews)[SOAIdx].SOA, 0);
470 CurSOASize = TransientHandle.GeometryParticles->Size();
471 }
472 else
473 {
474 MoveToEnd();
475 }
478 }
479
486
488 {
489#if PARTICLE_ITERATOR_RANGED_FOR_CHECK
490 if (CurHandlesArray)
491 {
492 check(DirtyValidationCount == CurHandlesArray->Num());
493 }
494 else if (TransientHandle.GeometryParticles)
495 {
496 check(DirtyValidationCount != INDEX_NONE);
497 check(TransientHandle.GeometryParticles->DirtyValidationCount() == DirtyValidationCount && TEXT("Iterating over particles while modifying the underlying SOA. Consider delaying any operations that require a Handle*"));
498 }
499#endif
500 }
501
503 {
504 ++SOAIdx;
506 }
507
509 {
510
511#if PARTICLE_ITERATOR_RANGED_FOR_CHECK
512 if (CurHandlesArray)
513 {
514 DirtyValidationCount = CurHandlesArray->Num();
515 }
516 else
517 {
518 DirtyValidationCount = TransientHandle.GeometryParticles ? TransientHandle.GeometryParticles->DirtyValidationCount() : INDEX_NONE;
519 }
520#endif
521 }
522
523#if PARTICLE_ITERATOR_RANGED_FOR_CHECK
524 int32 DirtyValidationCount;
525#endif
526};
527
528template <typename TSOA>
530{
531public:
536
538 : Base()
539 {
540 }
541
546
548 {
550 //const_cast ok because the const is operation is really about the iterator.The transient handle cannot change
551 return const_cast<TTransientHandle&>(static_cast<const TTransientHandle&>(TransientHandle));
552 }
553
555 {
557 //const_cast ok because the const is operation is really about the iterator. The transient handle cannot change
558 return const_cast<TTransientHandle*>(static_cast<const TTransientHandle*>(&TransientHandle));
559 }
560};
561
562template <typename TSOA>
567
568template <typename TSOA>
573
574
575template <typename TSOA>
577{
578public:
579 using THandle = typename TSOA::THandleType;
581 : Size(0)
582 {
583 }
584
587 , Size(0)
588 {
589 for (const auto& SOAView : SOAViews)
590 {
591 Size += SOAView.Size();
592 }
593 }
594
600
601 int32 Num() const
602 {
603 return Size;
604 }
605
608
611
612 template <typename ContextCreatorType, typename Lambda>
613 void ParallelFor(const ContextCreatorType& ContextCreator, const Lambda& Func, bool bForceSingleThreaded = false) const
614 {
616 }
617
618 template <typename Lambda>
619 void ParallelFor(const Lambda& Func, bool bForceSingleThreaded = false) const
620 {
621 // Dummy context creator and a context-stripping function wrapper
622 auto EmptyContextCreator = [](int32 WorkerIndex, int32 NumWorkers) -> int32 { return WorkerIndex; };
623 auto ContextFunc = [&Func](auto& Particle, int32 Index, int32 WorkerIndex) { return Func(Particle, Index); };
624
626 }
627
628 template <typename TParticleView, typename ContextCreatorType, typename Lambda>
629 friend void ParticleViewParallelForImp(const TParticleView& Particles, const ContextCreatorType& ContextCreator, const Lambda& Func);
630
631protected:
632
635};
636
637template <typename TSOAIn>
638class TParticleView : public TConstParticleView<TSOAIn>
639{
640public:
641 using TSOA = TSOAIn;
646
648 : Base()
649 {
650 }
651
656
658 TParticleIterator<TSOA> begin() const { return Begin(); }
659
661 TParticleIterator<TSOA> end() const { return End(); }
662
663 template <typename ContextCreatorType, typename Lambda>
664 void ParallelFor(const ContextCreatorType& ContextCreator, const Lambda& Func, bool bForceSingleThreaded = false) const
665 {
667 }
668
669 template <typename Lambda>
670 void ParallelFor(const Lambda& Func, bool bForceSingleThreaded = false) const
671 {
672 // Dummy context creator and a context-stripping function wrapper
673 auto EmptyContextCreator = [](int32 WorkerIndex, int32 NumWorkers) -> int32 { return WorkerIndex; };
674 auto ContextFunc = [&Func](auto& Particle, int32 Index, int32 WorkerIndex) { return Func(Particle, Index); };
675
677 }
678};
679
680template <typename TSOA>
685
686template <typename TSOA>
691
692template <typename TSOA>
697
698template <typename TSOA>
705
706template <typename TSOA>
713
714// The non-parallel implementation of iteration should not deviate in behavior from
715// this parallel implementation. They must be kept in sync.
716template <typename TParticleView, typename ContextCreatorType, typename Lambda>
718{
720
721 using TSOA = typename TParticleView::TSOA;
722 using THandle = typename TSOA::THandleType;
723 using THandleBase = typename THandle::THandleBase;
724 using TTransientHandle = typename THandle::TTransientHandle;
725
726 auto Func = [&UserFunc](auto& Handle, const int32 Idx, const int32 ContextIndex)
727 {
728 if (!Handle.LightWeightDisabled())
729 {
730 UserFunc(Handle, Idx, ContextIndex);
731 }
732 };
733
734 // Loop over every SOA in this view, skipping empty ones
736 for (int32 ViewIndex = 0; ViewIndex < Particles.SOAViews.Num(); ++ViewIndex)
737 {
738 const TSOAView<TSOA>& SOAView = Particles.SOAViews[ViewIndex];
739 const int32 ParticleCount = SOAView.Size();
740 if (ParticleCount == 0)
741 {
742 continue;
743 }
744
745 // Iterate over each element using normal parallel for
746 if (const TArray<THandle*>* CurHandlesArray = SOAView.HandlesArray)
747 {
748 // Do a regular parallel for over the handles in this SOA view
749 const int32 HandleCount = CurHandlesArray->Num();
750 PhysicsParallelForWithContext(HandleCount, ContextCreator, [&Func, CurHandlesArray, ParticleIdxOff](const int32 HandleIdx, const int32 ContextIndex)
751 {
752 // Reconstruct the TransientHandle so that it has a chance to update
753 // other data members, like the particle type in the case of geometry
754 // particles.
755 THandle* HandlePtr = (*CurHandlesArray)[HandleIdx];
756 THandleBase Handle(HandlePtr->GeometryParticles, HandlePtr->ParticleIdx);
757 Func(static_cast<TTransientHandle&>(Handle), ParticleIdxOff + HandleIdx, ContextIndex);
758 });
759 ParticleIdxOff += HandleCount;
760 }
761 else
762 {
763 // Do a regular parallel for over the particles in this SOA view
764 PhysicsParallelForWithContext(ParticleCount, ContextCreator, [&Func, &SOAView, ParticleIdxOff](const int32 ParticleIdx, const int32 ContextIndex)
765 {
766 // Reconstruct the TransientHandle so that it has a chance to update
767 // other data members, like the particle type in the case of geometry
768 // particles.
769 THandleBase Handle(SOAView.SOA, ParticleIdx);
770 Func(static_cast<TTransientHandle&>(Handle), ParticleIdxOff + ParticleIdx, ContextIndex);
771 });
772 ParticleIdxOff += ParticleCount;
773 }
774 }
775}
776
777template <typename THandleView, typename ContextCreatorType, typename Lambda>
779{
781
782 using THandle = typename THandleView::THandle;
783 const int32 HandleCount = HandleView.Handles.Num();
784 PhysicsParallelForWithContext(HandleCount, ContextCreator, [&HandleView, &Func](const int32 Index, const int32 ContextIndex)
785 {
786 if (!HandleView.Handles[Index]->LightWeightDisabled())
787 {
788 Func(static_cast<THandle&>(*HandleView.Handles[Index]), Index, ContextIndex);
789 }
790 });
791}
792
793}
#define check(expr)
Definition AssertionMacros.h:314
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define DECLARE_CYCLE_STAT(CounterName, StatId, GroupId)
Definition Stats.h:669
#define SCOPE_CYCLE_COUNTER(Stat)
Definition Stats.h:650
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
@ Num
Definition MetalRHIPrivate.h:234
const bool
Definition NetworkReplayStreaming.h:178
#define PARTICLE_ITERATOR_RANGED_FOR_CHECK
Definition Particles.h:14
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint32 Size
Definition VulkanMemory.cpp:4034
if(Failed) console_printf("Failed.\n")
Definition ParticleIterator.h:115
TConstHandleIterator()
Definition ParticleIterator.h:119
const THandle * operator->() const
Definition ParticleIterator.h:152
TConstHandleIterator(const TArray< THandle * > &InHandles)
Definition ParticleIterator.h:125
const THandle & operator*() const
Definition ParticleIterator.h:147
typename TSOA::THandleType THandle
Definition ParticleIterator.h:117
int32 ComputeSize() const
Definition ParticleIterator.h:157
TConstHandleIterator< TSOA > & operator++()
Definition ParticleIterator.h:136
const TArray< THandle * > * Handles
Definition ParticleIterator.h:166
bool CurrentIsLightWeightDisabled() const
Definition ParticleIterator.h:169
int32 CurIdx
Definition ParticleIterator.h:167
Definition ParticleIterator.h:222
TConstHandleIterator< TSOA > End() const
Definition ParticleIterator.h:242
void ParallelFor(const Lambda &Func) const
Definition ParticleIterator.h:255
TConstHandleView(const TArray< THandle * > &InHandles)
Definition ParticleIterator.h:229
typename TSOA::THandleType THandle
Definition ParticleIterator.h:224
TConstHandleIterator< TSOA > Begin() const
Definition ParticleIterator.h:239
void ParallelFor(const ContextCreatorType &ContextCreator, const Lambda &Func) const
Definition ParticleIterator.h:249
friend void HandleViewParallelForImp(const TParticleView &Particles, const ContextCreatorType &ContextCreator, const Lambda &Func)
const TArray< THandle * > & Handles
Definition ParticleIterator.h:265
TConstHandleIterator< TSOA > end() const
Definition ParticleIterator.h:243
TConstHandleView()
Definition ParticleIterator.h:225
int32 Num() const
Definition ParticleIterator.h:234
TConstHandleIterator< TSOA > begin() const
Definition ParticleIterator.h:240
Definition ParticleIterator.h:359
int32 CurSOASize
Definition ParticleIterator.h:484
TConstParticleIterator()
Definition ParticleIterator.h:365
const TTransientHandle * operator->() const
Definition ParticleIterator.h:437
TConstParticleIterator(const TConstParticleIterator &Rhs)=default
typename TSOA::THandleType THandle
Definition ParticleIterator.h:361
void SeekNonEmptySOA()
Definition ParticleIterator.h:459
TConstParticleIterator(const TArray< TSOAView< TSOA > > &InSOAViews)
Definition ParticleIterator.h:370
typename THandle::THandleBase THandleBase
Definition ParticleIterator.h:362
THandleBase TransientHandle
Definition ParticleIterator.h:482
const TArray< THandle * > * CurHandlesArray
Definition ParticleIterator.h:481
const TTransientHandle & operator*() const
Definition ParticleIterator.h:431
void SyncDirtyValidationCount()
Definition ParticleIterator.h:508
const TArray< TSOAView< TSOA > > * SOAViews
Definition ParticleIterator.h:480
void MoveToEnd()
Definition ParticleIterator.h:450
void RangedForValidation() const
Definition ParticleIterator.h:487
int32 CurHandleIdx
Definition ParticleIterator.h:485
int32 SOAIdx
Definition ParticleIterator.h:483
bool CurrentIsLightWeightDisabled() const
Definition ParticleIterator.h:445
void IncSOAIdx()
Definition ParticleIterator.h:502
TConstParticleIterator< TSOA > & operator++()
Definition ParticleIterator.h:392
typename THandle::TTransientHandle TTransientHandle
Definition ParticleIterator.h:363
Definition ParticleIterator.h:577
TConstParticleView()
Definition ParticleIterator.h:580
void ParallelFor(const ContextCreatorType &ContextCreator, const Lambda &Func, bool bForceSingleThreaded=false) const
Definition ParticleIterator.h:613
int32 Num() const
Definition ParticleIterator.h:601
typename TSOA::THandleType THandle
Definition ParticleIterator.h:579
void ParallelFor(const Lambda &Func, bool bForceSingleThreaded=false) const
Definition ParticleIterator.h:619
friend void ParticleViewParallelForImp(const TParticleView &Particles, const ContextCreatorType &ContextCreator, const Lambda &Func)
Definition ParticleIterator.h:717
TConstParticleIterator< TSOA > End() const
Definition ParticleIterator.h:609
int32 Size
Definition ParticleIterator.h:634
TConstParticleIterator< TSOA > end() const
Definition ParticleIterator.h:610
TConstParticleIterator< TSOA > Begin() const
Definition ParticleIterator.h:606
TConstParticleView(TArray< TSOAView< TSOA > > &&InSOAViews)
Definition ParticleIterator.h:585
TConstParticleIterator< TSOA > begin() const
Definition ParticleIterator.h:607
TConstParticleView(TSOAView< TSOA > &&InSOAView)
Definition ParticleIterator.h:595
TArray< TSOAView< TSOA > > SOAViews
Definition ParticleIterator.h:633
Definition ParticleIterator.h:177
THandle * operator->() const
Definition ParticleIterator.h:199
typename TSOA::THandleType THandle
Definition ParticleIterator.h:117
THandleIterator(const TArray< THandle * > &InHandles)
Definition ParticleIterator.h:189
THandle & operator*() const
Definition ParticleIterator.h:194
int32 CurIdx
Definition ParticleIterator.h:167
THandleIterator()
Definition ParticleIterator.h:184
Definition ParticleIterator.h:270
THandleIterator< TSOA > begin() const
Definition ParticleIterator.h:288
THandleView()
Definition ParticleIterator.h:277
void ParallelFor(const ContextCreatorType &ContextCreator, const Lambda &Func) const
Definition ParticleIterator.h:294
typename TSOA::THandleType THandle
Definition ParticleIterator.h:224
THandleIterator< TSOA > Begin() const
Definition ParticleIterator.h:287
void ParallelFor(const Lambda &Func) const
Definition ParticleIterator.h:300
const TArray< THandle * > & Handles
Definition ParticleIterator.h:265
THandleIterator< TSOA > End() const
Definition ParticleIterator.h:290
THandleView(const TArray< THandle * > &InHandles)
Definition ParticleIterator.h:282
THandleIterator< TSOA > end() const
Definition ParticleIterator.h:291
Definition Handles.h:93
Definition ParticleIterator.h:530
TParticleIterator()
Definition ParticleIterator.h:537
THandleBase TransientHandle
Definition ParticleIterator.h:482
TTransientHandle & operator*() const
Definition ParticleIterator.h:547
TTransientHandle * operator->() const
Definition ParticleIterator.h:554
void RangedForValidation() const
Definition ParticleIterator.h:487
TParticleIterator(const TArray< TSOAView< TSOA > > &InSOAs)
Definition ParticleIterator.h:542
typename Base::TTransientHandle TTransientHandle
Definition ParticleIterator.h:533
Definition ParticleIterator.h:639
void ParallelFor(const Lambda &Func, bool bForceSingleThreaded=false) const
Definition ParticleIterator.h:670
void ParallelFor(const ContextCreatorType &ContextCreator, const Lambda &Func, bool bForceSingleThreaded=false) const
Definition ParticleIterator.h:664
TParticleView(TArray< TSOAView< TSOA > > &&InSOAViews)
Definition ParticleIterator.h:652
TParticleIterator< TSOA > begin() const
Definition ParticleIterator.h:658
TParticleView()
Definition ParticleIterator.h:647
TParticleIterator< TSOA > End() const
Definition ParticleIterator.h:660
TParticleIterator< TSOA > end() const
Definition ParticleIterator.h:661
TSOAIn TSOA
Definition ParticleIterator.h:641
TParticleIterator< TSOA > Begin() const
Definition ParticleIterator.h:657
TArray< TSOAView< TSOA > > SOAViews
Definition ParticleIterator.h:633
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
Definition SkeletalMeshComponent.h:307
TConstHandleIterator< typename THandle::TSOAType > MakeConstHandleIterator(const TArray< THandle * > &Handles)
Definition ParticleIterator.h:209
void CHAOS_API PhysicsParallelForWithContext(int32 InNum, TFunctionRef< int32(int32, int32)> InContextCreator, TFunctionRef< void(int32, int32)> InCallable, bool bForceSingleThreaded=false)
Definition Parallel.cpp:162
void ParticlesParallelFor(const TView &Particles, const ContextCreatorType &ContextCreator, const Lambda &Func, bool bForceSingleThreaded=false)
Definition ParticleIterator.h:99
TConstParticleIterator< TSOA > MakeConstParticleIterator(const TArray< TSOAView< TSOA > > &SOAs)
Definition ParticleIterator.h:563
TConstParticleView< TSOA > MakeConstParticleView(TArray< TSOAView< TSOA > > &&SOAViews)
Definition ParticleIterator.h:681
void CHAOS_API PhysicsParallelFor(int32 InNum, TFunctionRef< void(int32)> InCallable, bool bForceSingleThreaded=false)
Definition Parallel.cpp:55
TParticleView< TSOA > MakeParticleView(TArray< TSOAView< TSOA > > &&SOAViews)
Definition ParticleIterator.h:693
THandleIterator< typename THandle::TSOAType > MakeHandleIterator(const TArray< THandle * > &Handles)
Definition ParticleIterator.h:215
TParticleIterator< TSOA > MakeParticleIterator(const TArray< TSOAView< TSOA > > &SOAs)
Definition ParticleIterator.h:569
void ParticleViewParallelForImp(const TParticleView &Particles, const ContextCreatorType &ContextCreator, const Lambda &Func)
Definition ParticleIterator.h:717
void ParticlesSequentialFor(const TView &Particles, const ContextCreatorType &ContextCreator, const Lambda &Func)
Definition ParticleIterator.h:86
THandleView< typename THandle::TSOAType > MakeHandleView(const TArray< THandle * > &Handles)
Definition ParticleIterator.h:316
void HandleViewParallelForImp(const THandleView &HandleView, const ContextCreatorType &ContextCreator, const Lambda &Func)
Definition ParticleIterator.h:778
CHAOS_API bool bDisableParticleParallelFor
Definition Parallel.cpp:19
TConstHandleView< typename THandle::TSOAType > MakeConstHandleView(const TArray< THandle * > &Handles)
Definition ParticleIterator.h:310
void ParticlesParallelForImp(const TConstHandleView< TSOA > &Particles, const ContextCreatorType &ContextCreator, const Lambda &Func)
Definition ParticleIterator.h:49
U16 Index
Definition radfft.cpp:71
Definition ParticleIterator.h:323
TArray< THandle * > * HandlesArray
Definition ParticleIterator.h:349
typename TSOA::THandleType THandle
Definition ParticleIterator.h:324
TSOAView(TSOA *InSOA)
Definition ParticleIterator.h:331
int32 Size() const
Definition ParticleIterator.h:351
TSOAView(TArray< TDerivedHandle * > *Handles)
Definition ParticleIterator.h:337
TSOA * SOA
Definition ParticleIterator.h:348
TSOAView()
Definition ParticleIterator.h:326
Definition UnrealTypeTraits.h:40