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

◆ extract_vertex_attributes()

std::vector< std::pair< std::string, Kakshya::DataVariant > > MayaFlux::Nodes::Network::PhysicsOperator::extract_vertex_attributes ( ) const
overridevirtual

Adds "mass" (PhysicsState::mass) and "accreted_mass" (get_accreted_mass_span()) as named float attributes, in the same global vertex-index order get_vertex_data() produces.

Reads m_accreted_mass directly rather than calling get_accreted_mass_span(), which is non-const (it lazily seeds m_accreted_mass on first call): this override must stay const, so that method's own default of 1.0F per particle before the first sync_bonds_from_claims is replicated here instead.

Cluster/collection membership is not repeated here: a consumer already gets that from build_cluster_ids(), which this class already overrides.

Reimplemented from MayaFlux::Nodes::Network::GraphicsOperator.

Definition at line 823 of file PhysicsOperator.cpp.

824{
825 std::vector<float> mass;
826 mass.reserve(get_point_count());
827 for (const auto& group : m_collections) {
828 for (const auto& state : group.physics_state) {
829 mass.push_back(state.mass);
830 }
831 }
832
833 std::vector<std::pair<std::string, Kakshya::DataVariant>> attributes;
834 attributes.emplace_back("mass", std::move(mass));
835
836 std::vector<float> accreted(m_accreted_mass.empty() ? get_point_count() : m_accreted_mass.size(), 1.0F);
837 if (!m_accreted_mass.empty()) {
838 std::copy(m_accreted_mass.begin(), m_accreted_mass.end(), accreted.begin());
839 }
840 attributes.emplace_back("accreted_mass", std::move(accreted));
841
842 return attributes;
843}
size_t get_point_count() const override
Get source point count (before topology expansion)
std::vector< CollectionGroup > m_collections
std::vector< float > m_accreted_mass
Lazily seeded to 1.0 per particle; see sync_bonds_from_claims.

References get_point_count(), m_accreted_mass, and m_collections.

+ Here is the call graph for this function: