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
vtkIdList * UnstructuredPartIds
vtkIdList * FileSetsWithFilenameNumbers
void AddVariableDescription(const char *description)
Add a variable description to the appropriate array.
vtkIdList * ComplexVariableFileSetIds
maintain an unordered list of dataset objects
vtkIdListCollection * FileSetNumberOfSteps
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.
vtkIdList * FileSets
vtkEnSightReaderCellIdsType * CellIds
vtkTypeBool UseTimeSets
int vtkTypeBool
Definition: vtkABI.h:69
vtkIdListCollection * TimeSetFileNameNumbers
vtkIdList * ComplexVariableTimeSetIds
vtkIdList * VariableFileSetIds
char ** ComplexVariableFileNames
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkIdListCollection * FileSetFileNameNumbers
list of point or cell ids
Definition: vtkIdList.h:36
vtkIdList * TimeSetsWithFilenameNumbers
int ReplaceWildcards(char *fileName, int timeSet, int fileSet)
Replace the wildcards in the geometry file name with appropriate filename numbers as specified in the...
superclass for EnSight file readers
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.
vtkIdList * VariableTimeSetIds
Store zero or more vtkInformation instances.
vtkIdList * TimeSetIds
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.
vtkTypeBool UseFileSets