1 #ifndef PMPL_REEB_GRAPH_CONSTRUCTION_H_
2 #define PMPL_REEB_GRAPH_CONSTRUCTION_H_
6 #include <unordered_set>
9 #include <boost/functional/hash.hpp>
11 #include <containers/sequential/graph/directed_preds_graph.h>
55 typedef tuple<size_t, size_t, size_t>
Triangle;
66 ReebNode(
size_t _vIndx = -1,
const Vector3d& _v = Vector3d(),
67 double _w = numeric_limits<double>::max()) :
68 m_vertexIndex(_vIndx), m_vertex(_v), m_w(_w) {}
95 auto vertComp = [](
const Vector3d _a,
const Vector3d _b) {
96 return _a[0] - _b[0] > ReebTolerance() ||
97 (fabs(_a[0] - _b[0]) < ReebTolerance() && (_a[1] - _b[1] > ReebTolerance() ||
98 (fabs(_a[1] - _b[1]) < ReebTolerance() && _a[2] - _b[2] > ReebTolerance())));
104 (_a.
m_w - _b.
m_w > ReebTolerance() ||
105 (fabs(_a.
m_w - _b.
m_w) < ReebTolerance() &&
106 (vertComp(a, b) || (a == b &&
127 m_source(_s), m_target(_t) {
142 typedef stapl::sequential::directed_preds_graph<
146 typedef ReebGraph::edge_descriptor
RGEID;
162 ReebNode& s0 = m_rg->find_vertex(_a.source())->property();
163 ReebNode& s1 = m_rg->find_vertex(_b.source())->property();
167 ReebNode& t0 = m_rg->find_vertex(_a.target())->property();
168 ReebNode& t1 = m_rg->find_vertex(_b.target())->property();
172 if(_a.id() < _b.id())
192 m_source(_s), m_target(_t), m_numTris(0), m_arcs(
ReebArcComp(_rg)) {
212 boost::hash<pair<size_t, size_t>>
h;
228 typedef stapl::sequential::directed_preds_graph<
229 stapl::MULTIEDGES, Vector3d, vector<Vector3d>
241 static void SetDefaultParameters(
XMLNode& _node);
272 void Read(
const string& _filename);
276 void Write(
const string& _filename);
306 void CreateNode(
size_t _i,
const Vector3d& _v,
double _w);
318 MeshEdge* CreateArc(
size_t _s,
size_t _t,
319 const unordered_set<size_t>& _tetra = unordered_set<size_t>());
333 void MergePaths(MeshEdge* _e0, MeshEdge* _e1, MeshEdge* _e2);
352 void GlueByMergeSorting(ArcSet& _a0, MeshEdge* _e0,
353 ArcSet& _a1, MeshEdge* _e1);
364 void MergeArcs(RGEID _a0, RGEID _a1);
368 ReebArc& GetReebArc(RGEID _a);
372 void DeleteMeshEdge(MeshEdge* _e);
394 vector<Vector3d> m_vertices;
397 unordered_set<MeshEdge*, MeshEdgeHash, MeshEdgeEq> m_edges;
400 vector<pair<Triangle, unordered_set<size_t>>> m_triangles;
402 ReebGraph m_reebGraph;
ostream & operator<<(ostream &_os, const Cfg &_cfg)
Definition: Cfg.cpp:1280
istream & operator>>(istream &_is, Cfg &_cfg)
Definition: Cfg.cpp:1273
void Read(GenericStateGraph *_g, const std::string &_filename)
Definition: GenericStateGraph.h:1337
Definition: Environment.h:137
Definition: ReebGraphConstruction.h:38
stapl::sequential::directed_preds_graph< stapl::MULTIEDGES, Vector3d, vector< Vector3d > > FlowGraph
Definition: ReebGraphConstruction.h:230
ReebGraph & GetReebGraph()
Get the embedding graph.
Definition: ReebGraphConstruction.h:264
static Parameters m_defaultParams
The default parameters.
Definition: ReebGraphConstruction.h:53
set< RGEID, ReebArcComp > ArcSet
Set of ReebArcs.
Definition: ReebGraphConstruction.h:181
stapl::sequential::directed_preds_graph< stapl::MULTIEDGES, ReebNode, ReebArc > ReebGraph
Definition: ReebGraphConstruction.h:144
tuple< size_t, size_t, size_t > Triangle
Definition: ReebGraphConstruction.h:55
ReebGraph::edge_descriptor RGEID
ReebGraph edge descriptor.
Definition: ReebGraphConstruction.h:146
Definition: WorkspaceDecomposition.h:24
Geometric skeleton of the workspace.
Definition: WorkspaceSkeleton.h:22
Mesh edge equivalence. Based on source/target pair.
Definition: ReebGraphConstruction.h:218
bool operator()(const MeshEdge *const _a, const MeshEdge *const _b) const
Definition: ReebGraphConstruction.h:223
Hash function for MeshEdge. Hash based on source/target pair.
Definition: ReebGraphConstruction.h:204
size_t operator()(const MeshEdge *const _m) const
Definition: ReebGraphConstruction.h:208
boost::hash< pair< size_t, size_t > > h
Definition: ReebGraphConstruction.h:212
Tetrahedralization edge. Stores associates ReebEdges.
Definition: ReebGraphConstruction.h:186
MeshEdge(size_t _s, size_t _t, ReebGraph *_rg)
Definition: ReebGraphConstruction.h:191
size_t m_target
Target vertex index.
Definition: ReebGraphConstruction.h:196
size_t m_numTris
Number of triangles which it is incident on.
Definition: ReebGraphConstruction.h:197
ArcSet m_arcs
Set of Reeb Arcs.
Definition: ReebGraphConstruction.h:198
size_t m_source
Source vertex index.
Definition: ReebGraphConstruction.h:195
The parameters for this object.
Definition: ReebGraphConstruction.h:46
std::string filename
Input/output filename for embedded reeb graph.
Definition: ReebGraphConstruction.h:47
Definition: ReebGraphConstruction.h:152
ReebGraph * m_rg
ReebGraph pointer.
Definition: ReebGraphConstruction.h:178
ReebArcComp(ReebGraph *_rg)
Definition: ReebGraphConstruction.h:155
bool operator()(const RGEID &_a, const RGEID &_b)
Definition: ReebGraphConstruction.h:160
Definition: ReebGraphConstruction.h:121
vector< Vector3d > m_path
Embedded ReebArc.
Definition: ReebGraphConstruction.h:139
unordered_set< size_t > m_tetra
Related tetrahedron.
Definition: ReebGraphConstruction.h:138
ReebArc(size_t _s=-1, size_t _t=-1, MeshEdge *_m=nullptr)
Definition: ReebGraphConstruction.h:126
size_t m_target
Target vertex index.
Definition: ReebGraphConstruction.h:136
unordered_set< MeshEdge * > m_edges
Related mesh edges.
Definition: ReebGraphConstruction.h:137
size_t m_source
Source vertex index.
Definition: ReebGraphConstruction.h:135
Definition: ReebGraphConstruction.h:84
bool operator()(const ReebNode &_a, const ReebNode &_b)
Definition: ReebGraphConstruction.h:89
static constexpr double ReebTolerance()
Definition: ReebGraphConstruction.h:112
Vertex property of ReebGraph.
Definition: ReebGraphConstruction.h:61
size_t m_vertexIndex
Vertex Index.
Definition: ReebGraphConstruction.h:73
ReebNode(size_t _vIndx=-1, const Vector3d &_v=Vector3d(), double _w=numeric_limits< double >::max())
Definition: ReebGraphConstruction.h:66
Vector3d m_vertex
Vertex.
Definition: ReebGraphConstruction.h:74
size_t m_order
Total ordering of vertex.
Definition: ReebGraphConstruction.h:76
double m_w
Morse function value.
Definition: ReebGraphConstruction.h:75