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

Method ExecuteEach

Common/ExecutionModel/vtkThreadedCompositeDataPipeline.cxx:203–258  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

201
202//------------------------------------------------------------------------------
203void vtkThreadedCompositeDataPipeline::ExecuteEach(vtkCompositeDataIterator* iter,
204 vtkInformationVector** inInfoVec, vtkInformationVector* outInfoVec, int compositePort,
205 int connection, vtkInformation* request,
206 std::vector<vtkSmartPointer<vtkCompositeDataSet>>& compositeOutput)
207{
208 // from input data objects itr -> (inObjs, indices)
209 // inObjs are the non-null objects that we will loop over.
210 // indices map the input objects to inObjs
211 std::vector<vtkDataObject*> inObjs;
212 std::vector<int> indices;
213 for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem())
214 {
215 vtkDataObject* dobj = iter->GetCurrentDataObject();
216 if (dobj)
217 {
218 inObjs.push_back(dobj);
219 indices.push_back(static_cast<int>(inObjs.size()) - 1);
220 }
221 else
222 {
223 indices.push_back(-1);
224 }
225 }
226
227 // instantiate outObjs, the output objects that will be created from inObjs
228 std::vector<vtkDataObject*> outObjs;
229 outObjs.resize(indices.size() * outInfoVec->GetNumberOfInformationObjects(), nullptr);
230
231 // create the parallel task processBlock
232 ProcessBlock processBlock(
233 this, inInfoVec, outInfoVec, compositePort, connection, request, inObjs, outObjs);
234
235 vtkSmartPointer<vtkProgressObserver> origPo(this->Algorithm->GetProgressObserver());
236 vtkNew<vtkSMPProgressObserver> po;
237 this->Algorithm->SetProgressObserver(po);
238 vtkSMPTools::For(0, static_cast<vtkIdType>(inObjs.size()), processBlock);
239 this->Algorithm->SetProgressObserver(origPo);
240
241 int i = 0;
242 for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem(), i++)
243 {
244 int j = indices[i];
245 if (j >= 0)
246 {
247 for (int k = 0; k < outInfoVec->GetNumberOfInformationObjects(); ++k)
248 {
249 vtkDataObject* outObj = outObjs[j * outInfoVec->GetNumberOfInformationObjects() + k];
250 compositeOutput[k]->SetDataSet(iter, outObj);
251 if (outObj)
252 {
253 outObj->FastDelete();
254 }
255 }
256 }
257 }
258}
259
260//------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 11

SetProgressObserverMethod · 0.80
FastDeleteMethod · 0.80
ForFunction · 0.50
InitTraversalMethod · 0.45
IsDoneWithTraversalMethod · 0.45
GoToNextItemMethod · 0.45
GetCurrentDataObjectMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
SetDataSetMethod · 0.45

Tested by

no test coverage detected