VTK  9.0.1
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  };
75 
77  {
78  COORDINATES = 0,
79  BLOCK = 1,
80  ELEMENT = 2
81  };
82 
84 
88  vtkGetStringMacro(MeasuredFileName);
90 
92 
96  vtkGetStringMacro(MatchFileName);
98 
99 protected:
101  ~vtkEnSightReader() override;
102 
105 
106  void ClearForNewCaseFileName() override;
107 
109 
112  vtkSetStringMacro(MeasuredFileName);
114 
116 
119  vtkSetStringMacro(MatchFileName);
121 
123 
126  int ReadCaseFile();
127  int ReadCaseFileGeometry(char* line);
128  int ReadCaseFileVariable(char* line);
129  int ReadCaseFileTime(char* line);
130  int ReadCaseFileFile(char* line);
132 
133  // set in UpdateInformation to value returned from ReadCaseFile
135 
139  virtual int ReadGeometryFile(
140  const char* fileName, int timeStep, vtkMultiBlockDataSet* output) = 0;
141 
146  virtual int ReadMeasuredGeometryFile(
147  const char* fileName, int timeStep, vtkMultiBlockDataSet* output) = 0;
148 
152  int ReadVariableFiles(vtkMultiBlockDataSet* output);
153 
158  virtual int ReadScalarsPerNode(const char* fileName, const char* description, int timeStep,
159  vtkMultiBlockDataSet* output, int measured = 0, int numberOfComponents = 1,
160  int component = 0) = 0;
161 
166  virtual int ReadVectorsPerNode(const char* fileName, const char* description, int timeStep,
167  vtkMultiBlockDataSet* output, int measured = 0) = 0;
168 
173  virtual int ReadTensorsPerNode(
174  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
175 
180  virtual int ReadScalarsPerElement(const char* fileName, const char* description, int timeStep,
181  vtkMultiBlockDataSet* output, int numberOfComponents = 1, int component = 0) = 0;
182 
187  virtual int ReadVectorsPerElement(
188  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
189 
194  virtual int ReadTensorsPerElement(
195  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
196 
201  virtual int CreateUnstructuredGridOutput(
202  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) = 0;
203 
208  virtual int CreateStructuredGridOutput(
209  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) = 0;
210 
214  void AddVariableFileName(const char* fileName1, const char* fileName2 = nullptr);
215 
219  void AddVariableDescription(const char* description);
220 
224  void AddVariableType();
225 
230  int GetElementType(const char* line);
231 
236  int GetSectionType(const char* line);
237 
241  void ReplaceWildcards(char* filename, int num);
242 
246  void RemoveLeadingBlanks(char* line);
247 
248  // Get the vtkIdList for the given output index and cell type.
249  vtkIdList* GetCellIds(int index, int cellType);
250 
255  void AddToBlock(vtkMultiBlockDataSet* output, unsigned int blockNo, vtkDataSet* dataset);
256 
261  vtkDataSet* GetDataSetFromBlock(vtkMultiBlockDataSet* output, unsigned int blockNo);
262 
266  void SetBlockName(vtkMultiBlockDataSet* output, unsigned int blockNo, const char* name);
267 
269  char* MatchFileName; // may not actually be necessary to read this file
270 
271  // pointer to lists of vtkIdLists (cell ids per element type per part)
272  vtkEnSightReaderCellIdsType* CellIds;
273 
274  // part ids of unstructured outputs
276 
278 
279  // pointers to lists of filenames
280  char** VariableFileNames; // non-complex
282 
283  // array of time sets
286 
287  // array of file sets
290 
291  // collection of filename numbers per time set
294 
295  // collection of filename numbers per file set
298 
299  // collection of number of steps per file per file set
301 
302  // ids of the time and file sets
305 
310 
313 
315  vtkSetMacro(UseTimeSets, vtkTypeBool);
316  vtkGetMacro(UseTimeSets, vtkTypeBool);
317  vtkBooleanMacro(UseTimeSets, vtkTypeBool);
318 
320  vtkSetMacro(UseFileSets, vtkTypeBool);
321  vtkGetMacro(UseFileSets, vtkTypeBool);
322  vtkBooleanMacro(UseFileSets, vtkTypeBool);
323 
325 
326  // global list of points for measured geometry
328 
331 
332  int CheckOutputConsistency();
333 
335 
336 private:
337  vtkEnSightReader(const vtkEnSightReader&) = delete;
338  void operator=(const vtkEnSightReader&) = delete;
339 };
340 
341 #endif
vtkEnSightReader::NumberOfNewOutputs
int NumberOfNewOutputs
Definition: vtkEnSightReader.h:329
vtkEnSightReader::GeometryTimeValue
float GeometryTimeValue
Definition: vtkEnSightReader.h:311
vtkEnSightReader::MatchFileName
char * MatchFileName
Definition: vtkEnSightReader.h:269
vtkEnSightReader::FileSetFileNameNumbers
vtkIdListCollection * FileSetFileNameNumbers
Definition: vtkEnSightReader.h:296
vtkGenericEnSightReader.h
vtkGenericEnSightReader::AddVariableType
void AddVariableType(int variableType)
Add a variable type to the appropriate array.
vtkX3D::component
@ component
Definition: vtkX3D.h:181
vtkEnSightReader::SectionTypeList
SectionTypeList
Definition: vtkEnSightReader.h:76
vtkEnSightReader::VariableFileSetIds
vtkIdList * VariableFileSetIds
Definition: vtkEnSightReader.h:288
vtkEnSightReader
superclass for EnSight file readers
Definition: vtkEnSightReader.h:32
vtkEnSightReader::ComplexVariableFileNames
char ** ComplexVariableFileNames
Definition: vtkEnSightReader.h:281
vtkEnSightReader::NumberOfMeasuredPoints
int NumberOfMeasuredPoints
Definition: vtkEnSightReader.h:327
vtkEnSightReader::TimeSetsWithFilenameNumbers
vtkIdList * TimeSetsWithFilenameNumbers
Definition: vtkEnSightReader.h:293
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkEnSightReader::VariableTimeSetIds
vtkIdList * VariableTimeSetIds
Definition: vtkEnSightReader.h:284
vtkEnSightReader::CaseFileRead
int CaseFileRead
Definition: vtkEnSightReader.h:134
vtkGenericEnSightReader::RequestInformation
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkEnSightReader::VariableFileNames
char ** VariableFileNames
Definition: vtkEnSightReader.h:280
vtkEnSightReader::InitialRead
int InitialRead
Definition: vtkEnSightReader.h:330
vtkEnSightReader::GeometryFileSet
int GeometryFileSet
Definition: vtkEnSightReader.h:307
vtkMultiBlockDataSet
Composite dataset that organizes datasets into blocks.
Definition: vtkMultiBlockDataSet.h:45
vtkEnSightReader::MeasuredTimeValue
float MeasuredTimeValue
Definition: vtkEnSightReader.h:312
vtkEnSightReader::TimeSetIds
vtkIdList * TimeSetIds
Definition: vtkEnSightReader.h:303
vtkEnSightReader::MeasuredFileName
char * MeasuredFileName
Definition: vtkEnSightReader.h:268
vtkEnSightReader::ComplexVariableFileSetIds
vtkIdList * ComplexVariableFileSetIds
Definition: vtkEnSightReader.h:289
vtkEnSightReader::FileSetsWithFilenameNumbers
vtkIdList * FileSetsWithFilenameNumbers
Definition: vtkEnSightReader.h:297
vtkEnSightReader::UseFileSets
vtkTypeBool UseFileSets
Definition: vtkEnSightReader.h:317
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkGenericEnSightReader
class to read any type of EnSight files
Definition: vtkGenericEnSightReader.h:48
vtkEnSightReader::UnstructuredPartIds
vtkIdList * UnstructuredPartIds
Definition: vtkEnSightReader.h:275
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkIdListCollection
maintain an ordered list of IdList objects
Definition: vtkIdListCollection.h:31
vtkEnSightReader::FileSetNumberOfSteps
vtkIdListCollection * FileSetNumberOfSteps
Definition: vtkEnSightReader.h:300
vtkGenericEnSightReader::ClearForNewCaseFileName
virtual void ClearForNewCaseFileName()
Clear data structures such that setting a new case file name works.
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkGenericEnSightReader::ReplaceWildcards
int ReplaceWildcards(char *fileName, int timeSet, int fileSet)
Replace the wildcards in the geometry file name with appropriate filename numbers as specified in the...
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkEnSightReader::VariableTypesList
VariableTypesList
Definition: vtkEnSightReader.h:60
vtkEnSightReader::ElementTypesList
ElementTypesList
Definition: vtkEnSightReader.h:38
vtkX3D::description
@ description
Definition: vtkX3D.h:328
vtkEnSightReader::ActualTimeValue
double ActualTimeValue
Definition: vtkEnSightReader.h:334
vtkEnSightReader::MeasuredTimeSet
int MeasuredTimeSet
Definition: vtkEnSightReader.h:308
vtkEnSightReader::TimeSetFileNameNumbers
vtkIdListCollection * TimeSetFileNameNumbers
Definition: vtkEnSightReader.h:292
vtkEnSightReader::MeasuredFileSet
int MeasuredFileSet
Definition: vtkEnSightReader.h:309
vtkDataSetCollection
maintain an unordered list of dataset objects
Definition: vtkDataSetCollection.h:31
vtkEnSightReader::GeometryTimeSet
int GeometryTimeSet
Definition: vtkEnSightReader.h:306
vtkEnSightReader::CellIds
vtkEnSightReaderCellIdsType * CellIds
Definition: vtkEnSightReader.h:272
vtkEnSightReader::NumberOfGeometryParts
int NumberOfGeometryParts
Definition: vtkEnSightReader.h:322
vtkEnSightReader::UseTimeSets
vtkTypeBool UseTimeSets
Definition: vtkEnSightReader.h:314
vtkGenericEnSightReader::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkEnSightReader::FileSets
vtkIdList * FileSets
Definition: vtkEnSightReader.h:304
vtkGenericEnSightReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkEnSightReader::ComplexVariableTimeSetIds
vtkIdList * ComplexVariableTimeSetIds
Definition: vtkEnSightReader.h:285
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkEnSightReader::VariableMode
int VariableMode
Definition: vtkEnSightReader.h:277
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkGenericEnSightReader::AddVariableDescription
void AddVariableDescription(const char *description)
Add a variable description to the appropriate array.