| 677 | typename decltype(vtk::DataArrayTupleRange(std::declval<ArrayT*>()))::ComponentType; |
| 678 | |
| 679 | PointMatchingWorker(vtkDataSet* query, vtkDataSet* target, vtkAbstractPointLocator* locator, |
| 680 | std::vector<vtkIdType>& pointIdMap, double toleranceFactor) |
| 681 | : Query(query) |
| 682 | , Target(target) |
| 683 | , Locator(locator) |
| 684 | , PointIdMap(pointIdMap) |
| 685 | , ToleranceFactor(toleranceFactor) |
| 686 | { |
| 687 | vtkIdType numberOfPoints = query->GetNumberOfPoints(); |
| 688 | if (target->GetNumberOfPoints() != numberOfPoints) |
| 689 | { |
| 690 | vtkLog(ERROR, |
| 691 | "Tested DataSets do not have the same number of points: " |
| 692 | << numberOfPoints << " != " << target->GetNumberOfPoints() << "."); |
| 693 | this->Fail(); |
| 694 | return; |
| 695 | } |
| 696 | |
| 697 | this->PointIdMap.resize(Query->GetNumberOfPoints()); |
| 698 | |
| 699 | vtkPointData* queryPD = this->Query->GetPointData(); |
| 700 | vtkPointData* targetPD = this->Target->GetPointData(); |
| 701 | int nArrays = queryPD->GetNumberOfArrays(); |
| 702 | this->QueryArrays.reserve(nArrays); |
| 703 | this->TargetArrays.reserve(nArrays); |
| 704 | |
| 705 | this->QueryGhosts = queryPD->GetGhostArray(); |
| 706 | this->TargetGhosts = targetPD->GetGhostArray(); |
| 707 | |
| 708 | unsigned char queryGhostsToSkip = queryPD->GetGhostsToSkip(); |
| 709 | |
| 710 | if (!this->QueryGhosts != !this->TargetGhosts) |
| 711 | { |
| 712 | vtkLog(ERROR, "One input has ghosts, the other doesn't."); |
| 713 | this->Fail(); |
| 714 | return; |
| 715 | } |
| 716 | |
| 717 | this->GhostsToSkip = queryGhostsToSkip; |
| 718 | |
| 719 | for (int i = 0; i < nArrays; ++i) |
| 720 | { |
| 721 | // Sorting QueryArrays and TargetArrays in the same order |
| 722 | vtkAbstractArray* queryArray = queryPD->GetAbstractArray(i); |
| 723 | if (queryArray == this->QueryGhosts) |
| 724 | { |
| 725 | continue; |
| 726 | } |
| 727 | |
| 728 | if (!queryArray) |
| 729 | { |
| 730 | vtkLog(ERROR, "Array at index " << i << " is nullptr."); |
| 731 | this->Fail(); |
| 732 | return; |
| 733 | } |
| 734 | if (vtkAbstractArray* targetArray = targetPD->GetAbstractArray(queryArray->GetName())) |
| 735 | { |
| 736 | if (!ArrayErrorHandler(queryArray, targetArray, numberOfPoints)) |
nothing calls this directly
no test coverage detected