TTK
Loading...
Searching...
No Matches
VectorSimplification.cpp
Go to the documentation of this file.
2
6
8 const std::vector<CandidatePair> &pairs,
9 const std::array<std::vector<SimplexId>, 4> &criticalCellsByDim,
10 const std::vector<bool> &pairedMinima,
11 const std::vector<bool> &paired1Saddles,
12 const std::vector<bool> &paired2Saddles,
13 const std::vector<bool> &pairedMaxima) const {
14
15 const auto dim = this->dcvf_.getDimensionality();
16
17 // display number of pairs per pair type
18 std::vector<std::vector<std::string>> rows{
19 {" #Min-saddle pairs",
20 std::to_string(
21 std::count_if(pairs.begin(), pairs.end(),
22 [](const CandidatePair &a) { return a.type == 0; }))},
23 {" #Saddle-saddle pairs",
24 std::to_string(dim == 3 ? std::count_if(
25 pairs.begin(), pairs.end(),
26 [](const CandidatePair &a) { return a.type == 1; })
27 : 0)},
28 {" #Saddle-max pairs",
29 std::to_string(std::count_if(
30 pairs.begin(), pairs.end(),
31 [dim](const CandidatePair &a) { return a.type == dim - 1; }))},
32 };
33
34 // display number of critical cells (paired and unpaired)
35 std::vector<size_t> nCritCells(dim + 1);
36 std::vector<size_t> nNonPairedCritCells(dim + 1);
37
38 for(int i = 0; i < dim + 1; ++i) {
39 nCritCells[i] = criticalCellsByDim[i].size();
40 size_t nNonPaired{};
41 for(size_t j = 0; j < criticalCellsByDim[i].size(); ++j) {
42 const auto cell = criticalCellsByDim[i][j];
43 if((i == 0 && !pairedMinima[cell]) || (i == 1 && !paired1Saddles[cell])
44 || (i == 2 && dim == 3 && !paired2Saddles[cell])
45 || (i == dim && !pairedMaxima[cell])) {
46 nNonPaired++;
47 }
48 }
49 nNonPairedCritCells[i] = nNonPaired;
50 }
51
52 std::vector<std::string> critCellsLabels{"Minima"};
53 if(dim >= 2) {
54 critCellsLabels.emplace_back("1-saddles");
55 }
56 if(dim >= 3) {
57 critCellsLabels.emplace_back("2-saddles");
58 }
59 critCellsLabels.emplace_back("Maxima");
60
61 for(int i = 0; i < dim + 1; ++i) {
62 const std::string unpaired{nNonPairedCritCells[i] == 0
63 ? " (all paired)"
64 : " (" + std::to_string(nNonPairedCritCells[i])
65 + " unpaired)"};
66
67 rows.emplace_back(std::vector<std::string>{
68 " #" + critCellsLabels[i], std::to_string(nCritCells[i]) + unpaired});
69 }
71}
void setDebugMsgPrefix(const std::string &prefix)
Definition Debug.h:364
dcvf::DiscreteVectorField dcvf_
void displayStats(const std::vector< CandidatePair > &pairs, const std::array< std::vector< SimplexId >, 4 > &criticalCellsByDim, const std::vector< bool > &pairedMinima, const std::vector< bool > &paired1Saddles, const std::vector< bool > &paired2Saddles, const std::vector< bool > &pairedMaxima) const
Print number of pairs, critical cells per dimension & unpaired cells.
Candidate pair struct for information of pairs connected by V-Paths We need to know the start and end...
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/| (_) |"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)