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

◆ sync_bonds_from_claims()

void MayaFlux::Nodes::Network::PhysicsOperator::sync_bonds_from_claims ( std::span< const uint32_t >  claimed_by)

Adopt this cycle's GPU claim/absorption clustering as bonds.

Parameters
claimed_byOne entry per particle, global index order: entry i equals i if i is a cluster root, or the root's index if i was absorbed into it. Same shape as MutationClaimProcessor's mutation_claimed_by state field, since it is meant to be called directly with that field's readback.

Bonded (non-root) particles are pulled toward their root each cycle by apply_bond_forces, a spring toward bond_rest_length rather than the root's own absorb_radius, so the CPU-simulated particle stays close to its cluster even on a cycle where the GPU claim graph (fully rebuilt from scratch every cycle, see ClaimInitProcessor) briefly finds no claim for it. Replaces any previously adopted bonds outright: there is no incremental merge, the whole table is the current cycle's snapshot.

Note
Entries in claimed_by are validated against m_accreted_mass's size before use as an index; an out-of-range entry is skipped rather than trusted, since claimed_by comes from a GPU readback.

Definition at line 578 of file PhysicsOperator.cpp.

579{
580 if (!m_bonds_enabled) {
581 return;
582 }
583
584 if (m_accreted_mass.size() != claimed_by.size()) {
585 m_accreted_mass.assign(claimed_by.size(), 1.0F);
586 }
587
588 for (size_t i = 0; i < claimed_by.size(); ++i) {
589 uint32_t root = claimed_by[i];
590 if (root == i || root >= m_accreted_mass.size()) {
591 continue;
592 }
594 m_accreted_mass[i] = 0.0F;
595 }
596
597 m_bond_root.assign(claimed_by.begin(), claimed_by.end());
598}
std::vector< float > m_accreted_mass
Lazily seeded to 1.0 per particle; see sync_bonds_from_claims.
std::vector< uint32_t > m_bond_root
Empty when no bonds are adopted; see sync_bonds_from_claims.

References m_accreted_mass, m_bond_root, and m_bonds_enabled.

Referenced by MayaFlux::Buffers::ClaimAccumulateProcessor::processing_function().

+ Here is the caller graph for this function: