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
17Copyright (c) 2002-2005 Los Alamos National Laboratory
18
19This software and ancillary information known as vtk_ext (and herein
20called "SOFTWARE") is made available under the terms described below.
21The SOFTWARE has been approved for release with associated LA_CC
22Number 99-44, granted by Los Alamos National Laboratory in July 1999.
23
24Unless otherwise indicated, this SOFTWARE has been authored by an
25employee or employees of the University of California, operator of the
26Los Alamos National Laboratory under Contract No. W-7405-ENG-36 with
27the United States Department of Energy.
28
29The United States Government has rights to use, reproduce, and
30distribute this SOFTWARE. The public may copy, distribute, prepare
31derivative works and publicly display this SOFTWARE without charge,
32provided that this Notice and any statement of authorship are
33reproduced on all copies.
34
35Neither the U. S. Government, the University of California, nor the
36Advanced Computing Laboratory makes any warranty, either express or
37implied, nor assumes any liability or responsibility for the use of
38this SOFTWARE.
39
40If SOFTWARE is modified to produce derivative works, such modified
41SOFTWARE should be clearly marked, so as not to confuse it with the
42version available from Los Alamos National Laboratory.
43
44=========================================================================*/
80#ifndef vtkMPASReader_h
81#define vtkMPASReader_h
82
83#include "vtkIONetCDFModule.h" // For export macro
85
86#include <string> // for std::string
87
90class vtkDoubleArray;
91class vtkStdString;
92class vtkStringArray;
93
94class NcVar;
95class NcDim;
96
97class VTKIONETCDF_EXPORT vtkMPASReader : public vtkUnstructuredGridAlgorithm
98{
99 public:
102 void PrintSelf(ostream& os, vtkIndent indent);
103
105
108 vtkSetStringMacro(FileName);
111
113
116 vtkGetMacro(MaximumCells, int);
118
120
123 vtkGetMacro(MaximumPoints, int);
125
127
130 virtual int GetNumberOfCellVars();
131 virtual int GetNumberOfPointVars();
133
135
141
143
149 vtkSetMacro(UseDimensionedArrayNames, bool)
150 vtkGetMacro(UseDimensionedArrayNames, bool)
151 vtkBooleanMacro(UseDimensionedArrayNames, bool)
153
155
160 int GetNumberOfPointArrays();
161 const char* GetPointArrayName(int index);
162 int GetPointArrayStatus(const char* name);
163 void SetPointArrayStatus(const char* name, int status);
164 void DisableAllPointArrays();
165 void EnableAllPointArrays();
167
168 int GetNumberOfCellArrays();
169 const char* GetCellArrayName(int index);
170 int GetCellArrayStatus(const char* name);
171 void SetCellArrayStatus(const char* name, int status);
172 void DisableAllCellArrays();
173 void EnableAllCellArrays();
174
176
184 int GetNumberOfDimensions();
185 std::string GetDimensionName(int idx);
186 vtkStringArray* GetAllDimensions();
187 int GetDimensionCurrentIndex(const std::string &dim);
188 void SetDimensionCurrentIndex(const std::string &dim, int idx);
189 int GetDimensionSize(const std::string &dim);
191
193
197 vtkSetMacro(VerticalDimension, std::string)
198 vtkGetMacro(VerticalDimension, std::string)
200
202
206 void SetVerticalLevel(int level);
207 int GetVerticalLevel();
209
210 vtkGetVector2Macro(VerticalLevelRange, int)
211
212 vtkSetMacro(LayerThickness, int)
213 vtkGetMacro(LayerThickness, int)
214 vtkGetVector2Macro(LayerThicknessRange, int)
215
216 void SetCenterLon(int val);
217 vtkGetVector2Macro(CenterLonRange, int)
218
219 vtkSetMacro(ProjectLatLon, bool)
220 vtkGetMacro(ProjectLatLon, bool)
221
222 vtkSetMacro(IsAtmosphere, bool)
223 vtkGetMacro(IsAtmosphere, bool)
224
225 vtkSetMacro(IsZeroCentered, bool)
226 vtkGetMacro(IsZeroCentered, bool)
227
228 vtkSetMacro(ShowMultilayerView, bool)
229 vtkGetMacro(ShowMultilayerView, bool)
230
234 static int CanReadFile(const char *filename);
235
236 vtkMTimeType GetMTime();
237
238 protected:
241 void ReleaseNcData();
242 void DestroyData();
243
244 char *FileName; // First field part file giving path
245
246 int NumberOfTimeSteps; // Temporal domain
247 double DTime; // The current time
248
249 // Observer to modify this object when array selections are modified
250 vtkCallbackCommand* SelectionObserver;
251
254 int RequestInformation(vtkInformation *, vtkInformationVector **,
256
257
258 static void SelectionCallback(vtkObject* caller, unsigned long eid,
259 void* clientdata, void* calldata);
260
261 // Selected field of interest
262 vtkDataArraySelection* PointDataArraySelection;
263 vtkDataArraySelection* CellDataArraySelection;
264
269 void UpdateDimensions(bool force = false);
270
271 std::string VerticalDimension;
272 int VerticalLevelRange[2];
273
274 int LayerThickness;
275 int LayerThicknessRange[2];
276
277 int CenterLon;
278 int CenterLonRange[2];
279
281 {
284 Planar
285 };
286
288
289 bool ProjectLatLon; // User option
290 bool OnASphere; // Data file attribute
294
297 double CenterRad;
298
300
301 // geometry
308 int CurrentExtraPoint; // current extra point
309 int CurrentExtraCell; // current extra cell
310 double* PointX; // x coord of point
311 double* PointY; // y coord of point
312 double* PointZ; // z coord of point
315 int* OrigConnections; // original connections
316 int* ModConnections; // modified connections
317 int* CellMap; // maps from added cell to original cell #
318 int* PointMap; // maps from added point to original point #
320 int MaximumCells; // max cells
321 int MaximumPoints; // max points
322
327 int GetNcVars(const char* cellDimName, const char* pointDimName);
334 int AddMirrorPoint(int index, double dividerX, double offset);
335 void FixPoints();
339 unsigned char GetCellType();
340
348 bool ValidateDimensions(NcVar *var, bool silent, int ndims, ...);
349
353 long GetCursorForDimension(const NcDim *dim);
354
358 size_t GetCountForDimension(const NcDim *dim);
359
365 long InitializeDimension(const NcDim *dim);
366
371
381
382 private:
383 vtkMPASReader(const vtkMPASReader&) VTK_DELETE_FUNCTION;
384 void operator=(const vtkMPASReader&) VTK_DELETE_FUNCTION;
385
386 class Internal;
387 Internal *Internals;
388
389 static int NcTypeToVtkType(int ncType);
390
391 vtkDataArray* CreateDataArray(int ncType);
392 vtkIdType ComputeNumberOfTuples(NcVar *ncVar);
393
394 template <typename ValueType>
395 bool LoadDataArray(NcVar *ncVar, vtkDataArray *array, bool resize = true);
396
397 template <typename ValueType>
398 int LoadPointVarDataImpl(NcVar *ncVar, vtkDataArray *array);
399
400 template <typename ValueType>
401 int LoadCellVarDataImpl(NcVar *ncVar, vtkDataArray *array);
402};
403
404#endif
supports function callbacks
Store on/off settings for data arrays for a vtkSource.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Read an MPAS netCDF file.
Definition: vtkMPASReader.h:98
double * PointX
vtkDataArray * LookupPointDataArray(int varIdx)
int EliminateXWrap()
double * PointZ
vtkDataArray * LookupCellDataArray(int varIdx)
virtual int GetNumberOfPointVars()
int AllocPlanarGeometry()
void SetDefaults()
int * OrigConnections
void ShiftLonData()
long GetCursorForDimension(const NcDim *dim)
Return the cursor position for the specified dimension.
double * PointY
long InitializeDimension(const NcDim *dim)
For an arbitrary (i.e.
vtkUnstructuredGrid * GetOutput(int index)
GeometryType Geometry
int AllocSphericalGeometry()
int AddMirrorPoint(int index, double dividerX, double offset)
void OutputCells()
bool IncludeTopography
void OutputPoints()
int BuildVarArrays()
int ReadAndOutputGrid()
static vtkMPASReader * New()
virtual int GetNumberOfCellVars()
Get the number of data variables at the cell centers and points.
unsigned char GetCellType()
int * ModConnections
void FixPoints()
int GetNcVars(const char *cellDimName, const char *pointDimName)
vtkDataArray * LoadPointVarData(int variable)
bool ShowMultilayerView
size_t GetCountForDimension(const NcDim *dim)
Return the number of values to read for the specified dimension.
vtkUnstructuredGrid * GetOutput()
Get the reader's output.
void LoadTimeFieldData(vtkUnstructuredGrid *dataset)
Update the "Time" vtkStringArray in dataset's FieldData to contain the xtime string for the current t...
vtkDataArray * LoadCellVarData(int variable)
bool UseDimensionedArrayNames
int AllocProjectedGeometry()
bool ValidateDimensions(NcVar *var, bool silent, int ndims,...)
Returns true if the dimensions in var match the expected args, or prints a warning and returns false ...
int * MaximumLevelPoint
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
abstract base class for most VTK objects
Definition: vtkObject.h:60
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:49
a vtkAbstractArray subclass for strings
Superclass for algorithms that produce only unstructured grid as output.
dataset represents arbitrary combinations of all possible cell types
@ level
Definition: vtkX3D.h:395
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
@ offset
Definition: vtkX3D.h:438
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
int vtkIdType
Definition: vtkType.h:287
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248