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 
45 class vtkIntArray;
46 class vtkFloatArray;
47 class vtkIdTypeArray;
49 
50 class VTKIOGEOMETRY_EXPORT vtkAVSucdReader : public vtkUnstructuredGridAlgorithm
51 {
52 public:
53  static vtkAVSucdReader* New();
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
61  vtkSetFilePathMacro(FileName);
62  vtkGetFilePathMacro(FileName);
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 
122  void SetByteOrderToBigEndian();
123  void SetByteOrderToLittleEndian();
124  const char* GetByteOrderAsString();
126 
127  vtkSetMacro(ByteOrder, int);
128  vtkGetMacro(ByteOrder, int);
129 
131 
136  int GetNumberOfPointArrays();
137  int GetNumberOfCellArrays();
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 
146  void DisableAllCellArrays();
147  void EnableAllCellArrays();
148  void DisableAllPointArrays();
149  void EnableAllPointArrays();
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 
159 protected:
160  vtkAVSucdReader();
161  ~vtkAVSucdReader() override;
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 
213 private:
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
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
Store vtkAlgorithm input/output information.
vtkDataArraySelection * PointDataArraySelection
static vtkUnstructuredGridAlgorithm * New()
vtkTypeBool BinaryFile
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
DataInfo * NodeDataInfo
dynamic, self-adjusting array of vtkIdType
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int vtkTypeBool
Definition: vtkABI.h:69
istream * FileStream
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
Store on/off settings for data arrays, etc.
dataset represents arbitrary combinations of all possible cell types
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)