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

Method ExchangeFloatArraysFast

Filters/ParallelGeometry/vtkPDistributedDataFilter.cxx:1772–1921  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1770
1771//------------------------------------------------------------------------------
1772vtkFloatArray** vtkPDistributedDataFilter::ExchangeFloatArraysFast(
1773 vtkFloatArray** myArray, int deleteSendArrays, int tag)
1774{
1775 vtkFloatArray** fa = nullptr;
1776 int proc;
1777 int nprocs = this->NumProcesses;
1778 int iam = this->MyId;
1779
1780 vtkMPIController* mpiContr = vtkMPIController::SafeDownCast(this->Controller);
1781
1782 int* sendSize = new int[nprocs];
1783 int* recvSize = new int[nprocs];
1784
1785 for (proc = 0; proc < nprocs; proc++)
1786 {
1787 recvSize[proc] = sendSize[proc] = 0;
1788
1789 if (proc == iam)
1790 {
1791 continue;
1792 }
1793
1794 if (myArray[proc])
1795 {
1796 sendSize[proc] = myArray[proc]->GetNumberOfTuples();
1797 }
1798 }
1799
1800 // Exchange sizes of arrays to send and receive
1801
1802 vtkMPICommunicator::Request* reqBuf = new vtkMPICommunicator::Request[nprocs];
1803
1804 for (proc = 0; proc < nprocs; proc++)
1805 {
1806 if (proc == iam)
1807 {
1808 continue;
1809 }
1810 mpiContr->NoBlockReceive(recvSize + proc, 1, proc, tag, reqBuf[proc]);
1811 }
1812
1813 mpiContr->Barrier();
1814
1815 for (proc = 0; proc < nprocs; proc++)
1816 {
1817 if (proc == iam)
1818 {
1819 continue;
1820 }
1821 mpiContr->Send(sendSize + proc, 1, proc, tag);
1822 }
1823
1824 for (proc = 0; proc < nprocs; proc++)
1825 {
1826 if (proc == iam)
1827 {
1828 continue;
1829 }

Callers 1

ExchangeFloatArraysMethod · 0.95

Calls 9

NoBlockReceiveMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetNumberOfTuplesMethod · 0.45
BarrierMethod · 0.45
SendMethod · 0.45
WaitMethod · 0.45
GetPointerMethod · 0.45
SetArrayMethod · 0.45

Tested by

no test coverage detected