VTK  9.2.6
vtkAVSucdReader.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkAVSucdReader.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=========================================================================*/
39#ifndef vtkAVSucdReader_h
40#define vtkAVSucdReader_h
41
42#include "vtkIOGeometryModule.h" // For export macro
44
45class vtkIntArray;
46class vtkFloatArray;
47class vtkIdTypeArray;
49
50class VTKIOGEOMETRY_EXPORT vtkAVSucdReader : public vtkUnstructuredGridAlgorithm
51{
52public:
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
58
64
66
69 vtkSetMacro(BinaryFile, vtkTypeBool);
70 vtkGetMacro(BinaryFile, vtkTypeBool);
71 vtkBooleanMacro(BinaryFile, vtkTypeBool);
73
75
78 vtkGetMacro(NumberOfCells, int);
80
82
85 vtkGetMacro(NumberOfNodes, int);
87
89
92 vtkGetMacro(NumberOfNodeFields, int);
94
96
99 vtkGetMacro(NumberOfCellFields, int);
101
103
107 vtkGetMacro(NumberOfFields, int);
109
111
114 vtkGetMacro(NumberOfNodeComponents, int);
115 vtkGetMacro(NumberOfCellComponents, int);
117
119
124 const char* GetByteOrderAsString();
126
127 vtkSetMacro(ByteOrder, int);
128 vtkGetMacro(ByteOrder, int);
129
131
138 const char* GetPointArrayName(int index);
139 const char* GetCellArrayName(int index);
140 int GetPointArrayStatus(const char* name);
141 int GetCellArrayStatus(const char* name);
142 void SetPointArrayStatus(const char* name, int status);
143 void SetCellArrayStatus(const char* name, int status);
145
150
151 // get min and max value for the index-th value of a cell component
152 // index varies from 0 to (veclen - 1)
153 void GetCellDataRange(int cellComp, int index, float* min, float* max);
154
155 // get min and max value for the index-th value of a node component
156 // index varies from 0 to (veclen - 1)
157 void GetNodeDataRange(int nodeComp, int index, float* min, float* max);
158
159protected:
164
165 char* FileName;
167
176
177 istream* FileStream;
178
181
183 int GetLabel(char* string, int number, char* label);
184
185 enum
186 {
187 FILE_BIG_ENDIAN = 0,
188 FILE_LITTLE_ENDIAN = 1
189 };
191 {
192 PT = 0,
193 LINE = 1,
194 TRI = 2,
195 QUAD = 3,
196 TET = 4,
197 PYR = 5,
198 PRISM = 6,
199 HEX = 7
200 };
201
202 struct DataInfo
203 {
204 long foffset; // offset in binary file
205 int veclen; // number of components in the node or cell variable
206 float min[3]; // pre-calculated data minima (max size 3 for vectors)
207 float max[3]; // pre-calculated data maxima (max size 3 for vectors)
208 };
209
212
213private:
214 struct idMapping;
215
216 void ReadFile(vtkUnstructuredGrid* output);
217 void ReadGeometry(vtkUnstructuredGrid* output, idMapping& nodeMap, idMapping& cellMap);
218 void ReadNodeData(vtkUnstructuredGrid* output, const idMapping& nodeMap);
219 void ReadCellData(vtkUnstructuredGrid* output, const idMapping& cellMap);
220
221 int ReadFloatBlock(int n, float* block);
222 int ReadIntBlock(int n, int* block);
223 void ReadXYZCoords(vtkFloatArray* coords, idMapping& nodeMap);
224 void ReadBinaryCellTopology(vtkIntArray* material, int* types, vtkIdTypeArray* listcells);
225 void ReadASCIICellTopology(vtkIntArray* material, vtkUnstructuredGrid* output,
226 const idMapping& nodeMap, idMapping& cellMap);
227
228 vtkAVSucdReader(const vtkAVSucdReader&) = delete;
229 void operator=(const vtkAVSucdReader&) = delete;
230};
231
232#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.
istream * FileStream
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
Definition: vtkFloatArray.h:42
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:46
Superclass for algorithms that produce only unstructured grid as output.
dataset represents arbitrary combinations of all possible cell types
int vtkTypeBool
Definition: vtkABI.h:69
#define max(a, b)