Action_Thermostats
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
Rev | Line | |
---|
[bccbe9] | 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 |
|
---|
[966ce7] | 17 | #include <map>
|
---|
[bccbe9] | 18 | #include <stddef.h>
|
---|
| 19 | #include <vector>
|
---|
| 20 |
|
---|
| 21 | #include "types.hpp"
|
---|
| 22 |
|
---|
[4a6ef3] | 23 | class bond;
|
---|
[bccbe9] | 24 | struct BoostGraphCreator;
|
---|
| 25 |
|
---|
| 26 | /** This struct performs a BFS on a given boost::graph and finds
|
---|
| 27 | * all nodes, i.e. atoms, up to a given limit.
|
---|
| 28 | */
|
---|
| 29 | struct BreadthFirstSearchGatherer
|
---|
| 30 | {
|
---|
[966ce7] | 31 | //!> typedef for the distance map to the obtained atomic id set.
|
---|
| 32 | typedef std::map<atomId_t, size_t> distance_map_t;
|
---|
| 33 |
|
---|
[bccbe9] | 34 | /** Cstor of class BreadthFirstSearchGatherer.
|
---|
| 35 | *
|
---|
| 36 | * \param _graph graph to work on
|
---|
| 37 | */
|
---|
| 38 | BreadthFirstSearchGatherer(BoostGraphCreator &_graph);
|
---|
| 39 |
|
---|
| 40 | /** Discovers all nodes from the given \a _discoverfrom and returns
|
---|
| 41 | * the vector of ids.
|
---|
[e3ec8a8] | 42 | *
|
---|
| 43 | * \param _discoverfrom node to start BFS from
|
---|
| 44 | * \param _max_distance max distance to discover (negative means all)
|
---|
[bccbe9] | 45 | */
|
---|
[e3ec8a8] | 46 | std::vector<atomId_t> operator()(
|
---|
| 47 | const atomId_t &_discoverfrom,
|
---|
| 48 | const int &_max_distance = -1);
|
---|
[bccbe9] | 49 |
|
---|
[966ce7] | 50 | /** Getter to the internal map of distances of each atomic id.
|
---|
| 51 | *
|
---|
| 52 | * \return ref to distance map
|
---|
| 53 | */
|
---|
| 54 | const distance_map_t& getDistances() const
|
---|
| 55 | { return distance_map; }
|
---|
| 56 |
|
---|
[4a6ef3] | 57 | /** This is a default predicate which returns always true.
|
---|
| 58 | *
|
---|
| 59 | * \return true
|
---|
| 60 | */
|
---|
| 61 | static bool AlwaysTruePredicate(const bond &_bond) { return true; }
|
---|
| 62 |
|
---|
[bccbe9] | 63 | private:
|
---|
[966ce7] | 64 | //!> typedef for a vector of BFS discovery distances
|
---|
[bccbe9] | 65 | typedef std::vector<size_t> distances_t;
|
---|
| 66 |
|
---|
[966ce7] | 67 | //!> BFS discovery distances for the returned atomic id set
|
---|
| 68 | distance_map_t distance_map;
|
---|
| 69 |
|
---|
[bccbe9] | 70 | //!> graph to operate on
|
---|
| 71 | BoostGraphCreator &BGcreator;
|
---|
| 72 | };
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 | #endif /* GRAPH_BREADTHFIRSTSEARCHGATHERER_HPP_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.