Navigation
API > API/Runtime > API/Runtime/Chaos > API/Runtime/Chaos/Chaos
References
Module | Chaos |
Header | /Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/ParticleIterator.h |
Include | #include "Chaos/ParticleIterator.h" |
namespace Chaos
{
template<typename TParticleView, typename ContextCreatorType, typename Lambda>
void Chaos&58;&58;ParticleViewParallelForImp
&40;
const TParticleView & Particles,
const ContextCreatorType & ContextCreator,
const Lambda & Func
&41;
}
Remarks
The function ParticlesParallelFor may be called on ParticleViews, HandleViews, or plain old manually curated arrays of either. In each case, the implementation can differ. The following set of templates will select for the right case.
Signatures: Lambda: void(auto& Particle, int32 Index, const int32 ContextIndex) ContextCreator: int32 (int32 WorkerIndex, int32 NumWorkers)
There will be one context creation call per worker thread and they are all created prior to starting the work. The ContextCreator should return the context index (which is usually just the WorkerIndex but, for example, it can also be used to generate a single context for use by all workers, assuming the context has appropriate locks in place.)
The non-parallel implementation of iteration should not deviate in behavior from this parallel implementation. They must be kept in sync.