void Particle::show(std::ostream &out) const { internal::PrefixStream preout(&out); preout << "index: " << get_index() << (get_is_active() ? " (active)" : " (dead)"); preout << std::endl; if (get_model()) { { FloatKeys fks = get_float_keys(); if (!fks.empty()) { preout << "float attributes:" << std::endl; preout.set_prefix(" "); for (FloatKeys::const_iterator it = fks.begin(); it != fks.end(); ++it) { FloatKey k = *it; preout << k << ": " << get_model()->get_attribute(k, id_, false); preout << " (" << get_model()->get_derivative(k, id_, false) << ") "; preout << (get_is_optimized(k) ? " (optimized)" : ""); preout << std::endl; } preout.set_prefix(""); } } show_attributes(get_model(), get_int_keys(), id_, "int", IdentityValue(), preout); show_attributes(get_model(), get_string_keys(), id_, "string", IdentityValue(), preout); show_attributes( get_model(), get_model()->internal::ParticleAttributeTable::get_attribute_keys(id_), id_, "particle", NameValue(get_model()), preout); show_attributes( get_model(), get_model()->internal::ObjectAttributeTable::get_attribute_keys(id_), id_, "object", DirectNameValue(), preout); show_attributes( get_model(), get_model()->internal::ParticlesAttributeTable::get_attribute_keys(id_), id_, "particles", SizeValue<NameValue>(NameValue(get_model())), preout); show_attributes( get_model(), get_model()->internal::ObjectsAttributeTable::get_attribute_keys(id_), id_, "objects", SizeValue<DirectNameValue>(), preout); show_attributes( get_model(), get_model()->internal::IntsAttributeTable::get_attribute_keys(id_), id_, "ints", SizeValue<IdentityValue>(), preout); } }
void KMLProxy::initialize(Model *m,const Particles &ps, const FloatKeys &atts,unsigned int num_centers){ for(Particles::const_iterator it = ps.begin(); it != ps.end();it++) {ps_.push_back(*it);} for(FloatKeys::const_iterator it = atts.begin(); it != atts.end();it++) {atts_.push_back(*it);} m_ = m; kcenters_=num_centers; dim_=atts.size(); centroids_ = Particles(); data_ = new KMData(dim_,ps_.size()); for(unsigned int i=0;i<ps_.size(); i++) { for(unsigned int j=0;j<atts.size();j++){ (*(*data_)[i])[j]=ps_[i]->get_value(atts[j]); } } is_init_=true; }