53 vtkInformation *vtkNotUsed(request),
54 vtkInformationVector **inputVector,
55 vtkInformationVector *outputVector)
57 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
58 vtkInformation *outInfo = outputVector->GetInformationObject(0);
60 vtkUnstructuredGrid *input = vtkUnstructuredGrid::SafeDownCast(
61 inInfo->Get(vtkDataObject::DATA_OBJECT()));
62 vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
63 outInfo->Get(vtkDataObject::DATA_OBJECT()));
68 double point[3], closestPoint[3];
71 vtkCellLocator *locator;
72 vtkGenericCell *genericCell;
76 vtkErrorMacro(<<
"No reference mesh!");
80 int numberOfPoints = input->GetNumberOfPoints();
82 output->DeepCopy(input);
84 vtkPointData* outputPointData = output->GetPointData();
85 vtkPointData* referencePointData = this->
ReferenceMesh->GetPointData();
87 outputPointData->InterpolateAllocate(referencePointData,numberOfPoints);
89 locator = vtkCellLocator::New();
90 genericCell = vtkGenericCell::New();
93 locator->BuildLocator();
96 for (i=0; i<numberOfPoints; i++)
98 input->GetPoint(i,point);
99 locator->FindClosestPoint(point,closestPoint,genericCell,cellId,subId,distance2);
100 double* weights =
new double[genericCell->GetNumberOfPoints()];
101 genericCell->EvaluatePosition(closestPoint,NULL,subId,pcoords,distance2,weights);
103 outputPointData->InterpolatePoint(referencePointData,i,genericCell->GetPointIds(),weights);
109 genericCell->Delete();