VTK
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=========================================================================*/
42#ifndef vtkAVSucdReader_h
43#define vtkAVSucdReader_h
44
45#include "vtkIOGeometryModule.h" // For export macro
47
48class vtkIntArray;
49class vtkFloatArray;
50class vtkIdTypeArray;
52
53class VTKIOGEOMETRY_EXPORT vtkAVSucdReader : public vtkUnstructuredGridAlgorithm
54{
55public:
58 void PrintSelf(ostream& os, vtkIndent indent);
59
61
64 vtkSetStringMacro(FileName);
67
69
72 vtkSetMacro(BinaryFile, int);
73 vtkGetMacro(BinaryFile, int);
74 vtkBooleanMacro(BinaryFile, int);
76
78
81 vtkGetMacro(NumberOfCells,int);
83
85
88 vtkGetMacro(NumberOfNodes,int);
90
92
95 vtkGetMacro(NumberOfNodeFields,int);
97
99
102 vtkGetMacro(NumberOfCellFields,int);
104
106
110 vtkGetMacro(NumberOfFields,int);
112
114
117 vtkGetMacro(NumberOfNodeComponents,int);
118 vtkGetMacro(NumberOfCellComponents,int);
120
122
127 const char *GetByteOrderAsString();
129
130 vtkSetMacro(ByteOrder, int);
131 vtkGetMacro(ByteOrder, int);
132
134
141 const char* GetPointArrayName(int index);
142 const char* GetCellArrayName(int index);
143 int GetPointArrayStatus(const char* name);
144 int GetCellArrayStatus(const char* name);
145 void SetPointArrayStatus(const char* name, int status);
146 void SetCellArrayStatus(const char* name, int status);
148
153
154 // get min and max value for the index-th value of a cell component
155 // index varies from 0 to (veclen - 1)
156 void GetCellDataRange(int cellComp, int index, float *min, float *max);
157
158 // get min and max value for the index-th value of a node component
159 // index varies from 0 to (veclen - 1)
160 void GetNodeDataRange(int nodeComp, int index, float *min, float *max);
161
162protected:
167
168 char *FileName;
170
179
180 ifstream *FileStream;
181
184
186 int GetLabel(char *string, int number, char *label);
187
188 enum
189 {
190 FILE_BIG_ENDIAN=0,
191 FILE_LITTLE_ENDIAN=1
192 };
194 {
195 PT = 0,
196 LINE = 1,
197 TRI = 2,
198 QUAD = 3,
199 TET = 4,
200 PYR = 5,
201 PRISM = 6,
202 HEX = 7
203 };
204
205 struct DataInfo {
206 long foffset; // offset in binary file
207 int veclen; // number of components in the node or cell variable
208 float min[3]; // pre-calculated data minima (max size 3 for vectors)
209 float max[3]; // pre-calculated data maxima (max size 3 for vectors)
210 };
211
214
215private:
216 struct idMapping;
217
218 void ReadFile(vtkUnstructuredGrid *output);
219 void ReadGeometry(vtkUnstructuredGrid *output,
220 idMapping& nodeMap,
221 idMapping& cellMap);
222 void ReadNodeData(vtkUnstructuredGrid *output, const idMapping& nodeMap);
223 void ReadCellData(vtkUnstructuredGrid *output, const idMapping& cellMap);
224
225 int ReadFloatBlock(int n, float *block);
226 int ReadIntBlock(int n, int *block);
227 void ReadXYZCoords(vtkFloatArray *coords, idMapping& nodeMap);
228 void ReadBinaryCellTopology(vtkIntArray *material, int *types,
229 vtkIdTypeArray *listcells);
230 void ReadASCIICellTopology(vtkIntArray *material,
231 vtkUnstructuredGrid *output,
232 const idMapping& nodeMap,
233 idMapping& cellMap);
234
235 vtkAVSucdReader(const vtkAVSucdReader&) VTK_DELETE_FUNCTION;
236 void operator=(const vtkAVSucdReader&) VTK_DELETE_FUNCTION;
237};
238
239#endif
reads a dataset in AVS "UCD" format
void DisableAllPointArrays()
const char * GetByteOrderAsString()
void SetCellArrayStatus(const char *name, int status)
void SetPointArrayStatus(const char *name, int status)
ifstream * FileStream
DataInfo * CellDataInfo
static vtkAVSucdReader * New()
vtkDataArraySelection * CellDataArraySelection
DataInfo * NodeDataInfo
void DisableAllCellArrays()
int GetNumberOfPointArrays()
The following methods allow selective reading of solutions fields.
int GetNumberOfCellArrays()
void EnableAllPointArrays()
void SetByteOrderToBigEndian()
Set/Get the endian-ness of the binary file.
const char * GetCellArrayName(int index)
int GetLabel(char *string, int number, char *label)
void SetByteOrderToLittleEndian()
const char * GetPointArrayName(int index)
void GetNodeDataRange(int nodeComp, int index, float *min, float *max)
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
void EnableAllCellArrays()
void GetCellDataRange(int cellComp, int index, float *min, float *max)
int GetPointArrayStatus(const char *name)
int GetCellArrayStatus(const char *name)
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkDataArraySelection * PointDataArraySelection
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Store on/off settings for data arrays for a vtkSource.
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
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
#define max(a, b)