MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ declare_fields()

void MayaFlux::Buffers::MutationConfig::declare_fields ( const std::shared_ptr< NetworkGeometryBuffer > &  buffer) const

Declare the state fields the claim pipeline reads and writes.

Parameters
bufferBuffer to declare on. Already-present names are left untouched, matching NetworkGeometryBuffer::declare_state's own documented behaviour.

Declares mutation_claimed_by and mutation_swallow_count at hash.particle_count elements each, single-slot: every cycle's claim pass starts from a fresh claimed_by[i] = i and swallow_count[i] = 0 and overwrites the whole array, so there is nothing to carry across cycles in a second slot.

Also declares mutation_claim_events, a single uint32 counter reset to 0 each cycle by ClaimInitProcessor and incremented by ClaimProcessor for every neighbour pair it finds within absorb_radius. Its sole purpose is letting ClaimAccumulateProcessor decide, with a cheap single-word readback, whether the full claimed_by/swallow_count arrays are worth downloading this cycle at all.

Also declares mutation_accreted_mass, one float per particle. Unlike the fields above it is not reset each cycle: ClaimInitProcessor never touches it. ClaimAccumulateProcessor uploads PhysicsOperator's own accreted mass into it each cycle (see that class's own doc), and ClaimProcessor reads it back to scale capture_growth. swallow_count cannot serve this role because ClaimInitProcessor zeroes it before ClaimProcessor runs in the same cycle, so a read of swallow_count here would always see 0.

Does not declare a cluster id field of its own: hash_cluster_id belongs to SpatialHashConfig::declare_fields, since it is shared with HashDensityColorProcessor and must exist even when mutation is never enabled at all.

Definition at line 16 of file MutationClaimProcessor.cpp.

17{
18 buffer->declare_state("mutation_claimed_by", hash.particle_count, sizeof(uint32_t), false);
19 buffer->declare_state("mutation_swallow_count", hash.particle_count, sizeof(uint32_t), false);
20 buffer->declare_state("mutation_claim_events", 1, sizeof(uint32_t), false);
21 buffer->declare_state("mutation_accreted_mass", hash.particle_count, sizeof(float), false);
22}

References hash, and MayaFlux::Buffers::SpatialHashConfig::particle_count.