VTK
vtkNetCDFReader.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 /*=========================================================================
3 
4  Program: Visualization Toolkit
5  Module: vtkNetCDFReader.h
6 
7  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8  All rights reserved.
9  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10 
11  This software is distributed WITHOUT ANY WARRANTY; without even
12  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  PURPOSE. See the above copyright notice for more information.
14 
15 =========================================================================*/
16 
17 /*-------------------------------------------------------------------------
18  Copyright 2008 Sandia Corporation.
19  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
20  the U.S. Government retains certain rights in this software.
21 -------------------------------------------------------------------------*/
22 
34 #ifndef vtkNetCDFReader_h
35 #define vtkNetCDFReader_h
36 
37 #include "vtkIONetCDFModule.h" // For export macro
38 #include "vtkDataObjectAlgorithm.h"
39 
40 #include "vtkSmartPointer.h" // For ivars
41 #include <string> //For std::string
42 
44 class vtkDataSet;
45 class vtkDoubleArray;
46 class vtkIntArray;
47 class vtkStdString;
48 class vtkStringArray;
49 class vtkNetCDFReaderPrivate;
50 
51 class VTKIONETCDF_EXPORT vtkNetCDFReader : public vtkDataObjectAlgorithm
52 {
53 public:
55  static vtkNetCDFReader *New();
56  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
57 
58  virtual void SetFileName(const char *filename);
59  vtkGetStringMacro(FileName);
60 
65  int UpdateMetaData();
66 
67 // // Description:
68 // // Get the data array selection tables used to configure which variables to
69 // // load.
70 // vtkGetObjectMacro(VariableArraySelection, vtkDataArraySelection);
71 
73 
76  virtual int GetNumberOfVariableArrays();
77  virtual const char *GetVariableArrayName(int idx);
78  virtual int GetVariableArrayStatus(const char *name);
79  virtual void SetVariableArrayStatus(const char *name, int status);
81 
87  virtual vtkStringArray *GetAllVariableArrayNames();
88 
90 
96  vtkGetObjectMacro(VariableDimensions, vtkStringArray);
98 
106  virtual void SetDimensions(const char *dimensions);
107 
109 
116  vtkGetObjectMacro(AllDimensions, vtkStringArray);
118 
120 
129  vtkGetMacro(ReplaceFillValueWithNan, int);
130  vtkSetMacro(ReplaceFillValueWithNan, int);
131  vtkBooleanMacro(ReplaceFillValueWithNan, int);
133 
135 
140  vtkGetStringMacro(TimeUnits);
141  vtkGetStringMacro(Calendar);
143 
147  std::string QueryArrayUnits(const char *ArrayName);
148 
149 protected:
150  vtkNetCDFReader();
151  ~vtkNetCDFReader() VTK_OVERRIDE;
152 
153  char *FileName;
154  vtkTimeStamp FileNameMTime;
155  vtkTimeStamp MetaDataMTime;
156 
160  vtkSmartPointer<vtkIntArray> LoadingDimensions;
161 
162  vtkSmartPointer<vtkDataArraySelection> VariableArraySelection;
163 
164  vtkSmartPointer<vtkStringArray> AllVariableArrayNames;
165 
169  vtkStringArray *VariableDimensions;
170 
174  vtkStringArray *AllDimensions;
175 
176  int ReplaceFillValueWithNan;
177 
178  int WholeExtent[6];
179 
180  int RequestDataObject(vtkInformation *request,
181  vtkInformationVector **inputVector,
182  vtkInformationVector *outputVector) VTK_OVERRIDE;
183 
184  int RequestInformation(vtkInformation *request,
185  vtkInformationVector **inputVector,
186  vtkInformationVector *outputVector) VTK_OVERRIDE;
187 
188  int RequestData(vtkInformation *request,
189  vtkInformationVector **inputVector,
190  vtkInformationVector *outputVector) VTK_OVERRIDE;
191 
195  static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid,
196  void *clientdata, void *calldata);
197 
202  vtkStdString DescribeDimensions(int ncFD, const int *dimIds, int numDims);
203 
207  virtual int ReadMetaData(int ncFD);
208 
212  virtual int FillVariableDimensions(int ncFD);
213 
221  virtual int IsTimeDimension(int ncFD, int dimId);
222 
230  virtual vtkSmartPointer<vtkDoubleArray> GetTimeValues(int ncFD, int dimId);
231 
238  virtual bool DimensionsAreForPointData(vtkIntArray *vtkNotUsed(dimensions)) {
239  return true;
240  }
241 
248  virtual void GetUpdateExtentForOutput(vtkDataSet *output, int extent[6]);
249 
254  virtual int LoadVariable(int ncFD, const char *varName, double time,
255  vtkDataSet *output);
256 
257 private:
258  vtkNetCDFReader(const vtkNetCDFReader &) VTK_DELETE_FUNCTION;
259  void operator=(const vtkNetCDFReader &) VTK_DELETE_FUNCTION;
260 
261  int UpdateExtent[6];
262  char *TimeUnits;
263  char *Calendar;
264  vtkNetCDFReaderPrivate *Private;
265 };
266 
267 #endif //vtkNetCDFReader_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:41
abstract base class for most VTK objects
Definition: vtkObject.h:53
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
static vtkDataObjectAlgorithm * New()
record modification and/or execution time
Definition: vtkTimeStamp.h:32
a vtkAbstractArray subclass for strings
Hold a reference to a vtkObjectBase instance.
A superclass for reading netCDF files.
dynamic, self-adjusting array of double
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
a simple class to control print indentation
Definition: vtkIndent.h:33
Store on/off settings for data arrays for a vtkSource.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Superclass for algorithms that produce only data object as output.
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.