VTK
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 "vtkIOEnSightModule.h" // For export macro
25 
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  };
76 
78  {
79  COORDINATES = 0,
80  BLOCK = 1,
81  ELEMENT = 2
82  };
83 
85 
89  vtkGetStringMacro(MeasuredFileName);
91 
93 
97  vtkGetStringMacro(MatchFileName);
99 
100 protected:
102  ~vtkEnSightReader() override;
103 
106  vtkInformationVector*) override;
109  vtkInformationVector*) override;
110 
111  void ClearForNewCaseFileName() override;
112 
114 
117  vtkSetStringMacro(MeasuredFileName);
119 
121 
124  vtkSetStringMacro(MatchFileName);
126 
128 
131  int ReadCaseFile();
132  int ReadCaseFileGeometry(char* line);
133  int ReadCaseFileVariable(char* line);
134  int ReadCaseFileTime(char* line);
135  int ReadCaseFileFile(char* line);
137 
138  // set in UpdateInformation to value returned from ReadCaseFile
140 
144  virtual int ReadGeometryFile(const char* fileName, int timeStep,
145  vtkMultiBlockDataSet *output) = 0;
146 
151  virtual int ReadMeasuredGeometryFile(const char* fileName, int timeStep,
152  vtkMultiBlockDataSet *output) = 0;
153 
157  int ReadVariableFiles(vtkMultiBlockDataSet *output);
158 
163  virtual int ReadScalarsPerNode(const char* fileName, const char* description,
164  int timeStep, vtkMultiBlockDataSet *output,
165  int measured = 0, int numberOfComponents = 1,
166  int component = 0) = 0;
167 
172  virtual int ReadVectorsPerNode(const char* fileName, const char* description,
173  int timeStep, vtkMultiBlockDataSet *output,
174  int measured = 0) = 0;
175 
180  virtual int ReadTensorsPerNode(const char* fileName, const char* description,
181  int timeStep, vtkMultiBlockDataSet *output) = 0;
182 
187  virtual int ReadScalarsPerElement(const char* fileName, const char* description,
188  int timeStep, vtkMultiBlockDataSet *output,
189  int numberOfComponents = 1,
190  int component = 0) = 0;
191 
196  virtual int ReadVectorsPerElement(const char* fileName, const char* description,
197  int timeStep, vtkMultiBlockDataSet *output) = 0;
198 
203  virtual int ReadTensorsPerElement(const char* fileName, const char* description,
204  int timeStep, vtkMultiBlockDataSet *output) = 0;
205 
210  virtual int CreateUnstructuredGridOutput(int partId,
211  char line[80],
212  const char* name,
213  vtkMultiBlockDataSet *output) = 0;
214 
219  virtual int CreateStructuredGridOutput(int partId,
220  char line[80],
221  const char* name,
222  vtkMultiBlockDataSet *output) = 0;
223 
227  void AddVariableFileName(const char* fileName1, const char* fileName2 = nullptr);
228 
232  void AddVariableDescription(const char* description);
233 
237  void AddVariableType();
238 
243  int GetElementType(const char* line);
244 
249  int GetSectionType(const char *line);
250 
254  void ReplaceWildcards(char* filename, int num);
255 
259  void RemoveLeadingBlanks(char *line);
260 
261  // Get the vtkIdList for the given output index and cell type.
262  vtkIdList* GetCellIds(int index, int cellType);
263 
268  void AddToBlock(vtkMultiBlockDataSet* output,
269  unsigned int blockNo,
270  vtkDataSet* dataset);
271 
276  vtkDataSet* GetDataSetFromBlock(vtkMultiBlockDataSet* output,
277  unsigned int blockNo);
278 
282  void SetBlockName(vtkMultiBlockDataSet* output, unsigned int blockNo,
283  const char* name);
284 
286  char* MatchFileName; // may not actually be necessary to read this file
287 
288  // pointer to lists of vtkIdLists (cell ids per element type per part)
289  vtkEnSightReaderCellIdsType* CellIds;
290 
291  // part ids of unstructured outputs
293 
295 
296  // pointers to lists of filenames
297  char** VariableFileNames; // non-complex
299 
300  // array of time sets
303 
304  // array of file sets
307 
308  // collection of filename numbers per time set
311 
312  // collection of filename numbers per file set
315 
316  // collection of number of steps per file per file set
318 
319  // ids of the time and file sets
322 
327 
330 
332  vtkSetMacro(UseTimeSets, vtkTypeBool);
333  vtkGetMacro(UseTimeSets, vtkTypeBool);
334  vtkBooleanMacro(UseTimeSets, vtkTypeBool);
335 
337  vtkSetMacro(UseFileSets, vtkTypeBool);
338  vtkGetMacro(UseFileSets, vtkTypeBool);
339  vtkBooleanMacro(UseFileSets, vtkTypeBool);
340 
342 
343  // global list of points for measured geometry
345 
348 
349  int CheckOutputConsistency();
350 
352 
353 private:
354  vtkEnSightReader(const vtkEnSightReader&) = delete;
355  void operator=(const vtkEnSightReader&) = delete;
356 };
357 
358 #endif
vtkEnSightReader::NumberOfNewOutputs
int NumberOfNewOutputs
Definition: vtkEnSightReader.h:346
vtkEnSightReader::GeometryTimeValue
float GeometryTimeValue
Definition: vtkEnSightReader.h:328
vtkEnSightReader::MatchFileName
char * MatchFileName
Definition: vtkEnSightReader.h:286
vtkEnSightReader::FileSetFileNameNumbers
vtkIdListCollection * FileSetFileNameNumbers
Definition: vtkEnSightReader.h:313
vtkGenericEnSightReader.h
vtkGenericEnSightReader::AddVariableType
void AddVariableType(int variableType)
Add a variable type to the appropriate array.
vtkX3D::component
Definition: vtkX3D.h:175
vtkEnSightReader::SectionTypeList
SectionTypeList
Definition: vtkEnSightReader.h:77
vtkEnSightReader::VariableFileSetIds
vtkIdList * VariableFileSetIds
Definition: vtkEnSightReader.h:305
vtkEnSightReader
superclass for EnSight file readers
Definition: vtkEnSightReader.h:33
vtkEnSightReader::ComplexVariableFileNames
char ** ComplexVariableFileNames
Definition: vtkEnSightReader.h:298
vtkEnSightReader::NumberOfMeasuredPoints
int NumberOfMeasuredPoints
Definition: vtkEnSightReader.h:344
vtkEnSightReader::TimeSetsWithFilenameNumbers
vtkIdList * TimeSetsWithFilenameNumbers
Definition: vtkEnSightReader.h:310
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkEnSightReader::VariableTimeSetIds
vtkIdList * VariableTimeSetIds
Definition: vtkEnSightReader.h:301
vtkEnSightReader::CaseFileRead
int CaseFileRead
Definition: vtkEnSightReader.h:139
vtkGenericEnSightReader::RequestInformation
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkEnSightReader::VariableFileNames
char ** VariableFileNames
Definition: vtkEnSightReader.h:297
vtkEnSightReader::InitialRead
int InitialRead
Definition: vtkEnSightReader.h:347
vtkEnSightReader::GeometryFileSet
int GeometryFileSet
Definition: vtkEnSightReader.h:324
vtkMultiBlockDataSet
Composite dataset that organizes datasets into blocks.
Definition: vtkMultiBlockDataSet.h:51
vtkEnSightReader::MeasuredTimeValue
float MeasuredTimeValue
Definition: vtkEnSightReader.h:329
vtkEnSightReader::TimeSetIds
vtkIdList * TimeSetIds
Definition: vtkEnSightReader.h:320
vtkEnSightReader::MeasuredFileName
char * MeasuredFileName
Definition: vtkEnSightReader.h:285
vtkEnSightReader::ComplexVariableFileSetIds
vtkIdList * ComplexVariableFileSetIds
Definition: vtkEnSightReader.h:306
vtkEnSightReader::FileSetsWithFilenameNumbers
vtkIdList * FileSetsWithFilenameNumbers
Definition: vtkEnSightReader.h:314
vtkEnSightReader::UseFileSets
vtkTypeBool UseFileSets
Definition: vtkEnSightReader.h:334
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkGenericEnSightReader
class to read any type of EnSight files
Definition: vtkGenericEnSightReader.h:51
vtkEnSightReader::UnstructuredPartIds
vtkIdList * UnstructuredPartIds
Definition: vtkEnSightReader.h:292
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkIdListCollection
maintain an ordered list of IdList objects
Definition: vtkIdListCollection.h:34
vtkEnSightReader::FileSetNumberOfSteps
vtkIdListCollection * FileSetNumberOfSteps
Definition: vtkEnSightReader.h:317
vtkGenericEnSightReader::ClearForNewCaseFileName
virtual void ClearForNewCaseFileName()
Clear data structures such that setting a new case file name works.
vtkX3D::name
Definition: vtkX3D.h:219
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:62
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkEnSightReader::VariableTypesList
VariableTypesList
Definition: vtkEnSightReader.h:61
vtkEnSightReader::ElementTypesList
ElementTypesList
Definition: vtkEnSightReader.h:39
vtkX3D::description
Definition: vtkX3D.h:322
vtkEnSightReader::ActualTimeValue
double ActualTimeValue
Definition: vtkEnSightReader.h:351
vtkEnSightReader::MeasuredTimeSet
int MeasuredTimeSet
Definition: vtkEnSightReader.h:325
vtkEnSightReader::TimeSetFileNameNumbers
vtkIdListCollection * TimeSetFileNameNumbers
Definition: vtkEnSightReader.h:309
vtkEnSightReader::MeasuredFileSet
int MeasuredFileSet
Definition: vtkEnSightReader.h:326
vtkDataSetCollection
maintain an unordered list of dataset objects
Definition: vtkDataSetCollection.h:31
vtkEnSightReader::GeometryTimeSet
int GeometryTimeSet
Definition: vtkEnSightReader.h:323
vtkEnSightReader::CellIds
vtkEnSightReaderCellIdsType * CellIds
Definition: vtkEnSightReader.h:289
vtkEnSightReader::NumberOfGeometryParts
int NumberOfGeometryParts
Definition: vtkEnSightReader.h:339
vtkEnSightReader::UseTimeSets
vtkTypeBool UseTimeSets
Definition: vtkEnSightReader.h:331
vtkGenericEnSightReader::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkEnSightReader::FileSets
vtkIdList * FileSets
Definition: vtkEnSightReader.h:321
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:302
vtkX3D::index
Definition: vtkX3D.h:246
vtkEnSightReader::VariableMode
int VariableMode
Definition: vtkEnSightReader.h:294
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkGenericEnSightReader::AddVariableDescription
void AddVariableDescription(const char *description)
Add a variable description to the appropriate array.