------------------------------------------------------------------------------
| 181 | |
| 182 | //------------------------------------------------------------------------------ |
| 183 | int vtkLinearToQuadraticCellsFilter::RequestData(vtkInformation* vtkNotUsed(request), |
| 184 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 185 | { |
| 186 | // get the info objects |
| 187 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 188 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 189 | |
| 190 | // get the input and output |
| 191 | vtkUnstructuredGrid* input = |
| 192 | vtkUnstructuredGrid::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 193 | vtkUnstructuredGrid* output = |
| 194 | vtkUnstructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 195 | |
| 196 | vtkNew<vtkUnsignedCharArray> outputCellTypes; |
| 197 | vtkNew<vtkCellArray> outputCellConnectivities; |
| 198 | |
| 199 | output->SetPoints(vtkNew<vtkPoints>()); |
| 200 | |
| 201 | // Set the desired precision for the points in the output. |
| 202 | if (this->OutputPointsPrecision == vtkAlgorithm::DEFAULT_PRECISION) |
| 203 | { |
| 204 | output->GetPoints()->SetDataType(input->GetPoints()->GetDataType()); |
| 205 | } |
| 206 | else if (this->OutputPointsPrecision == vtkAlgorithm::SINGLE_PRECISION) |
| 207 | { |
| 208 | output->GetPoints()->SetDataType(VTK_FLOAT); |
| 209 | } |
| 210 | else if (this->OutputPointsPrecision == vtkAlgorithm::DOUBLE_PRECISION) |
| 211 | { |
| 212 | output->GetPoints()->SetDataType(VTK_DOUBLE); |
| 213 | } |
| 214 | |
| 215 | // locator used to merge potentially duplicate points |
| 216 | if (this->Locator == nullptr) |
| 217 | { |
| 218 | this->CreateDefaultLocator(); |
| 219 | } |
| 220 | this->Locator->InitPointInsertion(output->GetPoints(), input->GetBounds()); |
| 221 | |
| 222 | vtkIdType estimatedSize = input->GetNumberOfCells(); |
| 223 | estimatedSize = estimatedSize / 1024 * 1024; // multiple of 1024 |
| 224 | estimatedSize = std::max<vtkIdType>(estimatedSize, 1024); |
| 225 | |
| 226 | output->GetPointData()->InterpolateAllocate( |
| 227 | input->GetPointData(), estimatedSize, estimatedSize / 2); |
| 228 | output->GetCellData()->CopyAllocate(input->GetCellData(), estimatedSize, estimatedSize / 2); |
| 229 | |
| 230 | vtkGenericCell* cell = vtkGenericCell::New(); |
| 231 | vtkCellIterator* it = input->NewCellIterator(); |
| 232 | for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell()) |
| 233 | { |
| 234 | if (this->CheckAbort()) |
| 235 | { |
| 236 | break; |
| 237 | } |
| 238 | it->GetCell(cell); |
| 239 | DegreeElevate(cell, this->Locator, outputCellTypes, outputCellConnectivities, |
| 240 | input->GetPointData(), output->GetPointData(), input->GetCellData(), it->GetCellId(), |
nothing calls this directly
no test coverage detected