VTK  9.4.20241221
vtkAVSucdReader.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
27#ifndef vtkAVSucdReader_h
28#define vtkAVSucdReader_h
29
30#include "vtkIOGeometryModule.h" // For export macro
32
33VTK_ABI_NAMESPACE_BEGIN
34class vtkIntArray;
35class vtkFloatArray;
36class vtkIdTypeArray;
38
39class VTKIOGEOMETRY_EXPORT vtkAVSucdReader : public vtkUnstructuredGridAlgorithm
40{
41public:
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
47
53
55
58 vtkSetMacro(BinaryFile, vtkTypeBool);
59 vtkGetMacro(BinaryFile, vtkTypeBool);
60 vtkBooleanMacro(BinaryFile, vtkTypeBool);
62
64
67 vtkGetMacro(NumberOfCells, int);
69
71
74 vtkGetMacro(NumberOfNodes, int);
76
78
81 vtkGetMacro(NumberOfNodeFields, int);
83
85
88 vtkGetMacro(NumberOfCellFields, int);
90
92
96 vtkGetMacro(NumberOfFields, int);
98
100
103 vtkGetMacro(NumberOfNodeComponents, int);
104 vtkGetMacro(NumberOfCellComponents, int);
106
108
113 const char* GetByteOrderAsString();
115
116 vtkSetMacro(ByteOrder, int);
117 vtkGetMacro(ByteOrder, int);
118
120
127 const char* GetPointArrayName(int index);
128 const char* GetCellArrayName(int index);
129 int GetPointArrayStatus(const char* name);
130 int GetCellArrayStatus(const char* name);
131 void SetPointArrayStatus(const char* name, int status);
132 void SetCellArrayStatus(const char* name, int status);
134
139
140 // get min and max value for the index-th value of a cell component
141 // index varies from 0 to (veclen - 1)
142 void GetCellDataRange(int cellComp, int index, float* min, float* max);
143
144 // get min and max value for the index-th value of a node component
145 // index varies from 0 to (veclen - 1)
146 void GetNodeDataRange(int nodeComp, int index, float* min, float* max);
147
148protected:
153
154 char* FileName;
156
165
166 istream* FileStream;
167
170
172 int GetLabel(char* string, int number, char* label);
173
174 enum
175 {
176 FILE_BIG_ENDIAN = 0,
177 FILE_LITTLE_ENDIAN = 1
178 };
180 {
181 PT = 0,
182 LINE = 1,
183 TRI = 2,
184 QUAD = 3,
185 TET = 4,
186 PYR = 5,
187 PRISM = 6,
188 HEX = 7
189 };
190
191 struct DataInfo
192 {
193 long foffset; // offset in binary file
194 int veclen; // number of components in the node or cell variable
195 float min[3]; // pre-calculated data minima (max size 3 for vectors)
196 float max[3]; // pre-calculated data maxima (max size 3 for vectors)
197 };
198
201
202private:
203 struct idMapping;
204
205 void ReadFile(vtkUnstructuredGrid* output);
206 void ReadGeometry(vtkUnstructuredGrid* output, idMapping& nodeMap, idMapping& cellMap);
207 void ReadNodeData(vtkUnstructuredGrid* output, const idMapping& nodeMap);
208 void ReadCellData(vtkUnstructuredGrid* output, const idMapping& cellMap);
209
210 int ReadFloatBlock(int n, float* block);
211 int ReadIntBlock(int n, int* block);
212 void ReadXYZCoords(vtkFloatArray* coords, idMapping& nodeMap);
213 void ReadBinaryCellTopology(vtkIntArray* material, int* types, vtkIdTypeArray* listcells);
214 void ReadASCIICellTopology(vtkIntArray* material, vtkUnstructuredGrid* output,
215 const idMapping& nodeMap, idMapping& cellMap);
216
217 vtkAVSucdReader(const vtkAVSucdReader&) = delete;
218 void operator=(const vtkAVSucdReader&) = delete;
219};
220
221VTK_ABI_NAMESPACE_END
222#endif
reads a dataset in AVS "UCD" format
void DisableAllPointArrays()
const char * GetByteOrderAsString()
Set/Get the endian-ness of the binary file.
void SetCellArrayStatus(const char *name, int status)
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.
DataInfo * CellDataInfo
static vtkAVSucdReader * New()
vtkDataArraySelection * CellDataArraySelection
DataInfo * NodeDataInfo
void DisableAllCellArrays()
int GetNumberOfPointArrays()
The following methods allow selective reading of solutions fields.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int GetNumberOfCellArrays()
The following methods allow selective reading of solutions fields.
void EnableAllPointArrays()
vtkTypeBool BinaryFile
void SetByteOrderToBigEndian()
Set/Get the endian-ness of the binary file.
const char * GetCellArrayName(int index)
The following methods allow selective reading of solutions fields.
int GetLabel(char *string, int number, char *label)
void SetByteOrderToLittleEndian()
Set/Get the endian-ness of the binary file.
const char * GetPointArrayName(int index)
The following methods allow selective reading of solutions fields.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void GetNodeDataRange(int nodeComp, int index, float *min, float *max)
void EnableAllCellArrays()
void GetCellDataRange(int cellComp, int index, float *min, float *max)
int GetPointArrayStatus(const char *name)
The following methods allow selective reading of solutions fields.
~vtkAVSucdReader() override
vtkSetFilePathMacro(FileName)
Specify file name of AVS UCD datafile to read.
vtkGetFilePathMacro(FileName)
Specify file name of AVS UCD datafile to read.
int GetCellArrayStatus(const char *name)
The following methods allow selective reading of solutions fields.
vtkDataArraySelection * PointDataArraySelection
Store on/off settings for data arrays, etc.
dynamic, self-adjusting array of float
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Superclass for algorithms that produce only unstructured grid as output.
dataset represents arbitrary combinations of all possible cell types
int vtkTypeBool
Definition vtkABI.h:64
#define max(a, b)