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

Method RequestData

Filters/CellGrid/vtkUnstructuredGridToCellGrid.cxx:191–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191int vtkUnstructuredGridToCellGrid::RequestData(
192 vtkInformation* vtkNotUsed(request), vtkInformationVector** inInfo, vtkInformationVector* ouInfo)
193{
194 vtkSmartPointer<vtkPartitionedDataSetCollection> inputPDC;
195 inputPDC = vtkPartitionedDataSetCollection::GetData(inInfo[0]);
196 if (!inputPDC)
197 {
198 auto* input = vtkUnstructuredGrid::GetData(inInfo[0]);
199 if (input)
200 {
201 inputPDC = vtkSmartPointer<vtkPartitionedDataSetCollection>::New();
202 inputPDC->SetNumberOfPartitionedDataSets(1);
203 inputPDC->SetPartition(0, 0, input);
204 }
205 }
206 auto* output = vtkPartitionedDataSetCollection::GetData(ouInfo);
207 if (!inputPDC)
208 {
209 vtkWarningMacro("Empty input or input of wrong type.");
210 return 1;
211 }
212 if (!output)
213 {
214 vtkErrorMacro("Empty output.");
215 return 0;
216 }
217
218 // Copy the input's hierarchical block arrangement if it exists:
219 if (inputPDC->GetDataAssembly())
220 {
221 vtkNew<vtkDataAssembly> dataAssembly;
222 dataAssembly->DeepCopy(inputPDC->GetDataAssembly());
223 output->SetDataAssembly(dataAssembly);
224 }
225
226 // Look for annotations specifying DG cell-attributes.
227 // this->AddAnnotatedAttributes(inputPDC);
228 // Reset any annotations from the ustructured grid and re-ingest.
229 this->Request->Annotations->Reset();
230 this->Request->Annotations->FetchAnnotations(
231 inputPDC->GetFieldData(), inputPDC->GetDataAssembly());
232
233 // Iterate over partitioned datasets and turn unstructured grids
234 // into cell grids.
235 //
236 // NB: We cannot use vtkPartitionedDataSetCollection::NewIterator()
237 // to fetch an iterator because there is no mapping between that
238 // iterator's flat index and the flat index of the parent node ID
239 // in the vtkDataAssembly.
240 // For instance, given a data assembly like this:
241 // + root 1
242 // + node 2 : dataset ids 0, 3
243 // + node 3 : dataset ids 1
244 // + node 4 : dataset ids 2
245 // When a composite iterator points to a dataset held inside
246 // dataset id 1 (itself a partitioned-dataset), there is no
247 // way to discover the flat index of dataset id 1 from the
248 // (non-partitioned) child dataset or the iterator.

Callers

nothing calls this directly

Calls 15

GetDataAssemblyMethod · 0.80
FetchAnnotationsMethod · 0.80
GetPartitionedDataSetMethod · 0.80
GetDataFunction · 0.50
NewFunction · 0.50
SetPartitionMethod · 0.45
DeepCopyMethod · 0.45
ResetMethod · 0.45
GetFieldDataMethod · 0.45

Tested by

no test coverage detected