VTK  9.2.5
vtkEnSightReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkEnSightReader.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 =========================================================================*/
20 #ifndef vtkEnSightReader_h
21 #define vtkEnSightReader_h
22 
23 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_1_0
25 #include "vtkIOEnSightModule.h" // For export macro
26 
27 class vtkDataSet;
29 class vtkEnSightReaderCellIdsType;
30 class vtkIdList;
32 
33 class VTKIOENSIGHT_EXPORT vtkEnSightReader : public vtkGenericEnSightReader
34 {
35 public:
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
40  {
41  POINT = 0,
42  BAR2 = 1,
43  BAR3 = 2,
44  NSIDED = 3,
45  TRIA3 = 4,
46  TRIA6 = 5,
47  QUAD4 = 6,
48  QUAD8 = 7,
49  NFACED = 8,
50  TETRA4 = 9,
51  TETRA10 = 10,
52  PYRAMID5 = 11,
53  PYRAMID13 = 12,
54  HEXA8 = 13,
55  HEXA20 = 14,
56  PENTA6 = 15,
57  PENTA15 = 16,
58  NUMBER_OF_ELEMENT_TYPES = 17
59  };
60 
62  {
63  SCALAR_PER_NODE = 0,
64  VECTOR_PER_NODE = 1,
65  TENSOR_SYMM_PER_NODE = 2,
66  SCALAR_PER_ELEMENT = 3,
67  VECTOR_PER_ELEMENT = 4,
68  TENSOR_SYMM_PER_ELEMENT = 5,
69  SCALAR_PER_MEASURED_NODE = 6,
70  VECTOR_PER_MEASURED_NODE = 7,
71  COMPLEX_SCALAR_PER_NODE = 8,
72  COMPLEX_VECTOR_PER_NODE = 9,
73  COMPLEX_SCALAR_PER_ELEMENT = 10,
74  COMPLEX_VECTOR_PER_ELEMENT = 11,
75  TENSOR_ASYM_PER_NODE = 12,
76  TENSOR_ASYM_PER_ELEMENT = 13
77  };
78 
80  {
81  COORDINATES = 0,
82  BLOCK = 1,
83  ELEMENT = 2
84  };
85 
87 
91  vtkGetFilePathMacro(MeasuredFileName);
93 
95 
99  vtkGetFilePathMacro(MatchFileName);
101 
102 protected:
104  ~vtkEnSightReader() override;
105 
108 
109  void ClearForNewCaseFileName() override;
110 
112 
115  vtkSetFilePathMacro(MeasuredFileName);
117 
119 
122  vtkSetFilePathMacro(MatchFileName);
124 
126 
130  int ReadCaseFileGeometry(char* line);
131  int ReadCaseFileVariable(char* line);
132  int ReadCaseFileTime(char* line);
133  int ReadCaseFileFile(char* line);
135 
136  // set in UpdateInformation to value returned from ReadCaseFile
138 
142  virtual int ReadGeometryFile(
143  const char* fileName, int timeStep, vtkMultiBlockDataSet* output) = 0;
144 
150  const char* fileName, int timeStep, vtkMultiBlockDataSet* output) = 0;
151 
156 
161  virtual int ReadScalarsPerNode(const char* fileName, const char* description, int timeStep,
162  vtkMultiBlockDataSet* output, int measured = 0, int numberOfComponents = 1,
163  int component = 0) = 0;
164 
169  virtual int ReadVectorsPerNode(const char* fileName, const char* description, int timeStep,
170  vtkMultiBlockDataSet* output, int measured = 0) = 0;
171 
177  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
178 
183  virtual int ReadTensorsPerNode(
184  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
185 
190  virtual int ReadScalarsPerElement(const char* fileName, const char* description, int timeStep,
191  vtkMultiBlockDataSet* output, int numberOfComponents = 1, int component = 0) = 0;
192 
198  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
199 
205  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
206 
212  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
213 
219  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) = 0;
220 
226  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) = 0;
227 
231  void AddVariableFileName(const char* fileName1, const char* fileName2 = nullptr);
232 
237 
242 
247  int GetElementType(const char* line);
248 
253  int GetSectionType(const char* line);
254 
258  VTK_DEPRECATED_IN_9_1_0("Use vtkGenericEnSightReader::ReplaceWildcardsHelper instead.")
259  void ReplaceWildcards(char* filename, int num);
260 
261  // Remove when removing the deprecated method above.
262  using vtkGenericEnSightReader::ReplaceWildcards;
263 
267  void RemoveLeadingBlanks(char* line);
268 
269  // Get the vtkIdList for the given output index and cell type.
270  vtkIdList* GetCellIds(int index, int cellType);
271 
276  void AddToBlock(vtkMultiBlockDataSet* output, unsigned int blockNo, vtkDataSet* dataset);
277 
282  vtkDataSet* GetDataSetFromBlock(vtkMultiBlockDataSet* output, unsigned int blockNo);
283 
287  void SetBlockName(vtkMultiBlockDataSet* output, unsigned int blockNo, const char* name);
288 
289  char* MeasuredFileName;
290  char* MatchFileName; // may not actually be necessary to read this file
291 
292  // pointer to lists of vtkIdLists (cell ids per element type per part)
293  vtkEnSightReaderCellIdsType* CellIds;
294 
295  // part ids of unstructured outputs
296  vtkIdList* UnstructuredPartIds;
297 
298  int VariableMode;
299 
300  // pointers to lists of filenames
301  char** VariableFileNames; // non-complex
302  char** ComplexVariableFileNames;
303 
304  // array of time sets
305  vtkIdList* VariableTimeSetIds;
306  vtkIdList* ComplexVariableTimeSetIds;
307 
308  // array of file sets
309  vtkIdList* VariableFileSetIds;
310  vtkIdList* ComplexVariableFileSetIds;
311 
312  // collection of filename numbers per time set
313  vtkIdListCollection* TimeSetFileNameNumbers;
314  vtkIdList* TimeSetsWithFilenameNumbers;
315 
316  // collection of filename numbers per file set
317  vtkIdListCollection* FileSetFileNameNumbers;
318  vtkIdList* FileSetsWithFilenameNumbers;
319 
320  // collection of number of steps per file per file set
321  vtkIdListCollection* FileSetNumberOfSteps;
322 
323  // ids of the time and file sets
324  vtkIdList* TimeSetIds;
325  vtkIdList* FileSets;
326 
327  int GeometryTimeSet;
328  int GeometryFileSet;
329  int MeasuredTimeSet;
330  int MeasuredFileSet;
331 
332  float GeometryTimeValue;
333  float MeasuredTimeValue;
334 
335  vtkTypeBool UseTimeSets;
336  vtkSetMacro(UseTimeSets, vtkTypeBool);
337  vtkGetMacro(UseTimeSets, vtkTypeBool);
338  vtkBooleanMacro(UseTimeSets, vtkTypeBool);
339 
340  vtkTypeBool UseFileSets;
341  vtkSetMacro(UseFileSets, vtkTypeBool);
342  vtkGetMacro(UseFileSets, vtkTypeBool);
343  vtkBooleanMacro(UseFileSets, vtkTypeBool);
344 
345  int NumberOfGeometryParts;
346 
347  // global list of points for measured geometry
348  int NumberOfMeasuredPoints;
349 
350  int NumberOfNewOutputs;
351  int InitialRead;
352 
353  int CheckOutputConsistency();
354 
355  double ActualTimeValue;
356 
357 private:
358  vtkEnSightReader(const vtkEnSightReader&) = delete;
359  void operator=(const vtkEnSightReader&) = delete;
360 };
361 
362 #endif
maintain an unordered list of dataset objects
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
superclass for EnSight file readers
int GetSectionType(const char *line)
Determine the section type from a line read a file.
virtual int ReadTensorsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output)=0
Read tensors per element for this dataset.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
virtual int ReadVectorsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output)=0
Read vectors per element for this dataset.
int GetElementType(const char *line)
Determine the element type from a line read a file.
virtual int CreateUnstructuredGridOutput(int partId, char line[80], const char *name, vtkMultiBlockDataSet *output)=0
Read an unstructured part (partId) from the geometry file and create a vtkUnstructuredGrid output.
virtual int ReadVectorsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output, int measured=0)=0
Read vectors per node for this dataset.
vtkGetFilePathMacro(MeasuredFileName)
Get the Measured file name.
void AddVariableType()
Record the variable type for the variable line just read.
void AddVariableDescription(const char *description)
Add another description to the list for a particular variable type.
int ReadCaseFileTime(char *line)
Read the case file.
virtual int ReadAsymmetricTensorsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output)=0
Read asymmetric tensors per node for this dataset.
virtual int ReadAsymmetricTensorsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output)=0
Read asymmetric tensors per element for this dataset.
virtual int ReadScalarsPerElement(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output, int numberOfComponents=1, int component=0)=0
Read scalars per element for this dataset.
int ReadCaseFileVariable(char *line)
Read the case file.
virtual int CreateStructuredGridOutput(int partId, char line[80], const char *name, vtkMultiBlockDataSet *output)=0
Read a structured part from the geometry file and create a vtkStructuredGridOutput.
vtkGetFilePathMacro(MatchFileName)
Get the Match file name.
virtual int ReadMeasuredGeometryFile(const char *fileName, int timeStep, vtkMultiBlockDataSet *output)=0
Read the measured geometry file.
int ReadCaseFile()
Read the case file.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSetFilePathMacro(MeasuredFileName)
Set the Measured file name.
~vtkEnSightReader() override
virtual int ReadScalarsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output, int measured=0, int numberOfComponents=1, int component=0)=0
Read scalars per node for this dataset.
int ReadCaseFileFile(char *line)
Read the case file.
void ClearForNewCaseFileName() override
Clear data structures such that setting a new case file name works.
int ReadVariableFiles(vtkMultiBlockDataSet *output)
Read the variable files.
int ReadCaseFileGeometry(char *line)
Read the case file.
vtkSetFilePathMacro(MatchFileName)
Set the Match file name.
virtual int ReadGeometryFile(const char *fileName, int timeStep, vtkMultiBlockDataSet *output)=0
Read the geometry file.
virtual int ReadTensorsPerNode(const char *fileName, const char *description, int timeStep, vtkMultiBlockDataSet *output)=0
Read tensors per node for this dataset.
void AddVariableFileName(const char *fileName1, const char *fileName2=nullptr)
Add another file name to the list for a particular variable type.
class to read any type of EnSight files
maintain an ordered list of IdList objects
list of point or cell ids
Definition: vtkIdList.h:143
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Composite dataset that organizes datasets into blocks.
@ component
Definition: vtkX3D.h:181
@ description
Definition: vtkX3D.h:328
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DEPRECATED_IN_9_1_0(reason)