vtkPhastaReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPhastaReader.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 =========================================================================*/
25 #ifndef vtkPhastaReader_h
26 #define vtkPhastaReader_h
27 
28 #include "vtkPVVTKExtensionsIOGeneralModule.h" //needed for exports
30 
32 class vtkPoints;
35 
36 struct vtkPhastaReaderInternal;
37 
39 {
40 public:
41  static vtkPhastaReader* New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
49  vtkSetStringMacro(GeometryFileName);
50  vtkGetStringMacro(GeometryFileName);
52 
54 
57  vtkSetStringMacro(FieldFileName);
58  vtkGetStringMacro(FieldFileName);
60 
62 
65  void ClearFieldInfo();
66  void SetFieldInfo(const char* paraviewFieldTag, const char* phastaFieldTag, int index,
67  int numOfComps, int dataDependency, const char* dataType);
69 
70  void SetCachedGrid(vtkUnstructuredGrid*);
71  vtkGetObjectMacro(CachedGrid, vtkUnstructuredGrid);
72 
73 protected:
75  ~vtkPhastaReader() override;
76 
77  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
78  vtkInformationVector* outputVector) override;
79 
80  void ReadGeomFile(
81  char* GeomFileName, int& firstVertexNo, vtkPoints* points, int& noOfNodes, int& noOfCells);
82  void ReadFieldFile(
83  char* fieldFileName, int firstVertexNo, vtkDataSetAttributes* field, int& noOfNodes);
84  void ReadFieldFile(
85  char* fieldFileName, int firstVertexNo, vtkUnstructuredGrid* output, int& noOfDatas);
86 
87 private:
88  char* GeometryFileName;
89  char* FieldFileName;
90  vtkUnstructuredGrid* CachedGrid;
91 
92  int NumberOfVariables; // number of variable in the field file
93 
94  static char* StringStripper(const char istring[]);
95  static int cscompare(const char teststring[], const char targetstring[]);
96  static void isBinary(const char iotype[]);
97  static size_t typeSize(const char typestring[]);
98  static int readHeader(FILE* fileObject, const char phrase[], int* params, int expect);
99  static void SwapArrayByteOrder(void* array, int nbytes, int nItems);
100  static void openfile(const char filename[], const char mode[], int* fileDescriptor);
101  static void closefile(int* fileDescriptor, const char mode[]);
102  static void readheader(int* fileDescriptor, const char keyphrase[], void* valueArray, int* nItems,
103  const char datatype[], const char iotype[]);
104  static void readdatablock(int* fileDescriptor, const char keyphrase[], void* valueArray,
105  int* nItems, const char datatype[], const char iotype[]);
106 
107 private:
108  vtkPhastaReaderInternal* Internal;
109 
110  vtkPhastaReader(const vtkPhastaReader&) = delete;
111  void operator=(const vtkPhastaReader&) = delete;
112 };
113 
114 #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 &)