VTK  9.3.1
vtkEnSightReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
8 #ifndef vtkEnSightReader_h
9 #define vtkEnSightReader_h
10 
12 #include "vtkIOEnSightModule.h" // For export macro
13 
14 VTK_ABI_NAMESPACE_BEGIN
15 class vtkDataSet;
17 class vtkEnSightReaderCellIdsType;
18 class vtkIdList;
20 
21 class VTKIOENSIGHT_EXPORT vtkEnSightReader : public vtkGenericEnSightReader
22 {
23 public:
25  void PrintSelf(ostream& os, vtkIndent indent) override;
26 
28  {
29  POINT = 0,
30  BAR2 = 1,
31  BAR3 = 2,
32  NSIDED = 3,
33  TRIA3 = 4,
34  TRIA6 = 5,
35  QUAD4 = 6,
36  QUAD8 = 7,
37  NFACED = 8,
38  TETRA4 = 9,
39  TETRA10 = 10,
40  PYRAMID5 = 11,
41  PYRAMID13 = 12,
42  HEXA8 = 13,
43  HEXA20 = 14,
44  PENTA6 = 15,
45  PENTA15 = 16,
46  NUMBER_OF_ELEMENT_TYPES = 17
47  };
48 
50  {
51  SCALAR_PER_NODE = 0,
52  VECTOR_PER_NODE = 1,
53  TENSOR_SYMM_PER_NODE = 2,
54  SCALAR_PER_ELEMENT = 3,
55  VECTOR_PER_ELEMENT = 4,
56  TENSOR_SYMM_PER_ELEMENT = 5,
57  SCALAR_PER_MEASURED_NODE = 6,
58  VECTOR_PER_MEASURED_NODE = 7,
59  COMPLEX_SCALAR_PER_NODE = 8,
60  COMPLEX_VECTOR_PER_NODE = 9,
61  COMPLEX_SCALAR_PER_ELEMENT = 10,
62  COMPLEX_VECTOR_PER_ELEMENT = 11,
63  TENSOR_ASYM_PER_NODE = 12,
64  TENSOR_ASYM_PER_ELEMENT = 13
65  };
66 
68  {
69  COORDINATES = 0,
70  BLOCK = 1,
71  ELEMENT = 2
72  };
73 
75 
79  vtkGetFilePathMacro(MeasuredFileName);
81 
83 
87  vtkGetFilePathMacro(MatchFileName);
89 
90 protected:
92  ~vtkEnSightReader() override;
93 
96 
97  void ClearForNewCaseFileName() override;
98 
100 
103  vtkSetFilePathMacro(MeasuredFileName);
105 
107 
110  vtkSetFilePathMacro(MatchFileName);
112 
114 
117  int ReadCaseFile();
118  int ReadCaseFileGeometry(char* line);
119  int ReadCaseFileVariable(char* line);
120  int ReadCaseFileTime(char* line);
121  int ReadCaseFileFile(char* line);
122  int ReadCaseFileScripts(char* line);
123 
125 
126  // set in UpdateInformation to value returned from ReadCaseFile
128 
132  virtual int ReadGeometryFile(
133  const char* fileName, int timeStep, vtkMultiBlockDataSet* output) = 0;
134 
139  virtual int ReadMeasuredGeometryFile(
140  const char* fileName, int timeStep, vtkMultiBlockDataSet* output) = 0;
141 
145  int ReadVariableFiles(vtkMultiBlockDataSet* output);
146 
151  virtual int ReadScalarsPerNode(const char* fileName, const char* description, int timeStep,
152  vtkMultiBlockDataSet* output, int measured = 0, int numberOfComponents = 1,
153  int component = 0) = 0;
154 
159  virtual int ReadVectorsPerNode(const char* fileName, const char* description, int timeStep,
160  vtkMultiBlockDataSet* output, int measured = 0) = 0;
161 
166  virtual int ReadAsymmetricTensorsPerNode(
167  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 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 ReadAsymmetricTensorsPerElement(
195  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
196 
201  virtual int ReadTensorsPerElement(
202  const char* fileName, const char* description, int timeStep, vtkMultiBlockDataSet* output) = 0;
203 
208  virtual int CreateUnstructuredGridOutput(
209  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) = 0;
210 
215  virtual int CreateStructuredGridOutput(
216  int partId, char line[80], const char* name, vtkMultiBlockDataSet* output) = 0;
217 
221  void AddVariableFileName(const char* fileName1, const char* fileName2 = nullptr);
222 
226  void AddVariableDescription(const char* description);
227 
231  void AddVariableType();
232 
237  int GetElementType(const char* line);
238 
243  int GetSectionType(const char* line);
244 
248  void RemoveLeadingBlanks(char* line);
249 
250  // Get the vtkIdList for the given output index and cell type.
251  vtkIdList* GetCellIds(int index, int cellType);
252 
257  void AddToBlock(vtkMultiBlockDataSet* output, unsigned int blockNo, vtkDataSet* dataset);
258 
263  vtkDataSet* GetDataSetFromBlock(vtkMultiBlockDataSet* output, unsigned int blockNo);
264 
268  void SetBlockName(vtkMultiBlockDataSet* output, unsigned int blockNo, const char* name);
269 
271  char* MatchFileName; // may not actually be necessary to read this file
272 
273  // pointer to lists of vtkIdLists (cell ids per element type per part)
274  vtkEnSightReaderCellIdsType* CellIds;
275 
276  // part ids of unstructured outputs
278 
280 
281  // pointers to lists of filenames
282  char** VariableFileNames; // non-complex
284 
285  // array of time sets
288 
289  // array of file sets
292 
293  // collection of filename numbers per time set
296 
297  // collection of filename numbers per file set
300 
301  // collection of number of steps per file per file set
303 
304  // ids of the time and file sets
307 
312 
315 
317  vtkSetMacro(UseTimeSets, vtkTypeBool);
318  vtkGetMacro(UseTimeSets, vtkTypeBool);
319  vtkBooleanMacro(UseTimeSets, vtkTypeBool);
320 
322  vtkSetMacro(UseFileSets, vtkTypeBool);
323  vtkGetMacro(UseFileSets, vtkTypeBool);
324  vtkBooleanMacro(UseFileSets, vtkTypeBool);
325 
327 
328  // global list of points for measured geometry
330 
333 
334  int CheckOutputConsistency();
335 
337 
338 private:
339  vtkEnSightReader(const vtkEnSightReader&) = delete;
340  void operator=(const vtkEnSightReader&) = delete;
341 };
342 
343 VTK_ABI_NAMESPACE_END
344 #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:52
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:64
vtkIdListCollection * TimeSetFileNameNumbers
vtkIdList * ComplexVariableTimeSetIds
vtkIdList * VariableFileSetIds
char ** ComplexVariableFileNames
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkIdListCollection * FileSetFileNameNumbers
list of point or cell ids
Definition: vtkIdList.h:22
vtkIdList * TimeSetsWithFilenameNumbers
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.
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.
vtkSetFilePathMacro(FilePath)
Set/Get the file path.
vtkTypeBool UseFileSets