------------------------------------------------------------------------------
| 1076 | |
| 1077 | //------------------------------------------------------------------------------ |
| 1078 | int vtkDataSetSurfaceFilter::DataSetExecute(vtkDataSet* input, vtkPolyData* output) |
| 1079 | { |
| 1080 | vtkIdType cellId, newCellId; |
| 1081 | int i, j; |
| 1082 | vtkIdType numPts = input->GetNumberOfPoints(); |
| 1083 | vtkIdType numCells = input->GetNumberOfCells(); |
| 1084 | vtkCell* face; |
| 1085 | double x[3]; |
| 1086 | vtkIdList* cellIds; |
| 1087 | vtkIdList* pts; |
| 1088 | vtkPoints* newPts; |
| 1089 | vtkIdType ptId, pt; |
| 1090 | int npts; |
| 1091 | vtkPointData* pd = input->GetPointData(); |
| 1092 | vtkCellData* cd = input->GetCellData(); |
| 1093 | vtkPointData* outputPD = output->GetPointData(); |
| 1094 | vtkCellData* outputCD = output->GetCellData(); |
| 1095 | if (numCells == 0) |
| 1096 | { |
| 1097 | vtkDebugMacro(<< "Number of cells is zero, no data to process."); |
| 1098 | return 1; |
| 1099 | } |
| 1100 | |
| 1101 | if (this->PassThroughCellIds) |
| 1102 | { |
| 1103 | this->OriginalCellIds = vtkIdTypeArray::New(); |
| 1104 | this->OriginalCellIds->SetName(this->GetOriginalCellIdsName()); |
| 1105 | this->OriginalCellIds->SetNumberOfComponents(1); |
| 1106 | this->OriginalCellIds->Allocate(numCells); |
| 1107 | outputCD->AddArray(this->OriginalCellIds); |
| 1108 | } |
| 1109 | if (this->PassThroughPointIds) |
| 1110 | { |
| 1111 | this->OriginalPointIds = vtkIdTypeArray::New(); |
| 1112 | this->OriginalPointIds->SetName(this->GetOriginalPointIdsName()); |
| 1113 | this->OriginalPointIds->SetNumberOfComponents(1); |
| 1114 | this->OriginalPointIds->Allocate(numPts); |
| 1115 | outputPD->AddArray(this->OriginalPointIds); |
| 1116 | } |
| 1117 | |
| 1118 | cellIds = vtkIdList::New(); |
| 1119 | pts = vtkIdList::New(); |
| 1120 | |
| 1121 | vtkDebugMacro(<< "Executing geometry filter"); |
| 1122 | |
| 1123 | // Allocate |
| 1124 | // |
| 1125 | newPts = vtkPoints::New(); |
| 1126 | // we don't know what type of data the input points are so |
| 1127 | // we keep the output points to have the default type (float) |
| 1128 | newPts->Allocate(numPts, numPts / 2); |
| 1129 | output->AllocateEstimate(numCells, 3); |
| 1130 | outputPD->CopyGlobalIdsOn(); |
| 1131 | outputPD->CopyAllocate(pd, numPts, numPts / 2); |
| 1132 | outputCD->CopyGlobalIdsOn(); |
| 1133 | outputCD->CopyAllocate(cd, numCells, numCells / 2); |
| 1134 | |
| 1135 | // Traverse cells to extract geometry |
no test coverage detected