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

Method ExecuteDataWithInformation

Imaging/Hybrid/vtkSampleFunction.cxx:395–447  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Produce the data.

Source from the content-addressed store, hash-verified

393//------------------------------------------------------------------------------
394// Produce the data.
395void 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//------------------------------------------------------------------------------
450vtkMTimeType vtkSampleFunction::GetMTime()

Callers

nothing calls this directly

Calls 15

DeleteMethod · 0.65
NewFunction · 0.50
GetOutputMethod · 0.45
GetMethod · 0.45
GetOutputInformationMethod · 0.45
GetExecutiveMethod · 0.45
SetExtentMethod · 0.45
AllocateOutputDataMethod · 0.45
GetScalarsMethod · 0.45
GetPointDataMethod · 0.45
GetNumberOfTuplesMethod · 0.45

Tested by

no test coverage detected