VTK  9.1.0
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 
24 #include "vtkIOEnSightModule.h" // For export macro
25 
26 class vtkDataSet;
28 class vtkEnSightReaderCellIdsType;
29 class vtkIdList;
31 
32 class VTKIOENSIGHT_EXPORT vtkEnSightReader : public vtkGenericEnSightReader
33 {
34 public:
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
39  {
40  POINT = 0,
41  BAR2 = 1,
42  BAR3 = 2,
43  NSIDED = 3,
44  TRIA3 = 4,
45  TRIA6 = 5,
46  QUAD4 = 6,
47  QUAD8 = 7,
48  NFACED = 8,
49  TETRA4 = 9,
50  TETRA10 = 10,
51  PYRAMID5 = 11,
52  PYRAMID13 = 12,
53  HEXA8 = 13,
54  HEXA20 = 14,
55  PENTA6 = 15,
56  PENTA15 = 16,
57  NUMBER_OF_ELEMENT_TYPES = 17
58  };
59 
61  {
62  SCALAR_PER_NODE = 0,
63  VECTOR_PER_NODE = 1,
64  TENSOR_SYMM_PER_NODE = 2,
65  SCALAR_PER_ELEMENT = 3,
66  VECTOR_PER_ELEMENT = 4,
67  TENSOR_SYMM_PER_ELEMENT = 5,
68  SCALAR_PER_MEASURED_NODE = 6,
69  VECTOR_PER_MEASURED_NODE = 7,
70  COMPLEX_SCALAR_PER_NODE = 8,
71  COMPLEX_VECTOR_PER_NODE = 9,
72  COMPLEX_SCALAR_PER_ELEMENT = 10,
73  COMPLEX_VECTOR_PER_ELEMENT = 11,
74  TENSOR_ASYM_PER_NODE = 12,
75  TENSOR_ASYM_PER_ELEMENT = 13
76  };
77 
79  {
80  COORDINATES = 0,
81  BLOCK = 1,
82  ELEMENT = 2
83  };
84 
86 
90  vtkGetFilePathMacro(MeasuredFileName);
92 
94 
98  vtkGetFilePathMacro(MatchFileName);
100 
101 protected:
103  ~vtkEnSightReader() override;
104 
107 
108  void ClearForNewCaseFileName() override;
109 
111 
114  vtkSetFilePathMacro(MeasuredFileName);
116 
118 
121  vtkSetFilePathMacro(MatchFileName);
123 
125 
129  int ReadCaseFileGeometry(char* line);
130  int ReadCaseFileVariable(char* line);
131  int ReadCaseFileTime(char* line);
132  int ReadCaseFileFile(char* line);
134 
135  // set in UpdateInformation to value returned from ReadCaseFile
137 
141  virtual int ReadGeometryFile(
142  const char* fileName, int timeStep, vtkMultiBlockDataSet* output) = 0;
143 
149  const char* fileName, int timeStep, vtkMultiBlockDataSet* output) = 0;
150 
155 
160  virtual int ReadScalarsPerNode(const char* fileName, const char* description, int timeStep,
161  vtkMultiBlockDataSet* output, int measured = 0, int numberOfComponents = 1,
162  int component = 0) = 0;
163 
168  virtual int ReadVectorsPerNode(const char* fileName, const char* description, int timeStep,
169  vtkMultiBlockDataSet* output, int measured = 0) = 0;
170 
176  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
177 
182  virtual int ReadTensorsPerNode(
183  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
184 
189  virtual int ReadScalarsPerElement(const char* fileName, const char* description, int timeStep,
190  vtkMultiBlockDataSet* output, int numberOfComponents = 1, int component = 0) = 0;
191 
197  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
198 
204  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
205 
211  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
212 
218  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) = 0;
219 
225  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) = 0;
226 
230  void AddVariableFileName(const char* fileName1, const char* fileName2 = nullptr);
231 
236 
241 
246  int GetElementType(const char* line);
247 
252  int GetSectionType(const char* line);
253 
257  VTK_DEPRECATED_IN_9_1_0("Use vtkGenericEnSightReader::ReplaceWildcardsHelper instead.")
258  void ReplaceWildcards(char* filename, int num);
259 
260  // Remove when removing the deprecated method above.
261  using vtkGenericEnSightReader::ReplaceWildcards;
262 
266  void RemoveLeadingBlanks(char* line);
267 
268  // Get the vtkIdList for the given output index and cell type.
269  vtkIdList* GetCellIds(int index, int cellType);
270 
275  void AddToBlock(vtkMultiBlockDataSet* output, unsigned int blockNo, vtkDataSet* dataset);
276 
281  vtkDataSet* GetDataSetFromBlock(vtkMultiBlockDataSet* output, unsigned int blockNo);
282 
286  void SetBlockName(vtkMultiBlockDataSet* output, unsigned int blockNo, const char* name);
287 
288  char* MeasuredFileName;
289  char* MatchFileName; // may not actually be necessary to read this file
290 
291  // pointer to lists of vtkIdLists (cell ids per element type per part)
292  vtkEnSightReaderCellIdsType* CellIds;
293 
294  // part ids of unstructured outputs
295  vtkIdList* UnstructuredPartIds;
296 
297  int VariableMode;
298 
299  // pointers to lists of filenames
300  char** VariableFileNames; // non-complex
301  char** ComplexVariableFileNames;
302 
303  // array of time sets
304  vtkIdList* VariableTimeSetIds;
305  vtkIdList* ComplexVariableTimeSetIds;
306 
307  // array of file sets
308  vtkIdList* VariableFileSetIds;
309  vtkIdList* ComplexVariableFileSetIds;
310 
311  // collection of filename numbers per time set
312  vtkIdListCollection* TimeSetFileNameNumbers;
313  vtkIdList* TimeSetsWithFilenameNumbers;
314 
315  // collection of filename numbers per file set
316  vtkIdListCollection* FileSetFileNameNumbers;
317  vtkIdList* FileSetsWithFilenameNumbers;
318 
319  // collection of number of steps per file per file set
320  vtkIdListCollection* FileSetNumberOfSteps;
321 
322  // ids of the time and file sets
323  vtkIdList* TimeSetIds;
324  vtkIdList* FileSets;
325 
326  int GeometryTimeSet;
327  int GeometryFileSet;
328  int MeasuredTimeSet;
329  int MeasuredFileSet;
330 
331  float GeometryTimeValue;
332  float MeasuredTimeValue;
333 
334  vtkTypeBool UseTimeSets;
335  vtkSetMacro(UseTimeSets, vtkTypeBool);
336  vtkGetMacro(UseTimeSets, vtkTypeBool);
337  vtkBooleanMacro(UseTimeSets, vtkTypeBool);
338 
339  vtkTypeBool UseFileSets;
340  vtkSetMacro(UseFileSets, vtkTypeBool);
341  vtkGetMacro(UseFileSets, vtkTypeBool);
342  vtkBooleanMacro(UseFileSets, vtkTypeBool);
343 
344  int NumberOfGeometryParts;
345 
346  // global list of points for measured geometry
347  int NumberOfMeasuredPoints;
348 
349  int NumberOfNewOutputs;
350  int InitialRead;
351 
352  int CheckOutputConsistency();
353 
354  double ActualTimeValue;
355 
356 private:
357  vtkEnSightReader(const vtkEnSightReader&) = delete;
358  void operator=(const vtkEnSightReader&) = delete;
359 };
360 
361 #endif
maintain an unordered list of dataset objects
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
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:31
a simple class to control print indentation
Definition: vtkIndent.h:34
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)