100 template <
class dataTypeU,
class dataTypeV,
typename triangulationType>
101 inline int execute(
const dataTypeU *
const uField,
102 const dataTypeV *
const vField,
103 const triangulationType &triangulation);
107#ifndef TTK_ENABLE_KAMIKAZE
117#ifndef TTK_ENABLE_KAMIKAZE
128#ifndef TTK_ENABLE_KAMIKAZE
138#ifndef TTK_ENABLE_KAMIKAZE
167 inline const std::vector<FiberSurface::Vertex> *
173 if((jacobiEdgeId < 0)
191 template <
class dataTypeU,
class dataTypeV>
193 perturb(
const dataTypeU *
const uField,
194 const dataTypeV *
const vField,
257 jacobiSet_.preconditionTriangulation(triangulation);
270 template <
class dataTypeU,
class dataTypeV,
typename triangulationType>
271 inline int simplify(
const dataTypeU *
const uField,
272 const dataTypeV *
const vField,
273 const triangulationType &triangulation,
274 const double &simplificationThreshold,
280 struct ReebSpaceData {
282 double simplificationThreshold_{};
284 std::vector<SimplexId> edge2sheet1_{};
285 std::vector<char> edgeTypes_{};
286 std::vector<SimplexId> tet2sheet3_{};
287 std::vector<SimplexId> vertex2sheet0_{};
288 std::vector<SimplexId> vertex2sheet3_{};
291 std::vector<Sheet0> sheet0List_{};
292 std::vector<Sheet1> sheet1List_{};
293 std::vector<Sheet2> sheet2List_{};
294 std::vector<Sheet3> sheet3List_{};
301 template <
typename triangulationType>
303 const std::vector<std::pair<SimplexId, char>> &jacobiSet,
304 std::vector<std::pair<SimplexId, SimplexId>> &jacobiSetClassification,
305 const triangulationType &triangulation);
307 template <
typename triangulationType>
309 const std::vector<std::pair<SimplexId, char>> &jacobiSet,
310 std::vector<std::pair<SimplexId, SimplexId>> &jacobiSetClassification,
311 const triangulationType &triangulation);
313 template <
class dataTypeU,
class dataTypeV,
typename triangulationType>
315 const std::vector<std::pair<SimplexId, SimplexId>> &jacobiEdges,
316 const dataTypeU *
const uField,
317 const dataTypeV *
const vField,
318 const triangulationType &triangulation);
320 template <
class dataTypeU,
class dataTypeV,
typename triangulationType>
322 const dataTypeV *
const vField,
323 const triangulationType &triangulation);
325 template <
typename triangulationType>
328 const std::vector<std::vector<std::array<SimplexId, 3>>> &tetTriangles,
329 const triangulationType &triangulation);
331 template <
typename triangulationType>
333 std::vector<std::vector<std::array<SimplexId, 3>>> &tetTriangles,
334 const triangulationType &triangulation);
336 template <
class dataTypeU,
class dataTypeV,
typename triangulationType>
339 const dataTypeU *
const uField,
340 const dataTypeV *
const vField,
341 const triangulationType &triangulation);
359 template <
typename triangulationType>
371 template <
typename triangulationType>
376 const triangulationType &triangulation);
386 template <
typename triangulationType>
387 int flush(
const triangulationType &triangulation);
389 template <
typename triangulationType>
392 const triangulationType &triangulation);
400 template <
typename triangulationType>
403 const triangulationType &triangulation);
405 template <
typename triangulationType>
408 const triangulationType &triangulation);
438template <
class dataTypeU,
class dataTypeV,
typename triangulationType>
440 const dataTypeV *
const vField,
441 const triangulationType &triangulation) {
443 flush(triangulation);
446#ifdef TTK_ENABLE_FIBER_SURFACE_WITH_RANGE_OCTREE
449 fiberSurface_.buildOctree<dataTypeU, dataTypeV>(&triangulation);
462 std::vector<std::pair<SimplexId, SimplexId>> jacobiSetClassification;
467 compute2sheets(jacobiSetClassification, uField, vField, triangulation);
470 std::vector<std::vector<std::array<SimplexId, 3>>> tetTriangles;
474 "Data-set processed", 1.0, t.
getElapsedTime(), this->threadNumber_);
481#ifdef TTK_ENABLE_OPENMP
482#pragma omp parallel for num_threads(threadNumber_)
484 for(
size_t i = 0; i <
originalData_.sheet3List_.size(); i++) {
486 originalData_.sheet3List_[i], uField, vField, triangulation);
489 for(
size_t i = 0; i <
originalData_.sheet3List_.size(); i++) {
496 this->threadNumber_);
506template <
class dataTypeU,
class dataTypeV,
typename triangulationType>
508 const std::vector<std::pair<SimplexId, SimplexId>> &jacobiEdges,
509 const dataTypeU *
const uField,
510 const dataTypeV *
const vField,
511 const triangulationType &triangulation) {
517 for(
size_t i = 0; i <
originalData_.sheet2List_.size(); i++) {
526 for(
size_t j = 0; j <
originalData_.sheet2List_[i].vertexList_.size();
536 std::vector<SimplexId> edge2polygonEdgeId(
edgeNumber_, -1);
539 for(
size_t i = 0; i < jacobiEdges.size(); i++) {
541 SimplexId const edgeId = jacobiEdges[i].first;
543 edge2polygonEdgeId[edgeId] = i;
547#ifdef TTK_ENABLE_OPENMP
548#pragma omp parallel for num_threads(threadNumber_)
550 for(
size_t i = 0; i <
originalData_.sheet2List_.size(); i++) {
562 edge2polygonEdgeId[edgeId],
565 edge2polygonEdgeId[edgeId],
570#ifdef TTK_ENABLE_OPENMP
571#pragma omp parallel for num_threads(threadNumber_)
573 for(
size_t i = 0; i < jacobiEdges.size(); i++) {
575 SimplexId const edgeId = jacobiEdges[i].first;
577 std::pair<double, double> rangePoint0, rangePoint1;
579 SimplexId vertexId0 = -1, vertexId1 = -1;
580 triangulation.getEdgeVertex(edgeId, 0, vertexId0);
581 triangulation.getEdgeVertex(edgeId, 1, vertexId1);
583 rangePoint0.first = uField[vertexId0];
584 rangePoint0.second = vField[vertexId0];
586 rangePoint1.first = uField[vertexId1];
587 rangePoint1.second = vField[vertexId1];
590 std::vector<SimplexId> edgeSeeds(
591 triangulation.getEdgeStarNumber(edgeId), -1);
592 for(
size_t j = 0; j < edgeSeeds.size(); j++) {
593 triangulation.getEdgeStar(edgeId, j, edgeSeeds[j]);
597 rangePoint0, rangePoint1, edgeSeeds, &triangulation,
598 edge2polygonEdgeId[edgeId]);
600#ifdef TTK_ENABLE_FIBER_SURFACE_WITH_RANGE_OCTREE
602 fiberSurface_.computeSurfaceWithOctree<dataTypeU, dataTypeV>(
603 rangePoint0, rangePoint1, &triangulation, edge2polygonEdgeId[edgeId]);
606 rangePoint0, rangePoint1, &triangulation, edge2polygonEdgeId[edgeId]);
610 rangePoint0, rangePoint1, edge2polygonEdgeId[edgeId]);
667 "Computed fiber surfaces", 1.0, t.
getElapsedTime(), this->threadNumber_);
672template <
class dataTypeU,
class dataTypeV,
typename triangulationType>
674 const dataTypeU *
const uField,
675 const dataTypeV *
const vField,
676 const triangulationType &triangulation) {
678 this->
printWrn(
"Computing chambers' pre-images.");
679 this->
printWrn(
"This will take a LONG time.");
685 for(
size_t i = 0; i <
originalData_.sheet2List_.size(); i++) {
696 for(
size_t i = 0; i <
originalData_.sheet2List_.size(); i++) {
704#ifdef TTK_ENABLE_OPENMP
705#pragma omp parallel for num_threads(threadNumber_)
709#ifdef TTK_ENABLE_OPENMP
710 ThreadId threadId = omp_get_thread_num();
717 std::pair<double, double> rangePoint0, rangePoint1;
719 SimplexId vertexId0 = -1, vertexId1 = -1;
720 triangulation.getEdgeVertex(edgeId, 0, vertexId0);
721 triangulation.getEdgeVertex(edgeId, 1, vertexId1);
723 rangePoint0.first = uField[vertexId0];
724 rangePoint0.second = vField[vertexId0];
726 rangePoint1.first = uField[vertexId1];
727 rangePoint1.second = vField[vertexId1];
730 rangePoint0, rangePoint1, threadId);
733 originalData_.sheet2List_[threadId].triangleList_[0].clear();
737 this->
printMsg(
"Computed chambers pre-image boundaries", 1.0,
743template <
class dataTypeU,
class dataTypeV,
typename triangulationType>
746 const dataTypeU *
const uField,
747 const dataTypeV *
const vField,
748 const triangulationType &triangulation) {
754 for(
size_t i = 0; i < sheet.
tetList_.size(); i++) {
757 std::array<std::pair<double, double>, 3> domainBox{};
758 std::array<std::pair<double, double>, 2> rangeBox;
759 std::array<std::array<float, 3>, 4> domainPoints{};
760 std::array<std::array<float, 2>, 4> rangePoints{};
762 for(
int j = 0; j < 4; j++) {
765 triangulation.getCellVertex(tetId, j, vertexId);
767 triangulation.getVertexPoint(
768 vertexId, domainPoints[j][0], domainPoints[j][1], domainPoints[j][2]);
770 rangePoints[j][0] = uField[vertexId];
771 rangePoints[j][1] = vField[vertexId];
777 sheet.
domainVolume_ += (domainBox[0].second - domainBox[0].first)
778 * (domainBox[1].second - domainBox[1].first)
779 * (domainBox[2].second - domainBox[2].first);
781 sheet.
rangeArea_ += (rangeBox[0].second - rangeBox[0].first)
782 * (rangeBox[1].second - rangeBox[1].first);
794template <
class dataTypeU,
class dataTypeV>
796 const dataTypeV *
const vField,
797 const dataTypeU &uEpsilon,
798 const dataTypeV &vEpsilon) {
801 jacobiSet_.perturb(uField, vField, uEpsilon, vEpsilon);
806template <
class dataTypeU,
class dataTypeV,
typename triangulationType>
808 const dataTypeV *
const vField,
809 const triangulationType &triangulation,
810 const double &simplificationThreshold,
817#ifdef TTK_ENABLE_OPENMP
818#pragma omp parallel for num_threads(threadNumber_)
820 for(
size_t i = 0; i <
originalData_.sheet3List_.size(); i++) {
822 originalData_.sheet3List_[i], uField, vField, triangulation);
825 for(
size_t i = 0; i <
originalData_.sheet3List_.size(); i++) {
832 this->threadNumber_);
841 std::stringstream msg;
842 msg <<
"Simplifying (";
845 msg <<
"'Domain Volume'";
848 msg <<
"'Range Area'";
851 msg <<
"'HyperVolume'";
854 msg <<
", thr: " << simplificationThreshold <<
").";
858 if(!((criterion ==
currentData_.simplificationCriterion_)
859 && (simplificationThreshold >
currentData_.simplificationThreshold_))) {
863 simplifySheets(simplificationThreshold, criterion, triangulation);
868template <
typename triangulationType>
870 const std::vector<std::pair<SimplexId, char>> &jacobiSet,
871 std::vector<std::pair<SimplexId, SimplexId>> &jacobiClassification,
872 const triangulationType &triangulation) {
880 jacobiClassification.reserve(jacobiSet.size());
883 for(
size_t i = 0; i < jacobiSet.size(); i++) {
884 originalData_.edgeTypes_[jacobiSet[i].first] = jacobiSet[i].second;
887 std::vector<bool> visitedEdges(triangulation.getNumberOfEdges(),
false);
889 for(
size_t i = 0; i < jacobiSet.size(); i++) {
891 if(visitedEdges[jacobiSet[i].first] ==
false) {
898 std::queue<SimplexId> edgeQueue;
899 edgeQueue.push(jacobiSet[i].first);
903 SimplexId const edgeId = edgeQueue.front();
906 if(!visitedEdges[edgeId]) {
908 jacobiClassification.emplace_back(edgeId, sheet1Id);
910 originalData_.sheet1List_.back().edgeList_.push_back(edgeId);
918 triangulation.getEdgeVertex(edgeId, 0, vertexId0);
920 triangulation.getEdgeVertex(edgeId, 1, vertexId1);
925 = triangulation.getVertexEdgeNumber(vertexId0);
927 for(
SimplexId j = 0; j < vertexEdgeNumber; j++) {
930 triangulation.getVertexEdge(vertexId0, j, vertexEdgeId);
933 if(vertexEdgeId != edgeId) {
937 if(!visitedEdges[vertexEdgeId]) {
938 edgeQueue.push(vertexEdgeId);
943 if((neighborNumber > 2)
958 vertexEdgeNumber = triangulation.getVertexEdgeNumber(vertexId1);
959 for(
SimplexId j = 0; j < vertexEdgeNumber; j++) {
962 triangulation.getVertexEdge(vertexId1, j, vertexEdgeId);
965 if(vertexEdgeId != edgeId) {
969 if(!visitedEdges[vertexEdgeId]) {
970 edgeQueue.push(vertexEdgeId);
976 if((neighborNumber > 2)
992 visitedEdges[edgeId] =
true;
994 }
while(edgeQueue.size());
998 this->
printMsg(std::vector<std::vector<std::string>>{
999 {
"#1-sheets", std::to_string(
originalData_.sheet1List_.size())},
1000 {
"#0-sheets", std::to_string(
originalData_.sheet0List_.size())}});
1002 "Extracted 0- and 1-sheets", 1.0, t.
getElapsedTime(), this->threadNumber_);
1007template <
typename triangulationType>
1009 const std::vector<std::pair<SimplexId, char>> &jacobiSet,
1010 std::vector<std::pair<SimplexId, SimplexId>> &jacobiClassification,
1011 const triangulationType &triangulation) {
1019 jacobiClassification.reserve(jacobiSet.size());
1022 for(
size_t i = 0; i < jacobiSet.size(); i++) {
1023 originalData_.edgeTypes_[jacobiSet[i].first] = jacobiSet[i].second;
1026 std::vector<bool> visitedEdges(triangulation.getNumberOfEdges(),
false);
1027 for(
size_t i = 0; i < jacobiSet.size(); i++) {
1030 (visitedEdges[jacobiSet[i].first] ==
false)) {
1039 std::queue<SimplexId> edgeQueue;
1040 edgeQueue.push(jacobiSet[i].first);
1047 if(!visitedEdges[edgeId]) {
1049 jacobiClassification.emplace_back(edgeId, sheet1Id);
1055 originalData_.sheet1List_.back().edgeList_.push_back(edgeId);
1061 triangulation.getEdgeVertex(edgeId, 0, vertexId0);
1063 triangulation.getEdgeVertex(edgeId, 1, vertexId1);
1078 = triangulation.getVertexEdgeNumber(vertexId0);
1079 for(
SimplexId j = 0; j < vertexEdgeNumber; j++) {
1082 triangulation.getVertexEdge(vertexId0, j, vertexEdgeId);
1086 if(vertexEdgeId != edgeId
1088 nextEdgeId = vertexEdgeId;
1093 if((neighborNumber == 2) && (nextEdgeId != -1)) {
1096 if(!visitedEdges[nextEdgeId])
1097 edgeQueue.push(nextEdgeId);
1124 .sheet1List_.push_back(sheet1Id);
1141 = triangulation.getVertexEdgeNumber(vertexId1);
1143 for(
SimplexId j = 0; j < vertexEdgeNumber; j++) {
1146 triangulation.getVertexEdge(vertexId1, j, vertexEdgeId);
1150 if(vertexEdgeId != edgeId
1152 nextEdgeId = vertexEdgeId;
1157 if((neighborNumber == 2) && (nextEdgeId != -1)) {
1160 if(!visitedEdges[nextEdgeId])
1161 edgeQueue.push(nextEdgeId);
1188 .sheet1List_.push_back(sheet1Id);
1191 visitedEdges[edgeId] =
true;
1194 }
while(edgeQueue.size());
1198 this->
printMsg(std::vector<std::vector<std::string>>{
1199 {
"#1-sheets", std::to_string(
originalData_.sheet1List_.size())},
1200 {
"#0-sheets", std::to_string(
originalData_.sheet0List_.size())}});
1202 "Extracted 0- and 1-sheets", 1.0, t.
getElapsedTime(), this->threadNumber_);
1207template <
typename triangulationType>
1210 const std::vector<std::vector<std::array<SimplexId, 3>>> &tetTriangles,
1211 const triangulationType &triangulation) {
1219 std::queue<SimplexId> vertexQueue;
1220 vertexQueue.push(vertexId);
1224 SimplexId const localVertexId = vertexQueue.front();
1230 originalData_.sheet3List_.back().vertexList_.push_back(localVertexId);
1234 = triangulation.getVertexStarNumber(localVertexId);
1236 for(
SimplexId i = 0; i < vertexStarNumber; i++) {
1238 triangulation.getVertexStar(localVertexId, i, tetId);
1240 if(tetTriangles[tetId].
empty()) {
1245 for(
int j = 0; j < 4; j++) {
1248 triangulation.getCellVertex(tetId, j, tetVertexId);
1251 vertexQueue.push(tetVertexId);
1256 for(
int j = 0; j < 4; j++) {
1258 triangulation.getCellVertex(tetId, j, otherVertexId);
1259 if((otherVertexId != localVertexId)
1265 for(
size_t k = 0; k < tetTriangles[tetId].size(); k++) {
1267 l = tetTriangles[tetId][k][0];
1268 m = tetTriangles[tetId][k][1];
1269 n = tetTriangles[tetId][k][2];
1271 for(
int p = 0; p < 3; p++) {
1272 std::pair<SimplexId, SimplexId> meshEdge;
1278 .triangleList_[m][n]
1285 .triangleList_[m][n]
1290 if(((meshEdge.first == localVertexId)
1291 && (meshEdge.second == otherVertexId))
1292 || ((meshEdge.second == localVertexId)
1293 && (meshEdge.first == otherVertexId))) {
1305 vertexQueue.push(otherVertexId);
1313 }
while(vertexQueue.size());
1318template <
typename triangulationType>
1320 std::vector<std::vector<std::array<SimplexId, 3>>> &tetTriangles,
1321 const triangulationType &triangulation) {
1327 for(
size_t i = 0; i <
originalData_.sheet2List_.size(); i++) {
1328 for(
size_t j = 0; j <
originalData_.sheet2List_[i].triangleList_.size();
1331 k <
originalData_.sheet2List_[i].triangleList_[j].size(); k++) {
1336 tetTriangles[tetId].emplace_back();
1337 tetTriangles[tetId].back()[0] = i;
1338 tetTriangles[tetId].back()[1] = j;
1339 tetTriangles[tetId].back()[2] = k;
1345 for(
size_t i = 0; i <
originalData_.sheet1List_.size(); i++) {
1346 for(
size_t j = 0; j <
originalData_.sheet1List_[i].edgeList_.size(); j++) {
1350 SimplexId vertexId0 = -1, vertexId1 = -1;
1351 triangulation.getEdgeVertex(edgeId, 0, vertexId0);
1352 triangulation.getEdgeVertex(edgeId, 1, vertexId1);
1366 std::vector<std::vector<std::pair<SimplexId, bool>>> neighborList(
1371#ifdef TTK_ENABLE_OPENMP
1372#pragma omp parallel for num_threads(threadNumber_)
1374 for(
size_t i = 0; i <
originalData_.sheet3List_.size(); i++) {
1375 for(
size_t j = 0; j <
originalData_.sheet3List_[i].vertexList_.size();
1382 = triangulation.getVertexStarNumber(vertexId);
1384 for(
SimplexId k = 0; k < vertexStarNumber; k++) {
1386 triangulation.getVertexStar(vertexId, k, tetId);
1387 if(tetTriangles[tetId].
empty()) {
1396 for(
int l = 0; l < 4; l++) {
1399 triangulation.getCellVertex(tetId, l, otherVertexId);
1401 if(vertexId != otherVertexId) {
1406 if((sheetId != otherSheetId) && (otherSheetId >= 0)) {
1408 bool inThere =
false;
1409 for(
size_t m = 0; m < neighborList[sheetId].size(); m++) {
1410 if(neighborList[sheetId][m].first == otherSheetId) {
1417 neighborList[sheetId].emplace_back(otherSheetId,
true);
1420 for(
size_t m = 0; m < tetTriangles[tetId].size(); m++) {
1423 SimplexId const x = tetTriangles[tetId][m][0];
1424 SimplexId const y = tetTriangles[tetId][m][1];
1425 SimplexId const z = tetTriangles[tetId][m][2];
1430 bool cuttingTriangle =
false;
1431 for(
int n = 0; n < 3; n++) {
1437 && (v->
meshEdge_.second == otherVertexId))
1439 && (v->
meshEdge_.first == otherVertexId))) {
1441 cuttingTriangle =
true;
1446 if(cuttingTriangle) {
1454 for(
size_t n = 0; n < neighborList[sheetId].size();
1457 if(neighborList[sheetId][n].first == otherSheetId) {
1458 if(neighborList[sheetId][n].second ==
true) {
1459 neighborList[sheetId][n].second =
false;
1467 neighborList[sheetId].emplace_back(
1468 otherSheetId,
false);
1490 for(
size_t i = 0; i <
originalData_.sheet3List_.size(); i++) {
1493 for(
size_t j = 0; j < neighborList[i].size(); j++) {
1495 if(neighborList[i][j].second) {
1497 bool isForbidden =
false;
1498 SimplexId neighborId = neighborList[i][j].first;
1501 while(
originalData_.sheet3List_[neighborId].preMerger_ != -1) {
1503 neighborId =
originalData_.sheet3List_[neighborId].preMerger_;
1510 <
originalData_.sheet3List_[neighborId].preMergedSheets_.size();
1514 =
originalData_.sheet3List_[neighborId].preMergedSheets_[k];
1516 for(
size_t l = 0; l < neighborList[i].size(); l++) {
1517 if((neighborList[i][l].first == subNeighborId)
1518 && (!neighborList[i][l].second)) {
1530 for(
size_t k = 0; k < neighborList[i].size(); k++) {
1531 if(!neighborList[i][k].second) {
1532 SimplexId const forbiddenNeighbor = neighborList[i][k].first;
1536 for(
size_t l = 0; l < neighborList[neighborId].size(); l++) {
1537 if((forbiddenNeighbor == neighborList[neighborId][l].first)
1538 && (neighborList[neighborId][l].second)) {
1549 if((neighborId !=
static_cast<SimplexId>(i)) && (!isForbidden)
1551 && (
originalData_.sheet3List_[neighborId].vertexList_.size()
1568 this->
printMsg(
"Computed " + std::to_string(totalSheetNumber) +
" 3-sheets",
1574template <
typename triangulationType>
1579 for(
size_t i = 0; i <
originalData_.sheet2List_.size(); i++) {
1580 for(
size_t j = 0; j <
originalData_.sheet2List_[i].triangleList_.size();
1584 k <
originalData_.sheet2List_[i].triangleList_[j].size(); k++) {
1589 for(
int l = 0; l < 4; l++) {
1591 triangulation.getCellVertex(tetId, l, vertexId);
1607 SimplexId const vertexEdgeNumber = triangulation.getVertexEdgeNumber(i);
1609 for(
SimplexId j = 0; j < vertexEdgeNumber; j++) {
1611 triangulation.getVertexEdge(i, j, edgeId);
1613 triangulation.getEdgeVertex(edgeId, 0, otherVertexId);
1614 if(otherVertexId == i) {
1615 triangulation.getEdgeVertex(edgeId, 1, otherVertexId);
1653template <
typename triangulationType>
1655 ReebSpaceData &data,
1659 const triangulationType &triangulation) {
1661 std::vector<SimplexId> newList;
1663 newList.reserve(data.sheet1List_[sheet1Id].sheet3List_.size());
1664 for(
size_t i = 0; i < data.sheet1List_[sheet1Id].sheet3List_.size(); i++) {
1665 SimplexId const other3SheetId = data.sheet1List_[sheet1Id].sheet3List_[i];
1666 if((other3SheetId != sheet3Id) && (!data.sheet3List_[other3SheetId].pruned_)
1667 && (data.sheet3List_[other3SheetId].tetList_.size())) {
1668 newList.push_back(data.sheet1List_[sheet1Id].sheet3List_[i]);
1672 data.sheet1List_[sheet1Id].sheet3List_ = newList;
1674 if((data.sheet1List_[sheet1Id].hasSaddleEdges_)
1675 && (data.sheet1List_[sheet1Id].sheet3List_.size() == 1)) {
1677 data.sheet1List_[sheet1Id].pruned_ =
true;
1678 data.sheet2List_[sheet1Id].pruned_ =
true;
1681 for(
size_t i = 0; i < data.sheet1List_[sheet1Id].edgeList_.size(); i++) {
1684 triangulation.getEdgeVertex(
1685 data.sheet1List_[sheet1Id].edgeList_[i], 0, vertexId);
1686 data.vertex2sheet3_[vertexId] = biggerId;
1689 triangulation.getEdgeVertex(
1690 data.sheet1List_[sheet1Id].edgeList_[i], 1, vertexId);
1691 data.vertex2sheet3_[vertexId] = biggerId;
1694 for(
size_t i = 0; i < data.sheet1List_[sheet1Id].sheet0List_.size(); i++) {
1697 data, sheet1Id, data.sheet1List_[sheet1Id].sheet0List_[i], biggerId);
1704template <
typename triangulationType>
1721 originalData_.edge2sheet1_.resize(triangulation.getNumberOfEdges(), -1);
1722 originalData_.edgeTypes_.resize(triangulation.getNumberOfEdges(), -1);
1739template <
typename triangulationType>
1742 const triangulationType &triangulation) {
1745 for(
size_t i = 0; i <
currentData_.sheet3List_[smallerId].vertexList_.size();
1749 currentData_.sheet3List_[biggerId].vertexList_.push_back(vertexId);
1752 for(
size_t i = 0; i <
currentData_.sheet3List_[smallerId].tetList_.size();
1755 currentData_.sheet3List_[biggerId].tetList_.push_back(tetId);
1768 for(
size_t i = 0; i <
currentData_.sheet3List_[smallerId].sheet3List_.size();
1774 if(otherSheetId != biggerId) {
1779 for(
size_t i = 0; i <
currentData_.sheet3List_[smallerId].sheet2List_.size();
1785 if(otherSheetId != biggerId) {
1790 for(
size_t i = 0; i <
currentData_.sheet3List_[smallerId].sheet1List_.size();
1796 if(otherSheetId != biggerId) {
1801 for(
size_t i = 0; i <
currentData_.sheet3List_[smallerId].sheet0List_.size();
1807 if(otherSheetId != biggerId) {
1815 for(
size_t i = 0; i <
currentData_.sheet3List_[smallerId].sheet3List_.size();
1822 for(
size_t i = 0; i <
currentData_.sheet3List_[smallerId].sheet2List_.size();
1829 for(
size_t i = 0; i <
currentData_.sheet3List_[smallerId].sheet1List_.size();
1833 currentData_.sheet3List_[smallerId].sheet1List_[i], biggerId,
1837 for(
size_t i = 0; i <
currentData_.sheet3List_[smallerId].sheet0List_.size();
1847template <
typename triangulationType>
1850 const triangulationType &triangulation) {
1853 double maximumScore = -1;
1856 for(
size_t i = 0; i <
currentData_.sheet3List_[sheetId].sheet3List_.size();
1861 && (sheetId != otherSheetId)) {
1863 double otherScore = 0;
1867 otherScore =
currentData_.sheet3List_[otherSheetId].domainVolume_;
1870 otherScore =
currentData_.sheet3List_[otherSheetId].rangeArea_;
1873 otherScore =
currentData_.sheet3List_[otherSheetId].hyperVolume_;
1877 if((maximumScore < 0) || (otherScore > maximumScore)) {
1878 candidateId = otherSheetId;
1879 maximumScore = otherScore;
1963 if(candidateId != -1) {
1972template <
typename triangulationType>
1974 const double &simplificationThreshold,
1976 const triangulationType &triangulation) {
1984 double lastThreshold = -1;
1986 for(
size_t it = 0; it <
originalData_.sheet3List_.size(); it++) {
1990 double minValue = -1;
1993 for(
size_t i = 0; i <
currentData_.sheet3List_.size(); i++) {
1997 switch(simplificationCriterion) {
2013 if((minId == -1) || (value < minValue)) {
2020 if((minId != -1) && (minValue < simplificationThreshold)) {
2021 simplifySheet(minId, simplificationCriterion, triangulation);
2023 lastThreshold = minValue;
2029 currentData_.simplificationThreshold_ = simplificationThreshold;
2030 currentData_.simplificationCriterion_ = simplificationCriterion;
2033 for(
size_t i = 0; i <
currentData_.sheet3List_.size(); i++) {
2035 currentData_.sheet3List_[i].simplificationId_ = simplificationId;
2039 for(
size_t i = 0; i <
currentData_.sheet3List_.size(); i++) {
2045 if(sheetId !=
static_cast<SimplexId>(i)) {
2054 for(
size_t i = 0; i <
currentData_.sheet1List_.size(); i++) {
2058 for(
size_t j = 0; j <
currentData_.sheet1List_[i].sheet3List_.size();
2067 if(nonSimplified < 2) {
2077 this->
printMsg(std::vector<std::vector<std::string>>{
2078 {
"#3-sheets simplified", std::to_string(simplifiedSheets)},
2079 {
"Last 3-sheet threshold", std::to_string(lastThreshold)},
2080 {
"#3-sheets left", std::to_string(simplificationId)}});
2083 "3-sheets simplified", 1.0, t.
getElapsedTime(), this->threadNumber_);
AbstractTriangulation is an interface class that defines an interface for efficient traversal methods...
virtual int preconditionVertexStars()
virtual int preconditionVertexEdges()
virtual int preconditionEdges()
virtual SimplexId getNumberOfCells() const
virtual SimplexId getNumberOfVertices() const
virtual SimplexId getNumberOfEdges() const
int printWrn(const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
TTK processing package that computes fiber surfaces.
TTK processing package for the computation of the Jacobi set of bivariate volumetric data.
void setSosOffsetsV(const SimplexId *const sosOffsetsV)
int disconnect3sheetFrom2sheet(ReebSpaceData &data, const SimplexId &sheet3Id, const SimplexId &sheet2Id)
std::vector< SimplexId > jacobi2edges_
const std::vector< SimplexId > * get0sheetSegmentation() const
std::vector< std::pair< SimplexId, char > > jacobiSetEdges_
bool setRangeDrivenOctree(const bool &onOff)
const std::vector< char > * getEdgeTypes() const
int compute3sheets(std::vector< std::vector< std::array< SimplexId, 3 > > > &tetTriangles, const triangulationType &triangulation)
const SimplexId * sosOffsetsU_
int connectSheets(const triangulationType &triangulation)
int getJacobi2Edge(const SimplexId &jacobiEdgeId) const
ReebSpaceData originalData_
ReebSpaceData currentData_
int preconditionTriangulation(AbstractTriangulation *const triangulation)
FiberSurface fiberSurface_
const Sheet3 * get3sheet(const SimplexId &sheetId) const
int connect3sheetTo3sheet(ReebSpaceData &data, const SimplexId &sheet3Id, const SimplexId &otherSheet3Id)
void setExpand3Sheets(const bool &onOff)
std::vector< FiberSurface::Vertex > fiberSurfaceVertexList_
int simplifySheets(const double &simplificationThreshold, const SimplificationCriterion &simplificationCriterion, const triangulationType &triangulation)
int connect3sheetTo0sheet(ReebSpaceData &data, const SimplexId &sheet3Id, const SimplexId &sheet0Id)
int printConnectivity(const ReebSpaceData &data) const
int connect3sheetTo2sheet(ReebSpaceData &data, const SimplexId &sheet3Id, const SimplexId &sheet2Id)
int mergeSheets(const SimplexId &smallerId, const SimplexId &biggerId, const triangulationType &triangulation)
int simplify(const dataTypeU *const uField, const dataTypeV *const vField, const triangulationType &triangulation, const double &simplificationThreshold, const SimplificationCriterion &criterion=SimplificationCriterion::rangeArea)
int compute2sheetChambers(const dataTypeU *const uField, const dataTypeV *const vField, const triangulationType &triangulation)
int prepareSimplification()
int connect3sheetTo1sheet(ReebSpaceData &data, const SimplexId &sheet3Id, const SimplexId &sheet1Id)
const std::vector< SimplexId > * get3sheetTetSegmentation() const
const std::vector< SimplexId > * get3sheetVertexSegmentation() const
const std::vector< SimplexId > * get1sheetSegmentation() const
bool withRangeDrivenOctree_
const Sheet0 * get0sheet(const SimplexId &sheetId) const
int preMergeSheets(const SimplexId &sheetId0, const SimplexId &sheetId1)
const Sheet2 * get2sheet(const SimplexId &sheetId) const
int disconnect1sheetFrom0sheet(ReebSpaceData &data, const SimplexId &sheet1Id, const SimplexId &sheet0Id, const SimplexId &biggerId)
int execute(const dataTypeU *const uField, const dataTypeV *const vField, const triangulationType &triangulation)
void setTetNumber(const SimplexId &tetNumber)
int compute2sheets(const std::vector< std::pair< SimplexId, SimplexId > > &jacobiEdges, const dataTypeU *const uField, const dataTypeV *const vField, const triangulationType &triangulation)
void setSosOffsetsU(const SimplexId *const sosOffsetsU)
const Sheet1 * get1sheet(const SimplexId &sheetId) const
const std::vector< FiberSurface::Vertex > * getFiberSurfaceVertices() const
int disconnect3sheetFrom3sheet(ReebSpaceData &data, const SimplexId &sheet3Id, const SimplexId &other3SheetId)
const SimplexId * sosOffsetsV_
int compute1sheets(const std::vector< std::pair< SimplexId, char > > &jacobiSet, std::vector< std::pair< SimplexId, SimplexId > > &jacobiSetClassification, const triangulationType &triangulation)
int computeGeometricalMeasures(Sheet3 &sheet, const dataTypeU *const uField, const dataTypeV *const vField, const triangulationType &triangulation)
int flush(const triangulationType &triangulation)
int compute1sheetsOnly(const std::vector< std::pair< SimplexId, char > > &jacobiSet, std::vector< std::pair< SimplexId, SimplexId > > &jacobiSetClassification, const triangulationType &triangulation)
int disconnect3sheetFrom1sheet(ReebSpaceData &data, const SimplexId &sheet3Id, const SimplexId &sheet1Id, const SimplexId &biggerId, const triangulationType &triangulation)
int compute3sheet(const SimplexId &vertexId, const std::vector< std::vector< std::array< SimplexId, 3 > > > &tetTriangles, const triangulationType &triangulation)
void setVertexNumber(const SimplexId &vertexNumber)
int simplifySheet(const SimplexId &sheetId, const SimplificationCriterion &simplificationCriterion, const triangulationType &triangulation)
int disconnect3sheetFrom0sheet(ReebSpaceData &data, const SimplexId &sheet3Id, const SimplexId &sheet0Id)
SimplexId getNumberOf2sheets() const
int perturb(const dataTypeU *const uField, const dataTypeV *const vField, const dataTypeU &uEpsilon=Geometry::powIntTen(-DBL_DIG), const dataTypeV &vEpsilon=Geometry::powIntTen(-DBL_DIG))
int getBoundingBox(const Container &points, std::array< std::pair< T, T >, dim > &bBox)
T powIntTen(const int n)
Compute the nth power of ten.
TTK base package defining the standard types.
int SimplexId
Identifier type for simplices of any dimension.
int ThreadId
Identifier type for threads (i.e. with OpenMP).
std::array< SimplexId, 3 > vertexIds_
std::pair< SimplexId, SimplexId > meshEdge_
std::vector< SimplexId > sheet1List_
std::vector< SimplexId > sheet3List_
std::vector< SimplexId > sheet3List_
std::vector< SimplexId > edgeList_
std::vector< SimplexId > sheet0List_
std::vector< std::vector< FiberSurface::Vertex > > vertexList_
std::vector< std::vector< FiberSurface::Triangle > > triangleList_
std::vector< SimplexId > sheet3List_
std::vector< SimplexId > sheet2List_
std::vector< SimplexId > sheet3List_
std::vector< SimplexId > tetList_
std::vector< SimplexId > sheet0List_
SimplexId simplificationId_
std::vector< SimplexId > vertexList_
std::vector< SimplexId > preMergedSheets_
std::vector< SimplexId > sheet1List_
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/| (_) |"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)