------------------------------------------------------------------------------
| 540 | |
| 541 | //------------------------------------------------------------------------------ |
| 542 | int vtkDataSetSurfaceFilter::UniformGridExecute( |
| 543 | vtkDataSet* input, vtkPolyData* output, vtkIdType* ext, vtkIdType* wholeExt, bool extractface[6]) |
| 544 | { |
| 545 | vtkIdType numPoints, numCells; |
| 546 | vtkPoints* gridPnts = vtkPoints::New(); |
| 547 | vtkCellArray* gridCells = vtkCellArray::New(); |
| 548 | |
| 549 | int originalPassThroughCellIds = this->PassThroughCellIds; |
| 550 | |
| 551 | // Lets figure out the max number of cells and points we are going to have |
| 552 | numPoints = numCells = 0; |
| 553 | this->EstimateStructuredDataArraySizes(ext, wholeExt, numPoints, numCells); |
| 554 | gridPnts->Allocate(numPoints); |
| 555 | gridCells->AllocateEstimate(numCells, 1); |
| 556 | output->SetPoints(gridPnts); |
| 557 | gridPnts->Delete(); |
| 558 | output->SetPolys(gridCells); |
| 559 | gridCells->Delete(); |
| 560 | |
| 561 | // Allocate attributes for copying. |
| 562 | output->GetPointData()->CopyGlobalIdsOn(); |
| 563 | output->GetPointData()->CopyAllocate(input->GetPointData(), numPoints); |
| 564 | output->GetCellData()->CopyGlobalIdsOn(); |
| 565 | output->GetCellData()->CopyAllocate(input->GetCellData(), numCells); |
| 566 | |
| 567 | if (this->PassThroughCellIds) |
| 568 | { |
| 569 | this->OriginalCellIds = vtkIdTypeArray::New(); |
| 570 | this->OriginalCellIds->SetName(this->GetOriginalCellIdsName()); |
| 571 | this->OriginalCellIds->SetNumberOfComponents(1); |
| 572 | this->OriginalCellIds->Allocate(numCells); |
| 573 | output->GetCellData()->AddArray(this->OriginalCellIds); |
| 574 | } |
| 575 | if (this->PassThroughPointIds) |
| 576 | { |
| 577 | this->OriginalPointIds = vtkIdTypeArray::New(); |
| 578 | this->OriginalPointIds->SetName(this->GetOriginalPointIdsName()); |
| 579 | this->OriginalPointIds->SetNumberOfComponents(1); |
| 580 | this->OriginalPointIds->Allocate(numPoints); |
| 581 | output->GetPointData()->AddArray(this->OriginalPointIds); |
| 582 | } |
| 583 | |
| 584 | // xMin face |
| 585 | if (extractface[0]) |
| 586 | this->ExecuteFaceQuads(input, output, 0, ext, 0, 1, 2, wholeExt, true); |
| 587 | |
| 588 | // xMax face |
| 589 | if (extractface[1]) |
| 590 | this->ExecuteFaceQuads(input, output, 1, ext, 0, 2, 1, wholeExt, true); |
| 591 | |
| 592 | // yMin face |
| 593 | if (extractface[2]) |
| 594 | this->ExecuteFaceQuads(input, output, 0, ext, 1, 2, 0, wholeExt, true); |
| 595 | |
| 596 | // yMax face |
| 597 | if (extractface[3]) |
| 598 | this->ExecuteFaceQuads(input, output, 1, ext, 1, 0, 2, wholeExt, true); |
| 599 |