TTK
Loading...
Searching...
No Matches
SeparatrixStability.h
Go to the documentation of this file.
1
25
26#pragma once
27
28#include <Debug.h>
29#include <optional>
30#include <utility>
31#include <vector>
32
33namespace ttk {
34
35 using MatchingType = std::tuple<int, int, double>;
36
37 class SeparatrixStability : virtual public Debug {
38
39 public:
41 = std::vector<std::vector<std::vector<std::pair<int, int>>>>;
42 using GraphMatrixFull = std::vector<std::vector<int>>;
43
45
47 const std::vector<GraphMatrixFull> &adjacencyMatrices,
48 const std::vector<int> &separatrixCountForEachBlock,
49 const std::vector<std::vector<std::array<double, 3>>> &coordsSource,
50 const std::vector<std::vector<std::array<double, 3>>> &coordsDestination,
51 const std::vector<std::vector<double>> &scalarsSource,
52 const std::vector<std::vector<double>> &scalarsDestination,
53 const bool &mergeEdgesOnSaddles,
54 std::vector<std::vector<int>> &edgesOccurrencesForEachBlock,
55 std::vector<std::vector<bool>> &isomorphismForEachBlock,
56 std::vector<std::vector<std::vector<int>>>
57 &matchingArrayForEachBlockSource,
58 std::vector<std::vector<std::vector<int>>>
59 &matchingArrayForEachBlockDestination,
60 std::vector<std::vector<std::vector<int>>>
61 &matchingArraySeparatrixForEachBlock);
63 inline void setEpsilon(double e) {
64 epsilon = e;
65 }
67 inline void setWeights(const double &px,
68 const double &py,
69 const double &pz,
70 const double &pf) {
71 Px = px;
72 Py = py;
73 Pz = pz;
74 Pf = pf;
75 }
76
77 private:
78 int buildMatchingsWithOtherBlocks(
79 const std::vector<std::vector<std::array<double, 3>>> &coords,
80 const std::vector<std::vector<double>> &scalars,
81 const int &block_id,
82 std::vector<std::vector<MatchingType>> &matchings);
83
84 void computeGraphMinor(const GraphMatrixFull &adjacencyMatrixFull,
85 GraphMatrixMinor &adjacencyMatrix);
86
87 void buildCostMatrix(const std::vector<std::array<double, 3>> &coords1,
88 const std::vector<std::array<double, 3>> &coords2,
89 const std::vector<double> &scalars1,
90 const std::vector<double> &scalars2,
91 std::vector<std::vector<double>> &matrix);
92
93 void assignmentSolver(std::vector<std::vector<double>> &costMatrix,
94 std::vector<ttk::MatchingType> &matching);
95
96 int buildOccurrenceArraysMinor(
97 const std::vector<GraphMatrixFull> &adjacencyMatrices,
98 const int &n_separatrices,
99 const std::vector<std::vector<std::array<double, 3>>> &coords,
100 const std::vector<std::vector<double>> &scalars,
101 const int &block_id,
102 std::vector<int> &edgeOccurrences,
103 std::vector<bool> &isIsomorphicWith,
104 std::vector<std::vector<int>> &matchingArray,
105 std::vector<std::vector<int>> &matchingArraySeparatrix);
106
107 int buildOccurrenceArraysFull(
108 const std::vector<GraphMatrixFull> &adjacencyMatrices,
109 const int &n_separatrices,
110 const std::vector<std::vector<std::array<double, 3>>> &coordsSource,
111 const std::vector<std::vector<std::array<double, 3>>> &coordsDestination,
112 const std::vector<std::vector<double>> &scalarsSource,
113 const std::vector<std::vector<double>> &scalarsDestination,
114 const int &block_id,
115 std::vector<int> &edgesOccurrences,
116 std::vector<bool> &isIsomorphicWith,
117 std::vector<std::vector<int>> &matchingArraySource,
118 std::vector<std::vector<int>> &matchingArrayDestination,
119 std::vector<std::vector<int>> &matchingArraySeparatrix);
120
121 double epsilon{};
122 double Px{1};
123 double Py{1};
124 double Pz{1};
125 double Pf{1};
126 };
127
128} // namespace ttk
void setWeights(const double &px, const double &py, const double &pz, const double &pf)
int buildOccurrenceArrays(const std::vector< GraphMatrixFull > &adjacencyMatrices, const std::vector< int > &separatrixCountForEachBlock, const std::vector< std::vector< std::array< double, 3 > > > &coordsSource, const std::vector< std::vector< std::array< double, 3 > > > &coordsDestination, const std::vector< std::vector< double > > &scalarsSource, const std::vector< std::vector< double > > &scalarsDestination, const bool &mergeEdgesOnSaddles, std::vector< std::vector< int > > &edgesOccurrencesForEachBlock, std::vector< std::vector< bool > > &isomorphismForEachBlock, std::vector< std::vector< std::vector< int > > > &matchingArrayForEachBlockSource, std::vector< std::vector< std::vector< int > > > &matchingArrayForEachBlockDestination, std::vector< std::vector< std::vector< int > > > &matchingArraySeparatrixForEachBlock)
std::vector< std::vector< int > > GraphMatrixFull
std::vector< std::vector< std::vector< std::pair< int, int > > > > GraphMatrixMinor
TTK base package defining the standard types.
std::tuple< int, int, double > MatchingType
Matching between two Persistence Diagram pairs.