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

Method ExchangeVals

Filters/Parallel/vtkPKdTree.cxx:858–893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

856}
857
858void 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

Callers

nothing calls this directly

Calls 7

WhoHasMethod · 0.95
ExchangeLocalValsMethod · 0.95
GetLocalValMethod · 0.95
SetLocalValMethod · 0.95
GetCommunicatorMethod · 0.45
SendMethod · 0.45
ReceiveMethod · 0.45

Tested by

no test coverage detected