Candidate_v1.6.1
ChemicalSpaceEvaluator
TremoloParser_IncreasedPrecision
Last change
on this file since fba720 was bccbe9, checked in by Frederik Heber <frederik.heber@…>, 8 years ago |
Extracted extraction (subset of) nodes from BoostGraph into BreadthFirstSearchGatherer.
- also added helper namespace BoostGraphHelpers.
- we now treat the vertex indices and vertex names properly. Before that they
had to coincide. Now, the name is the atomic id associated with the node
and the index is the boost::graph internal index.
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /*
|
---|
2 | * BoostGraphHelpers.hpp
|
---|
3 | *
|
---|
4 | * Created on: May 18, 2017
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 |
|
---|
9 | #ifndef GRAPH_BOOSTGRAPHHELPERS_HPP_
|
---|
10 | #define GRAPH_BOOSTGRAPHHELPERS_HPP_
|
---|
11 |
|
---|
12 | // include config.h
|
---|
13 | #ifdef HAVE_CONFIG_H
|
---|
14 | #include <config.h>
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | #include <vector>
|
---|
18 |
|
---|
19 | namespace BoostGraphHelpers {
|
---|
20 |
|
---|
21 | typedef std::vector<atomId_t> Nodeset_t;
|
---|
22 |
|
---|
23 | #ifdef HAVE_INLINE
|
---|
24 | inline
|
---|
25 | #else
|
---|
26 | static
|
---|
27 | #endif
|
---|
28 | bool isCommonNodeInVector(
|
---|
29 | const Nodeset_t &_firstnodes,
|
---|
30 | const Nodeset_t &_secondnodes) {
|
---|
31 | // std::set_intersection builds full set in bad case: too much work, just
|
---|
32 | // seek single element contained in either set
|
---|
33 | Nodeset_t::const_iterator firstiter = _firstnodes.begin();
|
---|
34 | Nodeset_t::const_iterator seconditer = _secondnodes.begin();
|
---|
35 | while ((firstiter != _firstnodes.end()) && (seconditer != _secondnodes.end())) {
|
---|
36 | if (*firstiter == *seconditer) {
|
---|
37 | break;
|
---|
38 | } else if (*firstiter > *seconditer) {
|
---|
39 | ++seconditer;
|
---|
40 | } else {
|
---|
41 | ++firstiter;
|
---|
42 | }
|
---|
43 | }
|
---|
44 | return ((firstiter != _firstnodes.end())
|
---|
45 | && (seconditer != _secondnodes.end()));
|
---|
46 | }
|
---|
47 | } /* namespace BoostGraphHelpers */
|
---|
48 |
|
---|
49 |
|
---|
50 | #endif /* GRAPH_BOOSTGRAPHHELPERS_HPP_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.