------------------------------------------------------------------------------
| 920 | |
| 921 | //------------------------------------------------------------------------------ |
| 922 | int vtkCommunicator::GatherVoidArray( |
| 923 | const void* sendBuffer, void* recvBuffer, vtkIdType length, int type, int destProcessId) |
| 924 | { |
| 925 | if (this->LocalProcessId == destProcessId) |
| 926 | { |
| 927 | int result = 1; |
| 928 | char* dest = reinterpret_cast<char*>(recvBuffer); |
| 929 | int typeSize = 1; |
| 930 | switch (type) |
| 931 | { |
| 932 | vtkTemplateMacro(typeSize = sizeof(VTK_TT)); |
| 933 | } |
| 934 | // Copy local data first in case buffers are the same. |
| 935 | memmove(dest + this->LocalProcessId * length * typeSize, sendBuffer, length * typeSize); |
| 936 | // Receive everything else. |
| 937 | for (int i = 0; i < this->NumberOfProcesses; i++) |
| 938 | { |
| 939 | if (this->LocalProcessId != i) |
| 940 | { |
| 941 | result &= this->ReceiveVoidArray(dest + i * length * typeSize, length, type, i, GATHER_TAG); |
| 942 | } |
| 943 | } |
| 944 | return result; |
| 945 | } |
| 946 | else |
| 947 | { |
| 948 | return this->SendVoidArray(sendBuffer, length, type, destProcessId, GATHER_TAG); |
| 949 | } |
| 950 | } |
| 951 | |
| 952 | //------------------------------------------------------------------------------ |
| 953 | int vtkCommunicator::Gather(vtkDataArray* sendBuffer, vtkDataArray* recvBuffer, int destProcessId) |
no test coverage detected