IMP logo
IMP Reference Guide  2.10.1
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-2018 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  //! return all close pairs among pc in model m
44  virtual ParticleIndexPairs get_close_pairs(
45  Model *m, const ParticleIndexes &pc) const = 0;
46  //! return all close pairs among pc in model m
47  virtual ParticleIndexPairs get_close_pairs(
48  Model *m, const ParticleIndexes &pca,
49  const ParticleIndexes &pcb) const = 0;
50  virtual IntPairs get_close_pairs(const algebra::BoundingBox3Ds &bbs)
51  const = 0;
52  virtual IntPairs get_close_pairs(const algebra::BoundingBox3Ds &bas,
53  const algebra::BoundingBox3Ds &bbs)
54  const = 0;
55  /** @} */
56 
57  /** \name The distance threshold
58  All pairs within this distance threshold are added to the output
59  list.
60  @{
61  */
62  virtual void set_distance(double d) { distance_ = d; }
63  double get_distance() const { return distance_; }
64  /** @} */
65 
66  public:
67  /** @name Methods to control the set of filters
68 
69  PairPredicates objects can be used as filters to prevent
70  the addition of pairs to the containeroutput list. Pairs
71  for which the predicate evaluates to a non-zero value are
72  excluded.
73  */
74  /**@{*/
75  IMP_LIST(public, PairFilter, pair_filter, PairPredicate *, PairPredicates);
76 /**@}*/
77 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
78  //! Return a container of all particles which moved more than threshold
79  virtual internal::MovedSingletonContainer *get_moved_singleton_container(
80  SingletonContainer *in, double threshold) const;
81 #endif
82 };
83 
84 IMPCORE_END_NAMESPACE
85 
86 #endif /* IMPCORE_CLOSE_PAIRS_FINDER_H */
A base class for algorithms to find spatial proximities.
A container for Singletons.
Base class for objects that take particle arguments and read from them.
#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
Common base class for heavy weight IMP objects.
Definition: Object.h:106
Define PairPredicate.
Classes used in the construction of ModelObjects.
A shared container for Singletons.
Abstract predicate function.
Definition: PairPredicate.h:31
A shared base class to help in debugging and things.
double get_distance(const Line3D &s, const Vector3D &p)
Get closest distance between a line and a point.