VTK  9.6.20260226
vtkNetCDFUGRIDReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef vtkNetCDFUGRIDReader_h
5#define vtkNetCDFUGRIDReader_h
6
7#include "vtkDataArraySelection.h" // For vtkSmartPointer downcast
8#include "vtkIONetCDFModule.h" // For export macro
9#include "vtkSmartPointer.h" // For vtkSmartPointer
11
12#include <cstdlib> // For std::size_t
13#include <vector> // For std::vector
14
15VTK_ABI_NAMESPACE_BEGIN
16
30class VTKIONETCDF_EXPORT vtkNetCDFUGRIDReader : public vtkUnstructuredGridAlgorithm
31{
32public:
35 void PrintSelf(ostream& os, vtkIndent indent) override;
36
38
44
46
50 vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
51 vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);
53
55
61
63
66 const char* GetPointArrayName(int index);
67 const char* GetCellArrayName(int index);
69
71
74 int GetPointArrayStatus(const char* name);
75 int GetCellArrayStatus(const char* name);
76 void SetPointArrayStatus(const char* name, int status);
77 void SetCellArrayStatus(const char* name, int status);
79
81
90 vtkGetMacro(ReplaceFillValueWithNan, bool);
91 vtkSetMacro(ReplaceFillValueWithNan, bool);
92 vtkBooleanMacro(ReplaceFillValueWithNan, bool);
94
95protected:
98
102 vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) override;
103
104 bool Open();
106 bool FillArraySelection(const std::vector<int>& ids, vtkDataArraySelection* selection);
109 bool FillArrays(vtkUnstructuredGrid* output, std::size_t timeStep);
110 void Close();
111
112 bool CheckError(int error);
113 std::string GetAttributeString(int var, std::string name);
114 std::string GetVariableName(int var);
115 std::string GetAttributeName(int var, int att);
116 std::string GetDimensionName(int dim);
117 vtkSmartPointer<vtkDataArray> GetArrayData(int var, std::size_t time, std::size_t size);
118
119private:
120 char* FileName = nullptr;
121
122 int NcId = -1;
123 int MeshVarId = -1;
124 int FaceVarId = -1;
125 int FaceFillValue = -1;
126 int FaceStartIndex = 0;
127 int NodeXVarId = -1;
128 int NodeYVarId = -1;
129 int NodeType = -1;
130 std::size_t NodeCount = 0;
131 std::size_t FaceCount = 0;
132 std::size_t NodesPerFace = 0;
133 std::size_t FaceStride = 0;
134 std::size_t NodesPerFaceStride = 0;
135 bool ReplaceFillValueWithNan = false;
136 std::vector<int> NodeArrayVarIds; // data variables linked to nodes (points)
137 std::vector<int> FaceArrayVarIds; // data variables linked to face (cells)
138 std::vector<double> TimeSteps;
139
140 vtkSmartPointer<vtkDataArraySelection> PointDataArraySelection;
141 vtkSmartPointer<vtkDataArraySelection> CellDataArraySelection;
142
144 void operator=(const vtkNetCDFUGRIDReader&) = delete;
145};
146
147VTK_ABI_NAMESPACE_END
148
149#endif
Store on/off settings for data arrays, etc.
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
vtkSetFilePathMacro(FileName)
Get/Set the file name of the file.
static vtkNetCDFUGRIDReader * New()
vtkSmartPointer< vtkDataArray > GetArrayData(int var, std::size_t time, std::size_t size)
int GetNumberOfCellArrays()
Get the number of point or cell arrays available in the input.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
bool FillArrays(vtkUnstructuredGrid *output, std::size_t timeStep)
bool FillArraySelection(const std::vector< int > &ids, vtkDataArraySelection *selection)
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *outputVector) override
This is called by the superclass.
int GetCellArrayStatus(const char *name)
Get/Set whether the point or cell with the given name is to be read.
void SetPointArrayStatus(const char *name, int status)
Get/Set whether the point or cell with the given name is to be read.
vtkGetFilePathMacro(FileName)
Get/Set the file name of the file.
const char * GetCellArrayName(int index)
Get the name of the point or cell with the given index in the input.
int GetPointArrayStatus(const char *name)
Get/Set whether the point or cell with the given name is to be read.
~vtkNetCDFUGRIDReader() override
int GetNumberOfPointArrays()
Get the number of point or cell arrays available in the input.
void SetCellArrayStatus(const char *name, int status)
Get/Set whether the point or cell with the given name is to be read.
bool CheckError(int error)
std::string GetVariableName(int var)
bool FillCells(vtkUnstructuredGrid *output)
std::string GetDimensionName(int dim)
std::string GetAttributeName(int var, int att)
bool FillPoints(vtkUnstructuredGrid *output)
std::string GetAttributeString(int var, std::string name)
const char * GetPointArrayName(int index)
Get the name of the point or cell with the given index in the input.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Hold a reference to a vtkObjectBase instance.
dataset represents arbitrary combinations of all possible cell types