| 1 | /*
 | 
|---|
| 2 |  * CyclicStructureAnalysis.hpp
 | 
|---|
| 3 |  *
 | 
|---|
| 4 |  *  Created on: Feb 16, 2011
 | 
|---|
| 5 |  *      Author: heber
 | 
|---|
| 6 |  */
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #ifndef CYCLICSTRUCTUREANALYSIS_HPP_
 | 
|---|
| 9 | #define CYCLICSTRUCTUREANALYSIS_HPP_
 | 
|---|
| 10 | 
 | 
|---|
| 11 | // include config.h
 | 
|---|
| 12 | #ifdef HAVE_CONFIG_H
 | 
|---|
| 13 | #include <config.h>
 | 
|---|
| 14 | #endif
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include <deque>
 | 
|---|
| 17 | #include <map>
 | 
|---|
| 18 | 
 | 
|---|
| 19 | #include "Bond/bond.hpp"
 | 
|---|
| 20 | #include "Bond/GraphEdge.hpp"
 | 
|---|
| 21 | #include "Fragmentation/HydrogenSaturation_enum.hpp"
 | 
|---|
| 22 | #include "Helpers/defs.hpp"
 | 
|---|
| 23 | #include "types.hpp"
 | 
|---|
| 24 | 
 | 
|---|
| 25 | class atom;
 | 
|---|
| 26 | class molecule;
 | 
|---|
| 27 | 
 | 
|---|
| 28 | class CyclicStructureAnalysis
 | 
|---|
| 29 | {
 | 
|---|
| 30 | public:
 | 
|---|
| 31 |   explicit CyclicStructureAnalysis(const enum HydrogenSaturation _saturation);
 | 
|---|
| 32 |   ~CyclicStructureAnalysis();
 | 
|---|
| 33 | 
 | 
|---|
| 34 |   void Reset();
 | 
|---|
| 35 |   void operator()(std::deque<bond::ptr > * BackEdgeStack);
 | 
|---|
| 36 | 
 | 
|---|
| 37 |   const std::map<atomId_t, int >& getMinimumRingSize() const;
 | 
|---|
| 38 | 
 | 
|---|
| 39 | private:
 | 
|---|
| 40 |   // init or reset
 | 
|---|
| 41 |   void InitNode(atomId_t atom_id);
 | 
|---|
| 42 |   void CleanAllTouched();
 | 
|---|
| 43 |   void InitializeToRoot(atom *&Walker);
 | 
|---|
| 44 |   // performing tasks
 | 
|---|
| 45 |   void CyclicBFSFromRootToRoot(bond::ptr &BackEdge);
 | 
|---|
| 46 |   void RetrieveCycleMembers(atom *&OtherAtom, bond::ptr &BackEdge, int &MinRingSize);
 | 
|---|
| 47 |   void BFSToNextCycle(atom *&Root, atom *&Walker);
 | 
|---|
| 48 |   void AssignRingSizetoNonCycleMembers(int &MinRingSize, int &NumCycles);
 | 
|---|
| 49 |   // output
 | 
|---|
| 50 |   void OutputAlreadyVisited(int *list);
 | 
|---|
| 51 | 
 | 
|---|
| 52 |   std::map<atomId_t, atom *> PredecessorList;
 | 
|---|
| 53 |   std::map<atomId_t, int > ShortestPathList;
 | 
|---|
| 54 |   std::map<atomId_t, enum GraphEdge::Shading> ColorList;
 | 
|---|
| 55 |   std::map<atomId_t, int > MinimumRingSize;
 | 
|---|
| 56 |   std::deque<atom *> BFSStack;
 | 
|---|
| 57 |   std::deque<atom *> TouchedStack;
 | 
|---|
| 58 |   int BondOrder;
 | 
|---|
| 59 |   atom *Root;
 | 
|---|
| 60 | 
 | 
|---|
| 61 |   //!> whether to treat hydrogen special or not
 | 
|---|
| 62 |   const enum HydrogenSaturation saturation;
 | 
|---|
| 63 | 
 | 
|---|
| 64 |   bool BackStepping;
 | 
|---|
| 65 |   int CurrentGraphNr;
 | 
|---|
| 66 |   int ComponentNr;
 | 
|---|
| 67 | };
 | 
|---|
| 68 | 
 | 
|---|
| 69 | #endif /* CYCLICSTRUCTUREANALYSIS_HPP_ */
 | 
|---|