8 #ifndef IMPCONTAINER_CONSECUTIVE_PAIR_CONTAINER_H
9 #define IMPCONTAINER_CONSECUTIVE_PAIR_CONTAINER_H
11 #include <IMP/container/container_config.h>
17 #include <boost/unordered_map.hpp>
20 IMPCONTAINER_BEGIN_NAMESPACE
41 if (!get_model()->get_has_attribute(key_, p[0]))
return false;
42 int ia = get_model()->get_attribute(key_, p[0]);
43 if (!get_model()->get_has_attribute(key_, p[1]))
return false;
44 int ib = get_model()->get_attribute(key_, p[1]);
45 return std::abs(ia - ib) == 1;
49 virtual std::size_t do_get_contents_hash()
const IMP_OVERRIDE {
return 0; }
55 for (
unsigned int i = 1; i < ps_.size(); ++i) {
56 f->apply_index(get_model(),
62 std::string name =
"ConsecutivePairContainer%1%");
66 virtual kernel::
ParticleIndexes get_all_possible_indexes() const IMP_OVERRIDE;
84 return cpc_->get_contains(pip);
105 static IntKey get_exclusive_key() {
106 static IntKey k(
"exclusive consecutive numbering");
109 static ObjectKey get_exclusive_object_key() {
110 static ObjectKey k(
"exclusive consecutive container");
116 ExclusiveConsecutivePairContainer::get_exclusive_object_key();
117 if (!m->get_has_attribute(ok, pp[0]) || !m->get_has_attribute(ok, pp[1]))
122 IntKey k = ExclusiveConsecutivePairContainer::get_exclusive_key();
125 return std::abs(ia - ib) == 1;
130 virtual std::size_t do_get_contents_hash()
const IMP_OVERRIDE {
return 0; }
136 for (
unsigned int i = 1; i < ps_.size(); ++i) {
137 f->apply_index(get_model(),
145 "ExclusiveConsecutivePairContainer%1%");
149 virtual kernel::
ParticleIndexes get_all_possible_indexes() const IMP_OVERRIDE;
164 return ExclusiveConsecutivePairContainer::get_contains(m, pip);
176 IMPCONTAINER_END_NAMESPACE
virtual int get_value_index(kernel::Model *, const kernel::ParticleIndexPair &pip) const
Compute the predicate and the derivative if needed.
Import IMP/kernel/pair_macros.h in the namespace.
IMP::base::Vector< IMP::base::WeakPointer< kernel::ModelObject > > ModelObjectsTemp
Import IMP/kernel/SingletonContainer.h in the namespace.
void apply_generic(F *f) const
apply to each item in container
void apply_generic(F *f) const
apply to each item in container
A smart pointer to a ref-counted Object that is a class memeber.
ParticlesTemp get_particles(kernel::Model *m, const ParticleIndexes &ps)
A container which contains all consecutive pairs from an input list.
#define IMP_PAIR_CONTAINER_METHODS(Name)
virtual kernel::ParticleIndexPairs get_indexes() const =0
A shared container for Pairs.
Type get_attribute(TypeKey attribute_key, ParticleIndex particle)
A class to store an fixed array of same-typed values.
virtual int get_value_index(kernel::Model *m, const kernel::ParticleIndexPair &pip) const
Compute the predicate and the derivative if needed.
Import IMP/kernel/PairContainer.h in the namespace.
Import IMP/kernel/PairPredicate.h in the namespace.
virtual kernel::ModelObjectsTemp do_get_inputs(kernel::Model *m, const kernel::ParticleIndexes &pi) const
#define IMP_PAIR_PREDICATE_METHODS(Name)
Define extra the functions needed for a PairPredicate.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
virtual kernel::ModelObjectsTemp do_get_inputs(kernel::Model *m, const kernel::ParticleIndexes &pi) const
Store a list of kernel::ParticlePairsTemp.
Abstract predicate function.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
IMP::kernel::PairPredicate PairPredicate
Class for storing model, its restraints, constraints, and particles.
Import IMP/kernel/generic.h in the namespace.