MCPcopy Create free account
hub / github.com/Kitware/VTK / RequestData

Method RequestData

Filters/Geometry/vtkLinearToQuadraticCellsFilter.cxx:183–252  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

181
182//------------------------------------------------------------------------------
183int 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(),

Callers

nothing calls this directly

Calls 15

CreateDefaultLocatorMethod · 0.95
DegreeElevateFunction · 0.85
GetInformationObjectMethod · 0.80
InterpolateAllocateMethod · 0.80
GoToNextCellMethod · 0.80
CheckAbortMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetMethod · 0.45
SetPointsMethod · 0.45
SetDataTypeMethod · 0.45
GetPointsMethod · 0.45

Tested by

no test coverage detected