示例#1
0
void Particle::do_show(std::ostream& out) const
{
  internal::PrefixStream preout(&out);
  preout << "index: " << get_index()
         << (get_is_active()? " (active)":" (dead)");
  preout << std::endl;

  if (get_is_part_of_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);
  }
}
示例#2
0
ParticleIndexKeys Particle::get_particle_keys() const {
  IMP_USAGE_CHECK(get_is_active(), "Inactive particle used.");
  return get_model()->internal::ParticleAttributeTable::get_attribute_keys(id_);
}
示例#3
0
void Particle::remove_attribute(ParticleIndexKey k) {
  IMP_USAGE_CHECK(get_is_active(), "Inactive particle used.");
  get_model()->remove_attribute(k, id_);
}
示例#4
0
void Particle::set_value(ParticleIndexKey k, Particle *v) {
  IMP_USAGE_CHECK(get_is_active(), "Inactive particle used.");
  get_model()->set_attribute(k, id_, v->get_index());
}
示例#5
0
bool Particle::has_attribute(ParticleIndexKey k) {
  IMP_USAGE_CHECK(get_is_active(), "Inactive particle used.");
  return get_model()->get_has_attribute(k, id_);
}
示例#6
0
void Particle::set_is_optimized(FloatKey k, bool tf) {
  IMP_USAGE_CHECK(get_is_active(), "Inactive particle used.");
  return get_model()->set_is_optimized(k, id_, tf);
}
示例#7
0
void Particle::add_to_derivative(FloatKey key, Float value,
                                 const DerivativeAccumulator &da) {
  IMP_USAGE_CHECK(get_is_active(), "Inactive particle used.");
  get_model()->add_to_derivative(key, id_, value, da);
}
示例#8
0
void Particle::add_attribute(FloatKey name, const Float initial_value,
                             bool optimized) {
  IMP_USAGE_CHECK(get_is_active(), "Inactive particle used.");
  get_model()->add_attribute(name, id_, initial_value);
  get_model()->set_is_optimized(name, id_, optimized);
}
示例#9
0
文件: Particle.cpp 项目: apolitis/imp
Particle *Particle::get_value(ParticleIndexKey k) const {
  IMP_USAGE_CHECK(get_is_active(), "Inactive particle used.");
  return get_model()->get_particle(get_model()->get_attribute(k, id_));
}
示例#10
0
文件: Particle.cpp 项目: apolitis/imp
Float Particle::get_derivative(FloatKey name) const {
  IMP_USAGE_CHECK(get_is_active(), "Inactive particle used.");
  return get_model()->get_derivative(name, id_);
}
示例#11
0
文件: Particle.cpp 项目: apolitis/imp
bool Particle::get_is_optimized(FloatKey k) const {
  IMP_USAGE_CHECK(get_is_active(), "Inactive particle used.");
  return get_model()->get_is_optimized(k, id_);
}