13 #ifndef IMPCONTAINER_PREDICATE_SINGLETONS_RESTRAINT_H
14 #define IMPCONTAINER_PREDICATE_SINGLETONS_RESTRAINT_H
16 #include <IMP/container/container_config.h>
21 #if IMP_CONTAINER_HAS_ROBIN_MAP==1
22 #define IMP_CONTAINER_PREDICATE_USE_ROBIN_MAP
23 #include <tsl/robin_map.h>
24 #elif IMP_CONTAINER_HAS_GOOGLE_DENSE_HASH_MAP==1
25 #define IMP_CONTAINER_PREDICATE_USE_GOOGLE_DENSE_HASH_MAP
26 #include <google/dense_hash_map>
28 #define IMP_CONTAINER_PREDICATE_USE_KERNEL_MAP
36 IMPCONTAINER_BEGIN_NAMESPACE
50 #if IMP_CONTAINER_HAS_ROBIN_MAP==1
51 typedef tsl::robin_map<int, ParticleIndexes> t_lists_map;
52 typedef tsl::robin_map<int, PointerMember<SingletonScore> > t_score_map;
53 #elif IMP_CONTAINER_HAS_GOOGLE_DENSE_HASH_MAP==1
54 typedef google::dense_hash_map<int, ParticleIndexes> t_lists_map;
55 typedef google::dense_hash_map<int, PointerMember<SingletonScore> > t_score_map;
57 typedef IMP_KERNEL_LARGE_UNORDERED_MAP<int, ParticleIndexes> t_lists_map;
58 typedef IMP_KERNEL_LARGE_UNORDERED_MAP<int, PointerMember<SingletonScore> > t_score_map;
60 mutable t_lists_map lists_;
63 bool is_get_inputs_ignores_individual_scores_;
64 mutable std::size_t input_version_;
66 bool error_on_unknown_;
69 void update_lists_if_necessary()
const;
75 "PredicateSingletonsRestraint %1%");
93 return lists_.find(predicate_value)->second;
106 is_get_inputs_ignores_individual_scores_= is_ignore;
122 get_score_for_predicate(
int predicate)
const;
131 PredicateSingletonsRestraint::get_score_for_predicate
132 (
int predicate)
const
135 t_score_map::const_iterator it= scores_.find(predicate);
136 if(it!=scores_.end()){
140 "unknown interaction type cannot be scored when error_on_unknown is true");
141 score = unknown_score_;
148 IMPCONTAINER_END_NAMESPACE
Various important functionality for implementing decorators.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
virtual void do_add_score_and_derivatives(ScoreAccumulator sa) const
A restraint should override this to compute the score and derivatives.
Macros to choose the best set or map for different purposes.
Define SingletonPredicate.
void set_is_get_inputs_ignores_individual_scores(bool is_ignore)
virtual Restraints do_create_current_decomposition() const
Abstract class for scoring object(s) of type ParticleIndex.
A smart pointer to a ref-counted Object that is a class member.
Class for adding up scores during ScoringFunction evaluation.
void set_is_complete(bool tf)
Applies a SingletonScore to each Singleton in a list based on a predicate.
Abstract predicate function.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
ParticleIndexes get_indexes(int predicate_value) const
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
A restraint is a term in an IMP ScoringFunction.