BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ringAnalyser.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_STRUCTURE_RINGANALYSER_H
6 #define BALL_STRUCTURE_RINGANALYSER_H
7 
8 #ifndef BALL_COMMON_GLOBAL_H
9 # include <BALL/common.h>
10 #endif
11 
12 #ifndef BALL_KERNEL_ATOMCONTAINER_H
14 #endif
15 
16 #ifndef BALL_CONCEPT_PROCESSOR_H
17 # include <BALL/CONCEPT/processor.h>
18 #endif
19 
20 #ifndef BALL_CONCEPT_PROPERTY_H
21 # include <BALL/CONCEPT/property.h>
22 #endif
23 
24 #include <vector>
25 #include <set>
26 #include <deque>
27 
28 namespace BALL
29 {
30  class Atom;
31  class Bond;
32 
37  : public UnaryProcessor<AtomContainer>
38  {
39  public:
40 
41  enum RingType
42  {
48  CORE
49  };
50 
52  : public PropertyManager
53  {
54  public:
56  Ring();
57 
59  Ring(std::vector<Atom*> const& atoms_);
60 
62  Position predecessor(Position i) const;
63 
65  Position successor(Position i) const;
66 
68  std::vector<Atom*> atoms;
69 
72 
74  std::set<Bond const*> shared_bonds;
75  };
76 
79 
83  RingAnalyser();
84 
88  virtual ~RingAnalyser();
90 
93 
95  virtual bool start();
96 
101  virtual Processor::Result operator ()(AtomContainer& ac);
102 
104  virtual bool finish();
105 
107 
112  void clear();
113 
120  bool isInRing(const Atom* atom, std::vector<Atom*> const& ring) const;
121 
128  bool isInRingSystem(const Atom* atom, Index i) const;
129 
137  void sequenceRing(std::vector<Atom*>& ring);
138 
141  Size getNumberOfRingSystems();
142 
145  std::vector<Ring> getRingSystem(Position i);
146 
149  std::vector<Position> getPeelingOrder(Position i);
150 
151  protected:
152 
156  void clusterRings_();
157 
161  void findSharedBonds_();
162 
166  void peelRings_();
167 
169  bool isCentralRing_(std::list<Position>::iterator ring, std::list<Position>& unassigned_rings);
170 
174  bool peelNextRing_(std::list<Position>& unassigned_rings, bool peel_fused = false);
175 
180  bool assignRTD_(std::list<Position>& trial_system);
181 
183  std::vector<Ring> rings_;
184 
186  std::vector<std::vector<Position> > ring_systems_;
187 
190 
192  std::vector<std::vector<Position> > peeling_order_;
193  };
194 
195 } // namespace BALL
196 
197 #endif // BALL_STRUCTURE_RINGANALYSER_H