3int ttk::MorseSmaleQuadrangulation::findSepsVertices(
4 const std::vector<size_t> &seps,
5 std::vector<LongSimplexId> &srcs,
6 std::vector<LongSimplexId> &dsts)
const {
8 srcs.resize(seps.size());
9 dsts.resize(seps.size());
11 for(
size_t i = 0; i < seps.size(); ++i) {
12 auto src = sepCellIds_[sepBegs_[seps[i]]];
13 auto dst = sepCellIds_[sepEnds_[seps[i]]];
14 auto src_dim = sepCellDims_[sepBegs_[seps[i]]];
15 auto dst_dim = sepCellDims_[sepEnds_[seps[i]]];
17 if(criticalPointsCellIds_[j] == src
18 && criticalPointsType_[j] == src_dim) {
21 if(criticalPointsCellIds_[j] == dst
22 && criticalPointsType_[j] == dst_dim) {
31int ttk::MorseSmaleQuadrangulation::dualQuadrangulate() {
36 std::vector<Quad> dualQuads{};
39 std::set<LongSimplexId> neighs{};
40 for(
const auto &q : outputCells_) {
41 if(a == q[0] || a == q[2]) {
45 if(a == q[1] || a == q[3]) {
53 for(
size_t i = 0; i < outputPointsIds_.size(); ++i) {
55 if(outputPointsTypes_[i] != 1) {
60 auto neighs = quadNeighbors(i);
71 std::vector<LongSimplexId> crit{}, gen{};
72 for(
const auto n : neighs) {
73 if(n < criticalPointsNumber_) {
80 dualQuads.emplace_back(Quad{crit[0], gen[0], crit[1], gen[1]});
85 for(
size_t i = 0; i < outputPointsIds_.size(); ++i) {
88 if(outputPointsTypes_[i] != 3) {
94 auto v0neighs = quadNeighbors(i);
95 std::vector<LongSimplexId> crit{}, gen{};
96 for(
const auto n : v0neighs) {
97 if(n < criticalPointsNumber_) {
107 auto v1neighs = quadNeighbors(gen[0]);
109 for(
const auto n : v1neighs) {
110 if(n < criticalPointsNumber_) {
118 auto sneighs = quadNeighbors(single);
119 for(
const auto n : sneighs) {
120 if(n < criticalPointsNumber_) {
121 crit.emplace_back(n);
125 dualQuads.emplace_back(Quad{crit[0], gen[0], crit[1], gen[1]});
129 std::vector<bool> hasNeighs(outputPointsIds_.size(),
false);
130 for(
const auto &q : dualQuads) {
131 for(
const auto &qv : q) {
132 hasNeighs[qv] =
true;
136 std::vector<SimplexId> newPos(outputPointsIds_.size(), -1);
138 for(
size_t i = 0; i < outputPointsIds_.size(); ++i) {
144 decltype(this->outputPoints_) newPoints(3 * pos);
145 decltype(this->outputPointsIds_) newPointsIds(pos);
146 decltype(this->outputPointsTypes_) newPointsTypes(pos);
147 decltype(this->outputPointsCells_) newPointsCells(pos);
149 for(
size_t i = 0; i < outputPointsIds_.size(); ++i) {
151 newPoints[3 * newPos[i] + 0] = this->outputPoints_[3 * i + 0];
152 newPoints[3 * newPos[i] + 1] = this->outputPoints_[3 * i + 1];
153 newPoints[3 * newPos[i] + 2] = this->outputPoints_[3 * i + 2];
154 newPointsIds[newPos[i]] = this->outputPointsIds_[i];
155 newPointsTypes[newPos[i]] = this->outputPointsTypes_[i];
156 newPointsCells[newPos[i]] = this->outputPointsCells_[i];
160 this->outputPoints_ = std::move(newPoints);
161 this->outputPointsIds_ = std::move(newPointsIds);
162 this->outputPointsTypes_ = std::move(newPointsTypes);
163 this->outputPointsCells_ = std::move(newPointsCells);
166 for(
auto &q : dualQuads) {
172 outputCells_ = std::move(dualQuads);
177void ttk::MorseSmaleQuadrangulation::clearData() {
178 outputCells_.clear();
179 outputPoints_.clear();
180 outputPointsIds_.clear();
181 outputPointsCells_.clear();
long long int LongSimplexId
Identifier type for simplices of any dimension.
int SimplexId
Identifier type for simplices of any dimension.