VTK
|
00001 // -*- c++ -*- 00002 /*========================================================================= 00003 00004 Program: Visualization Toolkit 00005 Module: vtkNetCDFReader.h 00006 00007 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00016 00017 /*------------------------------------------------------------------------- 00018 Copyright 2008 Sandia Corporation. 00019 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00020 the U.S. Government retains certain rights in this software. 00021 -------------------------------------------------------------------------*/ 00022 00033 #ifndef vtkNetCDFReader_h 00034 #define vtkNetCDFReader_h 00035 00036 #include "vtkIONetCDFModule.h" // For export macro 00037 #include "vtkDataObjectAlgorithm.h" 00038 00039 #include "vtkSmartPointer.h" // For ivars 00040 #include <string> //For std::string 00041 00042 class vtkDataArraySelection; 00043 class vtkDataSet; 00044 class vtkDoubleArray; 00045 class vtkIntArray; 00046 class vtkStdString; 00047 class vtkStringArray; 00048 class vtkNetCDFReaderPrivate; 00049 00050 class VTKIONETCDF_EXPORT vtkNetCDFReader : public vtkDataObjectAlgorithm 00051 { 00052 public: 00053 vtkTypeMacro(vtkNetCDFReader, vtkDataObjectAlgorithm); 00054 static vtkNetCDFReader *New(); 00055 virtual void PrintSelf(ostream &os, vtkIndent indent); 00056 00057 virtual void SetFileName(const char *filename); 00058 vtkGetStringMacro(FileName); 00059 00062 int UpdateMetaData(); 00063 00064 // // Description: 00065 // // Get the data array selection tables used to configure which variables to 00066 // // load. 00067 // vtkGetObjectMacro(VariableArraySelection, vtkDataArraySelection); 00068 00070 00071 virtual int GetNumberOfVariableArrays(); 00072 virtual const char *GetVariableArrayName(int idx); 00073 virtual int GetVariableArrayStatus(const char *name); 00074 virtual void SetVariableArrayStatus(const char *name, int status); 00076 00081 virtual vtkStringArray *GetAllVariableArrayNames(); 00082 00084 00089 vtkGetObjectMacro(VariableDimensions, vtkStringArray); 00091 00098 virtual void SetDimensions(const char *dimensions); 00099 00101 00106 vtkGetObjectMacro(AllDimensions, vtkStringArray); 00108 00110 00118 vtkGetMacro(ReplaceFillValueWithNan, int); 00119 vtkSetMacro(ReplaceFillValueWithNan, int); 00120 vtkBooleanMacro(ReplaceFillValueWithNan, int); 00122 00124 00127 vtkGetStringMacro(TimeUnits); 00128 vtkGetStringMacro(Calendar); 00130 00132 std::string QueryArrayUnits(const char *ArrayName); 00133 00134 protected: 00135 vtkNetCDFReader(); 00136 ~vtkNetCDFReader(); 00137 00138 char *FileName; 00139 vtkTimeStamp FileNameMTime; 00140 vtkTimeStamp MetaDataMTime; 00141 00142 //BTX 00144 vtkSmartPointer<vtkIntArray> LoadingDimensions; 00145 00146 vtkSmartPointer<vtkDataArraySelection> VariableArraySelection; 00147 00148 vtkSmartPointer<vtkStringArray> AllVariableArrayNames; 00149 00151 vtkStringArray *VariableDimensions; 00152 00154 00155 vtkStringArray *AllDimensions; 00156 //ETX 00158 00159 int ReplaceFillValueWithNan; 00160 00161 int WholeExtent[6]; 00162 00163 virtual int RequestDataObject(vtkInformation *request, 00164 vtkInformationVector **inputVector, 00165 vtkInformationVector *outputVector); 00166 00167 virtual int RequestInformation(vtkInformation *request, 00168 vtkInformationVector **inputVector, 00169 vtkInformationVector *outputVector); 00170 00171 virtual int RequestData(vtkInformation *request, 00172 vtkInformationVector **inputVector, 00173 vtkInformationVector *outputVector); 00174 00176 00177 static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid, 00178 void *clientdata, void *calldata); 00180 00183 vtkStdString DescribeDimensions(int ncFD, const int *dimIds, int numDims); 00184 00187 virtual int ReadMetaData(int ncFD); 00188 00190 virtual int FillVariableDimensions(int ncFD); 00191 00197 virtual int IsTimeDimension(int ncFD, int dimId); 00198 00199 //BTX 00201 00207 virtual vtkSmartPointer<vtkDoubleArray> GetTimeValues(int ncFD, int dimId); 00208 //ETX 00210 00212 00217 virtual bool DimensionsAreForPointData(vtkIntArray *vtkNotUsed(dimensions)) { 00218 return true; 00219 } 00221 00226 virtual void GetUpdateExtentForOutput(vtkDataSet *output, int extent[6]); 00227 00229 00231 virtual int LoadVariable(int ncFD, const char *varName, double time, 00232 vtkDataSet *output); 00234 00235 private: 00236 vtkNetCDFReader(const vtkNetCDFReader &); // Not implemented 00237 void operator=(const vtkNetCDFReader &); // Not implemented 00238 00239 int UpdateExtent[6]; 00240 char *TimeUnits; 00241 char *Calendar; 00242 vtkNetCDFReaderPrivate *Private; 00243 }; 00244 00245 #endif //vtkNetCDFReader_h