10 #ifndef IMPKERNEL_DECLARE_MODEL_H
11 #define IMPKERNEL_DECLARE_MODEL_H
13 #include <IMP/kernel/kernel_config.h>
23 #include "internal/AttributeTable.h"
24 #include "internal/attribute_tables.h"
30 #include <boost/iterator/transform_iterator.hpp>
31 #include <boost/iterator/filter_iterator.hpp>
35 IMPKERNEL_BEGIN_NAMESPACE
40 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
47 COMPUTING_DEPENDENCIES
73 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
75 public internal::Masks,
78 public internal::FloatAttributeTable,
79 public internal::StringAttributeTable,
80 public internal::IntAttributeTable,
81 public internal::ObjectAttributeTable,
82 public internal::WeakObjectAttributeTable,
83 public internal::IntsAttributeTable,
84 public internal::ObjectsAttributeTable,
85 public internal::ParticleAttributeTable,
86 public internal::ParticlesAttributeTable
113 void do_check_required_score_states(
const ModelObject *mo)
const;
114 void do_check_update_order(
const ScoreState *ss)
const;
115 void do_check_inputs_and_outputs(
const ModelObject *mo)
const;
116 void do_check_readers_and_writers(
const ModelObject *mo)
const;
117 void do_check_not_in_readers_and_writers(
const ModelObject *mo)
const;
119 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
126 internal::Stage cur_stage_;
130 bool do_get_has_dependencies(
const ModelObject *mo)
const {
131 return no_dependencies_.find(mo) == no_dependencies_.end();
133 void do_set_has_dependencies(
const ModelObject *mo,
bool tf);
134 void do_set_has_all_dependencies(
bool tf);
136 void validate_computed_derivatives()
const {}
137 void set_has_all_dependencies(
bool tf);
138 bool get_has_all_dependencies()
const;
139 void check_dependency_invariants()
const;
140 void check_dependency_invariants(
const ModelObject *mo)
const;
147 internal::Stage get_stage()
const {
return cur_stage_; }
149 static void do_remove_score_state(
ScoreState *obj);
152 bool do_get_has_required_score_states(
const ModelObject *mo)
const;
157 "Doesn't have score states");
158 return required_score_states_.find(mo)->second;
165 Model(std::string name =
"Model %1%");
168 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
169 IMP_MODEL_IMPORT(internal::FloatAttributeTable);
170 IMP_MODEL_IMPORT(internal::StringAttributeTable);
171 IMP_MODEL_IMPORT(internal::IntAttributeTable);
172 IMP_MODEL_IMPORT(internal::ObjectAttributeTable);
173 IMP_MODEL_IMPORT(internal::WeakObjectAttributeTable);
174 IMP_MODEL_IMPORT(internal::IntsAttributeTable);
175 IMP_MODEL_IMPORT(internal::ObjectsAttributeTable);
176 IMP_MODEL_IMPORT(internal::ParticleAttributeTable);
177 IMP_MODEL_IMPORT(internal::ParticlesAttributeTable);
187 return get_particle(pi)->get_name();
205 do_remove_score_state(obj));
229 void add_attribute(TypeKey attribute_key,
ParticleIndex particle, Type value);
232 void remove_attribute(TypeKey attribute_key,
ParticleIndex particle);
234 bool get_has_attribute(TypeKey attribute_key,
ParticleIndex particle)
const;
237 void set_attribute(TypeKey attribute_key,
ParticleIndex particle, Type value);
240 Type get_attribute(TypeKey attribute_key,
ParticleIndex particle);
253 void add_cache_attribute(TypeKey attribute_key,
ParticleIndex particle,
259 void set_is_optimized(TypeKey attribute_key,
ParticleIndex particle,
265 #define IMP_MODEL_ATTRIBUTE_METHODS(Type, Value) \
266 void add_attribute(Type##Key attribute_key, ParticleIndex particle, \
268 void remove_attribute(Type##Key attribute_key, ParticleIndex particle); \
269 bool get_has_attribute(Type##Key attribute_key, \
270 ParticleIndex particle) const; \
271 void set_attribute(Type##Key attribute_key, ParticleIndex particle, \
273 Value get_attribute(Type##Key attribute_key, ParticleIndex particle); \
274 void add_cache_attribute(Type##Key attribute_key, ParticleIndex particle, \
278 IMP_MODEL_ATTRIBUTE_METHODS(
Int,
Int);
279 IMP_MODEL_ATTRIBUTE_METHODS(
Ints,
Ints);
283 IMP_MODEL_ATTRIBUTE_METHODS(Object, Object *);
284 IMP_MODEL_ATTRIBUTE_METHODS(WeakObject, Object *);
324 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
328 typedef boost::filter_iterator<
334 #if !defined(IMP_DOXYGEN)
344 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
345 unsigned
int get_number_of_restraints() const;
347 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
348 Restraint *get_restraint(
unsigned int i) const;
350 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
351 double evaluate(
bool tf,
bool warn = true);
353 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
356 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
357 unsigned int get_number_of_particles() const;
359 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
362 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
365 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
368 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
369 double get_maximum_score(
Restraint *r) const;
371 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
372 void set_maximum_score(
Restraint *r,
double s);
374 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
375 void set_maximum_score(
double s);
377 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
378 double get_maximum_score() const;
381 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
382 ParticleIterator particles_begin() const;
384 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
385 ParticleIterator particles_end() const;
387 IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
388 operator
Restraint *()
const {
return restraints_.get(); }
392 IMPKERNEL_END_NAMESPACE
Abstract base class for all restraints.
IMP::kernel::ModelObject ModelObject
The base class for decorators.
IMP::base::Vector< IMP::base::WeakPointer< kernel::ModelObject > > ModelObjectsTemp
Used to hold a set of related restraints.
Classes to handle individual model particles.
A nullptr-initialized pointer to an IMP Object.
A smart pointer to a ref-counted Object that is a class memeber.
ParticlesTemp get_particles(kernel::Model *m, const ParticleIndexes &ps)
IMP::base::Vector< IMP::base::WeakPointer< Restraint > > RestraintsTemp
Object used to hold a set of restraints.
A smart pointer to a reference counted object.
kernel::RestraintsTemp get_restraints(const Subset &s, const ParticleStatesTable *pst, const DependencyGraph &dg, kernel::RestraintSet *rs)
ScoreStates maintian invariants in the Model.
ScoringFunction * create_scoring_function(RestraintType *rs, double weight=1.0, double max=NO_MAX, std::string name=std::string())
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
virtual void clear_caches()
Various general useful macros for IMP.
Single variable function.
A restraint is a term in an IMP ScoringFunction.
Storage of a model, its restraints, constraints and particles.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Class to handle individual model particles.
IMP::kernel::DependencyGraph DependencyGraph
Common base class for heavy weight IMP objects.
double Float
Basic floating-point value (could be float, double...)
virtual void do_destroy()
int Int
Basic integer value.
Macros to define containers of objects.
A shared base class to help in debugging and things.
void add_particle(RMF::FileHandle fh, kernel::Particle *hs)
void add_restraint(RMF::FileHandle fh, kernel::Restraint *hs)
std::string String
Basic string value.
Declare an efficient stl-compatible set.
Declare an efficient stl-compatible map.
Class for storing model, its restraints, constraints, and particles.
std::string get_particle_name(ParticleIndex pi)
Get the name of a particle.