00001 /** 00002 * \file RigidClosePairsFinder.h 00003 * \brief Handle rigid bodies by looking at their members 00004 * 00005 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00006 */ 00007 00008 #ifndef IMPCORE_RIGID_CLOSE_PAIRS_FINDER_H 00009 #define IMPCORE_RIGID_CLOSE_PAIRS_FINDER_H 00010 00011 #include "ClosePairsFinder.h" 00012 #include "rigid_bodies.h" 00013 #include <IMP/Refiner.h> 00014 00015 IMPCORE_BEGIN_NAMESPACE 00016 00017 //! Peform more efficient close pair finding when rigid bodies are involved. 00018 /** The class finds all close pairs consisting of particles taken from the 00019 passed list(s) (if they are not rigid bodies) or members of rigid 00020 bodies passed as input. That is, given an input list \c l, for each 00021 pair of particles \c p, \c q taken from the list, that are closer than 00022 the distance threshold, it returns 00023 - if neither \c p or \c q are RigidBody particles it returns 00024 (\c p,\c q) 00025 - if bother \c p and \c q are RigidBody particles, it returns 00026 all \c (\c r,\c s) where \c r is a member of \c p and \c s is member of 00027 \c q and \c r and \c s are closer than the distance threshold 00028 - pairs \c (\c p,\c s) or \c (\c r,\c q) as appropriate if only one of 00029 \c p or \c q is a rigid body. 00030 00031 Consequently, the user must ensure that the RigidBody are 00032 assigned a radius that encloses all of their RigidMember 00033 particles. 00034 00035 It uses another ClosePairsFinder to find which pairs of particles in 00036 the input list or lists are close. Your choice of this can be passed 00037 to the constructor. 00038 00039 \note Having CGAL makes the computations more efficient. 00040 00041 \note The bounding spheres are kept in internal coordinates for 00042 the rigid body and transformed on the fly. It would probably be 00043 faster to cache the tranformed results. 00044 00045 \note The particles are divided up using a grid. The number of 00046 grid cells to use should be explored. In addition, with highly 00047 excentric sets of points, there will be too many cells. 00048 00049 \htmlinclude rigid_collisions.py.html 00050 00051 \note This class uses the IMP::core::BoxSweepClosePairsFinder by 00052 default if \ref cgal "CGAL" is available. 00053 00054 \ingroup CGAL 00055 \see ClosePairsScoreState 00056 \see RigidBody 00057 \see cover_members() 00058 */ 00059 class IMPCOREEXPORT RigidClosePairsFinder : public ClosePairsFinder 00060 { 00061 IMP::internal::OwnerPointer<ClosePairsFinder> cpf_; 00062 IMP::internal::OwnerPointer<Refiner> r_; 00063 ObjectKey k_; 00064 public: 00065 //! Use the default choice for the ClosePairsFinder 00066 /** Use rep to generate the list of representation particles. */ 00067 RigidClosePairsFinder(Refiner *r); 00068 RigidClosePairsFinder(ClosePairsFinder *cpf, 00069 Refiner *r); 00070 IMP_CLOSE_PAIRS_FINDER(RigidClosePairsFinder); 00071 00072 ParticlePairsTemp get_close_pairs(Particle *a, Particle *b) const; 00073 00074 void set_distance(double d) { 00075 cpf_->set_distance(d); 00076 ClosePairsFinder::set_distance(d); 00077 } 00078 #ifndef IMP_SWIG 00079 internal::MovedSingletonContainer * 00080 get_moved_singleton_container(SingletonContainer *c, 00081 Model *m, double thresold) const; 00082 #endif 00083 }; 00084 00085 IMPCORE_END_NAMESPACE 00086 00087 #endif /* IMPCORE_RIGID_CLOSE_PAIRS_FINDER_H */