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

Method GatherVoidArray

Parallel/Core/vtkCommunicator.cxx:922–950  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

920
921//------------------------------------------------------------------------------
922int 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//------------------------------------------------------------------------------
953int vtkCommunicator::Gather(vtkDataArray* sendBuffer, vtkDataArray* recvBuffer, int destProcessId)

Callers 3

GatherMethod · 0.95
AllGatherVoidArrayMethod · 0.95
GatherFunction · 0.45

Calls 2

ReceiveVoidArrayMethod · 0.45
SendVoidArrayMethod · 0.45

Tested by

no test coverage detected