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

Method InterpolateTuple

Common/Core/vtkStringArray.cxx:294–324  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Interpolate array value from other array value given the indices and associated interpolation weights. This method assumes that the two arrays are of the same time.

Source from the content-addressed store, hash-verified

292// indices and associated interpolation weights.
293// This method assumes that the two arrays are of the same time.
294void vtkStringArray::InterpolateTuple(
295 vtkIdType i, vtkIdList* ptIndices, vtkAbstractArray* source, double* weights)
296{
297 if (this->GetDataType() != source->GetDataType())
298 {
299 vtkErrorMacro("Cannot CopyValue from array of type " << source->GetDataTypeAsString());
300 return;
301 }
302
303 if (ptIndices->GetNumberOfIds() == 0)
304 {
305 // nothing to do.
306 return;
307 }
308
309 // We use nearest neighbour for interpolating strings.
310 // First determine which is the nearest neighbour using the weights-
311 // it's the index with maximum weight.
312 vtkIdType nearest = ptIndices->GetId(0);
313 double max_weight = weights[0];
314 for (int k = 1; k < ptIndices->GetNumberOfIds(); k++)
315 {
316 if (weights[k] > max_weight)
317 {
318 nearest = ptIndices->GetId(k);
319 max_weight = weights[k];
320 }
321 }
322
323 this->InsertTuple(i, nearest, source);
324}
325
326//------------------------------------------------------------------------------
327// Interpolate value from the two values, p1 and p2, and an

Callers 15

benchmarkFunction · 0.45
InterpolatePointMethod · 0.45
InterpolateEdgeMethod · 0.45
InterpolateTimeMethod · 0.45
FunctionValuesMethod · 0.45
InterpolatePointMethod · 0.45
TessellateMethod · 0.45
ContourMethod · 0.45
ClipMethod · 0.45
TessellateMethod · 0.45

Calls 4

InsertTupleMethod · 0.95
GetDataTypeMethod · 0.45
GetNumberOfIdsMethod · 0.45
GetIdMethod · 0.45

Tested by 2

benchmarkFunction · 0.36