vtkEnSight6Reader.h 5.87 KB
Newer Older
1 2 3 4 5
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkEnSight6Reader.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 23 24 25 26 27 28 29 30 31 32 33 34 35 36
/**
 * @class   vtkEnSight6Reader
 * @brief   class to read EnSight6 files
 *
 * vtkEnSight6Reader is a class to read EnSight6 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.
 * 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.
 * @warning
 * 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).
*/
37

38 39
#ifndef vtkEnSight6Reader_h
#define vtkEnSight6Reader_h
40

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

44
class vtkMultiBlockDataSet;
45
class vtkIdTypeArray;
Andy Cedilnik's avatar
Andy Cedilnik committed
46
class vtkPoints;
47

48
class VTKIOENSIGHT_EXPORT vtkEnSight6Reader : public vtkEnSightReader
49 50 51
{
public:
  static vtkEnSight6Reader *New();
52
  vtkTypeMacro(vtkEnSight6Reader, vtkEnSightReader);
53
  void PrintSelf(ostream& os, vtkIndent indent) override;
54

55 56
protected:
  vtkEnSight6Reader();
57
  ~vtkEnSight6Reader() override;
58

59 60 61
  /**
   * Read the geometry file.  If an error occurred, 0 is returned; otherwise 1.
   */
62
  int ReadGeometryFile(const char* fileName, int timeStep,
63
                               vtkMultiBlockDataSet *output) override;
64

65 66 67 68
  /**
   * Read the measured geometry file.  If an error occurred, 0 is returned;
   * otherwise 1.
   */
69
  int ReadMeasuredGeometryFile(const char* fileName, int timeStep,
70
                                       vtkMultiBlockDataSet *output) override;
71

72 73 74 75 76
  /**
   * Read scalars per node for this dataset.  If an error occurred, 0 is
   * returned; otherwise 1.  If there will be more than one component in
   * the scalars array, we assume that 0 is the first component added to the array.
   */
77
  int ReadScalarsPerNode(const char* fileName, const char* description,
78
                                 int timeStep, vtkMultiBlockDataSet *output,
79
                                 int measured = 0,
80
                                 int numberOfComponents = 1,
81
                                 int component = 0) override;
82

83 84 85 86
  /**
   * Read vectors per node for this dataset.  If an error occurred, 0 is
   * returned; otherwise 1.
   */
87
  int ReadVectorsPerNode(const char* fileName, const char* description,
88
                                 int timeStep, vtkMultiBlockDataSet *output,
89
                                 int measured = 0) override;
90

91 92 93 94
  /**
   * Read tensors per node for this dataset.  If an error occurred, 0 is
   * returned; otherwise 1.
   */
95
  int ReadTensorsPerNode(const char* fileName, const char* description,
96
                                 int timeStep, vtkMultiBlockDataSet *output) override;
97

98 99 100 101 102
  /**
   * Read scalars per element for this dataset.  If an error occurred, 0 is
   * returned; otherwise 1.  If there will be more than one component in the
   * scalars array, we assume that 0 is the first component added to the array.
   */
103
  int ReadScalarsPerElement(const char* fileName, const char* description,
104
                                    int timeStep, vtkMultiBlockDataSet *output,
105
                                    int numberOfComponents = 1,
106
                                    int component = 0) override;
107

108 109 110 111
  /**
   * Read vectors per element for this dataset.  If an error occurred, 0 is
   * returned; otherwise 1.
   */
112
  int ReadVectorsPerElement(const char* fileName, const char* description,
113
                                    int timeStep, vtkMultiBlockDataSet *output) override;
114

115 116 117 118
  /**
   * Read tensors per element for this dataset.  If an error occurred, 0 is
   * returned; otherwise 1.
   */
119
  int ReadTensorsPerElement(const char* fileName, const char* description,
120
                                    int timeStep, vtkMultiBlockDataSet *output) override;
121

122 123 124 125
  /**
   * Read an unstructured part (partId) from the geometry file and create a
   * vtkUnstructuredGrid output.  Return 0 if EOF reached.
   */
126
  int CreateUnstructuredGridOutput(int partId,
127
                                           char line[256],
128
                                           const char* name,
129
                                           vtkMultiBlockDataSet *output) override;
130

131 132 133 134
  /**
   * Read a structured part from the geometry file and create a
   * vtkStructuredGridOutput.  Return 0 if EOF reached.
   */
135
  int CreateStructuredGridOutput(int partId,
136
                                         char line[256],
137
                                         const char* name,
138
                                         vtkMultiBlockDataSet *output) override;
139

140 141 142
  // global list of points for the unstructured parts of the model
  int NumberOfUnstructuredPoints;
  vtkPoints* UnstructuredPoints;
143
  vtkIdTypeArray* UnstructuredNodeIds; // matching of node ids to point ids
144
private:
145 146
  vtkEnSight6Reader(const vtkEnSight6Reader&) = delete;
  void operator=(const vtkEnSight6Reader&) = delete;
147 148 149
};

#endif