VTK  9.2.5
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 VTKIONETCDF_EXPORT vtkMPASReader : public vtkUnstructuredGridAlgorithm
95{
96public:
97 static vtkMPASReader* New();
99 void PrintSelf(ostream& os, vtkIndent indent) override;
100
102
108
110
113 vtkGetMacro(MaximumCells, int);
115
117
120 vtkGetMacro(MaximumPoints, int);
122
124
127 virtual int GetNumberOfCellVars();
128 virtual int GetNumberOfPointVars();
130
132
138
140
146 vtkSetMacro(UseDimensionedArrayNames, bool);
147 vtkGetMacro(UseDimensionedArrayNames, bool);
148 vtkBooleanMacro(UseDimensionedArrayNames, bool);
150
152
158 const char* GetPointArrayName(int index);
159 int GetPointArrayStatus(const char* name);
160 void SetPointArrayStatus(const char* name, int status);
164
166 const char* GetCellArrayName(int index);
167 int GetCellArrayStatus(const char* name);
168 void SetCellArrayStatus(const char* name, int status);
171
173
182 std::string GetDimensionName(int idx);
184 int GetDimensionCurrentIndex(const std::string& dim);
185 void SetDimensionCurrentIndex(const std::string& dim, int idx);
186 int GetDimensionSize(const std::string& dim);
188
190
194 vtkSetMacro(VerticalDimension, std::string);
195 vtkGetMacro(VerticalDimension, std::string);
197
199
203 void SetVerticalLevel(int level);
206
207 vtkGetVector2Macro(VerticalLevelRange, int);
208
209 vtkSetMacro(LayerThickness, int);
210 vtkGetMacro(LayerThickness, int);
211 vtkGetVector2Macro(LayerThicknessRange, int);
212
213 void SetCenterLon(int val);
214 vtkGetVector2Macro(CenterLonRange, int);
215
216 vtkSetMacro(ProjectLatLon, bool);
217 vtkGetMacro(ProjectLatLon, bool);
218
219 vtkSetMacro(IsAtmosphere, bool);
220 vtkGetMacro(IsAtmosphere, bool);
221
222 vtkSetMacro(IsZeroCentered, bool);
223 vtkGetMacro(IsZeroCentered, bool);
224
225 vtkSetMacro(ShowMultilayerView, bool);
226 vtkGetMacro(ShowMultilayerView, bool);
227
231 static int CanReadFile(VTK_FILEPATH const char* filename);
232
234
235protected:
237 ~vtkMPASReader() override;
240
241 char* FileName; // First field part file giving path
242
243 size_t NumberOfTimeSteps; // Temporal domain
244 double DTime; // The current time
245
246 // Observer to modify this object when array selections are modified
248
251
252 static void SelectionCallback(
253 vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
254
255 // Selected field of interest
258
263 void UpdateDimensions(bool force = false);
264
265 std::string VerticalDimension;
266 int VerticalLevelRange[2];
267
269 int LayerThicknessRange[2];
270
272 int CenterLonRange[2];
273
275 {
278 Planar
279 };
280
282
283 bool ProjectLatLon; // User option
284 bool OnASphere; // Data file attribute
288
291 double CenterRad;
292
294
295 // geometry
302 size_t CurrentExtraPoint; // current extra point
303 size_t CurrentExtraCell; // current extra cell
304 double* PointX; // x coord of point
305 double* PointY; // y coord of point
306 double* PointZ; // z coord of point
309 int* OrigConnections; // original connections
310 int* ModConnections; // modified connections
311 size_t* CellMap; // maps from added cell to original cell #
312 size_t* PointMap; // maps from added point to original point #
314 int MaximumCells; // max cells
315 int MaximumPoints; // max points
316
321 int GetNcVars(const char* cellDimName, const char* pointDimName);
328 int AddMirrorPoint(int index, double dividerX, double offset);
329 void FixPoints();
333 unsigned char GetCellType();
334
339
349
350private:
351 vtkMPASReader(const vtkMPASReader&) = delete;
352 void operator=(const vtkMPASReader&) = delete;
353
354 class Internal;
355 Internal* Internals;
356};
357
358#endif
supports function callbacks
Store on/off settings for data arrays, etc.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:56
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:95
void UpdateDimensions(bool force=false)
Update the list of available dimensions.
size_t * PointMap
double * PointX
int GetNumberOfPointArrays()
The following methods allow selective reading of solutions fields.
size_t NumberOfPoints
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkDataArray * LookupPointDataArray(int varIdx)
size_t CurrentExtraPoint
size_t PointOffset
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int EliminateXWrap()
double * PointZ
void DestroyData()
vtkCallbackCommand * SelectionObserver
vtkDataArray * LookupCellDataArray(int varIdx)
virtual int GetNumberOfPointVars()
Get the number of data variables at the cell centers and points.
int AllocPlanarGeometry()
size_t PointsPerCell
void SetDefaults()
vtkUnstructuredGrid * GetOutput(int idx)
Get the reader's output.
void SetPointArrayStatus(const char *name, int status)
The following methods allow selective reading of solutions fields.
int * OrigConnections
size_t ModNumPoints
void ShiftLonData()
void EnableAllPointArrays()
The following methods allow selective reading of solutions fields.
int GetDimensionCurrentIndex(const std::string &dim)
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
int GetCellArrayStatus(const char *name)
int GetVerticalLevel()
Convenience function for setting/querying [GS]etDimensionCurrentIndex for the dimension returned by G...
vtkIdType GetNumberOfDimensions()
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
std::string GetDimensionName(int idx)
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
const char * GetCellArrayName(int index)
vtkGetFilePathMacro(FileName)
Specify file name of MPAS data file to read.
double * PointY
void EnableAllCellArrays()
void SetDimensionCurrentIndex(const std::string &dim, int idx)
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
void SetCellArrayStatus(const char *name, int status)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkStringArray * GetAllDimensions()
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
size_t MaximumNVertLevels
GeometryType Geometry
int AllocSphericalGeometry()
int AddMirrorPoint(int index, double dividerX, double offset)
int GetNumberOfCellArrays()
vtkDataArraySelection * PointDataArraySelection
static void SelectionCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
size_t CurrentExtraCell
void OutputCells()
bool IncludeTopography
void OutputPoints()
int BuildVarArrays()
int ReadAndOutputGrid()
size_t NumberOfCells
std::string VerticalDimension
static vtkMPASReader * New()
void DisableAllPointArrays()
The following methods allow selective reading of solutions fields.
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)
void SetVerticalLevel(int level)
Convenience function for setting/querying [GS]etDimensionCurrentIndex for the dimension returned by G...
~vtkMPASReader() override
vtkDataArray * LoadPointVarData(int variable)
int GetDimensionSize(const std::string &dim)
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
static int CanReadFile(VTK_FILEPATH const char *filename)
Returns true if the given file can be read.
int GetPointArrayStatus(const char *name)
The following methods allow selective reading of solutions fields.
void DisableAllCellArrays()
bool ShowMultilayerView
const char * GetPointArrayName(int index)
The following methods allow selective reading of solutions fields.
vtkUnstructuredGrid * GetOutput()
Get the reader's output.
vtkSetFilePathMacro(FileName)
Specify file name of MPAS data file to read.
void ReleaseNcData()
vtkDataArraySelection * CellDataArraySelection
void LoadTimeFieldData(vtkUnstructuredGrid *dataset)
Update the "Time" vtkStringArray in dataset's FieldData to contain the xtime string for the current t...
size_t * CellMap
vtkDataArray * LoadCellVarData(int variable)
vtkMTimeType GetMTime() override
Return this object's modified time.
size_t ModNumCells
bool UseDimensionedArrayNames
void SetCenterLon(int val)
int AllocProjectedGeometry()
int * MaximumLevelPoint
size_t NumberOfTimeSteps
abstract base class for most VTK objects
Definition: vtkObject.h:63
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:39
a vtkAbstractArray subclass for strings
Superclass for algorithms that produce only unstructured grid as output.
dataset represents arbitrary combinations of all possible cell types
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_FILEPATH