1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: $RCSfile: vtkPhastaReader.h,v $ 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 =========================================================================*/ 15 // .NAME vtkPhastaReader - Reader for RPI's PHASTA software 16 // .SECTION Description 17 // vtkPhastaReader reads RPI's Scorec's PHASTA (Parallel Hierarchic 18 // Adaptive Stabilized Transient Analysis) dumps. See 19 // http://www.scorec.rpi.edu/software_products.html or contact Scorec for 20 // information on PHASTA. 21 22 #ifndef __vtkPhastaReader_h 23 #define __vtkPhastaReader_h 24 25 #include "vtkUnstructuredGridAlgorithm.h" 26 #include "vtkPPhastaReader.h" 27 28 class vtkUnstructuredGrid; 29 class vtkPoints; 30 class vtkDataSetAttributes; 31 class vtkInformationVector; 32 33 ///////////////////// 34 class vtkPVXMLParser; 35 class vtkPhastaReader; 36 ////////////////////// 37 38 //BTX 39 struct vtkPhastaReaderInternal; 40 //ETX 41 42 class VTK_EXPORT vtkPhastaReader : public vtkUnstructuredGridAlgorithm 43 { 44 public: 45 static vtkPhastaReader *New(); 46 vtkTypeRevisionMacro(vtkPhastaReader,vtkUnstructuredGridAlgorithm); 47 void PrintSelf(ostream& os, vtkIndent indent); 48 49 // Description: 50 // Specify file name of Phasta geometry file to read. 51 vtkSetStringMacro(GeometryFileName); 52 vtkGetStringMacro(GeometryFileName); 53 54 // Description: 55 // Specify file name of Phasta field file to read. 56 vtkSetStringMacro(FieldFileName); 57 vtkGetStringMacro(FieldFileName); 58 59 // Description: 60 // Clear/Set info. in FieldInfoMap for object of vtkPhastaReaderInternal 61 void ClearFieldInfo(); 62 void SetFieldInfo(const char *paraviewFieldTag, 63 const char* phastaFieldTag, 64 int index, 65 int numOfComps, 66 int dataDependency, 67 const char* dataType); 68 69 protected: 70 vtkPhastaReader(); 71 ~vtkPhastaReader(); 72 73 virtual int RequestData(vtkInformation* request, 74 vtkInformationVector** inputVector, 75 vtkInformationVector* outputVector); 76 77 void ReadGeomFile(char *GeomFileName, 78 int &firstVertexNo, 79 vtkPoints *points, 80 int &noOfNodes, 81 int &noOfCells); 82 void ReadFieldFile(char *fieldFileName , 83 int firstVertexNo, 84 vtkDataSetAttributes *field, 85 int &noOfNodes); 86 void ReadFieldFile(char *fieldFileName, 87 int firstVertexNo, 88 vtkUnstructuredGrid *output, 89 int &noOfDatas); 90 91 private: 92 char *GeometryFileName; 93 char *FieldFileName; 94 95 //////////////////// 96 vtkPVXMLParser* Parser; 97 char* FileName; 98 /////////////////// 99 100 int NumberOfVariables; //number of variable in the field file 101 102 static char* StringStripper( const char istring[] ); 103 static int cscompare( const char teststring[], 104 const char targetstring[] ); 105 static void isBinary( const char iotype[] ); 106 static size_t typeSize( const char typestring[] ); 107 //CHANGE//////////////////////////////////////////////////// 108 109 static void queryphmpiio_( const char filename[], 110 int *nfields, 111 int *nppf ); 112 static void finalizephmpiio_( int *fileDescriptor ); 113 114 //CHANGE END/////////////////////////////////////////////// 115 static int readHeader( FILE* fileObject, 116 const char phrase[], 117 int* params, 118 int expect ); 119 static void SwapArrayByteOrder_( void* array, 120 int nbytes, 121 int nItems ); 122 static void openfile( const char filename[], 123 const char mode[], 124 int* fileDescriptor ); 125 static void closefile( int* fileDescriptor, 126 const char mode[] ); 127 static void readheader( int* fileDescriptor, 128 const char keyphrase[], 129 void* valueArray, 130 int* nItems, 131 const char datatype[], 132 const char iotype[] ); 133 static void readdatablock( int* fileDescriptor, 134 const char keyphrase[], 135 void* valueArray, 136 int* nItems, 137 const char datatype[], 138 const char iotype[] ); 139 140 141 142 143 private: 144 vtkPhastaReaderInternal *Internal; 145 146 vtkPhastaReader(const vtkPhastaReader&); // Not implemented 147 void operator=(const vtkPhastaReader&); // Not implemented 148 }; 149 150 #endif 151 152 153