VTK  9.1.0
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=========================================================================*/
36#ifndef vtkAVSucdReader_h
37#define vtkAVSucdReader_h
38
39#include "vtkIOGeometryModule.h" // For export macro
41
42class vtkIntArray;
43class vtkFloatArray;
44class vtkIdTypeArray;
46
47class VTKIOGEOMETRY_EXPORT vtkAVSucdReader : public vtkUnstructuredGridAlgorithm
48{
49public:
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
55
61
63
66 vtkSetMacro(BinaryFile, vtkTypeBool);
67 vtkGetMacro(BinaryFile, vtkTypeBool);
68 vtkBooleanMacro(BinaryFile, vtkTypeBool);
70
72
75 vtkGetMacro(NumberOfCells, int);
77
79
82 vtkGetMacro(NumberOfNodes, int);
84
86
89 vtkGetMacro(NumberOfNodeFields, int);
91
93
96 vtkGetMacro(NumberOfCellFields, int);
98
100
104 vtkGetMacro(NumberOfFields, int);
106
108
111 vtkGetMacro(NumberOfNodeComponents, int);
112 vtkGetMacro(NumberOfCellComponents, int);
114
116
121 const char* GetByteOrderAsString();
123
124 vtkSetMacro(ByteOrder, int);
125 vtkGetMacro(ByteOrder, int);
126
128
135 const char* GetPointArrayName(int index);
136 const char* GetCellArrayName(int index);
137 int GetPointArrayStatus(const char* name);
138 int GetCellArrayStatus(const char* name);
139 void SetPointArrayStatus(const char* name, int status);
140 void SetCellArrayStatus(const char* name, int status);
142
147
148 // get min and max value for the index-th value of a cell component
149 // index varies from 0 to (veclen - 1)
150 void GetCellDataRange(int cellComp, int index, float* min, float* max);
151
152 // get min and max value for the index-th value of a node component
153 // index varies from 0 to (veclen - 1)
154 void GetNodeDataRange(int nodeComp, int index, float* min, float* max);
155
156protected:
161
162 char* FileName;
164
173
174 istream* FileStream;
175
178
180 int GetLabel(char* string, int number, char* label);
181
182 enum
183 {
184 FILE_BIG_ENDIAN = 0,
185 FILE_LITTLE_ENDIAN = 1
186 };
188 {
189 PT = 0,
190 LINE = 1,
191 TRI = 2,
192 QUAD = 3,
193 TET = 4,
194 PYR = 5,
195 PRISM = 6,
196 HEX = 7
197 };
198
199 struct DataInfo
200 {
201 long foffset; // offset in binary file
202 int veclen; // number of components in the node or cell variable
203 float min[3]; // pre-calculated data minima (max size 3 for vectors)
204 float max[3]; // pre-calculated data maxima (max size 3 for vectors)
205 };
206
209
210private:
211 struct idMapping;
212
213 void ReadFile(vtkUnstructuredGrid* output);
214 void ReadGeometry(vtkUnstructuredGrid* output, idMapping& nodeMap, idMapping& cellMap);
215 void ReadNodeData(vtkUnstructuredGrid* output, const idMapping& nodeMap);
216 void ReadCellData(vtkUnstructuredGrid* output, const idMapping& cellMap);
217
218 int ReadFloatBlock(int n, float* block);
219 int ReadIntBlock(int n, int* block);
220 void ReadXYZCoords(vtkFloatArray* coords, idMapping& nodeMap);
221 void ReadBinaryCellTopology(vtkIntArray* material, int* types, vtkIdTypeArray* listcells);
222 void ReadASCIICellTopology(vtkIntArray* material, vtkUnstructuredGrid* output,
223 const idMapping& nodeMap, idMapping& cellMap);
224
225 vtkAVSucdReader(const vtkAVSucdReader&) = delete;
226 void operator=(const vtkAVSucdReader&) = delete;
227};
228
229#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 for a vtkSource.
dynamic, self-adjusting array of float
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:149
Superclass for algorithms that produce only unstructured grid as output.
dataset represents arbitrary combinations of all possible cell types
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
int vtkTypeBool
Definition: vtkABI.h:69
#define max(a, b)