VTK
vtkGenericEnSightReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGenericEnSightReader.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 =========================================================================*/
25 #ifndef __vtkGenericEnSightReader_h
26 #define __vtkGenericEnSightReader_h
27 
28 #include "vtkIOEnSightModule.h" // For export macro
30 
31 class vtkCallbackCommand;
35 
36 //BTX
37 class TranslationTableType;
38 //ETX
39 
40 //BTX
41 // Cell/Point Ids store mode:
42 // Sparse Mode is supposed to be for a large number of distributed processes (Unstructured)
43 // Non Sparse Mode is supposed to be for a small number of distributed processes (Unstructured)
44 // Implicit Mode is for Structured Data
46  {
51  };
52 //ETX
53 
55 {
56 public:
57  static vtkGenericEnSightReader *New();
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
62 
63  void SetCaseFileName(const char* fileName);
64  vtkGetStringMacro(CaseFileName);
66 
68 
69  vtkSetStringMacro(FilePath);
70  vtkGetStringMacro(FilePath);
72 
74 
75  vtkGetMacro(EnSightVersion, int);
77 
79 
80  vtkGetMacro(NumberOfVariables, int);
81  vtkGetMacro(NumberOfComplexVariables, int);
83 
85 
86  int GetNumberOfVariables(int type); // returns -1 if unknown type specified
87  vtkGetMacro(NumberOfScalarsPerNode, int);
88  vtkGetMacro(NumberOfVectorsPerNode, int);
89  vtkGetMacro(NumberOfTensorsSymmPerNode, int);
90  vtkGetMacro(NumberOfScalarsPerElement, int);
91  vtkGetMacro(NumberOfVectorsPerElement, int);
92  vtkGetMacro(NumberOfTensorsSymmPerElement, int);
93  vtkGetMacro(NumberOfScalarsPerMeasuredNode, int);
94  vtkGetMacro(NumberOfVectorsPerMeasuredNode, int);
95  vtkGetMacro(NumberOfComplexScalarsPerNode, int);
96  vtkGetMacro(NumberOfComplexVectorsPerNode, int);
97  vtkGetMacro(NumberOfComplexScalarsPerElement, int);
98  vtkGetMacro(NumberOfComplexVectorsPerElement, int);
100 
102  const char* GetDescription(int n);
103 
105  const char* GetComplexDescription(int n);
106 
115  const char* GetDescription(int n, int type);
116 
118 
119  int GetVariableType(int n);
120  int GetComplexVariableType(int n);
122 
124 
125  virtual void SetTimeValue(float value);
126  vtkGetMacro(TimeValue, float);
128 
130 
131  vtkGetMacro(MinimumTimeValue, float);
132  vtkGetMacro(MaximumTimeValue, float);
134 
136 
139 
144  int DetermineEnSightVersion(int quiet=0);
145 
147 
148  vtkBooleanMacro(ReadAllVariables, int);
149  vtkSetMacro(ReadAllVariables, int);
150  vtkGetMacro(ReadAllVariables, int);
152 
154 
156  vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
157  vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);
159 
161 
162  int GetNumberOfPointArrays();
163  int GetNumberOfCellArrays();
165 
167 
169  const char* GetPointArrayName(int index);
170  const char* GetCellArrayName(int index);
172 
174 
176  int GetPointArrayStatus(const char* name);
177  int GetCellArrayStatus(const char* name);
178  void SetPointArrayStatus(const char* name, int status);
179  void SetCellArrayStatus(const char* name, int status);
181 
182  //BTX
184  {
185  ENSIGHT_6 = 0,
186  ENSIGHT_6_BINARY = 1,
187  ENSIGHT_GOLD = 2,
188  ENSIGHT_GOLD_BINARY = 3,
189  ENSIGHT_MASTER_SERVER = 4
190  };
191  //ETX
192 
194 
197  void SetByteOrderToBigEndian();
198  void SetByteOrderToLittleEndian();
199  vtkSetMacro(ByteOrder, int);
200  vtkGetMacro(ByteOrder, int);
201  const char *GetByteOrderAsString();
203 
204 //BTX
205  enum
206  {
207  FILE_BIG_ENDIAN=0,
208  FILE_LITTLE_ENDIAN=1,
209  FILE_UNKNOWN_ENDIAN=2
210  };
211 //ETX
212 
214 
216  vtkGetStringMacro(GeometryFileName);
218 
220 
228  vtkSetMacro(ParticleCoordinatesByIndex, int);
229  vtkGetMacro(ParticleCoordinatesByIndex, int);
230  vtkBooleanMacro(ParticleCoordinatesByIndex, int);
232 
235  static int CanReadFile(const char *casefilename);
236 
237 //THIB
238 vtkGenericEnSightReader* GetReader() { return this->Reader; }
239 
240 
241 protected:
244 
246  virtual int RequestInformation(vtkInformation*,
249  virtual int RequestData(vtkInformation*,
252 
255  int ReadLine(char result[256]);
256 
259  int ReadBinaryLine(char result[80]);
260 
261  // Internal function that skips blank lines and reads the 1st
262  // non-blank line it finds (up to 256 characters).
263  // Returns 0 is there was an error.
264  int ReadNextDataLine(char result[256]);
265 
267 
268  vtkSetStringMacro(GeometryFileName);
270 
272 
273  void AddVariableDescription(const char* description);
274  void AddComplexVariableDescription(const char* description);
276 
278 
279  void AddVariableType(int variableType);
280  void AddComplexVariableType(int variableType);
282 
284 
286  int ReplaceWildcards(char* fileName, int timeSet, int fileSet);
287  void ReplaceWildcardsHelper(char* fileName, int num);
289 
290  // Callback registered with the SelectionObserver.
291  static void SelectionModifiedCallback(vtkObject* caller, unsigned long eid,
292  void* clientdata, void* calldata);
293  void SelectionModified();
294 
295  // Utility to create argument for vtkDataArraySelection::SetArrays.
296  char** CreateStringArray(int numStrings);
297  void DestroyStringArray(int numStrings, char** strings);
298 
299  // Fill the vtkDataArraySelection objects with the current set of
300  // EnSight variables.
301  void SetDataArraySelectionSetsFromVariables();
302 
303  // Fill the vtkDataArraySelection objects with the current set of
304  // arrays in the internal EnSight reader.
305  void SetDataArraySelectionSetsFromReader();
306 
307  // Fill the internal EnSight reader's vtkDataArraySelection objects
308  // from those in this object.
309  void SetReaderDataArraySelectionSetsFromSelf();
310 
311  istream* IS;
312  FILE *IFile;
314 
317  char* FilePath;
318 
319  // array of types (one entry per instance of variable type in case file)
322 
323  // pointers to lists of descriptions
326 
329 
330  // number of file names / descriptions per type
343 
344  float TimeValue;
347 
348  // Flag for whether TimeValue has been set.
350 
352  virtual void SetTimeSets(vtkDataArrayCollection*);
353 
355 
358 
359  // The EnSight file version being read. Valid after
360  // UpdateInformation. Value is -1 for unknown version.
362 
363  // The array selections. These map over the variables and complex
364  // variables to hide the details of EnSight behind VTK terminology.
367 
368  // The observer to modify this object when the array selections are
369  // modified.
371 
372  // Whether the SelectionModified callback should invoke Modified.
373  // This is used when we are copying to/from the internal reader.
375 
376  // Insert a partId and return the 'realId' that should be used.
377  int InsertNewPartId(int partId);
378 
379  // Wrapper around an stl map
380  TranslationTableType *TranslationTable;
381 
382 private:
383  vtkGenericEnSightReader(const vtkGenericEnSightReader&); // Not implemented.
384  void operator=(const vtkGenericEnSightReader&); // Not implemented.
385 };
386 
387 #endif
vtkDataArrayCollection * TimeSets
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
vtkCallbackCommand * SelectionObserver
abstract base class for most VTK objects
Definition: vtkObject.h:61
GLuint index
Definition: vtkgl.h:11983
Store vtkAlgorithm input/output information.
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
EnsightReaderCellIdMode
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:94
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
GLuint GLuint num
Definition: vtkgl.h:16907
static vtkMultiBlockDataSetAlgorithm * New()
vtkDataArraySelection * PointDataArraySelection
virtual int FillOutputPortInformation(int port, vtkInformation *info)
GLsizei const GLchar ** strings
Definition: vtkgl.h:14213
supports function callbacks
GLuint const GLchar * name
Definition: vtkgl.h:11983
a simple class to control print indentation
Definition: vtkIndent.h:38
Store on/off settings for data arrays for a vtkSource.
#define vtkGetStringMacro(name)
Definition: vtkSetGet.h:120
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
TranslationTableType * TranslationTable
vtkGenericEnSightReader * Reader
GLuint64EXT * result
Definition: vtkgl.h:18868
maintain an unordered list of dataarray objects
maintain an unordered list of dataarray objects
void PrintSelf(ostream &os, vtkIndent indent)
GLclampd n
Definition: vtkgl.h:14370
Store zero or more vtkInformation instances.
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
vtkDataArraySelection * CellDataArraySelection
#define VTKIOENSIGHT_EXPORT
class to read any type of EnSight files
vtkGenericEnSightReader * GetReader()
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69