| 856 | } |
| 857 | |
| 858 | void vtkPKdTree::ExchangeVals(int pos1, int pos2) |
| 859 | { |
| 860 | vtkCommunicator* comm = this->Controller->GetCommunicator(); |
| 861 | |
| 862 | float* myval; |
| 863 | float otherval[3]; |
| 864 | |
| 865 | int player1 = this->WhoHas(pos1); |
| 866 | int player2 = this->WhoHas(pos2); |
| 867 | |
| 868 | if ((player1 == this->MyId) && (player2 == this->MyId)) |
| 869 | { |
| 870 | this->ExchangeLocalVals(pos1, pos2); |
| 871 | } |
| 872 | |
| 873 | else if (player1 == this->MyId) |
| 874 | { |
| 875 | myval = this->GetLocalVal(pos1); |
| 876 | |
| 877 | comm->Send(myval, 3, player2, this->SubGroup->tag); |
| 878 | |
| 879 | comm->Receive(otherval, 3, player2, this->SubGroup->tag); |
| 880 | |
| 881 | this->SetLocalVal(pos1, otherval); |
| 882 | } |
| 883 | else if (player2 == this->MyId) |
| 884 | { |
| 885 | myval = this->GetLocalVal(pos2); |
| 886 | |
| 887 | comm->Receive(otherval, 3, player1, this->SubGroup->tag); |
| 888 | |
| 889 | comm->Send(myval, 3, player1, this->SubGroup->tag); |
| 890 | |
| 891 | this->SetLocalVal(pos2, otherval); |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | // Given an array X with element indices ranging from L to R, and |
| 896 | // a K such that L <= K <= R, rearrange the elements such that |
nothing calls this directly
no test coverage detected