vtkPhastaReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
3 // SPDX-License-Identifier: BSD-3-Clause
14 #ifndef vtkPhastaReader_h
15 #define vtkPhastaReader_h
16 
17 #include "vtkPVVTKExtensionsIOGeneralModule.h" //needed for exports
19 
21 class vtkPoints;
24 
25 struct vtkPhastaReaderInternal;
26 
28 {
29 public:
30  static vtkPhastaReader* New();
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
35 
38  vtkSetStringMacro(GeometryFileName);
39  vtkGetStringMacro(GeometryFileName);
41 
43 
46  vtkSetStringMacro(FieldFileName);
47  vtkGetStringMacro(FieldFileName);
49 
51 
54  void ClearFieldInfo();
55  void SetFieldInfo(const char* paraviewFieldTag, const char* phastaFieldTag, int index,
56  int numOfComps, int dataDependency, const char* dataType);
58 
59  void SetCachedGrid(vtkUnstructuredGrid*);
60  vtkGetObjectMacro(CachedGrid, vtkUnstructuredGrid);
61 
62 protected:
64  ~vtkPhastaReader() override;
65 
66  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
67  vtkInformationVector* outputVector) override;
68 
69  void ReadGeomFile(
70  char* GeomFileName, int& firstVertexNo, vtkPoints* points, int& noOfNodes, int& noOfCells);
71  void ReadFieldFile(
72  char* fieldFileName, int firstVertexNo, vtkDataSetAttributes* field, int& noOfNodes);
73  void ReadFieldFile(
74  char* fieldFileName, int firstVertexNo, vtkUnstructuredGrid* output, int& noOfDatas);
75 
76 private:
77  char* GeometryFileName;
78  char* FieldFileName;
79  vtkUnstructuredGrid* CachedGrid;
80 
81  int NumberOfVariables; // number of variable in the field file
82 
83  static char* StringStripper(const char istring[]);
84  static int cscompare(const char teststring[], const char targetstring[]);
85  static void isBinary(const char iotype[]);
86  static size_t typeSize(const char typestring[]);
87  static int readHeader(FILE* fileObject, const char phrase[], int* params, int expect);
88  static void SwapArrayByteOrder(void* array, int nbytes, int nItems);
89  static void openfile(const char filename[], const char mode[], int* fileDescriptor);
90  static void closefile(int* fileDescriptor, const char mode[]);
91  static void readheader(int* fileDescriptor, const char keyphrase[], void* valueArray, int* nItems,
92  const char datatype[], const char iotype[]);
93  static void readdatablock(int* fileDescriptor, const char keyphrase[], void* valueArray,
94  int* nItems, const char datatype[], const char iotype[]);
95 
96  vtkPhastaReaderInternal* Internal;
97 
98  vtkPhastaReader(const vtkPhastaReader&) = delete;
99  void operator=(const vtkPhastaReader&) = delete;
100 };
101 
102 #endif
Reader for RPI's PHASTA software.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
static vtkUnstructuredGridAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
#define VTKPVVTKEXTENSIONSIOGENERAL_EXPORT
void operator=(const vtkObjectBase &)