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

Method RequestData

Filters/ParallelDIY2/vtkDIYAggregateDataSetFilter.cxx:104–297  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

102
103//------------------------------------------------------------------------------
104int vtkDIYAggregateDataSetFilter::RequestData(
105 vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
106{
107 vtkDataSet* input = nullptr;
108 vtkDataSet* output = vtkDataSet::GetData(outputVector, 0);
109
110 if (inputVector[0]->GetNumberOfInformationObjects() > 0)
111 {
112 input = vtkDataSet::GetData(inputVector[0], 0);
113 }
114
115 vtkMultiProcessController* controller = vtkMultiProcessController::GetGlobalController();
116
117 int numberOfProcesses = controller->GetNumberOfProcesses();
118 int myRank = controller->GetLocalProcessId();
119 if (numberOfProcesses == this->NumberOfTargetProcesses)
120 {
121 if (input)
122 {
123 output->ShallowCopy(input);
124 }
125 return 1;
126 }
127
128 if (input->IsA("vtkUnstructuredGrid") || input->IsA("vtkPolyData"))
129 {
130 // the superclass handles unstructured grids and polydata
131 return this->Superclass::RequestData(request, inputVector, outputVector);
132 }
133 // mark that the output grid hasn't been touched yet
134 this->OutputInitialized = false;
135 // DIY bounds are really just based on extents
136 vtkInformation* outputInfo = outputVector->GetInformationObject(0);
137 int wholeExtent[6] = { 0, -1, 0, -1, 0, -1 }; // empty by default
138 outputInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), wholeExtent);
139 int outputExtent[6] = { 0, -1, 0, -1, 0, -1 }; // empty by default
140
141 vtkNew<vtkExtentTranslator> extentTranslator;
142 int targetProcessId = this->GetTargetProcessId(myRank, numberOfProcesses);
143 if (targetProcessId != -1)
144 {
145 extentTranslator->PieceToExtentThreadSafe(targetProcessId, this->GetNumberOfTargetProcesses(),
146 0, wholeExtent, outputExtent, vtkExtentTranslator::BLOCK_MODE, 0);
147 }
148
149 if (vtkImageData* idOutput = vtkImageData::SafeDownCast(output))
150 {
151 idOutput->SetExtent(outputExtent);
152 }
153 else if (vtkRectilinearGrid* rgOutput = vtkRectilinearGrid::SafeDownCast(output))
154 {
155 rgOutput->SetExtent(outputExtent);
156 }
157 else if (vtkStructuredGrid* sgOutput = vtkStructuredGrid::SafeDownCast(output))
158 {
159 sgOutput->SetExtent(outputExtent);
160 }
161

Callers

nothing calls this directly

Calls 15

GetTargetProcessIdMethod · 0.95
GetExtentMethod · 0.95
DoExtentsOverlapMethod · 0.95
MoveDataMethod · 0.95
GetNumberOfProcessesMethod · 0.80
IsAMethod · 0.80
GetInformationObjectMethod · 0.80
GetDataFunction · 0.50
GetLocalProcessIdMethod · 0.45
ShallowCopyMethod · 0.45

Tested by

no test coverage detected