BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_STRUCTURE_RINGANALYSER_H 00006 #define BALL_STRUCTURE_RINGANALYSER_H 00007 00008 #ifndef BALL_COMMON_GLOBAL_H 00009 # include <BALL/common.h> 00010 #endif 00011 00012 #ifndef BALL_KERNEL_ATOMCONTAINER_H 00013 # include <BALL/KERNEL/atomContainer.h> 00014 #endif 00015 00016 #ifndef BALL_CONCEPT_PROCESSOR_H 00017 # include <BALL/CONCEPT/processor.h> 00018 #endif 00019 00020 #ifndef BALL_CONCEPT_PROPERTY_H 00021 # include <BALL/CONCEPT/property.h> 00022 #endif 00023 00024 #include <vector> 00025 #include <set> 00026 #include <deque> 00027 00028 namespace BALL 00029 { 00030 class Atom; 00031 class Bond; 00032 00036 class BALL_EXPORT RingAnalyser 00037 : public UnaryProcessor<AtomContainer> 00038 { 00039 public: 00040 00041 enum RingType 00042 { 00043 NONE, 00044 TEMPLATE, 00045 FUSED, 00046 BRIDGED, 00047 SPIRO, 00048 CORE 00049 }; 00050 00051 class BALL_EXPORT Ring 00052 : public PropertyManager 00053 { 00054 public: 00056 Ring(); 00057 00059 Ring(std::vector<Atom*> const& atoms_); 00060 00062 Position predecessor(Position i) const; 00063 00065 Position successor(Position i) const; 00066 00068 std::vector<Atom*> atoms; 00069 00071 RingType type; 00072 00074 std::set<Bond const*> shared_bonds; 00075 }; 00076 00079 00083 RingAnalyser(); 00084 00088 virtual ~RingAnalyser(); 00090 00093 00095 virtual bool start(); 00096 00101 virtual Processor::Result operator ()(AtomContainer& ac); 00102 00104 virtual bool finish(); 00105 00107 00112 void clear(); 00113 00120 bool isInRing(const Atom* atom, std::vector<Atom*> const& ring) const; 00121 00128 bool isInRingSystem(const Atom* atom, Index i) const; 00129 00137 void sequenceRing(std::vector<Atom*>& ring); 00138 00141 Size getNumberOfRingSystems(); 00142 00145 std::vector<Ring> getRingSystem(Position i); 00146 00149 std::vector<Position> getPeelingOrder(Position i); 00150 00151 protected: 00152 00156 void clusterRings_(); 00157 00161 void findSharedBonds_(); 00162 00166 void peelRings_(); 00167 00169 bool isCentralRing_(std::list<Position>::iterator ring, std::list<Position>& unassigned_rings); 00170 00174 bool peelNextRing_(std::list<Position>& unassigned_rings, bool peel_fused = false); 00175 00180 bool assignRTD_(std::list<Position>& trial_system); 00181 00183 std::vector<Ring> rings_; 00184 00186 std::vector<std::vector<Position> > ring_systems_; 00187 00189 HashMap<Bond const*, std::deque<Position> > rings_per_bond_; 00190 00192 std::vector<std::vector<Position> > peeling_order_; 00193 }; 00194 00195 } // namespace BALL 00196 00197 #endif // BALL_STRUCTURE_RINGANALYSER_H