------------------------------------------------------------------------------
| 403 | |
| 404 | //------------------------------------------------------------------------------ |
| 405 | int 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 | } |
nothing calls this directly
no test coverage detected