------------------------------------------------------------------------------ Produce the data.
| 393 | //------------------------------------------------------------------------------ |
| 394 | // Produce the data. |
| 395 | void vtkSampleFunction::ExecuteDataWithInformation(vtkDataObject* outp, vtkInformation* outInfo) |
| 396 | { |
| 397 | vtkFloatArray* newNormals = nullptr; |
| 398 | float* normals = nullptr; |
| 399 | |
| 400 | vtkImageData* output = this->GetOutput(); |
| 401 | int* extent = this->GetExecutive()->GetOutputInformation(0)->Get( |
| 402 | vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT()); |
| 403 | |
| 404 | output->SetExtent(extent); |
| 405 | output = this->AllocateOutputData(outp, outInfo); |
| 406 | vtkDataArray* newScalars = output->GetPointData()->GetScalars(); |
| 407 | vtkIdType numPts = newScalars->GetNumberOfTuples(); |
| 408 | |
| 409 | vtkDebugMacro(<< "Sampling implicit function"); |
| 410 | |
| 411 | // Initialize self; create output objects |
| 412 | // |
| 413 | if (!this->ImplicitFunction) |
| 414 | { |
| 415 | vtkErrorMacro(<< "No implicit function specified"); |
| 416 | return; |
| 417 | } |
| 418 | |
| 419 | if (this->ComputeNormals) |
| 420 | { |
| 421 | newNormals = vtkFloatArray::New(); |
| 422 | newNormals->SetNumberOfComponents(3); |
| 423 | newNormals->SetNumberOfTuples(numPts); |
| 424 | normals = newNormals->WritePointer(0, numPts); |
| 425 | } |
| 426 | |
| 427 | void* ptr = output->GetArrayPointerForExtent(newScalars, extent); |
| 428 | switch (newScalars->GetDataType()) |
| 429 | { |
| 430 | vtkTemplateMacro(vtkSampleFunctionAlgorithm<VTK_TT>::SampleAcrossImage( |
| 431 | this, output, extent, (VTK_TT*)ptr, normals)); |
| 432 | } |
| 433 | |
| 434 | newScalars->SetName(this->ScalarArrayName); |
| 435 | |
| 436 | // Update self |
| 437 | // |
| 438 | if (newNormals) |
| 439 | { |
| 440 | // For an unknown reason yet, if the following line is not commented out, |
| 441 | // it will make ImplicitSum, TestBoxFunction and TestDiscreteMarchingCubes |
| 442 | // to fail. |
| 443 | newNormals->SetName(this->NormalArrayName); |
| 444 | output->GetPointData()->SetNormals(newNormals); |
| 445 | newNormals->Delete(); |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | //------------------------------------------------------------------------------ |
| 450 | vtkMTimeType vtkSampleFunction::GetMTime() |
nothing calls this directly
no test coverage detected