54 vtkInformation *vtkNotUsed(request),
55 vtkInformationVector **inputVector,
56 vtkInformationVector *outputVector)
59 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
60 vtkInformation *outInfo = outputVector->GetInformationObject(0);
63 vtkUnstructuredGrid *input = vtkUnstructuredGrid::SafeDownCast(
64 inInfo->Get(vtkDataObject::DATA_OBJECT()));
65 vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
66 outInfo->Get(vtkDataObject::DATA_OBJECT()));
70 vtkDebugMacro(<<
"Produced " << this->GetOutput()->GetNumberOfCells() <<
" cells");
77 vtkIdList* neighborCellIds = vtkIdList::New();
80 ptIds->InsertId(0,quadPtIds->GetId(0));
81 ptIds->InsertId(1,quadPtIds->GetId(1));
82 ptIds->InsertId(2,quadPtIds->GetId(2));
84 output->GetCellNeighbors(-1,ptIds,neighborCellIds);
86 if (neighborCellIds->GetNumberOfIds() > 0)
88 ptIds->InsertId(3,quadPtIds->GetId(0));
89 ptIds->InsertId(4,quadPtIds->GetId(2));
90 ptIds->InsertId(5,quadPtIds->GetId(3));
94 ptIds->InsertId(0,quadPtIds->GetId(0));
95 ptIds->InsertId(1,quadPtIds->GetId(1));
96 ptIds->InsertId(2,quadPtIds->GetId(3));
97 ptIds->InsertId(3,quadPtIds->GetId(1));
98 ptIds->InsertId(4,quadPtIds->GetId(2));
99 ptIds->InsertId(5,quadPtIds->GetId(3));
102 neighborCellIds->Delete();
113 vtkUnstructuredGrid *output)
115 vtkPointSet *input =
static_cast<vtkPointSet*
>(dataSetInput);
116 vtkIdType numCells = input->GetNumberOfCells();
117 vtkGenericCell *cell;
118 vtkIdType newCellId, j;
120 vtkCellData *inCD=input->GetCellData();
121 vtkCellData *outCD=output->GetCellData();
123 vtkIdList *cellPtIds;
124 vtkIdType ptId, numTets, ncells;
126 int numSimplices, dim;
136 vtkUnsignedCharArray* cellTypes = dataSetInput->GetCellTypesArray();
139 int allsimplices = 1;
140 for (vtkIdType cellId = 0; cellId < cellTypes->GetSize() && allsimplices; cellId++)
142 switch (cellTypes->GetValue(cellId))
161 output->ShallowCopy(input);
166 cell = vtkGenericCell::New();
167 cellPts = vtkPoints::New();
168 cellPtIds = vtkIdList::New();
171 vtkCellData *tempCD = vtkCellData::New();
172 tempCD->ShallowCopy(inCD);
173 tempCD->SetActiveGlobalIds(NULL);
175 outCD->CopyAllocate(tempCD, input->GetNumberOfCells()*5);
176 output->Allocate(input->GetNumberOfCells()*5);
179 output->SetPoints(input->GetPoints());
180 output->GetPointData()->PassData(input->GetPointData());
182 for (vtkIdType cellId=0; cellId < numCells; cellId++)
184 input->GetCell(cellId, cell);
185 dim = cell->GetCellDimension();
192 numPts = cell->GetNumberOfPoints();
193 double *p, *pPtr=cell->GetParametricCoords();
194 this->
Triangulator->InitTriangulation(0.0,1.0, 0.0,1.0, 0.0,1.0, numPts);
195 for (p=pPtr, j=0; j<numPts; j++, p+=3)
197 ptId = cell->PointIds->GetId(j);
198 cell->Points->GetPoint(j, x);
201 if ( cell->IsPrimaryCell() )
203 int numEdges=cell->GetNumberOfEdges();
204 this->
Triangulator->TemplateTriangulate(cell->GetCellType(),
212 ncells = output->GetNumberOfCells();
215 for (j=0; j < numTets; j++)
217 outCD->CopyData(tempCD, cellId, ncells+j);
223 output->BuildLinks();
225 for (vtkIdType cellId=0; cellId < numCells; cellId++)
227 input->GetCell(cellId, cell);
228 dim = cell->GetCellDimension();
237 if (cell->GetCellType() == VTK_QUAD)
243 cell->Triangulate(0, cellPtIds, cellPts);
246 numPts = cellPtIds->GetNumberOfIds();
248 numSimplices = numPts / dim;
253 type = VTK_VERTEX;
break;
255 type = VTK_LINE;
break;
257 type = VTK_TRIANGLE;
break;
260 for ( j=0; j < numSimplices; j++ )
262 for (k=0; k<dim; k++)
264 pts[k] = cellPtIds->GetId(dim*j+k);
266 newCellId = output->InsertNextCell(type, dim, pts);
267 outCD->CopyData(tempCD, cellId, newCellId);