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

Method Execute

Filters/FlowPaths/vtkParticlePathFilter.cxx:75–250  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

73
74//------------------------------------------------------------------------------
75int vtkParticlePathFilter::Execute(
76 vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
77{
78 int retVal = this->Superclass::Execute(request, inputVector, outputVector);
79
80 // First, for every particle that we receive, we need to ask the original rank for its Path data
81 // so we can reconstruct the paths.
82 if (this->Controller && this->Controller->GetNumberOfProcesses() > 1)
83 {
84 int myRank = this->Controller ? this->Controller->GetLocalProcessId() : 0;
85
86 vtkIdType startId = this->Points->GetNumberOfPoints();
87 vtkIdType endId = startId;
88
89 // We map points using InjectedPointId
90 vtkIdType nParticlesSentLocal = static_cast<vtkIdType>(this->MPIRecvList.size());
91 std::vector<vtkIdType> particleRequests(nParticlesSentLocal);
92 vtkIdType counter = 0;
93 for (const auto& pair : this->MPIRecvList)
94 {
95 const auto& info = pair.second;
96 particleRequests[counter++] = info.InjectedPointId;
97 }
98
99 std::vector<vtkIdType> allNumParticles(this->Controller->GetNumberOfProcesses());
100
101 this->Controller->AllGather(&nParticlesSentLocal, allNumParticles.data(), 1);
102
103 vtkIdType nParticlesSent = 0;
104 std::vector<vtkIdType> offsets(this->Controller->GetNumberOfProcesses() + 1);
105 offsets.front() = 0;
106
107 for (std::size_t i = 0; i < allNumParticles.size(); ++i)
108 {
109 offsets[i + 1] = offsets[i] + allNumParticles[i];
110 nParticlesSent += allNumParticles[i];
111 }
112
113 std::vector<vtkIdType> allParticleRequests(nParticlesSent);
114
115 // We share with everyone the particles that we require. The processes owning the relevant Paths
116 // data will know what we want and we can exchange data.
117 this->Controller->AllGatherV(particleRequests.data(), allParticleRequests.data(),
118 nParticlesSentLocal, allNumParticles.data(), offsets.data());
119
120 std::vector<vtkNew<vtkIdList>> sendLists(this->Controller->GetNumberOfProcesses());
121 counter = 0;
122 int rank = 0;
123
124 while (rank < this->Controller->GetNumberOfProcesses())
125 {
126 if (allParticleRequests.empty())
127 {
128 break;
129 }
130 if (rank == myRank)
131 {
132 // skipping ourselves

Callers

nothing calls this directly

Calls 15

GetNumberOfProcessesMethod · 0.80
AllGatherVMethod · 0.80
InsertNextIdMethod · 0.80
GetAbstractArrayMethod · 0.80
popMethod · 0.80
GetLocalProcessIdMethod · 0.45
GetNumberOfPointsMethod · 0.45
sizeMethod · 0.45
AllGatherMethod · 0.45
dataMethod · 0.45
frontMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected