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

Method RequestData

Filters/Parallel/vtkAggregateDataSetFilter.cxx:64–188  ·  view source on GitHub ↗

------------------------------------------------------------------------------ We should avoid marshalling more than once.

Source from the content-addressed store, hash-verified

62//------------------------------------------------------------------------------
63// We should avoid marshalling more than once.
64int vtkAggregateDataSetFilter::RequestData(
65 vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
66{
67 vtkDataSet* input = nullptr;
68 vtkDataSet* output = vtkDataSet::GetData(outputVector, 0);
69
70 if (inputVector[0]->GetNumberOfInformationObjects() > 0)
71 {
72 input = vtkDataSet::GetData(inputVector[0], 0);
73 }
74
75 vtkMultiProcessController* controller = vtkMultiProcessController::GetGlobalController();
76
77 int numberOfProcesses = controller->GetNumberOfProcesses();
78 if (numberOfProcesses == this->NumberOfTargetProcesses)
79 {
80 if (input)
81 {
82 output->ShallowCopy(input);
83 }
84 return 1;
85 }
86
87 if (input->IsA("vtkImageData") || input->IsA("vtkRectilinearGrid") ||
88 input->IsA("vtkStructuredGrid"))
89 {
90 vtkErrorMacro("Must build with the vtkFiltersParallelDIY2 module enabled to "
91 << "aggregate topologically regular grids with MPI");
92
93 return 0;
94 }
95
96 // create a subcontroller to simplify communication between the processes
97 // that are aggregating data
98 vtkSmartPointer<vtkMultiProcessController> subController = nullptr;
99 if (this->NumberOfTargetProcesses == 1)
100 {
101 subController = controller;
102 }
103 else
104 {
105 int localProcessId = controller->GetLocalProcessId();
106 int numberOfProcessesPerGroup = numberOfProcesses / this->NumberOfTargetProcesses;
107 int localColor = localProcessId / numberOfProcessesPerGroup;
108 if (numberOfProcesses % this->NumberOfTargetProcesses)
109 {
110 double d = 1. * numberOfProcesses / this->NumberOfTargetProcesses;
111 localColor = int(localProcessId / d);
112 }
113 subController.TakeReference(controller->PartitionController(localColor, 0));
114 }
115
116 int subNumProcs = subController->GetNumberOfProcesses();
117 int subRank = subController->GetLocalProcessId();
118
119 std::vector<vtkIdType> pointCount(subNumProcs, 0);
120 vtkIdType numPoints = input->GetNumberOfPoints();
121 subController->AllGather(&numPoints, pointCount.data(), 1);

Callers

nothing calls this directly

Calls 15

TakeFunction · 0.85
GetNumberOfProcessesMethod · 0.80
IsAMethod · 0.80
GetDataFunction · 0.50
ShallowCopyMethod · 0.45
GetLocalProcessIdMethod · 0.45
TakeReferenceMethod · 0.45
PartitionControllerMethod · 0.45
GetNumberOfPointsMethod · 0.45
AllGatherMethod · 0.45
dataMethod · 0.45
GatherMethod · 0.45

Tested by

no test coverage detected