Class ChunkedCallbackSystem
Chunk-parallel CallbackSystem that's invoked N times in parallel across workers, where N is the chunk count declared via ChunkedParallel(int) in Configure(SystemBuilder). Each invocation receives ChunkIndex / ChunkCount so the implementation can compute its own data slice.
Designed for non-entity-iterating chunkable work: SIMD sweeps over flat arrays, parallel reductions, image downsamples, etc. Skips all entity-prep infrastructure that a QuerySystem would set up — no Accessor, no Entities, no per-chunk Transaction.
Typical use in Configure(SystemBuilder):
protected override void Configure(SystemBuilder b) => b
.Name("PheroMaxReduce")
.Phase(MyPhase)
.ReadsResource("PheromoneGrid")
.WritesResource("HeatFoodAccum")
.ChunkedParallel(chunkCount: 16);
Inside Execute(TickContext), compute the per-chunk slice from the TickContext:
protected override void Execute(TickContext ctx) {
int start = (int)((long)ctx.ChunkIndex * sourceLen / ctx.ChunkCount);
int end = (int)((long)(ctx.ChunkIndex + 1) * sourceLen / ctx.ChunkCount);
for (int i = start; i < end; i++) { /* ... */ }
}
public abstract class ChunkedCallbackSystem : CallbackSystem, ISystem
- Inheritance
-
ChunkedCallbackSystem
- Implements
- Derived
- Inherited Members
Constructors
ChunkedCallbackSystem()
protected ChunkedCallbackSystem()