IMP logo
IMP Reference Guide  2.5.0
The Integrative Modeling Platform
ClosePairsFinder.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/ClosePairsFinder.h
3  * \brief A base class for algorithms to detect proximities.
4  *
5  * Copyright 2007-2015 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPCORE_CLOSE_PAIRS_FINDER_H
9 #define IMPCORE_CLOSE_PAIRS_FINDER_H
10 
11 #include <IMP/core/core_config.h>
12 #include <IMP/PairPredicate.h>
13 
14 #include <IMP/Object.h>
15 #include <IMP/SingletonContainer.h>
16 #include <IMP/internal/container_helpers.h>
18 
19 IMPCORE_BEGIN_NAMESPACE
20 #ifndef IMP_DOXYGEN
21 namespace internal {
22 class MovedSingletonContainer;
23 }
24 #endif
25 
26 //! A base class for algorithms to find spatial proximities
27 /** In general, the algorithm should make sure it returns all
28  pairs of appropriate objects which are within the distance
29  of one another (including their radius). They are free to
30  return more if it is convenient, but this is not
31  recommended as the list can easily become very large.
32  \see ClosePairContainer
33  \see CloseBipartitePairContainer
34  */
35 class IMPCOREEXPORT ClosePairsFinder : public ParticleInputs,
36  public IMP::Object {
37  double distance_;
38 
39  public:
40  ClosePairsFinder(std::string name);
42 
43  virtual ParticleIndexPairs get_close_pairs(
44  Model *m, const ParticleIndexes &pc) const = 0;
45  virtual ParticleIndexPairs get_close_pairs(
46  Model *m, const ParticleIndexes &pca,
47  const ParticleIndexes &pcb) const = 0;
48  virtual IntPairs get_close_pairs(const algebra::BoundingBox3Ds &bbs)
49  const = 0;
50  virtual IntPairs get_close_pairs(const algebra::BoundingBox3Ds &bas,
51  const algebra::BoundingBox3Ds &bbs)
52  const = 0;
53  /** @} */
54 
55  /** \name The distance threshold
56  All pairs within this distance threshold are added to the output
57  list.
58  @{
59  */
60  virtual void set_distance(double d) { distance_ = d; }
61  double get_distance() const { return distance_; }
62  /** @} */
63 
64  public:
65  /** @name Methods to control the set of filters
66 
67  PairPredicates objects can be used as filters to prevent
68  the addition of pairs to the containeroutput list. Pairs
69  for which the predicate evaluates to a non-zero value are
70  excluded.
71  */
72  /**@{*/
73  IMP_LIST(public, PairFilter, pair_filter, PairPredicate *, PairPredicates);
74 /**@}*/
75 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
76  //! Return a container of all particles which moved more than threshold
77  virtual internal::MovedSingletonContainer *get_moved_singleton_container(
78  SingletonContainer *in, double threshold) const;
79 #endif
80 };
81 
82 IMPCORE_END_NAMESPACE
83 
84 #endif /* IMPCORE_CLOSE_PAIRS_FINDER_H */
A base class for algorithms to find spatial proximities.
A container for Singletons.
#define IMP_LIST(protection, Ucname, lcname, Data, PluralData)
A macro to provide a uniform interface for storing lists of objects.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
double get_distance(const Plane3D &pln, const Vector3D &p)
Return the distance between a plane and a point in 3D.
Definition: Plane3D.h:63
Common base class for heavy weight IMP objects.
Definition: Object.h:106
Define PairPredicate.
Single variable function.
A shared container for Singletons.
Abstract predicate function.
Definition: PairPredicate.h:32
A shared base class to help in debugging and things.