OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / include / vtk / vtkEnSightGoldBinaryReader.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkEnSightGoldBinaryReader.h,v $
5   Language:  C++
6   Date:      $Date: 2002/08/13 17:14:28 $
7   Version:   $Revision: 1.11 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
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.
16
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
23 // file.
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.
30 // .SECTION Caveats
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
36 // and variables).
37
38 #ifndef __vtkEnSightGoldBinaryReader_h
39 #define __vtkEnSightGoldBinaryReader_h
40
41 #include "vtkEnSightReader.h"
42
43 class VTK_IO_EXPORT vtkEnSightGoldBinaryReader : public vtkEnSightReader
44 {
45 public:
46   static vtkEnSightGoldBinaryReader *New();
47   vtkTypeRevisionMacro(vtkEnSightGoldBinaryReader, vtkEnSightReader);
48   virtual void PrintSelf(ostream& os, vtkIndent indent);
49  
50 protected:
51   vtkEnSightGoldBinaryReader();
52   ~vtkEnSightGoldBinaryReader();
53   
54   // Description:
55   // Read the geometry file.  If an error occurred, 0 is returned; otherwise 1.
56   virtual int ReadGeometryFile(char* fileName, int timeStep);
57
58   // Description:
59   // Read the measured geometry file.  If an error occurred, 0 is returned;
60   // otherwise 1.
61   virtual int ReadMeasuredGeometryFile(char* fileName, int timeStep);
62
63   // Description:
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,
70                                  int component = 0);
71   
72   // Description:
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);
77
78   // Description:
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,
82                                  int timeStep);
83
84   // 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,
90                                     int component = 0);
91
92   // Description:
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,
96                                     int timeStep);
97
98   // 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,
102                                     int timeStep);
103
104   // 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]);
109   
110   // Description:
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]);
114   
115   // Description:
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]);
119   
120   // Description:
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]);
124   
125   // Description:
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]);
129
130   // Description:
131   // Internal function to read in a single integer.
132   // Returns zero if there was an error.
133   int ReadInt(int *result);
134
135   // Description:
136   // Internal function to read in an integer array.
137   // Returns zero if there was an error.
138   int ReadIntArray(int *result, int numInts);
139
140   // Description:
141   // Internal function to read in a float array.
142   // Returns zero if there was an error.
143   int ReadFloatArray(float *result, int numFloats);
144
145   // Description:
146   // Read to the next time step in the geometry file.
147   void SkipTimeStep();
148   int SkipStructuredGrid(char line[256]);
149   int SkipUnstructuredGrid(char line[256]);
150   int SkipRectilinearGrid(char line[256]);
151   int SkipImageData(char line[256]);
152   
153   int NodeIdsListed;
154   int ElementIdsListed;
155   
156   FILE *IFile;
157 private:
158   vtkEnSightGoldBinaryReader(const vtkEnSightGoldBinaryReader&);  // Not implemented.
159   void operator=(const vtkEnSightGoldBinaryReader&);  // Not implemented.
160 };
161
162 #endif