IMP logo
IMP Reference Guide  2.10.0
The Integrative Modeling Platform
QuadPredicate.h
Go to the documentation of this file.
1 // Autogenerated by ../../../../tmp/nightly-build-36368/imp-2.10.0/tools/build/make_containers.py
2 // from ../../../../tmp/nightly-build-36368/imp-2.10.0/tools/build/container_templates/kernel/ClassnamePredicate.h
3 // Do not edit - any changes will be lost!
4 
5 /**
6  * \file IMP/QuadPredicate.h
7  * \brief Define QuadPredicate.
8  *
9  * Copyright 2007-2018 IMP Inventors. All rights reserved.
10  */
11 
12 #ifndef IMPKERNEL_QUAD_PREDICATE_H
13 #define IMPKERNEL_QUAD_PREDICATE_H
14 
15 #include <IMP/kernel_config.h>
16 #include "base_types.h"
17 #include "DerivativeAccumulator.h"
18 #include "internal/container_helpers.h"
19 #include "model_object_helpers.h"
20 
21 IMPKERNEL_BEGIN_NAMESPACE
22 
23 //! Abstract predicate function
24 /** A predicate is a function which returns one of a discrete set of
25  values (eg -1, 0, 1 depending on whether a value is negative, zero
26  or positive). QuadPredicates will evaluate the predicate for the passed
27  particles.
28 
29  Implementers should check out IMP_QUAD_PREDICATE().
30 */
31 class IMPKERNELEXPORT QuadPredicate : public ParticleInputs,
32  public Object {
33  public:
34  typedef ParticleQuad Argument;
36  QuadPredicate(std::string name = "QuadPredicate %1%");
37  /** \deprecated_at{2.1} Use the index based version.*/
38  IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
39  virtual int get_value(const ParticleQuad& vt) const;
40 
41  /** \deprecated_at{2.1} Use the index based version.*/
42  IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
43  virtual Ints get_value(const ParticleQuadsTemp &o) const;
44 
45 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
46  //! remove any particles in ps for which this predicate evaluates to v
47  virtual void remove_if_equal(Model *m, ParticleIndexQuads &ps,
48  int v) const;
49  //! remove any particles in ps for which this predicate does not evaluate to v
50  virtual void remove_if_not_equal(Model *m, ParticleIndexQuads &ps,
51  int v) const;
52 #endif
53 
54  //! Compute the predicate and the derivative if needed.
55  virtual int get_value_index(Model *m, const ParticleIndexQuad& vt) const;
56 
57  //! Setup for a batch of calls to get_value_index_in_batch()
58  //! (could be used for improving performance - e.g. preload various
59  //! tables from model)
60  virtual void setup_for_get_value_index_in_batch(Model*) const {};
61 
62  //! Same as get_value_index, but possibly with optimizations
63  //! for a batch of calls. Call setup_for_get_value_index_in_batch()
64  //! right before calling a batch of those.
65  virtual int get_value_index_in_batch(Model* m, const ParticleIndexQuad& vt) const{
66  return get_value_index(m, vt);
67  }
68 
69  //! Enable them to be use as functors
70  /** But beware of slicing.
71  */
72  int operator()(Model *m, const ParticleIndexQuad& vt) const {
73  return get_value_index(m, vt);
74  }
75 
76  virtual Ints get_value_index(Model *m,
77  const ParticleIndexQuads &o) const {
78  Ints ret(o.size());
79  for (unsigned int i = 0; i < o.size(); ++i) {
80  ret[i] += get_value_index(m, o[i]);
81  }
82  return ret;
83  }
84 
85  IMP_REF_COUNTED_DESTRUCTOR(QuadPredicate);
86 };
87 
88 IMPKERNEL_END_NAMESPACE
89 
90 #endif /* IMPKERNEL_QUAD_PREDICATE_H */
Basic types used by IMP.
Abstract predicate function.
Definition: QuadPredicate.h:31
virtual void setup_for_get_value_index_in_batch(Model *) const
Definition: QuadPredicate.h:60
A class to store an fixed array of same-typed values.
Definition: Array.h:33
Class for adding derivatives from restraints to the model.
Base class for objects that take particle arguments and read from them.
#define IMP_REF_COUNTED_DESTRUCTOR(Name)
Ref counted objects should have private destructors.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
Common base class for heavy weight IMP objects.
Definition: Object.h:106
Classes used in the construction of ModelObjects.
virtual int get_value_index_in_batch(Model *m, const ParticleIndexQuad &vt) const
Definition: QuadPredicate.h:65
int operator()(Model *m, const ParticleIndexQuad &vt) const
Enable them to be use as functors.
Definition: QuadPredicate.h:72