DHART
Loading...
Searching...
No Matches
boost_graph.h
Go to the documentation of this file.
1
8
9#include <boost/graph/graph_traits.hpp>
10#include <boost/graph/adjacency_matrix.hpp>
11#include <boost/graph/directed_graph.hpp>
12#include <boost/graph/compressed_sparse_row_graph.hpp>
13#include <boost/graph/adjacency_list.hpp>
14
15
16// Define a hash function for arrays of 3 floats.
17namespace std {
20
32 template <typename SizeT>
33 inline void array_hash_combine_impl(SizeT& seed, SizeT value)
34 {
35 seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
36 }
37 template <>
38 struct hash<std::array<float, 3>>
39 {
43
53 inline std::size_t operator()(const std::array<float, 3>& k) const
54 {
55 size_t seed = std::hash<float>()(k[0]);
56 array_hash_combine_impl(seed, std::hash<float>()(k[1]));
57 array_hash_combine_impl(seed, std::hash<float>()(k[2]));
58 return seed;
59 }
60 };
61}
62
75namespace boost
76{
77#ifdef BOOST_NO_EXCEPTIONS
78 inline void throw_exception(std::exception const& e) {
79 throw 11; // or whatever
80 };
81#endif
82}
83
84
85namespace HF {
86
87 // Forward Declares
88 namespace SpatialStructures {
89 class Graph;
90 class Node;
91 }
92
93 namespace Pathfinding {
94 // Note: These structs and typedefs are used to simplify creation and usage of the boost
95 // graph and serve no purpose outside of that.
96
98
99 struct Edge_Cost {
100 float weight;
101 };
102
104
111 struct vertex_data {
112 boost::graph_traits<
113 boost::compressed_sparse_row_graph<boost::directedS>
115 double d;
116 };
117
131 typedef boost::compressed_sparse_row_graph<
132 boost::directedS,
136
139 typedef boost::graph_traits< graph_t >::vertex_descriptor vertex_descriptor;
140
142 typedef std::pair <int, int> pair;
143
167 public:
169 std::vector<vertex_descriptor> p;
170 std::vector<double> d;
171
173
217 BoostGraph(const HF::SpatialStructures::Graph& graph, const std::string & cost_type = "");
218
220
265 };
266 }
267}
STL namespace.
void array_hash_combine_impl(SizeT &seed, SizeT value)
Combine the hash of value into seed.
Definition: meshinfo.h:52
Perform human scale analysis on 3D environments.
Data stored for every edge in the BoostGraph.
Definition: boost_graph.h:99
Data stored for every vertex in the BoostGraph.
Definition: boost_graph.h:111
double d
Unknown may have been used for the colormap.
Definition: boost_graph.h:115
boost::graph_traits< graph_t >::vertex_descriptor vertex_descriptor
Quick alias to shorten the typename of vertex descriptors for our graph_t type. /summary>
Definition: boost_graph.h:139
boost::graph_traits< boost::compressed_sparse_row_graph< boost::directedS > >::vertex_descriptor p
The index of a vertex in the CSR.
Definition: boost_graph.h:114
boost::compressed_sparse_row_graph< boost::directedS, vertex_data, Edge_Cost > graph_t
Type of graph held by the BoostGraph.
Definition: boost_graph.h:135
std::pair< int, int > pair
Shorten std::pair to simplify graph construction.
Definition: boost_graph.h:142
float weight
Cost of traversing this edge.
Definition: boost_graph.h:100
The Boost C++ library. https://www.boost.org/.
Definition: boost_graph.h:76
@ value
the parser finished reading a JSON value
std::size_t operator()(const std::array< float, 3 > &k) const
Template specialization to hash an array of floats.
Definition: boost_graph.h:53
A graph usable with the BoostGraphLibrary.
Definition: boost_graph.h:166
std::vector< double > d
Distance array preallocated to the number of nodes in the graph.
Definition: boost_graph.h:170
graph_t g
The underlying graph in boost.
Definition: boost_graph.h:168
~BoostGraph()
Explicit Destructor required for BoostGraphDeleter to work in path_finder.h.
std::vector< vertex_descriptor > p
Vertex array preallocated to the number of nodes in the graph.
Definition: boost_graph.h:169
A Graph of nodes connected by edges that supports both integers and HF::SpatialStructures::Node.
Definition: graph.h:486