TTK
Loading...
Searching...
No Matches
MergeTreeAxesAlgorithmUtils.cpp
Go to the documentation of this file.
2
3namespace ttk {
4 namespace axa {
5 //----------------------------------------------------------------------------
6 // Utils
7 //----------------------------------------------------------------------------
8 void reverseMatchingVector(unsigned int noNodes,
9 std::vector<ftm::idNode> &matchingVector,
10 std::vector<ftm::idNode> &invMatchingVector) {
11 invMatchingVector.clear();
12 invMatchingVector.resize(
13 noNodes, std::numeric_limits<ftm::idNode>::max());
14 for(unsigned int i = 0; i < matchingVector.size(); ++i)
15 if(matchingVector[i] < noNodes)
16 invMatchingVector[matchingVector[i]] = i;
17 }
18
19 //----------------------------------------------------------------------------
20 // Output Utils
21 //----------------------------------------------------------------------------
22 void zeroPadding(std::string &colName,
23 const size_t numberCols,
24 const size_t colIdx) {
25 std::string const max{std::to_string(numberCols - 1)};
26 std::string const cur{std::to_string(colIdx)};
27 std::string const zer(max.size() - cur.size(), '0');
28 colName.append(zer).append(cur);
29 }
30
31 std::string getTableCoefficientName(int noAxes, int axeNum) {
32 std::string name{"T"};
33 zeroPadding(name, noAxes, axeNum);
34 return name;
35 }
36
37 std::string getTableCoefficientNormName(int noAxes, int axeNum) {
38 std::string name{"TNorm"};
39 zeroPadding(name, noAxes, axeNum);
40 return name;
41 }
42
43 std::string getTableVectorName(
44 int noAxes, int axeNum, int vId, int vComp, bool isSecondInput) {
45 std::string indexString{};
46 zeroPadding(indexString, noAxes, axeNum);
47 std::string const prefix{(isSecondInput ? "T2_" : "")};
48 std::string name{prefix + "V" + indexString + "_" + std::to_string(vId)
49 + "_" + std::to_string(vComp)};
50 return name;
51 }
52
53 std::string getTableCorrelationName(int noAxes, int axeNum) {
54 std::string name{"Corr"};
55 zeroPadding(name, noAxes, axeNum);
56 return name;
57 }
58
59 std::string getTableCorrelationPersName(int noAxes, int axeNum) {
60 std::string name{"CorrPers"};
61 zeroPadding(name, noAxes, axeNum);
62 return name;
63 }
64
65 std::string getTableTreeName(int noTrees, int treeNum) {
66 std::string name{"Tree"};
67 zeroPadding(name, noTrees, treeNum);
68 return name;
69 }
70 } // namespace axa
71} // namespace ttk
void zeroPadding(std::string &colName, const size_t numberCols, const size_t colIdx)
std::string getTableCoefficientNormName(int noAxes, int axeNum)
std::string getTableCorrelationPersName(int noAxes, int axeNum)
void reverseMatchingVector(unsigned int noNodes, std::vector< ftm::idNode > &matchingVector, std::vector< ftm::idNode > &invMatchingVector)
std::string getTableVectorName(int noAxes, int axeNum, int vId, int vComp, bool isSecondInput)
std::string getTableTreeName(int noTrees, int treeNum)
std::string getTableCoefficientName(int noAxes, int axeNum)
std::string getTableCorrelationName(int noAxes, int axeNum)
TTK base package defining the standard types.