Action_Thermostats
Adding_Graph_to_ChangeBondActions
Adding_MD_integration_tests
Adding_StructOpt_integration_tests
AutomationFragmentation_failures
Candidate_v1.6.1
ChemicalSpaceEvaluator
Enhanced_StructuralOptimization
Enhanced_StructuralOptimization_continued
Exclude_Hydrogens_annealWithBondGraph
Fix_Verbose_Codepatterns
ForceAnnealing_with_BondGraph
ForceAnnealing_with_BondGraph_continued
ForceAnnealing_with_BondGraph_continued_betteresults
ForceAnnealing_with_BondGraph_contraction-expansion
Gui_displays_atomic_force_velocity
JobMarket_RobustOnKillsSegFaults
JobMarket_StableWorkerPool
PythonUI_with_named_parameters
Recreated_GuiChecks
StoppableMakroAction
TremoloParser_IncreasedPrecision
Last change
on this file since e0b960 was 966ce7, checked in by Frederik Heber <frederik.heber@…>, 8 years ago |
BreadthFirstSearchGatherer::getDistances() added.
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | /*
|
---|
2 | * BreadthFirstSearchGatherer.hpp
|
---|
3 | *
|
---|
4 | * Created on: May 17, 2017
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 |
|
---|
9 | #ifndef GRAPH_BREADTHFIRSTSEARCHGATHERER_HPP_
|
---|
10 | #define GRAPH_BREADTHFIRSTSEARCHGATHERER_HPP_
|
---|
11 |
|
---|
12 | // include config.h
|
---|
13 | #ifdef HAVE_CONFIG_H
|
---|
14 | #include <config.h>
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | #include <map>
|
---|
18 | #include <stddef.h>
|
---|
19 | #include <vector>
|
---|
20 |
|
---|
21 | #include "types.hpp"
|
---|
22 |
|
---|
23 | struct BoostGraphCreator;
|
---|
24 |
|
---|
25 | /** This struct performs a BFS on a given boost::graph and finds
|
---|
26 | * all nodes, i.e. atoms, up to a given limit.
|
---|
27 | */
|
---|
28 | struct BreadthFirstSearchGatherer
|
---|
29 | {
|
---|
30 | //!> typedef for the distance map to the obtained atomic id set.
|
---|
31 | typedef std::map<atomId_t, size_t> distance_map_t;
|
---|
32 |
|
---|
33 | /** Cstor of class BreadthFirstSearchGatherer.
|
---|
34 | *
|
---|
35 | * \param _graph graph to work on
|
---|
36 | */
|
---|
37 | BreadthFirstSearchGatherer(BoostGraphCreator &_graph);
|
---|
38 |
|
---|
39 | /** Discovers all nodes from the given \a _discoverfrom and returns
|
---|
40 | * the vector of ids.
|
---|
41 | *
|
---|
42 | * \param _discoverfrom node to start BFS from
|
---|
43 | * \param _max_distance max distance to discover (negative means all)
|
---|
44 | */
|
---|
45 | std::vector<atomId_t> operator()(
|
---|
46 | const atomId_t &_discoverfrom,
|
---|
47 | const int &_max_distance = -1);
|
---|
48 |
|
---|
49 | /** Getter to the internal map of distances of each atomic id.
|
---|
50 | *
|
---|
51 | * \return ref to distance map
|
---|
52 | */
|
---|
53 | const distance_map_t& getDistances() const
|
---|
54 | { return distance_map; }
|
---|
55 |
|
---|
56 | private:
|
---|
57 | //!> typedef for a vector of BFS discovery distances
|
---|
58 | typedef std::vector<size_t> distances_t;
|
---|
59 |
|
---|
60 | //!> BFS discovery distances for the returned atomic id set
|
---|
61 | distance_map_t distance_map;
|
---|
62 |
|
---|
63 | //!> graph to operate on
|
---|
64 | BoostGraphCreator &BGcreator;
|
---|
65 | };
|
---|
66 |
|
---|
67 |
|
---|
68 | #endif /* GRAPH_BREADTHFIRSTSEARCHGATHERER_HPP_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.