BALL 1.5.0
Loading...
Searching...
No Matches
ringPerceptionProcessor.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4// $Id: ringPerceptionProcessor.h,v 1.17.4.2 2007/04/03 13:29:45 bertsch Exp $
5//
6
7#ifndef BALL_QSAR_RINGPERCEPTIONPROCESSOR_H
8#define BALL_QSAR_RINGPERCEPTIONPROCESSOR_H
9
10#ifndef BALL_KERNEL_ATOMCONTAINER_H
12#endif
13
14#ifndef BALL_STRUCTURE_SIMPLEMOLECULARGRAPH_H
16#endif
17
18#ifndef BALL_DATATYPE_OPTIONS_H
20#endif
21
22
23#include <stack>
24#include <vector>
25
26namespace BALL
27{
37 : public UnaryProcessor<AtomContainer>
38{
39public:
40
42
43
49
53
57
59
62
66
68
71
76 Size calculateSSSR(vector<vector<Atom*> >& sssr, AtomContainer& ac);
78
82 const vector<vector<Atom*> >& getAllSmallRings() const;
83
87 Processor::Result operator () (AtomContainer& ac);
89
90protected:
91
92 // Balducci and Pearlman algorithm
93 struct PathMessage_;
94
95 /*_ The tnode structure described in the paper
96 */
97 struct TNode_
98 {
100 void recieve();
101
103 void send();
104
106
108
110
112 std::vector<PathMessage_> recieve_buffer;
113
115 std::vector<PathMessage_> send_buffer;
116 };
117
118 /*_ The pathMsg structure described in the paper
119 */
121 {
123
124 // path of the message
126
129
130 // pointer to the last node of the messages' path
132
135 };
136
140
144
146 static std::vector<BitVector> rings_;
147
149 static std::vector<BitVector> matrix_;
150
152 static std::vector<BitVector> forwarded_rings_;
153
155 static std::vector<BitVector> tested_beers_;
156
158 static std::vector<std::vector<Atom*> > all_small_rings_;
159
161 static std::vector<BitVector> all_small_beers_;
162
163 /*_ function that gets a binary edge-encoded ring as a BitVector
164 and adds it to the ringset if its linearly independend
165 */
167
168 /*_ Implementation of the Balducci/Pearlman algorithm
169 */
170 Size BalducciPearlmanAlgorithm_(std::vector<std::vector<Atom*> >& sssr, SimpleMolecularGraph& graph);
171};
172
173
181namespace Exception
182{
184{
185public:
186 RingProcessorException(const char* file, int line)
187 : GeneralException(file, line, "RingProcessorException", "")
188 {
189 message_ = "\nCould not find a valid set of smallest rings for an input molecule.\n\n";
190 message_+= "Either the input molecule was not valid (e.g.: not a single connected component)\n";
191 message_+= "or the algorithm failed on this special topology.";
192
193 globalHandler.setMessage(message_);
194 }
195};
196} // namespace Exception
197
198} // namespace BALL
199
200#endif // BALL_QSAR_RINGPERCEPTIONPROCESSOR_H
#define BALL_CREATE(name)
Definition create.h:62
TSimpleMolecularGraph< Index, Index > SimpleMolecularGraph
BALL_EXPORT GlobalExceptionHandler globalHandler
static void setMessage(const String &message)
Set the error message.
HashMap class based on the STL map (containing serveral convenience functions)
Definition hashMap.h:74
static std::vector< BitVector > forwarded_rings_
the rings of the ith phase, which are to be forwarded to the ring selector
static std::vector< BitVector > matrix_
the matrix for the independency tests
static std::vector< BitVector > rings_
the SSSR detected by the algorithm
static std::vector< BitVector > all_small_beers_
contains all 3 to 6 membered rings as beers
static std::vector< std::vector< Atom * > > all_small_rings_
contains all 3 to 6 membered rings after the procedure of the Balducci-Pearlman algorithm
static HashMap< TNode_ *, NodeItem< Index, Index > * > tnode_to_atom_
mapping for internal TNode structure and the nodes of the molecular graph
static HashMap< NodeItem< Index, Index > *, TNode_ * > atom_to_tnode_
static void BalducciPearlmanRingSelector_(BitVector bit_vector)
static HashMap< EdgeItem< Index, Index > *, Size > bond_to_index_
mapping for the path representation as bitvectors
static HashMap< Size, EdgeItem< Index, Index > * > index_to_bond_
Size BalducciPearlmanAlgorithm_(std::vector< std::vector< Atom * > > &sssr, SimpleMolecularGraph &graph)
static std::vector< BitVector > tested_beers_
rings (beer) which have already been tested
std::vector< PathMessage_ > recieve_buffer
the recieve buffer, where messages are stored in
bool haveZeroIntersection(BitVector &beep1, BitVector &beep2)
bool haveSingleIntersection(BitVector &beep1, BitVector &beep2)
bool nodeIsNew(BitVector &beep, NodeItem< Index, Index > *node)
void send()
method to process the messages in the send buffer
std::vector< PathMessage_ > send_buffer
the send buffer, where messages are stored in
void recieve()
method to process the messages in the recieve buffer
void push(EdgeItem< Index, Index > *bond, TNode_ *node)
TNode_ * nfirst
pointer to the first node this message was sent from
EdgeItem< Index, Index > * efirst
pointer to the first edge of the message path
#define BALL_EXPORT