13 const std::vector<std::pair<SimplexId, SimplexId>> &vertexLink)
const {
15 std::map<SimplexId, SimplexId> global2LowerLink, global2UpperLink;
16 std::map<SimplexId, SimplexId>::iterator neighborIt;
22 SimplexId neighborId = vertexLink[i].first;
26 if(offsets[neighborId] < offsets[vertexId]) {
28 neighborIt = global2LowerLink.find(neighborId);
29 if(neighborIt == global2LowerLink.end()) {
31 global2LowerLink[neighborId] = lowerCount;
37 if(offsets[neighborId] > offsets[vertexId]) {
39 neighborIt = global2UpperLink.find(neighborId);
40 if(neighborIt == global2UpperLink.end()) {
42 global2UpperLink[neighborId] = upperCount;
48 neighborId = vertexLink[i].second;
51 if(offsets[neighborId] < offsets[vertexId]) {
53 neighborIt = global2LowerLink.find(neighborId);
54 if(neighborIt == global2LowerLink.end()) {
56 global2LowerLink[neighborId] = lowerCount;
62 if(offsets[neighborId] > offsets[vertexId]) {
64 neighborIt = global2UpperLink.find(neighborId);
65 if(neighborIt == global2UpperLink.end()) {
67 global2UpperLink[neighborId] = upperCount;
96 std::vector<UnionFind> lowerSeeds(lowerCount);
97 std::vector<UnionFind> upperSeeds(upperCount);
98 std::vector<UnionFind *> lowerList(lowerCount);
99 std::vector<UnionFind *> upperList(upperCount);
101 lowerList[i] = &(lowerSeeds[i]);
103 upperList[i] = &(upperSeeds[i]);
107 SimplexId const neighborId0 = vertexLink[i].first;
108 SimplexId const neighborId1 = vertexLink[i].second;
111 if(offsets[neighborId0] < offsets[vertexId]
112 && offsets[neighborId1] < offsets[vertexId]) {
115 std::map<SimplexId, SimplexId>::iterator
const n0It
116 = global2LowerLink.find(neighborId0);
117 std::map<SimplexId, SimplexId>::iterator
const n1It
118 = global2LowerLink.find(neighborId1);
121 lowerList[n0It->second], lowerList[n1It->second]);
122 lowerList[n1It->second] = lowerList[n0It->second];
126 if(offsets[neighborId0] > offsets[vertexId]
127 && offsets[neighborId1] > offsets[vertexId]) {
130 std::map<SimplexId, SimplexId>::iterator
const n0It
131 = global2UpperLink.find(neighborId0);
132 std::map<SimplexId, SimplexId>::iterator
const n1It
133 = global2UpperLink.find(neighborId1);
136 upperList[n0It->second], upperList[n1It->second]);
137 upperList[n1It->second] = upperList[n0It->second];
142 std::vector<UnionFind *>::iterator it;
145 lowerList[i] = lowerList[i]->find();
147 upperList[i] = upperList[i]->find();
149 sort(lowerList.begin(), lowerList.end());
150 it = unique(lowerList.begin(), lowerList.end());
151 lowerList.resize(distance(lowerList.begin(), it));
153 sort(upperList.begin(), upperList.end());
154 it = unique(upperList.begin(), upperList.end());
155 upperList.resize(distance(upperList.begin(), it));
164 if((lowerList.size() == 1) && (upperList.size() == 1))
169 if(dimension_ == 2) {
170 if((lowerList.size() > 2) || (upperList.size() > 2)) {
181 }
else if(dimension_ == 3) {
182 if((lowerList.size() == 2) && (upperList.size() == 1)) {
184 }
else if((lowerList.size() == 1) && (upperList.size() == 2)) {