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

Method RequestData

Filters/Parallel/vtkHyperTreeGridGhostCellsGenerator.cxx:175–272  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

173
174//------------------------------------------------------------------------------
175int vtkHyperTreeGridGhostCellsGenerator::RequestData(vtkInformation* vtkNotUsed(request),
176 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
177{
178 this->UpdateProgress(0.);
179
180 vtkInformation* info = outputVector->GetInformationObject(0);
181 int currentPiece = info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER());
182
183 // Make sure input is either a HTG or a PartitionedDataSet that contains a HTG piece.
184 vtkHyperTreeGrid* inputHTG = vtkHyperTreeGrid::GetData(inputVector[0], 0);
185 vtkPartitionedDataSet* inputPDS = vtkPartitionedDataSet::GetData(inputVector[0], 0);
186
187 if (!inputPDS && !inputHTG)
188 {
189 vtkErrorMacro("Input data is neither HTG or PartitionedDataSet. Cannot proceed with ghost cell "
190 "generation.");
191 return 0;
192 }
193
194 vtkHyperTreeGrid* outputHTG = vtkHyperTreeGrid::GetData(outputVector, 0);
195 vtkPartitionedDataSet* outputPDS = vtkPartitionedDataSet::GetData(outputVector, 0);
196 if (outputPDS)
197 {
198 outputPDS->CopyStructure(inputPDS);
199 }
200
201 // When the filter receives a PartitionedDataSet, the data for the current rank can be in either
202 // partition, depending on the data generation method. We survey the partitions to find the one
203 // that contains the actual data. There should be exactly one non-null HTG partition in each
204 // piece. If we find multiple, the HTG structure is not capable of merging multiple grids, so we
205 // simply use the last one.
206 if (inputPDS && outputPDS)
207 {
208 for (unsigned int partId = 0; partId < inputPDS->GetNumberOfPartitions(); partId++)
209 {
210 auto partHTG = vtkHyperTreeGrid::SafeDownCast(inputPDS->GetPartitionAsDataObject(partId));
211 if (partHTG)
212 {
213 if (inputHTG)
214 {
215 vtkWarningMacro("Found more than one non-null HTG in the partitioned dataset for piece "
216 << currentPiece << ". Generating ghost data only for partition " << partId);
217 }
218 inputHTG = partHTG;
219 vtkNew<vtkHyperTreeGrid> newOutputHTG;
220 outputPDS->SetPartition(partId, newOutputHTG);
221 outputHTG = newOutputHTG; // Not dangling, outputPDS maintains a reference.
222 }
223 }
224 }
225
226 if (!outputHTG && !outputPDS)
227 {
228 vtkErrorMacro("No output available. Cannot proceed with hyper tree grid algorithm.");
229 return 0;
230 }
231
232 if (!inputHTG)

Callers

nothing calls this directly

Calls 13

ExchangeHTGMetadataMethod · 0.95
ProcessTreesMethod · 0.95
GetInformationObjectMethod · 0.80
GetDataFunction · 0.50
UpdateProgressMethod · 0.45
GetMethod · 0.45
CopyStructureMethod · 0.45
GetNumberOfPartitionsMethod · 0.45
SetPartitionMethod · 0.45
GetExtentMethod · 0.45
AllReduceMethod · 0.45

Tested by

no test coverage detected