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
40 if (!get_model()->get_has_attribute(key_, p[0]))
return false;
41 int ia = get_model()->get_attribute(key_, p[0]);
42 if (!get_model()->get_has_attribute(key_, p[1]))
return false;
43 int ib = get_model()->get_attribute(key_, p[1]);
44 return std::abs(ia - ib) == 1;
48 virtual std::size_t do_get_contents_hash()
const IMP_OVERRIDE {
return 0; }
54 for (
unsigned int i = 1; i < ps_.size(); ++i) {
55 f->apply_index(get_model(),
61 std::string name =
"ConsecutivePairContainer%1%");
65 virtual kernel::
ParticleIndexes get_all_possible_indexes() const IMP_OVERRIDE;
86 return cpc_->get_contains(pip);
107 static IntKey get_exclusive_key() {
108 static IntKey k(
"exclusive consecutive numbering");
111 static ObjectKey get_exclusive_object_key() {
112 static ObjectKey k(
"exclusive consecutive container");
118 ExclusiveConsecutivePairContainer::get_exclusive_object_key();
119 bool has_eok_0 = m->get_has_attribute(ok, pp[0]);
120 bool has_eok_1= m->get_has_attribute(ok, pp[1]);
121 if ( !has_eok_0 || !has_eok_1 )
126 IntKey k = ExclusiveConsecutivePairContainer::get_exclusive_key();
129 return std::abs(ia - ib) == 1;
134 virtual std::size_t do_get_contents_hash()
const IMP_OVERRIDE {
return 0; }
148 for (
unsigned int i = 1; i < ps_.size(); ++i) {
149 f->apply_index(get_model(),
157 "ExclusiveConsecutivePairContainer%1%");
161 virtual kernel::
ParticleIndexes get_all_possible_indexes() const IMP_OVERRIDE;
176 return ExclusiveConsecutivePairContainer::get_contains(m, pip);
188 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 member.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
ParticlesTemp get_particles(kernel::Model *m, const ParticleIndexes &ps)
A container which contains all consecutive particle 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.
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
virtual void do_destroy()
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for storing model, its restraints, constraints, and particles.
Import IMP/kernel/generic.h in the namespace.