------------------------------------------------------------------------------ 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 \
| 461 | // \pre val_exists: val!=0 |
| 462 | // \pre valid_size: sizeof(val)==a->GetNumberOfComponents() |
| 463 | void 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: |
nothing calls this directly
no test coverage detected