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 =========================================================================*/
41 #ifndef vtkAVSucdReader_h
42 #define vtkAVSucdReader_h
43 
44 #include "vtkIOGeometryModule.h" // For export macro
46 
47 class vtkIntArray;
48 class vtkFloatArray;
49 class vtkIdTypeArray;
51 
53 {
54 public:
55  static vtkAVSucdReader *New();
57  void PrintSelf(ostream& os, vtkIndent indent);
58 
60 
61  vtkSetStringMacro(FileName);
62  vtkGetStringMacro(FileName);
64 
66 
68  vtkSetMacro(BinaryFile, int);
69  vtkGetMacro(BinaryFile, int);
70  vtkBooleanMacro(BinaryFile, int);
72 
74 
75  vtkGetMacro(NumberOfCells,int);
77 
79 
80  vtkGetMacro(NumberOfNodes,int);
82 
84 
85  vtkGetMacro(NumberOfNodeFields,int);
87 
89 
90  vtkGetMacro(NumberOfCellFields,int);
92 
94 
96  vtkGetMacro(NumberOfFields,int);
98 
100 
101  vtkGetMacro(NumberOfNodeComponents,int);
102  vtkGetMacro(NumberOfCellComponents,int);
104 
106 
107  void SetByteOrderToBigEndian();
108  void SetByteOrderToLittleEndian();
109  const char *GetByteOrderAsString();
111 
112  vtkSetMacro(ByteOrder, int);
113  vtkGetMacro(ByteOrder, int);
114 
116 
119  int GetNumberOfPointArrays();
120  int GetNumberOfCellArrays();
121  const char* GetPointArrayName(int index);
122  const char* GetCellArrayName(int index);
123  int GetPointArrayStatus(const char* name);
124  int GetCellArrayStatus(const char* name);
125  void SetPointArrayStatus(const char* name, int status);
126  void SetCellArrayStatus(const char* name, int status);
128 
129  void DisableAllCellArrays();
130  void EnableAllCellArrays();
131  void DisableAllPointArrays();
132  void EnableAllPointArrays();
133 
134  // get min and max value for the index-th value of a cell component
135  // index varies from 0 to (veclen - 1)
136  void GetCellDataRange(int cellComp, int index, float *min, float *max);
137 
138  // get min and max value for the index-th value of a node component
139  // index varies from 0 to (veclen - 1)
140  void GetNodeDataRange(int nodeComp, int index, float *min, float *max);
141 
142 protected:
143  vtkAVSucdReader();
144  ~vtkAVSucdReader();
147 
148  char *FileName;
150 
159 
160  ifstream *FileStream;
161 
164 
166  int GetLabel(char *string, int number, char *label);
167  //BTX
168  enum
169  {
170  FILE_BIG_ENDIAN=0,
171  FILE_LITTLE_ENDIAN=1
172  };
174  {
175  PT = 0,
176  LINE = 1,
177  TRI = 2,
178  QUAD = 3,
179  TET = 4,
180  PYR = 5,
181  PRISM = 6,
182  HEX = 7
183  };
184 
185  struct DataInfo {
186  long foffset; // offset in binary file
187  int veclen; // number of components in the node or cell variable
188  float min[3]; // pre-calculated data minima (max size 3 for vectors)
189  float max[3]; // pre-calculated data maxima (max size 3 for vectors)
190  };
191  //ETX
192 
195 
196 private:
197  struct idMapping;
198 
199  void ReadFile(vtkUnstructuredGrid *output);
200  void ReadGeometry(vtkUnstructuredGrid *output,
201  idMapping& nodeMap,
202  idMapping& cellMap);
203  void ReadNodeData(vtkUnstructuredGrid *output, const idMapping& nodeMap);
204  void ReadCellData(vtkUnstructuredGrid *output, const idMapping& cellMap);
205 
206  int ReadFloatBlock(int n, float *block);
207  int ReadIntBlock(int n, int *block);
208  void ReadXYZCoords(vtkFloatArray *coords, idMapping& nodeMap);
209  void ReadBinaryCellTopology(vtkIntArray *material, int *types,
210  vtkIdTypeArray *listcells);
211  void ReadASCIICellTopology(vtkIntArray *material,
212  vtkUnstructuredGrid *output,
213  const idMapping& nodeMap,
214  idMapping& cellMap);
215 
216  vtkAVSucdReader(const vtkAVSucdReader&); // Not implemented.
217  void operator=(const vtkAVSucdReader&); // Not implemented.
218 };
219 
220 #endif
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Store vtkAlgorithm input/output information.
vtkDataArraySelection * PointDataArraySelection
static vtkUnstructuredGridAlgorithm * New()
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
DataInfo * NodeDataInfo
dynamic, self-adjusting array of vtkIdType
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTKIOGEOMETRY_EXPORT
ifstream * FileStream
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
a simple class to control print indentation
Definition: vtkIndent.h:38
Store on/off settings for data arrays for a vtkSource.
dataset represents arbitrary combinations of all possible cell types
void PrintSelf(ostream &os, vtkIndent indent)
vtkDataArraySelection * CellDataArraySelection
Superclass for algorithms that produce only unstructured grid as output.
Store zero or more vtkInformation instances.
DataInfo * CellDataInfo
reads a dataset in AVS "UCD" format
#define max(a, b)