VTK  9.3.0
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
44 
45 #include <string> // for std::string
46 
47 VTK_ABI_NAMESPACE_BEGIN
48 class vtkCallbackCommand;
50 class vtkDoubleArray;
51 class vtkStringArray;
52 
53 class VTKIONETCDF_EXPORT vtkMPASReader : public vtkUnstructuredGridAlgorithm
54 {
55 public:
56  static vtkMPASReader* New();
58  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
61 
67 
69 
72  vtkGetMacro(MaximumCells, int);
74 
76 
79  vtkGetMacro(MaximumPoints, int);
81 
83 
86  virtual int GetNumberOfCellVars();
87  virtual int GetNumberOfPointVars();
89 
91 
97 
99 
105  vtkSetMacro(UseDimensionedArrayNames, bool);
106  vtkGetMacro(UseDimensionedArrayNames, bool);
107  vtkBooleanMacro(UseDimensionedArrayNames, bool);
109 
111 
117  const char* GetPointArrayName(int index);
118  int GetPointArrayStatus(const char* name);
119  void SetPointArrayStatus(const char* name, int status);
123 
125  const char* GetCellArrayName(int index);
126  int GetCellArrayStatus(const char* name);
127  void SetCellArrayStatus(const char* name, int status);
130 
132 
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 
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:
196  ~vtkMPASReader() override;
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
207 
210 
211  static void SelectionCallback(
212  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
213 
214  // Selected field of interest
217 
222  void UpdateDimensions(bool force = false);
223 
225  int VerticalLevelRange[2];
226 
228  int LayerThicknessRange[2];
229 
231  int CenterLonRange[2];
232 
234  {
237  Planar
238  };
239 
241 
242  bool ProjectLatLon; // User option
243  bool OnASphere; // Data file attribute
247 
249  bool DoBugFix;
250  double CenterRad;
251 
253 
254  // geometry
259  size_t PointOffset;
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 #
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);
286  void ShiftLonData();
287  int AddMirrorPoint(int index, double dividerX, double offset);
288  void FixPoints();
290  void OutputPoints();
291  void OutputCells();
292  unsigned char GetCellType();
293 
298 
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
supports function callbacks
Store on/off settings for data arrays, etc.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition: vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Read an MPAS netCDF file.
Definition: vtkMPASReader.h:54
void UpdateDimensions(bool force=false)
Update the list of available dimensions.
vtkDataArray * LookupCellDataArray(int varIdx)
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
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 * LoadPointVarData(int variable)
virtual int GetNumberOfPointVars()
Get the number of data variables at the cell centers and points.
int AllocPlanarGeometry()
size_t PointsPerCell
void SetDefaults()
vtkUnstructuredGrid * GetOutput()
Get the reader's output.
const char * GetPointArrayName(int index)
The following methods allow selective reading of solutions fields.
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,...
vtkStringArray * GetAllDimensions()
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,...
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.
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)
vtkUnstructuredGrid * GetOutput(int idx)
Get the reader's output.
size_t CurrentExtraCell
void OutputCells()
bool IncludeTopography
void OutputPoints()
int BuildVarArrays()
vtkDataArray * LookupPointDataArray(int varIdx)
int ReadAndOutputGrid()
size_t NumberOfCells
std::string VerticalDimension
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
int GetDimensionSize(const std::string &dim)
If the point/cell arrays contain dimensions other than Time, nCells, or nVertices,...
const char * GetCellArrayName(int index)
static vtkMPASReader * New()
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
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
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
vtkDataArray * LoadCellVarData(int variable)
abstract base class for most VTK objects
Definition: vtkObject.h:61
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
@ string
Definition: vtkX3D.h:490
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_FILEPATH