VTK: IO/NetCDF/vtkMPASReader.h Source File

| VTK 9.3.1

vtkMPASReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) 2002-2005 Los Alamos National Laboratory
3 // SPDX-License-Identifier: BSD-3-Clause-Sandia-LANL-California-USGov
39 #ifndef vtkMPASReader_h
40 #define vtkMPASReader_h
41
42 #include "vtkIONetCDFModule.h" // For export macro
43 #include "vtkUnstructuredGridAlgorithm.h"
44
45 #include <string> // for std::string
46
47 VTK_ABI_NAMESPACE_BEGIN
48 class vtkCallbackCommand;
49 class vtkDataArraySelection;
50 class vtkDoubleArray;
51 class vtkStringArray;
52
53 class VTKIONETCDF_EXPORT vtkMPASReader : public vtkUnstructuredGridAlgorithm
54 {
55 public:
56 static vtkMPASReader* New();
57 vtkTypeMacro(vtkMPASReader, vtkUnstructuredGridAlgorithm);
58 void PrintSelf(ostream& os, vtkIndent indent) override;
59
61
64 vtkSetFilePathMacro(FileName);
65 vtkGetFilePathMacro(FileName);
67
69
72 vtkGetMacro(MaximumCells, int);
74
76
79 vtkGetMacro(MaximumPoints, int);
81
83
86 virtual int GetNumberOfCellVars();
87 virtual int GetNumberOfPointVars();
89
91
94 vtkUnstructuredGrid* GetOutput();
95 vtkUnstructuredGrid* GetOutput(int idx);
97
99
105 vtkSetMacro(UseDimensionedArrayNames, bool);
106 vtkGetMacro(UseDimensionedArrayNames, bool);
107 vtkBooleanMacro(UseDimensionedArrayNames, bool);
109
111
116 int GetNumberOfPointArrays();
117 const char* GetPointArrayName(int index);
118 int GetPointArrayStatus(const char* name);
119 void SetPointArrayStatus(const char* name, int status);
120 void DisableAllPointArrays();
121 void EnableAllPointArrays();
123
124 int GetNumberOfCellArrays();
125 const char* GetCellArrayName(int index);
126 int GetCellArrayStatus(const char* name);
127 void SetCellArrayStatus(const char* name, int status);
128 void DisableAllCellArrays();
129 void EnableAllCellArrays();
130
132
140 vtkIdType GetNumberOfDimensions();
141 std::string GetDimensionName(int idx);
142 vtkStringArray* GetAllDimensions();
143 int GetDimensionCurrentIndex(const std::string& dim);
144 void SetDimensionCurrentIndex(const std::string& dim, int idx);
145 int GetDimensionSize(const std::string& dim);
147
149
153 vtkSetMacro(VerticalDimension, std::string);
154 vtkGetMacro(VerticalDimension, std::string);
156
158
162 void SetVerticalLevel(int level);
163 int GetVerticalLevel();
165
166 vtkGetVector2Macro(VerticalLevelRange, int);
167
168 vtkSetMacro(LayerThickness, int);
169 vtkGetMacro(LayerThickness, int);
170 vtkGetVector2Macro(LayerThicknessRange, int);
171
172 void SetCenterLon(int val);
173 vtkGetVector2Macro(CenterLonRange, int);
174
175 vtkSetMacro(ProjectLatLon, bool);
176 vtkGetMacro(ProjectLatLon, bool);
177
178 vtkSetMacro(IsAtmosphere, bool);
179 vtkGetMacro(IsAtmosphere, bool);
180
181 vtkSetMacro(IsZeroCentered, bool);
182 vtkGetMacro(IsZeroCentered, bool);
183
184 vtkSetMacro(ShowMultilayerView, bool);
185 vtkGetMacro(ShowMultilayerView, bool);
186
190 static int CanReadFile(VTK_FILEPATH const char* filename);
191
192 vtkMTimeType GetMTime() override;
193
194 protected:
195 vtkMPASReader();
196 ~vtkMPASReader() override;
197 void ReleaseNcData();
198 void DestroyData();
199
200 char* FileName; // First field part file giving path
201
202 size_t NumberOfTimeSteps; // Temporal domain
203 double DTime; // The current time
204
205 // Observer to modify this object when array selections are modified
206 vtkCallbackCommand* SelectionObserver;
207
208 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
209 int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
210
211 static void SelectionCallback(
212 vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
213
214 // Selected field of interest
215 vtkDataArraySelection* PointDataArraySelection;
216 vtkDataArraySelection* CellDataArraySelection;
217
222 void UpdateDimensions(bool force = false);
223
224 std::string VerticalDimension;
225 int VerticalLevelRange[2];
226
227 int LayerThickness;
228 int LayerThicknessRange[2];
229
230 int CenterLon;
231 int CenterLonRange[2];
232
233 enum GeometryType
234 {
235 Spherical,
236 Projected,
237 Planar
238 };
239
240 GeometryType Geometry;
241
242 bool ProjectLatLon; // User option
243 bool OnASphere; // Data file attribute
244 bool IsAtmosphere;
245 bool IsZeroCentered;
246 bool ShowMultilayerView;
247
248 bool IncludeTopography;
249 bool DoBugFix;
250 double CenterRad;
251
252 bool UseDimensionedArrayNames;
253
254 // geometry
255 size_t MaximumNVertLevels;
256 size_t NumberOfCells;
257 size_t NumberOfPoints;
258 int CellOffset;
259 size_t PointOffset;
260 size_t PointsPerCell;
261 size_t CurrentExtraPoint; // current extra point
262 size_t CurrentExtraCell; // current extra cell
263 double* PointX; // x coord of point
264 double* PointY; // y coord of point
265 double* PointZ; // z coord of point
266 size_t ModNumPoints;
267 size_t ModNumCells;
268 int* OrigConnections; // original connections
269 int* ModConnections; // modified connections
270 size_t* CellMap; // maps from added cell to original cell #
271 size_t* PointMap; // maps from added point to original point #
272 int* MaximumLevelPoint; //
273 int MaximumCells; // max cells
274 int MaximumPoints; // max points
275
276 void SetDefaults();
277 int GetNcDims();
278 int GetNcAtts();
279 int CheckParams();
280 int GetNcVars(const char* cellDimName, const char* pointDimName);
281 int ReadAndOutputGrid();
282 int BuildVarArrays();
283 int AllocSphericalGeometry();
284 int AllocProjectedGeometry();
285 int AllocPlanarGeometry();
286 void ShiftLonData();
287 int AddMirrorPoint(int index, double dividerX, double offset);
288 void FixPoints();
289 int EliminateXWrap();
290 void OutputPoints();
291 void OutputCells();
292 unsigned char GetCellType();
293
294 vtkDataArray* LoadPointVarData(int variable);
295 vtkDataArray* LoadCellVarData(int variable);
296 vtkDataArray* LookupPointDataArray(int varIdx);
297 vtkDataArray* LookupCellDataArray(int varIdx);
298
307 void LoadTimeFieldData(vtkUnstructuredGrid* dataset);
308
309 private:
310 vtkMPASReader(const vtkMPASReader&) = delete;
311 void operator=(const vtkMPASReader&) = delete;
312
313 class Internal;
314 Internal* Internals;
315 };
316
317 VTK_ABI_NAMESPACE_END
318 #endif
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:49
vtkDataArraySelection
Store on/off settings for data arrays, etc.
Definition: vtkDataArraySelection.h:37
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:40
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkMPASReader
Read an MPAS netCDF file.
Definition: vtkMPASReader.h:54
vtkMPASReader::UpdateDimensions
void UpdateDimensions(bool force=false)
Update the list of available dimensions.
vtkMPASReader::LookupCellDataArray
vtkDataArray * LookupCellDataArray(int varIdx)
vtkMPASReader::PointMap
size_t * PointMap
Definition: vtkMPASReader.h:271
vtkMPASReader::PointX
double * PointX
Definition: vtkMPASReader.h:263
vtkMPASReader::GetNumberOfPointArrays
int GetNumberOfPointArrays()
The following methods allow selective reading of solutions fields.
vtkMPASReader::CenterRad
double CenterRad
Definition: vtkMPASReader.h:250
vtkMPASReader::NumberOfPoints
size_t NumberOfPoints
Definition: vtkMPASReader.h:257
vtkMPASReader::RequestInformation
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkMPASReader::CurrentExtraPoint
size_t CurrentExtraPoint
Definition: vtkMPASReader.h:261
vtkMPASReader::PointOffset
size_t PointOffset
Definition: vtkMPASReader.h:259
vtkMPASReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMPASReader::EliminateXWrap
int EliminateXWrap()
vtkMPASReader::PointZ
double * PointZ
Definition: vtkMPASReader.h:265
vtkMPASReader::DestroyData
void DestroyData()
vtkMPASReader::SelectionObserver
vtkCallbackCommand * SelectionObserver
Definition: vtkMPASReader.h:206
vtkMPASReader::LoadPointVarData
vtkDataArray * LoadPointVarData(int variable)
vtkMPASReader::GetNumberOfPointVars
virtual int GetNumberOfPointVars()
Get the number of data variables at the cell centers and points.
vtkMPASReader::FileName
char * FileName
Definition: vtkMPASReader.h:200
vtkMPASReader::AllocPlanarGeometry
int AllocPlanarGeometry()
vtkMPASReader::PointsPerCell
size_t PointsPerCell
Definition: vtkMPASReader.h:260
vtkMPASReader::SetDefaults
void SetDefaults()
vtkMPASReader::GetNcDims
int GetNcDims()
vtkMPASReader::MaximumCells
int MaximumCells
Definition: vtkMPASReader.h:273
vtkMPASReader::GetOutput
vtkUnstructuredGrid * GetOutput()
Get the reader's output.
vtkMPASReader::GetPointArrayName
const char * GetPointArrayName(int index)
The following methods allow selective reading of solutions fields.
vtkMPASReader::GeometryType
GeometryType
Definition: vtkMPASReader.h:234
vtkMPASReader::Spherical
@ Spherical
Definition: vtkMPASReader.h:235
vtkMPASReader::Projected
@ Projected
Definition: vtkMPASReader.h:236
vtkMPASReader::ProjectLatLon
bool ProjectLatLon
Definition: vtkMPASReader.h:242
vtkMPASReader::SetPointArrayStatus
void SetPointArrayStatus(const char *name, int status)
The following methods allow selective reading of solutions fields.
vtkMPASReader::OrigConnections
int * OrigConnections
Definition: vtkMPASReader.h:268
vtkMPASReader::ModNumPoints
size_t ModNumPoints
Definition: vtkMPASReader.h:266
vtkMPASReader::DoBugFix
bool DoBugFix
Definition: vtkMPASReader.h:249
vtkMPASReader::ShiftLonData
void ShiftLonData()
vtkMPASReader::CheckParams
int CheckParams()
vtkMPASReader::IsAtmosphere
bool IsAtmosphere
Definition: vtkMPASReader.h:244
vtkMPASReader::LayerThickness
int LayerThickness
Definition: vtkMPASReader.h:227
vtkMPASReader::EnableAllPointArrays
void EnableAllPointArrays()
The following methods allow selective reading of solutions fields.
vtkMPASReader::GetDimensionCurrentIndex
int GetDimensionCurrentIndex(const std::string &dim)
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
vtkMPASReader::GetAllDimensions
vtkStringArray * GetAllDimensions()
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
vtkMPASReader::GetCellArrayStatus
int GetCellArrayStatus(const char *name)
vtkMPASReader::GetVerticalLevel
int GetVerticalLevel()
Convenience function for setting/querying [GS]etDimensionCurrentIndex for the dimension returned by G...
vtkMPASReader::GetNumberOfDimensions
vtkIdType GetNumberOfDimensions()
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
vtkMPASReader::GetDimensionName
std::string GetDimensionName(int idx)
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
vtkMPASReader::vtkGetFilePathMacro
vtkGetFilePathMacro(FileName)
Specify file name of MPAS data file to read.
vtkMPASReader::PointY
double * PointY
Definition: vtkMPASReader.h:264
vtkMPASReader::EnableAllCellArrays
void EnableAllCellArrays()
vtkMPASReader::SetDimensionCurrentIndex
void SetDimensionCurrentIndex(const std::string &dim, int idx)
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
vtkMPASReader::SetCellArrayStatus
void SetCellArrayStatus(const char *name, int status)
vtkMPASReader::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkMPASReader::MaximumNVertLevels
size_t MaximumNVertLevels
Definition: vtkMPASReader.h:255
vtkMPASReader::vtkMPASReader
vtkMPASReader()
vtkMPASReader::Geometry
GeometryType Geometry
Definition: vtkMPASReader.h:240
vtkMPASReader::AllocSphericalGeometry
int AllocSphericalGeometry()
vtkMPASReader::AddMirrorPoint
int AddMirrorPoint(int index, double dividerX, double offset)
vtkMPASReader::CellOffset
int CellOffset
Definition: vtkMPASReader.h:258
vtkMPASReader::GetNcAtts
int GetNcAtts()
vtkMPASReader::GetNumberOfCellArrays
int GetNumberOfCellArrays()
vtkMPASReader::PointDataArraySelection
vtkDataArraySelection * PointDataArraySelection
Definition: vtkMPASReader.h:215
vtkMPASReader::SelectionCallback
static void SelectionCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
vtkMPASReader::GetOutput
vtkUnstructuredGrid * GetOutput(int idx)
Get the reader's output.
vtkMPASReader::CurrentExtraCell
size_t CurrentExtraCell
Definition: vtkMPASReader.h:262
vtkMPASReader::OutputCells
void OutputCells()
vtkMPASReader::IncludeTopography
bool IncludeTopography
Definition: vtkMPASReader.h:248
vtkMPASReader::OutputPoints
void OutputPoints()
vtkMPASReader::MaximumPoints
int MaximumPoints
Definition: vtkMPASReader.h:274
vtkMPASReader::BuildVarArrays
int BuildVarArrays()
vtkMPASReader::LookupPointDataArray
vtkDataArray * LookupPointDataArray(int varIdx)
vtkMPASReader::ReadAndOutputGrid
int ReadAndOutputGrid()
vtkMPASReader::NumberOfCells
size_t NumberOfCells
Definition: vtkMPASReader.h:256
vtkMPASReader::VerticalDimension
std::string VerticalDimension
Definition: vtkMPASReader.h:224
vtkMPASReader::DisableAllPointArrays
void DisableAllPointArrays()
The following methods allow selective reading of solutions fields.
vtkMPASReader::GetNumberOfCellVars
virtual int GetNumberOfCellVars()
Get the number of data variables at the cell centers and points.
vtkMPASReader::GetCellType
unsigned char GetCellType()
vtkMPASReader::ModConnections
int * ModConnections
Definition: vtkMPASReader.h:269
vtkMPASReader::FixPoints
void FixPoints()
vtkMPASReader::GetNcVars
int GetNcVars(const char *cellDimName, const char *pointDimName)
vtkMPASReader::SetVerticalLevel
void SetVerticalLevel(int level)
Convenience function for setting/querying [GS]etDimensionCurrentIndex for the dimension returned by G...
vtkMPASReader::~vtkMPASReader
~vtkMPASReader() override
vtkMPASReader::GetDimensionSize
int GetDimensionSize(const std::string &dim)
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
vtkMPASReader::GetCellArrayName
const char * GetCellArrayName(int index)
vtkMPASReader::New
static vtkMPASReader * New()
vtkMPASReader::CanReadFile
static int CanReadFile(VTK_FILEPATH const char *filename)
Returns true if the given file can be read.
vtkMPASReader::DTime
double DTime
Definition: vtkMPASReader.h:203
vtkMPASReader::GetPointArrayStatus
int GetPointArrayStatus(const char *name)
The following methods allow selective reading of solutions fields.
vtkMPASReader::DisableAllCellArrays
void DisableAllCellArrays()
vtkMPASReader::CenterLon
int CenterLon
Definition: vtkMPASReader.h:230
vtkMPASReader::ShowMultilayerView
bool ShowMultilayerView
Definition: vtkMPASReader.h:246
vtkMPASReader::IsZeroCentered
bool IsZeroCentered
Definition: vtkMPASReader.h:245
vtkMPASReader::vtkSetFilePathMacro
vtkSetFilePathMacro(FileName)
Specify file name of MPAS data file to read.
vtkMPASReader::ReleaseNcData
void ReleaseNcData()
vtkMPASReader::CellDataArraySelection
vtkDataArraySelection * CellDataArraySelection
Definition: vtkMPASReader.h:216
vtkMPASReader::LoadTimeFieldData
void LoadTimeFieldData(vtkUnstructuredGrid *dataset)
Update the "Time" vtkStringArray in dataset's FieldData to contain the xtime string for the current t...
vtkMPASReader::CellMap
size_t * CellMap
Definition: vtkMPASReader.h:270
vtkMPASReader::GetMTime
vtkMTimeType GetMTime() override
Return this object's modified time.
vtkMPASReader::ModNumCells
size_t ModNumCells
Definition: vtkMPASReader.h:267
vtkMPASReader::OnASphere
bool OnASphere
Definition: vtkMPASReader.h:243
vtkMPASReader::UseDimensionedArrayNames
bool UseDimensionedArrayNames
Definition: vtkMPASReader.h:252
vtkMPASReader::SetCenterLon
void SetCenterLon(int val)
vtkMPASReader::AllocProjectedGeometry
int AllocProjectedGeometry()
vtkMPASReader::MaximumLevelPoint
int * MaximumLevelPoint
Definition: vtkMPASReader.h:272
vtkMPASReader::NumberOfTimeSteps
size_t NumberOfTimeSteps
Definition: vtkMPASReader.h:202
vtkMPASReader::LoadCellVarData
vtkDataArray * LoadCellVarData(int variable)
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:41
vtkUnstructuredGridAlgorithm
Superclass for algorithms that produce only unstructured grid as output.
Definition: vtkUnstructuredGridAlgorithm.h:30
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:99
vtkX3D::level
@ level
Definition: vtkX3D.h:395
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkX3D::offset
@ offset
Definition: vtkX3D.h:438
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkIdType
int vtkIdType
Definition: vtkType.h:315
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
vtkUnstructuredGridAlgorithm.h
VTK_FILEPATH
#define VTK_FILEPATH
Definition: vtkWrappingHints.h:34