11 #ifndef IMPKERNEL_TRIPLET_MACROS_H
12 #define IMPKERNEL_TRIPLET_MACROS_H
14 #include "internal/TupleRestraint.h"
15 #include "internal/functors.h"
24 #define IMP_TRIPLET_SCORE_METHODS(Name) \
25 double evaluate_indexes(kernel::Model *m, const kernel::ParticleIndexTriplets &p, \
26 DerivativeAccumulator *da, unsigned int lower_bound, \
27 unsigned int upper_bound) const IMP_FINAL { \
29 for (unsigned int i = lower_bound; i < upper_bound; ++i) { \
30 ret += evaluate_index(m, p[i], da); \
34 double evaluate_if_good_indexes( \
35 kernel::Model *m, const kernel::ParticleIndexTriplets &p, DerivativeAccumulator *da, \
36 double max, unsigned int lower_bound, unsigned int upper_bound) const { \
38 for (unsigned int i = lower_bound; i < upper_bound; ++i) { \
39 ret += evaluate_if_good_index(m, p[i], da, max - ret); \
40 if (ret > max) return std::numeric_limits<double>::max(); \
46 #define IMP_TRIPLET_PREDICATE_METHODS(Name) \
47 int get_value(const kernel::ParticleTriplet& a) const { \
48 return get_value_index(IMP::kernel::internal::get_model(a), \
49 IMP::kernel::internal::get_index(a)); \
51 Ints get_value(const kernel::ParticleTripletsTemp &o) const { \
53 for (unsigned int i = 0; i < o.size(); ++i) { \
54 ret[i] += Name::get_value(o[i]); \
58 Ints get_value_index(kernel::Model *m, const kernel::ParticleIndexTriplets &o) const { \
60 for (unsigned int i = 0; i < o.size(); ++i) { \
61 ret[i] += Name::get_value_index(m, o[i]); \
65 IMP_IMPLEMENT_INLINE_NO_SWIG( \
66 void remove_if_equal(kernel::Model *m, kernel::ParticleIndexTriplets &ps, \
70 std::remove_if(ps.begin(), ps.end(), \
71 IMP::kernel::internal::PredicateEquals<Name, true>( \
75 IMP_IMPLEMENT_INLINE_NO_SWIG(void remove_if_not_equal(kernel::Model *m, \
76 kernel::ParticleIndexTriplets &ps, \
80 std::remove_if(ps.begin(), ps.end(), \
81 IMP::kernel::internal::PredicateEquals<Name, false>( \
87 #define IMP_TRIPLET_DERIVATIVE_MODIFIER(Name) IMP_TRIPLET_MODIFIER(Name)
92 #define IMP_TRIPLET_MODIFIER_METHODS(Name) \
93 virtual void apply_indexes(kernel::Model *m, const kernel::ParticleIndexTriplets &o, \
94 unsigned int lower_bound, \
95 unsigned int upper_bound) const IMP_FINAL { \
96 for (unsigned int i = lower_bound; i < upper_bound; ++i) { \
97 apply_index(m, o[i]); \
102 #define IMP_INDEX_TRIPLET_DERIVATIVE_MODIFIER(Name) \
103 IMP_INDEX_TRIPLET_MODIFIER(Name)
106 #define IMP_IMPLEMENT_TRIPLET_CONTAINER(Name) \
107 IMP_IMPLEMENT_INLINE(void do_apply(const TripletModifier *sm) const, \
108 { apply_generic(sm); }); \
109 virtual ParticleIndexes get_all_possible_indexes() const IMP_OVERRIDE; \
110 IMP_OBJECT_NO_WARNING(Name)
116 #define IMP_TRIPLET_CONTAINER_METHODS(Name) \
117 void do_apply(const TripletModifier *sm) const { apply_generic(sm); }
Various general useful macros for IMP.
Macros to define containers of objects.