vtkEnSightGoldReader.h 6.52 KB
Newer Older
1 2 3 4 5
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkEnSightGoldReader.h

6
  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 8
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9

10 11
     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
     PURPOSE.  See the above copyright notice for more information.
13 14 15 16 17 18 19 20 21 22

=========================================================================*/
// .NAME vtkEnSightGoldReader - class to read EnSight Gold files
// .SECTION Description
// vtkEnSightGoldReader is a class to read EnSight Gold files into vtk.
// Because the different parts of the EnSight data can be of various data
// types, this reader produces multiple outputs, one per part in the input
// file.
// All variable information is being stored in field data.  The descriptions
// listed in the case file are used as the array names in the field data.
23 24 25 26
// For complex vector variables, the description is appended with _r (for the
// array of real values) and _i (for the array if imaginary values).  Complex
// scalar variables are stored as a single array with 2 components, real and
// imaginary, listed in that order.
27 28 29 30 31 32 33
// .SECTION Caveats
// You must manually call Update on this reader and then connect the rest
// of the pipeline because (due to the nature of the file format) it is
// not possible to know ahead of time how many outputs you will have or
// what types they will be.
// This reader can only handle static EnSight datasets (both static geometry
// and variables).
34 35
// .SECTION Thanks
// Thanks to Yvan Fournier for providing the code to support nfaced elements.
36

37 38
#ifndef vtkEnSightGoldReader_h
#define vtkEnSightGoldReader_h
39

40
#include "vtkIOEnSightModule.h" // For export macro
41
#include "vtkEnSightReader.h"
42

Mathieu Malaterre's avatar
ENH:  
Mathieu Malaterre committed
43

44
class vtkMultiBlockDataSet;
45

46
class VTKIOENSIGHT_EXPORT vtkEnSightGoldReader : public vtkEnSightReader
47 48 49
{
public:
  static vtkEnSightGoldReader *New();
50
  vtkTypeMacro(vtkEnSightGoldReader, vtkEnSightReader);
51
  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
52

53
protected:
Mathieu Malaterre's avatar
ENH:  
Mathieu Malaterre committed
54 55
  vtkEnSightGoldReader();
  ~vtkEnSightGoldReader();
56

57 58
  // Description:
  // Read the geometry file.  If an error occurred, 0 is returned; otherwise 1.
59
  virtual int ReadGeometryFile(const char* fileName, int timeStep,
60
    vtkMultiBlockDataSet *output);
61

62 63 64
  // Description:
  // Read the measured geometry file.  If an error occurred, 0 is returned;
  // otherwise 1.
65
  virtual int ReadMeasuredGeometryFile(const char* fileName, int timeStep,
66
    vtkMultiBlockDataSet *output);
67

68 69
  // Description:
  // Read scalars per node for this dataset.  If an error occurred, 0 is
70 71
  // returned; otherwise 1.  If there will be more than one component in
  // the data array, it is assumed that 0 is the first component added.
Mathieu Malaterre's avatar
ENH:  
Mathieu Malaterre committed
72
  virtual int ReadScalarsPerNode(const char* fileName, const char* description,
73 74 75 76 77
    int timeStep, vtkMultiBlockDataSet *output,
    int measured = 0,
    int numberOfComponents = 1,
    int component = 0);

78 79 80
  // Description:
  // Read vectors per node for this dataset.  If an error occurred, 0 is
  // returned; otherwise 1.
Mathieu Malaterre's avatar
ENH:  
Mathieu Malaterre committed
81
  virtual int ReadVectorsPerNode(const char* fileName, const char* description,
82 83
    int timeStep, vtkMultiBlockDataSet *output,
    int measured = 0);
84 85 86 87

  // Description:
  // Read tensors per node for this dataset.  If an error occurred, 0 is
  // returned; otherwise 1.
Mathieu Malaterre's avatar
ENH:  
Mathieu Malaterre committed
88
  virtual int ReadTensorsPerNode(const char* fileName, const char* description,
89
    int timeStep, vtkMultiBlockDataSet *output);
90 91 92

  // Description:
  // Read scalars per element for this dataset.  If an error occurred, 0 is
93 94
  // returned; otherwise 1.  If there will be more than one componenet in the
  // data array, it is assumed that 0 is the first component added.
Mathieu Malaterre's avatar
ENH:  
Mathieu Malaterre committed
95
  virtual int ReadScalarsPerElement(const char* fileName, const char* description,
96 97 98
    int timeStep, vtkMultiBlockDataSet *output,
    int numberOfComponents = 1,
    int component = 0);
99 100 101 102

  // Description:
  // Read vectors per element for this dataset.  If an error occurred, 0 is
  // returned; otherwise 1.
Mathieu Malaterre's avatar
ENH:  
Mathieu Malaterre committed
103
  virtual int ReadVectorsPerElement(const char* fileName, const char* description,
104
    int timeStep, vtkMultiBlockDataSet *output);
105 106 107 108

  // Description:
  // Read tensors per element for this dataset.  If an error occurred, 0 is
  // returned; otherwise 1.
Mathieu Malaterre's avatar
ENH:  
Mathieu Malaterre committed
109
  virtual int ReadTensorsPerElement(const char* fileName, const char* description,
110
    int timeStep, vtkMultiBlockDataSet *output);
111 112 113

  // Description:
  // Read an unstructured part (partId) from the geometry file and create a
114 115
  // vtkUnstructuredGrid output.  Return 0 if EOF reached. Return -1 if
  // an error occurred.
116 117 118 119 120
  virtual int CreateUnstructuredGridOutput(int partId,
    char line[256],
    const char* name,
    vtkMultiBlockDataSet *output);

121 122
  // Description:
  // Read a structured part from the geometry file and create a
123
  // vtkStructuredGrid output.  Return 0 if EOF reached.
124 125 126 127 128
  virtual int CreateStructuredGridOutput(int partId,
    char line[256],
    const char* name,
    vtkMultiBlockDataSet *output);

129 130
  // Description:
  // Read a structured part from the geometry file and create a
131
  // vtkRectilinearGrid output.  Return 0 if EOF reached.
132
  int CreateRectilinearGridOutput(int partId, char line[256], const char* name,
133 134
    vtkMultiBlockDataSet *output);

135 136
  // Description:
  // Read a structured part from the geometry file and create a
137
  // vtkImageData output.  Return 0 if EOF reached.
138
  int CreateImageDataOutput(int partId, char line[256], const char* name,
139 140
    vtkMultiBlockDataSet *output);

141 142 143 144 145 146 147 148 149 150 151 152 153 154
  // Description:
  // Set/Get the Model file name.
  vtkSetStringMacro(GeometryFileName);
  vtkGetStringMacro(GeometryFileName);

  // Description:
  // Set/Get the Measured file name.
  vtkSetStringMacro(MeasuredFileName);
  vtkGetStringMacro(MeasuredFileName);

  // Description:
  // Set/Get the Match file name.
  vtkSetStringMacro(MatchFileName);
  vtkGetStringMacro(MatchFileName);
Mathieu Malaterre's avatar
ENH:  
Mathieu Malaterre committed
155 156

  // Description:
157
  // Skip next line in file if the 'undef' or 'partial' keyword was
Mathieu Malaterre's avatar
ENH:  
Mathieu Malaterre committed
158 159 160
  // specified after a sectional keyword
  int CheckForUndefOrPartial(const char *line);

161 162 163 164
  int NodeIdsListed;
  int ElementIdsListed;

  class UndefPartialInternal;
Mathieu Malaterre's avatar
ENH:  
Mathieu Malaterre committed
165 166 167 168
  // Description:
  // Handle the undef / partial support for EnSight gold
  UndefPartialInternal* UndefPartial;

169 170
  class FileOffsetMapInternal;
  FileOffsetMapInternal *FileOffsets;
171

172
private:
173
  vtkEnSightGoldReader(const vtkEnSightGoldReader&) VTK_DELETE_FUNCTION;
174
  void operator=(const vtkEnSightGoldReader&) VTK_DELETE_FUNCTION;
175 176 177
};

#endif