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 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%");
87 return cpc_->get_contains(pip);
108 static IntKey get_exclusive_key() {
109 static IntKey k(
"exclusive consecutive numbering");
112 static ObjectKey get_exclusive_object_key() {
113 static ObjectKey k(
"exclusive consecutive container");
116 static bool get_contains(
Model *m,
119 ExclusiveConsecutivePairContainer::get_exclusive_object_key();
122 if ( !has_eok_0 || !has_eok_1 )
127 IntKey k = ExclusiveConsecutivePairContainer::get_exclusive_key();
130 return std::abs(ia - ib) == 1;
135 virtual std::size_t do_get_contents_hash()
const override {
return 0; }
149 for (
unsigned int i = 1; i < ps_.size(); ++i) {
150 f->apply_index(get_model(),
157 "ExclusiveConsecutivePairContainer%1%");
177 return ExclusiveConsecutivePairContainer::get_contains(m, pip);
189 IMPCONTAINER_END_NAMESPACE
virtual ParticleIndexPairs get_range_indexes() const =0
A shared container for Pairs.
Macros for various classes.
A container for Singletons.
void apply_generic(F *f) const
apply to each item in container
void apply_generic(F *f) const
apply to each item in container
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
A container which contains all consecutive particle pairs from an input list.
ParticlesTemp get_particles(Model *m, const ParticleIndexes &ps)
Get the particles from a list of indexes.
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pi) const override
Overload this method to specify the inputs.
virtual int get_value_index(Model *m, const ParticleIndexPair &pip) const override
Compute the predicate and the derivative if needed.
#define IMP_PAIR_CONTAINER_METHODS(Name)
Class for storing model, its restraints, constraints, and particles.
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pi) const override
Overload this method to specify the inputs.
virtual void do_destroy()
A smart pointer to a ref-counted Object that is a class member.
virtual int get_value_index(Model *, const ParticleIndexPair &pip) const override
Compute the predicate and the derivative if needed.
Store a list of ParticleIndexPairs.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
virtual ParticleIndexes get_all_possible_indexes() const =0
Get contained particles.
Abstract predicate function.
virtual ParticleIndexPairs get_indexes() const =0
bool get_has_attribute(TypeKey attribute_key, ParticleIndex particle) const
return true if particle has attribute with the specified key
Type get_attribute(TypeKey attribute_key, ParticleIndex particle)
get the value of the particle attribute with the specified key
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_PAIR_PREDICATE_METHODS(Name)
Define extra the functions needed for a PairPredicate.
Compile-time generic restraint and constraint support.