54 if(connectedEdge < (
int)
edgeIdx_.size())
124 bool operator()(
const std::pair<std::pair<int, int>,
double> &left,
125 const std::pair<std::pair<int, int>,
double> &right)
const {
126 return (left.second < right.second);
133 const std::pair<int, int> &right)
const {
134 return (left.second < right.second);
142 const std::pair<int, double> &right)
const {
143 return (left.second < right.second);
183 template <
typename triangulationType>
188 template <
class dataType,
typename triangulationType>
189 int execute(
const triangulationType &triangulation);
191 template <
class dataType>
193 dataType *upperBoundField = (dataType *)upperData;
194 dataType *lowerBoundField = (dataType *)lowerData;
199#ifdef TTK_ENABLE_OPENMP
200#pragma omp parallel for num_threads(threadNumber_)
210 const int &vertexId0,
211 const int &vertexId1)
const;
279 const int &secondId)
const {
280 const double firstLower
284 const double firstUpper
288 const double secondLower
292 const double secondUpper
296 return !((secondUpper < firstLower) || (firstUpper < secondLower));
301 template <
typename triangulationType>
344 template <
typename triangulationType>
359 template <
typename triangulationType>
361 const triangulationType &triangulation,
362 const bool &reset =
true) {
385 const bool &reset =
true,
406 const bool &reset =
true,
426 template <
typename triangulationType>
428 const triangulationType &triangulation,
429 const bool &reset =
true) {
610 std::vector<int> &mdtTreePointComponentId,
611 std::vector<PointType> &mdtTreePointType,
612 std::vector<double> &mdtTreePointLowInterval,
613 std::vector<double> &mdtTreePointUpInterval,
614 std::vector<int> &mdtTreeEdgeSwitchable,
615 const std::vector<int> &mdtExtremumParentSaddle,
616 const std::vector<int> &mdtSaddleParentSaddle,
617 const std::vector<bool> &isExtremumSimplified,
618 const std::vector<bool> &isSaddleSimplified,
619 const std::vector<std::pair<double, double>> &extremumInterval,
620 const std::vector<std::pair<int, int>> &mandatorySaddleVertices,
621 const int extremaNumber,
622 const int saddleNumber,
626 const double globalOtherExtremumValue)
const;
631 const std::vector<std::pair<int, int>> &saddleList,
632 const std::vector<std::vector<int>> &mergedExtrema,
633 const std::vector<std::pair<double, double>> &extremumInterval,
636 std::vector<std::pair<std::pair<int, int>,
double>>
637 &extremaSaddlePair)
const;
640 const Graph &mdtTree,
641 const std::vector<PointType> &mdtTreePointType,
642 const std::vector<double> &mdtTreePointLowInterval,
643 const std::vector<double> &mdtTreePointUpInterval,
644 std::vector<double> &xCoord,
645 std::vector<double> &yCoord)
const;
649 const int seedVertexId,
650 const std::vector<double> &vertexScalars,
651 std::vector<int> &componentVertexList)
const;
653 template <
typename triangulationType>
655 const int componentId,
657 const std::vector<std::pair<int, int>> &mandatorySaddleVertex,
658 const std::vector<double> &lowVertexScalars,
659 const std::vector<double> &upVertexInterval,
660 std::vector<int> &componentVertexList,
661 const triangulationType &triangulation)
const;
667 std::vector<int> &mandatoryExtremum,
668 std::vector<std::pair<double, double>> &criticalInterval)
const;
675 const std::vector<int> &mandatoryExtremumVertex,
676 std::vector<std::pair<int, int>> &mandatorySaddleVertex,
677 std::vector<std::vector<int>> &mandatoryMergedExtrema);
680 const int &startingSuperArcId,
681 const double &targetValue)
const;
684 const int &rootSuperArcId,
685 std::vector<int> &subTreeSuperArcId)
const;
692 if(superArcId == -1) {
703 int simplify(
const double normalizedThreshold,
705 const std::vector<std::pair<std::pair<int, int>,
double>>
707 const std::vector<std::vector<int>> &mergedExtrema,
708 const int numberOfExtrema,
709 std::vector<bool> &extremumSimplified,
710 std::vector<bool> &saddleSimplified,
711 std::vector<int> &extremumParentSaddle,
712 std::vector<int> &saddleParentSaddle)
const;
774 std::vector<std::pair<std::pair<int, int>,
double>>
839template <
class dataType,
typename triangulationType>
841 const triangulationType &triangulation) {
847#ifndef TTK_ENABLE_KAMIKAZE
873#ifdef TTK_ENABLE_OPENMP
874#pragma omp parallel sections
877#ifdef TTK_ENABLE_OPENMP
885#ifdef TTK_ENABLE_OPENMP
969 "Data-set (" + std::to_string(
vertexNumber_) +
" points) processed", 1.0,
974template <
typename triangulationType>
976 const triangulationType &triangulation) {
980#ifndef TTK_ENABLE_KAMIKAZE
981 if(vertexNumber_ <= 0)
983 if((
int)upperVertexScalars_.size() != vertexNumber_)
985 if((
int)lowerVertexScalars_.size() != vertexNumber_)
987 if((
int)vertexPositions_.size() != vertexNumber_)
989 if(triangulation.getNumberOfVertices() != vertexNumber_)
991 if((
int)vertexSoSoffsets_.size() != vertexNumber_)
997 lowerMinimumList_.clear();
998 upperMaximumList_.clear();
999#ifdef TTK_ENABLE_OPENMP
1000#pragma omp parallel for num_threads(threadNumber_)
1002 for(
int i = 0; i < vertexNumber_; i++) {
1003 bool isLowerMin =
true;
1004 bool isUpperMax =
true;
1005 SimplexId const neighborNumber = triangulation.getVertexNeighborNumber(i);
1006 for(
SimplexId j = 0; j < neighborNumber; j++) {
1008 triangulation.getVertexNeighbor(i, j, neighborId);
1009 if((lowerVertexScalars_[neighborId] < lowerVertexScalars_[i])
1010 || ((lowerVertexScalars_[neighborId] == lowerVertexScalars_[i])
1011 && (vertexSoSoffsets_[neighborId] < vertexSoSoffsets_[i])))
1013 if((upperVertexScalars_[neighborId] > upperVertexScalars_[i])
1014 || ((upperVertexScalars_[neighborId] == upperVertexScalars_[i])
1015 && (vertexSoSoffsets_[neighborId] > vertexSoSoffsets_[i])))
1017 if(!isUpperMax && !isLowerMin)
1021#ifdef TTK_ENABLE_OPENMP
1024 { lowerMinimumList_.push_back(i); }
1027#ifdef TTK_ENABLE_OPENMP
1030 { upperMaximumList_.push_back(i); }
1034#ifdef TTK_ENABLE_OPENMP
1035#pragma omp parallel sections num_threads(threadNumber_)
1038#ifdef TTK_ENABLE_OPENMP
1042 upperJoinTree_.setNumberOfVertices(vertexNumber_);
1043 upperJoinTree_.setVertexScalars(&upperVertexScalars_);
1044 upperJoinTree_.setVertexPositions(&vertexPositions_);
1045 upperJoinTree_.setTriangulation(&triangulation);
1046 upperJoinTree_.setVertexSoSoffsets(&vertexSoSoffsets_);
1047 upperJoinTree_.buildExtremumList(upperMinimumList_,
true);
1048 upperJoinTree_.build();
1050#ifdef TTK_ENABLE_OPENMP
1054 lowerJoinTree_.setNumberOfVertices(vertexNumber_);
1055 lowerJoinTree_.setVertexScalars(&lowerVertexScalars_);
1056 lowerJoinTree_.setVertexPositions(&vertexPositions_);
1057 lowerJoinTree_.setTriangulation(&triangulation);
1058 lowerJoinTree_.setVertexSoSoffsets(&vertexSoSoffsets_);
1059 lowerJoinTree_.setMinimumList(lowerMinimumList_);
1060 lowerJoinTree_.build();
1062#ifdef TTK_ENABLE_OPENMP
1066 upperSplitTree_.setNumberOfVertices(vertexNumber_);
1067 upperSplitTree_.setVertexScalars(&upperVertexScalars_);
1068 upperSplitTree_.setVertexPositions(&vertexPositions_);
1069 upperSplitTree_.setTriangulation(&triangulation);
1070 upperSplitTree_.setVertexSoSoffsets(&vertexSoSoffsets_);
1071 upperSplitTree_.setMaximumList(upperMaximumList_);
1072 upperSplitTree_.build();
1074#ifdef TTK_ENABLE_OPENMP
1078 lowerSplitTree_.setNumberOfVertices(vertexNumber_);
1079 lowerSplitTree_.setVertexScalars(&lowerVertexScalars_);
1080 lowerSplitTree_.setVertexPositions(&vertexPositions_);
1081 lowerSplitTree_.setTriangulation(&triangulation);
1082 lowerSplitTree_.setVertexSoSoffsets(&vertexSoSoffsets_);
1083 lowerSplitTree_.buildExtremumList(lowerMaximumList_,
false);
1084 lowerSplitTree_.build();
1088 this->threadNumber_);
1092template <
typename triangulationType>
1094 const int componentId,
1096 const std::vector<std::pair<int, int>> &mandatorySaddleVertex,
1097 const std::vector<double> &lowVertexScalars,
1098 const std::vector<double> &upVertexScalars,
1099 std::vector<int> &componentVertexList,
1100 const triangulationType &triangulation)
const {
1102 const int seedVertexId = mandatorySaddleVertex[componentId].first;
1103 const double lowInterval = lowVertexScalars[seedVertexId];
1104 const double upInterval
1105 = upVertexScalars[mandatorySaddleVertex[componentId].second];
1107 componentVertexList.clear();
1109 std::vector<bool> isVisited(vertexNumber_,
false);
1110 std::queue<SimplexId> idQueue;
1111 idQueue.push(seedVertexId);
1113 while(!(idQueue.empty())) {
1114 int const vertexId = idQueue.front();
1116 if(!isVisited[vertexId]) {
1117 isVisited[vertexId] =
true;
1118 double const lowerValue = lowerVertexScalars_[vertexId];
1119 double const upperValue = upperVertexScalars_[vertexId];
1120 if((pointType == PointType::JoinSaddle && (!(lowerValue > upInterval))
1121 && (upperValue > lowInterval))
1122 || (pointType == PointType::SplitSaddle
1123 && (!(upperValue < lowInterval)) && (lowerValue < upInterval))) {
1124 componentVertexList.push_back(vertexId);
1127 = triangulation.getVertexNeighborNumber(vertexId);
1128 for(
SimplexId i = 0; i < neighborNumber; i++) {
1130 triangulation.getVertexNeighbor(vertexId, i, neighborVertexId);
1131 idQueue.push(neighborVertexId);
#define ttkNotUsed(x)
Mark function/method parameters that are not used in the function body at all.
AbstractTriangulation is an interface class that defines an interface for efficient traversal methods...
virtual int preconditionVertexNeighbors()
Minimalist debugging class.
virtual int setDebugLevel(const int &debugLevel)
Edge(const int &start, const int &end)
const std::pair< int, int > & getVertexIdx() const
std::pair< int, int > vertexIdx_
std::vector< int > edgeIdx_
int getNumberOfEdges() const
int getEdgeIdx(const int &connectedEdge) const
const Edge & getEdge(const int idx) const
int addEdge(const int &start, const int &end)
Add an edge between the vertex start and end, returns it's index.
const Vertex & getVertex(const int idx) const
Get a pointer to the vertex idx.
std::vector< Edge > edgeList_
std::vector< Vertex > vertexList_
int addVertex()
Add a vertex, returns it's index.
int getNumberOfVertices() const
int getNumberOfEdges() const
TTK processing package for the computation of mandatory critical points in uncertain scalar data.
std::vector< std::pair< int, int > > mandatorySplitSaddleVertex_
Pair of mandatory vertices for each split saddle component.
std::vector< std::pair< std::pair< int, int >, double > > mdtMaxSplitSaddlePair_
Pairs ( (M,S), d(M,S) ) Of maxima and split saddles.
int computeJoinSaddle(const int &id, const triangulationType &triangulation, const bool &reset=true)
int execute(const triangulationType &triangulation)
std::vector< double > mdtJoinTreePointXCoord_
int vertexNumber_
Number of vertices.
std::vector< std::vector< int > > mandatoryMinimumComponentVertices_
const std::vector< PointType > * getMdtJoinTreePointType() const
std::vector< double > mdtSplitTreePointLowInterval_
std::vector< double > mdtJoinTreePointLowInterval_
int computePlanarLayout(const TreeType &treeType, const Graph &mdtTree, const std::vector< PointType > &mdtTreePointType, const std::vector< double > &mdtTreePointLowInterval, const std::vector< double > &mdtTreePointUpInterval, std::vector< double > &xCoord, std::vector< double > &yCoord) const
double getGlobalMaximum() const
int enumerateMandatorySaddles(const PointType pointType, SubLevelSetTree &lowerTree, SubLevelSetTree &upperTree, const std::vector< int > &mandatoryExtremumVertex, std::vector< std::pair< int, int > > &mandatorySaddleVertex, std::vector< std::vector< int > > &mandatoryMergedExtrema)
TODO : Multiplicity.
std::vector< PointType > mdtJoinTreePointType_
std::vector< int > mdtSplitTreeEdgeSwitchable_
bool areSaddlesSwitchables(const TreeType treeType, const int &firstId, const int &secondId) const
const std::vector< double > * getJoinTreeYLayout()
MandatoryCriticalPoints()
int computeAllSplitSaddle(const triangulationType &triangulation)
int enumerateMandatoryExtrema(const PointType pointType, SubLevelSetTree &firstTree, SubLevelSetTree &secondTree, std::vector< int > &mandatoryExtremum, std::vector< std::pair< double, double > > &criticalInterval) const
std::vector< std::vector< double > > vertexPositions_
Position (x,y,z) of each vertex.
std::vector< std::vector< int > > mandatoryMaximumComponentVertices_
List of the vertices forming each of the mandatory maximum components.
int buildMandatoryTree(const TreeType treeType, Graph &mdtTree, std::vector< int > &mdtTreePointComponentId, std::vector< PointType > &mdtTreePointType, std::vector< double > &mdtTreePointLowInterval, std::vector< double > &mdtTreePointUpInterval, std::vector< int > &mdtTreeEdgeSwitchable, const std::vector< int > &mdtExtremumParentSaddle, const std::vector< int > &mdtSaddleParentSaddle, const std::vector< bool > &isExtremumSimplified, const std::vector< bool > &isSaddleSimplified, const std::vector< std::pair< double, double > > &extremumInterval, const std::vector< std::pair< int, int > > &mandatorySaddleVertices, const int extremaNumber, const int saddleNumber, const PointType extremumType, const PointType saddleType, const PointType otherExtremumType, const double globalOtherExtremumValue) const
int computeSplitSaddle(const int &id, const triangulationType &triangulation, const bool &reset=true)
int * outputMandatoryMinimum_
Void pointer to the output mandatory minima components.
int getVertexSuperArcId(const int &vertexId, const SubLevelSetTree *tree) const
std::vector< int > mdtSplitSaddleParentSaddleId_
const std::vector< int > * getMdtJoinTreeEdgeSwitchable()
void getSubTreeSuperArcIds(const SubLevelSetTree *tree, const int &rootSuperArcId, std::vector< int > &subTreeSuperArcId) const
SubLevelSetTree lowerJoinTree_
Join tree of the lower bound scalar field.
std::vector< std::vector< int > > mergedMinimaId_
std::vector< int > upperMinimumList_
List of vertex id of the minima in the upper bound scalar field.
int setLowerBoundFieldPointer(void *data)
void * inputUpperBoundField_
Void pointer to the input upper bound scalar field.
int * outputMandatoryJoinSaddle_
Void pointer to the output mandatory join saddles components.
std::vector< int > mdtJoinSaddleParentSaddleId_
SubLevelSetTree lowerSplitTree_
Split tree of the lower bound scalar field.
int computeMaximum(const int &id, const bool &reset=true, const bool &ttkNotUsed(parallel)=true)
const std::vector< double > * getMdtJoinTreePointLowInterval() const
const std::vector< PointType > * getMdtSplitTreePointType() const
const std::vector< double > * getMdtSplitTreePointLowInterval() const
int computeSaddleComponent(const int componentId, const PointType &pointType, const std::vector< std::pair< int, int > > &mandatorySaddleVertex, const std::vector< double > &lowVertexScalars, const std::vector< double > &upVertexInterval, std::vector< int > &componentVertexList, const triangulationType &triangulation) const
int setOutputJoinSaddleDataPointer(void *data)
std::vector< PointType > mdtSplitTreePointType_
void * inputLowerBoundField_
Void pointer to the input lower bound scalar field.
std::vector< int > mdtMaximumParentSaddleId_
std::vector< std::pair< std::pair< int, int >, double > > mdtMinJoinSaddlePair_
Pairs ( (M,S), d(M,S) ) Of minima and join saddles.
int setVertexPosition(const int &i, const double point[3])
const std::vector< double > * getSplitTreeYLayout()
int simplify(const double normalizedThreshold, const TreeType treeType, const std::vector< std::pair< std::pair< int, int >, double > > &extremaSaddlePair, const std::vector< std::vector< int > > &mergedExtrema, const int numberOfExtrema, std::vector< bool > &extremumSimplified, std::vector< bool > &saddleSimplified, std::vector< int > &extremumParentSaddle, std::vector< int > &saddleParentSaddle) const
int setVertexNumber(const int &vertexNumber)
std::vector< int > lowerMaximumList_
List of vertex id of the maxima in the lower bound scalar field.
std::vector< double > upperVertexScalars_
Copy of the input upper scalar field converted in double.
std::vector< double > mdtJoinTreePointUpInterval_
const std::vector< double > * getMdtSplitTreePointUpInterval() const
std::vector< bool > isMdtMinimumSimplified_
std::vector< int > mdtJoinTreePointComponentId_
std::vector< double > lowerVertexScalars_
Copy of the input lower scalar field converted in double.
std::vector< bool > isMdtSplitSaddleSimplified_
int buildJoinTreePlanarLayout()
int setSoSoffsets(int *offsets=nullptr)
double normalizedThreshold_
Value of the simplification threshold.
const Graph * getSplitTreeGraph()
SubLevelSetTree upperJoinTree_
Join tree of the upper bound scalar field.
int setUpperBoundFieldPointer(void *data)
int findCommonAncestorNodeId(const SubLevelSetTree *tree, const int &vertexId0, const int &vertexId1) const
std::vector< int > mdtSplitTreePointComponentId_
std::vector< std::pair< int, int > > mandatoryJoinSaddleVertex_
Pair of mandatory vertices for each join saddle component.
int setOutputSplitSaddleDataPointer(void *data)
std::vector< bool > isMdtMaximumSimplified_
SubLevelSetTree upperSplitTree_
Split tree of the upper bound scalar field.
const std::vector< double > * getJoinTreeXLayout()
const std::vector< int > * getMdtSplitTreePointComponentId() const
std::vector< int > vertexSoSoffsets_
Offsets.
std::vector< int > mdtJoinTreeEdgeSwitchable_
double globalMaximumValue_
std::vector< std::pair< double, double > > mandatoryMaximumInterval_
Critical interval for each maximum component.
double getGlobalMinimum() const
int computeMinimum(const int &id, const bool &reset=true, const bool &ttkNotUsed(parallel)=true)
int getSubTreeRootSuperArcId(const SubLevelSetTree *tree, const int &startingSuperArcId, const double &targetValue) const
std::vector< double > mdtSplitTreePointXCoord_
const std::vector< int > * getMdtJoinTreePointComponentId() const
int computeExtremumComponent(const PointType &pointType, const SubLevelSetTree &tree, const int seedVertexId, const std::vector< double > &vertexScalars, std::vector< int > &componentVertexList) const
int buildPairs(const TreeType treeType, const std::vector< std::pair< int, int > > &saddleList, const std::vector< std::vector< int > > &mergedExtrema, const std::vector< std::pair< double, double > > &extremumInterval, SubLevelSetTree &lowerTree, SubLevelSetTree &upperTree, std::vector< std::pair< std::pair< int, int >, double > > &extremaSaddlePair) const
TODO : Replace SubLevelSetTrees by scalar fields for vertex value.
std::vector< std::vector< int > > mandatorySplitSaddleComponentVertices_
std::vector< int > lowerMinimumList_
List of vertex id of the minima in the lower bound scalar field.
int * outputMandatorySplitSaddle_
Void pointer to the output mandatory split saddles components.
std::vector< std::vector< int > > mandatoryJoinSaddleComponentVertices_
std::vector< int > mdtMinimumParentSaddleId_
int setSimplificationThreshold(double normalizedThreshold)
std::vector< std::vector< int > > mergedMaximaId_
std::vector< std::pair< double, double > > mandatoryMinimumInterval_
Critical interval for each minimum component.
const std::vector< double > * getSplitTreeXLayout()
std::vector< double > mdtSplitTreePointYCoord_
std::vector< double > mdtJoinTreePointYCoord_
int fillVertexScalars(void *upperData, void *lowerData)
int setDebugLevel(const int &debugLevel) override
int buildSplitTreePlanarLayout()
double globalMinimumValue_
int setOutputMaximumDataPointer(void *data)
const std::vector< double > * getMdtJoinTreePointUpInterval() const
std::vector< double > mdtSplitTreePointUpInterval_
int buildSubTrees(const triangulationType &triangulation)
int * outputMandatoryMaximum_
Void pointer to the output mandatory maxima components.
std::vector< bool > isMdtJoinSaddleSimplified_
const std::vector< int > * getMdtSplitTreeEdgeSwitchable()
void preconditionTriangulation(AbstractTriangulation *const triangulation)
int setOutputMinimumDataPointer(void *data)
std::vector< int > upperMaximumList_
List of vertex id of the maxima in the upper bound scalar field.
std::vector< int > mandatoryMinimumVertex_
Mandatory vertex for each minimum component.
const Graph * getJoinTreeGraph()
int computeAllJoinSaddle(const triangulationType &triangulation)
std::vector< int > mandatoryMaximumVertex_
Mandatory vertex for each maximum component.
int getUpSuperArcId(const int &neighborId) const
int getNumberOfDownSuperArcs() const
int getNumberOfUpSuperArcs() const
int getDownSuperArcId(const int &neighborId) const
int getVertexSuperArcId(const int &vertexId) const
const Node * getNode(const int &nodeId) const
int getVertexNodeId(const int &vertexId) const
int SimplexId
Identifier type for simplices of any dimension.
T end(std::pair< T, T > &p)
Comparison between critical point pairs ( (Extremum,Saddle), dist(M,S) )
bool operator()(const std::pair< std::pair< int, int >, double > &left, const std::pair< std::pair< int, int >, double > &right) const
Comparison between mandatory saddles (Saddle id, Number of merged extrema)
bool operator()(const std::pair< int, int > &left, const std::pair< int, int > &right) const
Comparison of the second member of a std::pair<int,double>
bool operator()(const std::pair< int, double > &left, const std::pair< int, double > &right) const
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)