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

◆ get_total_mass()

float MayaFlux::Nodes::Network::PhysicsOperator::get_total_mass ( ) const

Sum of every particle's accreted mass.

Returns
particle count before bonds have ever synced (each particle starts at mass 1.0), and exactly that same value forever after, since transfer neither creates nor destroys mass. Useful as a caller's own reference point for what fraction of the whole system a given body currently represents.

Definition at line 630 of file PhysicsOperator.cpp.

631{
632 if (m_accreted_mass.empty()) {
633 float count = 0.0F;
634 for (const auto& group : m_collections) {
635 count += static_cast<float>(group.collection->get_point_count());
636 }
637 return count;
638 }
639
640 float total = 0.0F;
641 for (float mass : m_accreted_mass) {
642 total += mass;
643 }
644 return total;
645}
size_t count
std::vector< CollectionGroup > m_collections
std::vector< float > m_accreted_mass
Lazily seeded to 1.0 per particle; see sync_bonds_from_claims.

References count, m_accreted_mass, and m_collections.