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

Method InterpolateTuple

Testing/GenericBridge/vtkBridgeCell.cxx:463–498  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Description: Interpolate the attribute `a' at local position `pcoords' of the cell into `val'. \pre a_exists: a!=0 \pre a_is_point_centered: a->GetCentering()==vtkPointCentered \pre clamped_point: pcoords[0]>=0 && pcoords[0]<=1 && pcoords[1]>=0 && pcoords[1]<=1 && pcoords[2]>=0 && pcoords[2]<=1 \pre val_exists: val!=0 \

Source from the content-addressed store, hash-verified

461// \pre val_exists: val!=0
462// \pre valid_size: sizeof(val)==a->GetNumberOfComponents()
463void vtkBridgeCell::InterpolateTuple(vtkGenericAttribute* a, double pcoords[3], double* val)
464{
465 assert("pre: a_exists" && a != nullptr);
466 assert("pre: a_is_point_centered" && a->GetCentering() == vtkPointCentered);
467 assert("pre: clamped_point" &&
468 (pcoords[0] >= 0 && pcoords[0] <= 1 && pcoords[1] >= 0 && pcoords[1] <= 1 && pcoords[2] >= 0 &&
469 pcoords[2] <= 1));
470 assert("pre: val_exists" && val != nullptr);
471
472 vtkBridgeAttribute* ba = static_cast<vtkBridgeAttribute*>(a);
473
474 int componentCount = a->GetNumberOfComponents();
475 int ptCount = this->GetNumberOfPoints();
476
477 if (a->GetCentering() == vtkPointCentered)
478 {
479 this->AllocateWeights();
480 this->InterpolationFunctions(pcoords, this->Weights);
481
482 memset(val, 0, sizeof(double) * componentCount);
483 for (int pt = 0; pt < ptCount; ++pt)
484 {
485 ba->Data->GetArray(ba->AttributeNumber)
486 ->GetTuple(this->Cell->GetPointId(pt), ba->InternalTuple);
487 for (int component = 0; component < componentCount; ++component)
488 {
489 val[component] += ba->InternalTuple[component] * this->Weights[pt];
490 }
491 }
492 }
493 else // cell centered
494 {
495 // not need to interpolate
496 ba->Data->GetArray(ba->AttributeNumber)->GetTuple(this->GetId(), val);
497 }
498}
499
500//------------------------------------------------------------------------------
501// Description:

Callers

nothing calls this directly

Calls 12

GetNumberOfPointsMethod · 0.95
AllocateWeightsMethod · 0.95
GetIdMethod · 0.95
GetCenteringMethod · 0.80
assertFunction · 0.50
GetNumberOfComponentsMethod · 0.45
GetTupleMethod · 0.45
GetArrayMethod · 0.45
GetPointIdMethod · 0.45
GetNumberOfAttributesMethod · 0.45
GetAttributeMethod · 0.45

Tested by

no test coverage detected