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

Method RequestData

IO/NetCDF/vtkNetCDFReader.cxx:405–494  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

403
404//------------------------------------------------------------------------------
405int vtkNetCDFReader::RequestData(vtkInformation* vtkNotUsed(request),
406 vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector)
407{
408 vtkInformation* outInfo = outputVector->GetInformationObject(0);
409 // If the output is not a vtkDataSet, then the subclass needs to override
410 // this method.
411 vtkDataSet* output = vtkDataSet::GetData(outInfo);
412 if (!output)
413 {
414 vtkErrorMacro(<< "Bad output type.");
415 return 0;
416 }
417
418 // Set up the extent for regular-grid type data sets.
419 vtkImageData* imageOutput = vtkImageData::SafeDownCast(output);
420 vtkRectilinearGrid* rectOutput = vtkRectilinearGrid::SafeDownCast(output);
421 vtkStructuredGrid* structOutput = vtkStructuredGrid::SafeDownCast(output);
422 outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), this->UpdateExtent);
423 if (imageOutput)
424 {
425 imageOutput->SetExtent(this->UpdateExtent);
426 }
427 else if (rectOutput)
428 {
429 rectOutput->SetExtent(this->UpdateExtent);
430 }
431 else if (structOutput)
432 {
433 structOutput->SetExtent(this->UpdateExtent);
434 }
435 else
436 {
437 // Superclass should handle extent setup if necessary.
438 }
439
440 // Get requested time step.
441 double time = 0.0;
442 if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()))
443 {
444 time = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP());
445 }
446
447 int ncFD;
448 CALL_NETCDF_INT(this->Accessor->open(this->FileName, NC_NOWRITE, &ncFD));
449
450 this->ComputeArraySelection();
451 // Iterate over arrays and load selected ones.
452 int numArrays = this->VariableArraySelection->GetNumberOfArrays();
453 for (int arrayIndex = 0; arrayIndex < numArrays; arrayIndex++)
454 {
455 if (!this->VariableArraySelection->GetArraySetting(arrayIndex))
456 continue;
457
458 const char* name = this->VariableArraySelection->GetArrayName(arrayIndex);
459
460 if (!this->LoadVariable(ncFD, name, time, output))
461 return 0;
462 }

Callers

nothing calls this directly

Calls 15

ComputeArraySelectionMethod · 0.95
LoadVariableMethod · 0.95
GetInformationObjectMethod · 0.80
GetDataFunction · 0.50
GetMethod · 0.45
SetExtentMethod · 0.45
HasMethod · 0.45
openMethod · 0.45
GetNumberOfArraysMethod · 0.45
GetArraySettingMethod · 0.45
GetArrayNameMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected