42 vtkInformationVector **inputVector,
43 vtkInformationVector *outputVector) {
45 vtkDataSet *input = vtkDataSet::GetData(inputVector[0]);
46 vtkDataSet *output = vtkDataSet::GetData(outputVector);
57 output->ShallowCopy(input);
66 (error = this->execute<TTK_TT>((TTK_TT *)triangulation->
getData())));
74 vertexPointArray->SetName(
"VertexLinkComponentNumber");
75 vertexPointArray->SetNumberOfTuples(output->GetNumberOfPoints());
77 vertexPointArray->SetTuple1(i, vertexLinkComponentNumber_[i]);
78 output->GetPointData()->AddArray(vertexPointArray);
82 vertexCellArray->SetName(
"VertexLinkComponentNumber");
83 vertexCellArray->SetNumberOfTuples(output->GetNumberOfCells());
85 for(
SimplexId i = 0; i < output->GetNumberOfCells(); i++) {
86 vtkCell *c = output->GetCell(i);
88 for(
int j = 0; j < c->GetNumberOfPoints(); j++) {
89 SimplexId const vertexId = c->GetPointId(j);
90 if((!j) || (vertexLinkComponentNumber_[vertexId] > cellMax)) {
91 cellMax = vertexLinkComponentNumber_[vertexId];
95 vertexCellArray->SetTuple1(i, cellMax);
97 output->GetCellData()->AddArray(vertexCellArray);
102 edgePointArray->SetName(
"EdgeLinkComponentNumber");
103 edgePointArray->SetNumberOfTuples(output->GetNumberOfPoints());
104 for(
SimplexId i = 0; i < edgePointArray->GetNumberOfTuples(); i++) {
105 edgePointArray->SetTuple1(i, 0);
110 edgeCellArray->SetName(
"EdgeLinkComponentNumber");
111 edgeCellArray->SetNumberOfTuples(output->GetNumberOfCells());
112 for(
SimplexId i = 0; i < edgeCellArray->GetNumberOfTuples(); i++) {
113 edgeCellArray->SetTuple1(i, 0);
116 if(edgeLinkComponentNumber_.size()) {
120 SimplexId vertexId0 = -1, vertexId1 = -1;
124 SimplexId const vertexMax0 = edgePointArray->GetTuple1(vertexId0);
125 SimplexId const vertexMax1 = edgePointArray->GetTuple1(vertexId1);
127 if(edgeLinkComponentNumber_[i] > vertexMax0)
128 edgePointArray->SetTuple1(vertexId0, edgeLinkComponentNumber_[i]);
129 if(edgeLinkComponentNumber_[i] > vertexMax1)
130 edgePointArray->SetTuple1(vertexId1, edgeLinkComponentNumber_[i]);
133#ifdef TTK_ENABLE_OPENMP
134#pragma omp parallel for num_threads(threadNumber_)
136 for(
SimplexId i = 0; i < output->GetNumberOfCells(); i++) {
139 output->GetCell(i, c);
141 for(
int j = 0; j < c->GetNumberOfPoints(); j++) {
142 SimplexId const vertexId0 = c->GetPointId(j);
144 for(
int k = 0; k < c->GetNumberOfPoints(); k++) {
146 vertexId1 = c->GetPointId(k);
152 for(
SimplexId l = 0; l < edgeNumber; l++) {
156 SimplexId vertexIdA = -1, vertexIdB = -1;
160 if(((vertexId0 == vertexIdA) && (vertexId1 == vertexIdB))
161 || ((vertexId1 == vertexIdA) && (vertexId0 == vertexIdB))) {
165 if(edgeLinkComponentNumber_[edgeId] > cellMax)
166 cellMax = edgeLinkComponentNumber_[edgeId];
172 edgeCellArray->SetTuple1(i, cellMax);
175 output->GetPointData()->AddArray(edgePointArray);
176 output->GetCellData()->AddArray(edgeCellArray);
181 trianglePointArray->SetName(
"TriangleLinkComponentNumber");
182 trianglePointArray->SetNumberOfTuples(output->GetNumberOfPoints());
183 for(
SimplexId i = 0; i < trianglePointArray->GetNumberOfTuples(); i++) {
184 trianglePointArray->SetTuple1(i, 0);
189 triangleCellArray->SetName(
"TriangleLinkComponentNumber");
190 triangleCellArray->SetNumberOfTuples(output->GetNumberOfCells());
191 for(
SimplexId i = 0; i < triangleCellArray->GetNumberOfTuples(); i++) {
192 triangleCellArray->SetTuple1(i, 0);
195 if(triangleLinkComponentNumber_.size()) {
200 SimplexId vertexId0 = -1, vertexId1 = -1, vertexId2 = -1;
205 SimplexId const vertexMax0 = trianglePointArray->GetTuple1(vertexId0);
206 SimplexId const vertexMax1 = trianglePointArray->GetTuple1(vertexId1);
207 SimplexId const vertexMax2 = trianglePointArray->GetTuple1(vertexId2);
209 if(triangleLinkComponentNumber_[i] > vertexMax0)
210 trianglePointArray->SetTuple1(
211 vertexId0, triangleLinkComponentNumber_[i]);
212 if(triangleLinkComponentNumber_[i] > vertexMax1)
213 trianglePointArray->SetTuple1(
214 vertexId1, triangleLinkComponentNumber_[i]);
215 if(triangleLinkComponentNumber_[i] > vertexMax2)
216 trianglePointArray->SetTuple1(
217 vertexId2, triangleLinkComponentNumber_[i]);
220#ifdef TTK_ENABLE_OPENMP
221#pragma omp parallel for num_threads(threadNumber_)
223 for(
SimplexId i = 0; i < output->GetNumberOfCells(); i++) {
226 output->GetCell(i, c);
229 for(
int j = 0; j < c->GetNumberOfPoints(); j++) {
230 SimplexId const vertexId0 = c->GetPointId(j);
234 for(
int k = 0; k < c->GetNumberOfPoints(); k++) {
236 vertexId1 = c->GetPointId(k);
238 for(
int l = 0; l < c->GetNumberOfPoints(); l++) {
239 if((l != j) && (l != k)) {
240 vertexId2 = c->GetPointId(l);
246 for(
SimplexId m = 0; m < triangleNumber; m++) {
250 SimplexId vertexIdA = -1, vertexIdB = -1, vertexIdC = -1;
255 if(((vertexId0 == vertexIdA) && (vertexId1 == vertexIdB)
256 && (vertexId2 == vertexIdC))
258 || ((vertexId0 == vertexIdA) && (vertexId1 == vertexIdC)
259 && (vertexId2 == vertexIdB))
261 || ((vertexId0 == vertexIdB) && (vertexId1 == vertexIdA)
262 && (vertexId2 == vertexIdC))
264 || ((vertexId0 == vertexIdB) && (vertexId1 == vertexIdC)
265 && (vertexId2 == vertexIdA))
267 || ((vertexId0 == vertexIdC) && (vertexId1 == vertexIdA)
268 && (vertexId2 == vertexIdB))
270 || ((vertexId0 == vertexIdC) && (vertexId1 == vertexIdB)
271 && (vertexId2 == vertexIdA))) {
276 if(triangleLinkComponentNumber_[triangleId] > cellMax) {
277 cellMax = triangleLinkComponentNumber_[triangleId];
286 triangleCellArray->SetTuple1(i, cellMax);
289 output->GetPointData()->AddArray(trianglePointArray);
290 output->GetCellData()->AddArray(triangleCellArray);