1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkEnSightGoldBinaryReader.h,v $
6 Date: $Date: 2002/08/13 17:14:28 $
7 Version: $Revision: 1.11 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 =========================================================================*/
18 // .NAME vtkEnSightGoldBinaryReader - class to read binary EnSight Gold files
19 // .SECTION Description
20 // vtkEnSightGoldBinaryReader is a class to read EnSight Gold files into vtk.
21 // Because the different parts of the EnSight data can be of various data
22 // types, this reader produces multiple outputs, one per part in the input
24 // All variable information is being stored in field data. The descriptions
25 // listed in the case file are used as the array names in the field data.
26 // For complex vector variables, the description is appended with _r (for the
27 // array of real values) and _i (for the array if imaginary values). Complex
28 // scalar variables are stored as a single array with 2 components, real and
29 // imaginary, listed in that order.
31 // You must manually call Update on this reader and then connect the rest
32 // of the pipeline because (due to the nature of the file format) it is
33 // not possible to know ahead of time how many outputs you will have or
34 // what types they will be.
35 // This reader can only handle static EnSight datasets (both static geometry
38 #ifndef __vtkEnSightGoldBinaryReader_h
39 #define __vtkEnSightGoldBinaryReader_h
41 #include "vtkEnSightReader.h"
43 class VTK_IO_EXPORT vtkEnSightGoldBinaryReader : public vtkEnSightReader
46 static vtkEnSightGoldBinaryReader *New();
47 vtkTypeRevisionMacro(vtkEnSightGoldBinaryReader, vtkEnSightReader);
48 virtual void PrintSelf(ostream& os, vtkIndent indent);
51 vtkEnSightGoldBinaryReader();
52 ~vtkEnSightGoldBinaryReader();
55 // Read the geometry file. If an error occurred, 0 is returned; otherwise 1.
56 virtual int ReadGeometryFile(char* fileName, int timeStep);
59 // Read the measured geometry file. If an error occurred, 0 is returned;
61 virtual int ReadMeasuredGeometryFile(char* fileName, int timeStep);
64 // Read scalars per node for this dataset. If an error occurred, 0 is
65 // returned; otherwise 1. If there will be more than one component in
66 // the data array, it is assumed that 0 is the first component added.
67 virtual int ReadScalarsPerNode(char* fileName, char* description,
68 int timeStep, int measured = 0,
69 int numberOfComponents = 1,
73 // Read vectors per node for this dataset. If an error occurred, 0 is
74 // returned; otherwise 1.
75 virtual int ReadVectorsPerNode(char* fileName, char* description,
76 int timeStep, int measured = 0);
79 // Read tensors per node for this dataset. If an error occurred, 0 is
80 // returned; otherwise 1.
81 virtual int ReadTensorsPerNode(char* fileName, char* description,
85 // Read scalars per element for this dataset. If an error occurred, 0 is
86 // returned; otherwise 1. If there will be more than one componenet in the
87 // data array, it is assumed that 0 is the first component added.
88 virtual int ReadScalarsPerElement(char* fileName, char* description,
89 int timeStep, int numberOfComponents = 1,
93 // Read vectors per element for this dataset. If an error occurred, 0 is
94 // returned; otherwise 1.
95 virtual int ReadVectorsPerElement(char* fileName, char* description,
99 // Read tensors per element for this dataset. If an error occurred, 0 is
100 // returned; otherwise 1.
101 virtual int ReadTensorsPerElement(char* fileName, char* description,
105 // Read an unstructured part (partId) from the geometry file and create a
106 // vtkUnstructuredGrid output. Return 0 if EOF reached. Return -1 if
107 // an error occurred.
108 virtual int CreateUnstructuredGridOutput(int partId, char line[80]);
111 // Read a structured part from the geometry file and create a
112 // vtkStructuredGrid output. Return 0 if EOF reached.
113 virtual int CreateStructuredGridOutput(int partId, char line[256]);
116 // Read a structured part from the geometry file and create a
117 // vtkRectilinearGrid output. Return 0 if EOF reached.
118 int CreateRectilinearGridOutput(int partId, char line[256]);
121 // Read a structured part from the geometry file and create a
122 // vtkImageData output. Return 0 if EOF reached.
123 int CreateImageDataOutput(int partId, char line[80]);
126 // Internal function to read in a line up to 80 characters.
127 // Returns zero if there was an error.
128 int ReadLine(char result[80]);
131 // Internal function to read in a single integer.
132 // Returns zero if there was an error.
133 int ReadInt(int *result);
136 // Internal function to read in an integer array.
137 // Returns zero if there was an error.
138 int ReadIntArray(int *result, int numInts);
141 // Internal function to read in a float array.
142 // Returns zero if there was an error.
143 int ReadFloatArray(float *result, int numFloats);
146 // Read to the next time step in the geometry file.
148 int SkipStructuredGrid(char line[256]);
149 int SkipUnstructuredGrid(char line[256]);
150 int SkipRectilinearGrid(char line[256]);
151 int SkipImageData(char line[256]);
154 int ElementIdsListed;
158 vtkEnSightGoldBinaryReader(const vtkEnSightGoldBinaryReader&); // Not implemented.
159 void operator=(const vtkEnSightGoldBinaryReader&); // Not implemented.