VTK
vtkMPASReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMPASReader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*=========================================================================
16 
17 Copyright (c) 2002-2005 Los Alamos National Laboratory
18 
19 This software and ancillary information known as vtk_ext (and herein
20 called "SOFTWARE") is made available under the terms described below.
21 The SOFTWARE has been approved for release with associated LA_CC
22 Number 99-44, granted by Los Alamos National Laboratory in July 1999.
23 
24 Unless otherwise indicated, this SOFTWARE has been authored by an
25 employee or employees of the University of California, operator of the
26 Los Alamos National Laboratory under Contract No. W-7405-ENG-36 with
27 the United States Department of Energy.
28 
29 The United States Government has rights to use, reproduce, and
30 distribute this SOFTWARE. The public may copy, distribute, prepare
31 derivative works and publicly display this SOFTWARE without charge,
32 provided that this Notice and any statement of authorship are
33 reproduced on all copies.
34 
35 Neither the U. S. Government, the University of California, nor the
36 Advanced Computing Laboratory makes any warranty, either express or
37 implied, nor assumes any liability or responsibility for the use of
38 this SOFTWARE.
39 
40 If SOFTWARE is modified to produce derivative works, such modified
41 SOFTWARE should be clearly marked, so as not to confuse it with the
42 version available from Los Alamos National Laboratory.
43 
44 =========================================================================*/
80 #ifndef vtkMPASReader_h
81 #define vtkMPASReader_h
82 
83 #define MAX_VARS 100
84 #define MAX_VAR_NAME 100
85 
86 #include "vtkIONetCDFModule.h" // For export macro
88 
89 class vtkCallbackCommand;
91 class vtkDoubleArray;
92 class vtkStdString;
93 class vtkStringArray;
94 
96 {
97  public:
98  static vtkMPASReader *New();
100  void PrintSelf(ostream& os, vtkIndent indent);
101 
103 
104  vtkSetStringMacro(FileName);
105  vtkGetStringMacro(FileName);
107 
109 
110  vtkGetMacro(MaximumCells, int);
112 
114 
115  vtkGetMacro(MaximumPoints, int);
117 
119 
120  vtkGetMacro(NumberOfCellVars, int);
121  vtkGetMacro(NumberOfPointVars, int);
123 
125 
129 
131 
134  int GetNumberOfPointArrays();
135  const char* GetPointArrayName(int index);
136  int GetPointArrayStatus(const char* name);
137  void SetPointArrayStatus(const char* name, int status);
138  void DisableAllPointArrays();
139  void EnableAllPointArrays();
141 
142  int GetNumberOfCellArrays();
143  const char* GetCellArrayName(int index);
144  int GetCellArrayStatus(const char* name);
145  void SetCellArrayStatus(const char* name, int status);
146  void DisableAllCellArrays();
147  void EnableAllCellArrays();
148 
149  void SetVerticalLevel(int level);
150  vtkGetVector2Macro(VerticalLevelRange, int);
151 
152  void SetLayerThickness(int val);
153  vtkGetVector2Macro(LayerThicknessRange, int);
154 
155  void SetCenterLon(int val);
156  vtkGetVector2Macro(CenterLonRange, int);
157 
158  void SetProjectLatLon(bool val);
159  vtkGetMacro(ProjectLatLon, bool);
160 
161  void SetIsAtmosphere(bool val);
162  vtkGetMacro(IsAtmosphere, bool);
163 
164  void SetIsZeroCentered(bool val);
165  vtkGetMacro(IsZeroCentered, bool);
166 
167  void SetShowMultilayerView(bool val);
168  vtkGetMacro(ShowMultilayerView, bool);
169 
171  static int CanReadFile(const char *filename);
172 
173  protected:
174  vtkMPASReader();
175  ~vtkMPASReader();
176  void DestroyData();
177 
178  char *FileName; // First field part file giving path
179  /*
180  int Rank; // Number of this processor
181  int TotalRank; // Number of processors
182  */
183 
184  // int NumberOfPieces; // Number of files in dataset
185  // vtkIdType NumberOfTuples; // Number of tuples in sub extent
186 
187  vtkStdString* VariableName; // Names of each variable
188  int* VariableType; // Scalar, vector or tensor
189 
190  int NumberOfTimeSteps; // Temporal domain
191  double* TimeSteps; // Times available for request
192  double DTime;
193 
194 
195  // Observer to modify this object when array selections are modified
197 
202 
203 
204  static void SelectionCallback(vtkObject* caller, unsigned long eid,
205  void* clientdata, void* calldata);
206 
209 
210  // params
211 
212  // Selected field of interest
215 
216  vtkDoubleArray** CellVarDataArray; // Actual data arrays
217  vtkDoubleArray** PointVarDataArray; // Actual data arrays
218 
220  int VerticalLevelRange[2];
221 
223  int LayerThicknessRange[2];
224 
226  int CenterLonRange[2];
227 
232 
234  bool DoBugFix;
235  double CenterRad;
236 
237 
238  // geometry
245  int CurrentExtraPoint; // current extra point
246  int CurrentExtraCell; // current extra cell
247  double* PointX; // x coord of point
248  double* PointY; // y coord of point
249  double* PointZ; // z coord of point
252  int* CellMask;
253  int* OrigConnections; // original connections
254  int* ModConnections; // modified connections
255  int* CellMap; // maps from added cell to original cell #
256  int* PointMap; // maps from added point to original point #
258  int MaximumCells; // max cells
259  int MaximumPoints; // max points
260  int VerticalIndex; // for singleLayer, which vertical level
261 
262  // vars
265  double* PointVarData;
266 
267  void SetDefaults();
268  int GetNcDims();
269  int CheckParams();
270  int GetNcVars(const char* cellDimName, const char* pointDimName);
271  int ReadAndOutputGrid(bool init);
272  int ReadAndOutputVariableData();
273  int BuildVarArrays();
274  int AllocSphereGeometry();
275  int AllocLatLonGeometry();
276  void ShiftLonData();
277  int AddMirrorPoint(int index, double dividerX);
278  void FixPoints();
279  int EliminateXWrap();
280  void OutputPoints(bool init);
281  void OutputCells(bool init);
282  unsigned char GetCellType();
283  void LoadGeometryData(int var, double dTime);
284  int LoadPointVarData(int variable, double dTime);
285  int LoadCellVarData(int variable, double dTime);
286  int RegenerateGeometry();
287 
288  private:
289  vtkMPASReader(const vtkMPASReader&); // Not implemented.
290  void operator=(const vtkMPASReader&); // Not implemented.
291  class Internal;
292  Internal *Internals;
293 
294 };
295 
296 #endif
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
int VerticalLevelSelected
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
abstract base class for most VTK objects
Definition: vtkObject.h:61
Store vtkAlgorithm input/output information.
vtkDoubleArray ** PointVarDataArray
static vtkUnstructuredGridAlgorithm * New()
double * PointZ
a vtkAbstractArray subclass for strings
bool IncludeTopography
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
double * TimeSteps
int * OrigConnections
vtkDataArraySelection * PointDataArraySelection
vtkDoubleArray ** CellVarDataArray
Read an MPAS netCDF file.
Definition: vtkMPASReader.h:95
dynamic, self-adjusting array of double
double * PointX
supports function callbacks
double * PointY
a simple class to control print indentation
Definition: vtkIndent.h:38
Store on/off settings for data arrays for a vtkSource.
double * PointVarData
dataset represents arbitrary combinations of all possible cell types
void PrintSelf(ostream &os, vtkIndent indent)
Superclass for algorithms that produce only unstructured grid as output.
vtkStdString * VariableName
vtkCallbackCommand * SelectionObserver
Store zero or more vtkInformation instances.
#define VTKIONETCDF_EXPORT
int * MaximumLevelPoint
vtkUnstructuredGrid * GetOutput()
int * ModConnections
vtkDataArraySelection * CellDataArraySelection
bool ShowMultilayerView