------------------------------------------------------------------------------
| 741 | |
| 742 | //------------------------------------------------------------------------------ |
| 743 | int vtkNetCDFCFReader::RequestDataObject(vtkInformation* vtkNotUsed(request), |
| 744 | vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector) |
| 745 | { |
| 746 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 747 | vtkDataObject* output = vtkDataObject::GetData(outInfo); |
| 748 | |
| 749 | // This is really too early to know the appropriate data type. We need to |
| 750 | // have meta data and let the user select arrays. We have to do part |
| 751 | // of the RequestInformation to get the appropriate meta data. |
| 752 | if (!this->UpdateMetaData()) |
| 753 | return 0; |
| 754 | |
| 755 | // Check that the dataType is correct or automatically set it if it is set to |
| 756 | // -1. |
| 757 | int dataType = this->OutputType; |
| 758 | |
| 759 | int ncFD; |
| 760 | CALL_NETCDF(this->Accessor->open(this->FileName, NC_NOWRITE, &ncFD)); |
| 761 | |
| 762 | int numArrays = this->VariableArraySelection->GetNumberOfArrays(); |
| 763 | for (int arrayIndex = 0; arrayIndex < numArrays; arrayIndex++) |
| 764 | { |
| 765 | if (!this->VariableArraySelection->GetArraySetting(arrayIndex)) |
| 766 | continue; |
| 767 | |
| 768 | const char* name = this->VariableArraySelection->GetArrayName(arrayIndex); |
| 769 | int varId; |
| 770 | CALL_NETCDF(this->Accessor->inq_varid(ncFD, name, &varId)); |
| 771 | |
| 772 | int currentNumDims; |
| 773 | CALL_NETCDF(this->Accessor->inq_varndims(ncFD, varId, ¤tNumDims)); |
| 774 | if (currentNumDims < 1) |
| 775 | continue; |
| 776 | VTK_CREATE(vtkIntArray, currentDimensions); |
| 777 | currentDimensions->SetNumberOfComponents(1); |
| 778 | currentDimensions->SetNumberOfTuples(currentNumDims); |
| 779 | CALL_NETCDF(this->Accessor->inq_vardimid(ncFD, varId, currentDimensions->GetPointer(0))); |
| 780 | |
| 781 | // Remove initial time dimension, which has no effect on data type. |
| 782 | if (this->IsTimeDimension(ncFD, currentDimensions->GetValue(0))) |
| 783 | { |
| 784 | currentDimensions->RemoveTuple(0); |
| 785 | currentNumDims--; |
| 786 | if (currentNumDims < 1) |
| 787 | continue; |
| 788 | } |
| 789 | |
| 790 | CoordinateTypesEnum coordType = this->CoordinateType(currentDimensions); |
| 791 | |
| 792 | int preferredDataType; |
| 793 | switch (coordType) |
| 794 | { |
| 795 | case COORDS_UNIFORM_RECTILINEAR: |
| 796 | preferredDataType = VTK_IMAGE_DATA; |
| 797 | break; |
| 798 | case COORDS_NONUNIFORM_RECTILINEAR: |
| 799 | preferredDataType = VTK_RECTILINEAR_GRID; |
| 800 | break; |
nothing calls this directly
no test coverage detected