12 #ifndef IMPCORE_PAIR_PREDICATES_H
13 #define IMPCORE_PAIR_PREDICATES_H
15 #include <IMP/core/core_config.h>
19 #include <boost/random.hpp>
20 #include "internal/container_helpers.h"
21 #include <cereal/access.hpp>
22 #include <cereal/types/base_class.hpp>
24 IMPCORE_BEGIN_NAMESPACE
30 friend class cereal::access;
31 template<
class Archive>
void serialize(Archive &ar) {
32 ar(cereal::base_class<PairPredicate>(
this), v_);
38 std::string name =
"ConstPairPredicate%1%");
61 friend class cereal::access;
62 template<
class Archive>
void serialize(Archive &ar) {
63 ar(cereal::base_class<PairPredicate>(
this));
69 "UnorderedTypePairPredicate%1%");
72 return internal::get_type_hash(m, pi);
91 mutable int const* cached_particle_type_ids_table_;
92 mutable int cached_n_particle_types_;
95 "OrderedTypePairPredicate%1%");
98 return internal::get_ordered_type_hash(types);
103 return internal::get_ordered_type_hash(m, pi);
110 cached_particle_type_ids_table_=
111 m->IMP::internal::IntAttributeTable::access_attribute_data(Typed::get_type_key());
112 cached_n_particle_types_= ParticleType::get_number_unique();
121 return internal::get_ordered_type_hash( pi,
122 cached_particle_type_ids_table_,
123 cached_n_particle_types_);
138 friend class cereal::access;
139 template<
class Archive>
void serialize(Archive &ar) {
140 ar(cereal::base_class<PairPredicate>(
this));
148 return internal::get_all_same(m, pi);
161 mutable boost::uniform_real<double> rng_;
165 "CoinFlipPairPredicate%1%");
181 IMPCORE_END_NAMESPACE
virtual int get_value_index(Model *m, const ParticleIndexPair &pi) const override
Compute the predicate for types of specific pi.
Macros for various classes.
Return a unique predicate value for each ordered set of ParticleTypes.
virtual ModelObjectsTemp do_get_inputs(Model *, const ParticleIndexes &) const override
Overload this method to specify the inputs.
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pis) const override
Overload this method to specify the inputs.
Return true (1) if all members of the tuple are the same.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pis) const override
Overload this method to specify the inputs.
ParticlesTemp get_particles(Model *m, const ParticleIndexes &ps)
Get the particles from a list of indexes.
virtual int get_value_index(Model *m, const ParticleIndexPair &pi) const override
Compute the predicate and the derivative if needed.
A more IMP-like version of the std::vector.
A particle with a user-defined type.
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Class for storing model, its restraints, constraints, and particles.
#define IMP_UNUSED(variable)
int get_value(const core::ParticleTypes &types)
Compute the predicate for specified types.
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Return true (1) with a fixed probability.
virtual ModelObjectsTemp do_get_inputs(Model *, const ParticleIndexes &) const override
Overload this method to specify the inputs.
virtual int get_value_index(Model *, const ParticleIndexPair &) const override
Compute the predicate and the derivative if needed.
Return a unique predicate value for each unordered set of ParticleTypes.
virtual void setup_for_get_value_index_in_batch(Model *m) const override
Abstract predicate function.
virtual ModelObjectsTemp do_get_inputs(Model *, const ParticleIndexes &) const override
Overload this method to specify the inputs.
virtual int get_value_index(Model *, const ParticleIndexPair &) const override
Compute the predicate and the derivative if needed.
virtual int get_value_index_in_batch(Model *m, const ParticleIndexPair &pi) const override
Always return a constant value.
virtual int get_value_index(Model *m, const ParticleIndexPair &pi) const override
Compute the predicate and the derivative if needed.
RandomNumberGenerator random_number_generator
A shared non-GPU random number generator.
#define IMP_PAIR_PREDICATE_METHODS(Name)
Define extra the functions needed for a PairPredicate.