VTK  9.2.6
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 
129  int ReadCaseFile();
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 
149  virtual int ReadMeasuredGeometryFile(
150  const char* fileName, int timeStep, vtkMultiBlockDataSet* output) = 0;
151 
155  int ReadVariableFiles(vtkMultiBlockDataSet* output);
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 
176  virtual int ReadAsymmetricTensorsPerNode(
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 
197  virtual int ReadVectorsPerElement(
198  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
199 
204  virtual int ReadAsymmetricTensorsPerElement(
205  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
206 
211  virtual int ReadTensorsPerElement(
212  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
213 
218  virtual int CreateUnstructuredGridOutput(
219  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) = 0;
220 
225  virtual int CreateStructuredGridOutput(
226  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) = 0;
227 
231  void AddVariableFileName(const char* fileName1, const char* fileName2 = nullptr);
232 
236  void AddVariableDescription(const char* description);
237 
241  void AddVariableType();
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
void AddVariableDescription(const char *description)
Add a variable description to the appropriate array.
#define VTK_DEPRECATED_IN_9_1_0(reason)
maintain an unordered list of dataset objects
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void AddVariableType(int variableType)
Add a variable type to the appropriate array.
int vtkTypeBool
Definition: vtkABI.h:69
a simple class to control print indentation
Definition: vtkIndent.h:39
list of point or cell ids
Definition: vtkIdList.h:33
superclass for EnSight file readers
vtkGetFilePathMacro(CaseFileName)
Set/Get the Case file name.
virtual void ClearForNewCaseFileName()
Clear data structures such that setting a new case file name works.
maintain an ordered list of IdList objects
Composite dataset that organizes datasets into blocks.
Store zero or more vtkInformation instances.
class to read any type of EnSight files
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSetFilePathMacro(FilePath)
Set/Get the file path.