00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00030 #ifndef __vtkOpenFOAMReader_h
00031 #define __vtkOpenFOAMReader_h
00032
00033 #include "vtkMultiBlockDataSetAlgorithm.h"
00034
00035 typedef struct
00036 {
00037 int faceIndex;
00038 bool neighborFace;
00039 } face;
00040
00041 class vtkUnstructuredGrid;
00042 class vtkPoints;
00043 class vtkIntArray;
00044 class vtkFloatArray;
00045 class vtkDoubleArray;
00046 class vtkDataArraySelection;
00047 struct stdString;
00048 struct stringVector;
00049 struct intVector;
00050 struct intVectorVector;
00051 struct faceVectorVector;
00052
00053 class VTK_IO_EXPORT vtkOpenFOAMReader : public vtkMultiBlockDataSetAlgorithm
00054 {
00055 public:
00056 static vtkOpenFOAMReader *New();
00057 vtkTypeRevisionMacro(vtkOpenFOAMReader, vtkMultiBlockDataSetAlgorithm);
00058 void PrintSelf(ostream& os, vtkIndent indent);
00059
00061
00062 vtkSetStringMacro(FileName);
00063 vtkGetStringMacro(FileName);
00065
00067
00068 vtkGetMacro(NumberOfTimeSteps, int);
00070
00072
00073 vtkSetMacro(TimeStep, int);
00074 vtkGetMacro(TimeStep, int);
00076
00078
00079 vtkGetVector2Macro(TimeStepRange, int);
00081
00083 int GetNumberOfCellArrays(void);
00084
00086
00087 int GetCellArrayStatus(const char* name);
00088 void SetCellArrayStatus(const char* name, int status);
00090
00092 const char* GetCellArrayName(int index);
00093
00095
00096 void DisableAllCellArrays();
00097 void EnableAllCellArrays();
00099
00100
00101 protected:
00102 vtkOpenFOAMReader();
00103 ~vtkOpenFOAMReader();
00104 int RequestData(vtkInformation *,
00105 vtkInformationVector **, vtkInformationVector *);
00106 int RequestInformation(vtkInformation *,
00107 vtkInformationVector **, vtkInformationVector *);
00108
00109 private:
00110 vtkOpenFOAMReader(const vtkOpenFOAMReader&);
00111 void operator=(const vtkOpenFOAMReader&);
00112
00113 vtkSetVector2Macro(TimeStepRange, int);
00114
00115 char * FileName;
00116 int NumberOfTimeSteps;
00117 int TimeStep;
00118 int TimeStepRange[2];
00119 double * Steps;
00120 bool RequestInformationFlag;
00121 int StartFace;
00122
00123 stdString * Path;
00124 stdString * PathPrefix;
00125 stringVector * TimeStepData;
00126 vtkDataArraySelection * CellDataArraySelection;
00127 intVectorVector * FacePoints;
00128 intVectorVector * FacesOwnerCell;
00129 intVectorVector * FacesNeighborCell;
00130 faceVectorVector * FacesOfCell;
00131 vtkPoints * Points;
00132 vtkIdType NumCells;
00133 vtkIdType NumFaces;
00134 vtkIntArray * FaceOwner;
00135
00136 stringVector * PolyMeshPointsDir;
00137 stringVector * PolyMeshFacesDir;
00138 vtkIdType NumPoints;
00139 intVector * SizeOfBoundary;
00140 stringVector * BoundaryNames;
00141 stringVector * PointZoneNames;
00142 stringVector * FaceZoneNames;
00143 stringVector * CellZoneNames;
00144 int NumBlocks;
00145
00146 void CombineOwnerNeigbor();
00147 vtkUnstructuredGrid * MakeInternalMesh();
00148 double ControlDictDataParser(const char *);
00149 void ReadControlDict ();
00150 void GetPoints (int);
00151 void ReadFacesFile (const char *);
00152 void ReadOwnerFile(const char *);
00153 void ReadNeighborFile(const char *);
00154 void PopulatePolyMeshDirArrays();
00155 const char * GetDataType(const char *, const char *);
00156 vtkDoubleArray * GetInternalVariableAtTimestep(const char *, int);
00157 vtkDoubleArray * GetBoundaryVariableAtTimestep(int, const char *, int,
00158 vtkUnstructuredGrid *);
00159 stringVector *GatherBlocks(const char *, int);
00160 vtkUnstructuredGrid * GetBoundaryMesh(int, int);
00161 vtkUnstructuredGrid * GetPointZoneMesh(int, int);
00162 vtkUnstructuredGrid * GetFaceZoneMesh(int, int);
00163 vtkUnstructuredGrid * GetCellZoneMesh(int, int);
00164 void CreateDataSet(vtkMultiBlockDataSet *);
00165 stdString * GetLine(ifstream *);
00166 };
00167
00168 #endif