17 auto localTriangleStars = triangleStars;
19 if(!localTriangleStars) {
20 localTriangleStars = &defaultTriangleStars;
23 if(localTriangleStars->empty()) {
28 vertexNumber, cellArray,
nullptr, localTriangleStars);
36 const SimplexId triangleNumber = localTriangleStars->size();
37 std::vector<SimplexId> offsets(cellNumber + 1);
39 std::vector<SimplexId> neighborsId(cellNumber);
41 for(
SimplexId i = 0; i < triangleNumber; i++) {
42 if(localTriangleStars->size(i) == 2) {
44 const auto cs0 = localTriangleStars->get(i, 0);
45 const auto cs1 = localTriangleStars->get(i, 1);
52 for(
size_t i = 1; i < offsets.size(); ++i) {
53 offsets[i] += offsets[i - 1];
57 std::vector<SimplexId> neighbors(offsets.back());
60 for(
SimplexId i = 0; i < triangleNumber; i++) {
61 if(localTriangleStars->size(i) == 2) {
63 const auto cs0 = localTriangleStars->get(i, 0);
64 const auto cs1 = localTriangleStars->get(i, 1);
65 neighbors[offsets[cs0] + neighborsId[cs0]] = cs1;
67 neighbors[offsets[cs1] + neighborsId[cs1]] = cs0;
73 cellNeighbors.
setData(std::move(neighbors), std::move(offsets));
75 printMsg(
"Built " + std::to_string(cellNumber) +
" cell neighbors", 1,
109 vertexNumber, cellArray, cellNeighbors, vertexStars);
114 printErr(
"buildCellNeighborsFromVertices in 1D:");
115 printErr(
"Not implemented! TODO?!");
119 auto localVertexStars = vertexStars;
122 if(!localVertexStars) {
123 localVertexStars = &defaultVertexStars;
126 if(localVertexStars->empty()) {
140 using boost::container::small_vector;
142 std::vector<small_vector<SimplexId, 4>> neighbors(cellNumber);
144#ifdef TTK_ENABLE_OPENMP
145#pragma omp parallel for num_threads(threadNumber_)
147 for(
SimplexId cid = 0; cid < cellNumber; cid++) {
151 for(
SimplexId j = 0; j < nbVertCell; j++) {
161 while(pos0 < localVertexStars->size(v0)
162 && pos1 < localVertexStars->size(v1)
163 && pos2 < localVertexStars->size(v2)) {
165 SimplexId biggest = localVertexStars->get(v0, pos0);
166 if(localVertexStars->get(v1, pos1) > biggest) {
167 biggest = localVertexStars->get(v1, pos1);
169 if(localVertexStars->get(v2, pos2) > biggest) {
170 biggest = localVertexStars->get(v2, pos2);
173 for(
SimplexId l = pos0; l < localVertexStars->size(v0); l++) {
174 if(localVertexStars->get(v0, l) < biggest) {
180 for(
SimplexId l = pos1; l < localVertexStars->size(v1); l++) {
181 if(localVertexStars->get(v1, l) < biggest) {
187 for(
SimplexId l = pos2; l < localVertexStars->size(v2); l++) {
188 if(localVertexStars->get(v2, l) < biggest) {
195 if(pos0 < localVertexStars->size(v0)
196 && pos1 < localVertexStars->size(v1)
197 && pos2 < localVertexStars->size(v2)) {
199 if((localVertexStars->get(v0, pos0)
200 == localVertexStars->get(v1, pos1))
201 && (localVertexStars->get(v0, pos0)
202 == localVertexStars->get(v2, pos2))) {
204 if(localVertexStars->get(v0, pos0) != cid) {
205 intersection = localVertexStars->get(v0, pos0);
216 if(intersection != -1) {
217 neighbors[cid].emplace_back(intersection);
225 printMsg(
"Built " + std::to_string(cellNumber) +
" cell neighbors", 1,
int buildTriangleList(const SimplexId &vertexNumber, const CellArray &cellArray, std::vector< std::array< SimplexId, 3 > > *triangleList=nullptr, FlatJaggedArray *triangleStars=nullptr, std::vector< std::array< SimplexId, 4 > > *cellTriangleList=nullptr) const
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)