1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkOpenFOAMReader.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkOpenFOAMReader - reads a dataset in OpenFOAM format
// .SECTION Description
// vtkOpenFOAMReader creates an multiblock dataset. It reads a controlDict
// file, mesh information, and time dependent data. The controlDict file
// contains timestep information. The polyMesh folders contain mesh information
// The time folders contain transient data for the cells Each folder can
// contain any number of data files.
// .SECTION Thanks
// Thanks to Terry Jordan of SAIC at the National Energy
// Technology Laboratory who developed this class.
// Please address all comments to Terry Jordan (terry.jordan@sa.netl.doe.gov)
#ifndef __vtkOpenFOAMReader_h
#define __vtkOpenFOAMReader_h
#include "vtkMultiBlockDataSetAlgorithm.h"
typedef struct
{
int faceIndex;
bool neighborFace;
} face;
class vtkUnstructuredGrid;
class vtkPoints;
class vtkIntArray;
class vtkFloatArray;
class vtkDoubleArray;
class vtkDataArraySelection;
struct stdString;
struct stringVector;
struct intVector;
struct intVectorVector;
struct faceVectorVector;
class VTK_IO_EXPORT vtkOpenFOAMReader : public vtkMultiBlockDataSetAlgorithm
{
public:
static vtkOpenFOAMReader *New();
vtkTypeRevisionMacro(vtkOpenFOAMReader, vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Set/Get the filename.
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
// Description:
// Returns the number of timesteps.
vtkGetMacro(NumberOfTimeSteps, int);
// Description:
// Set/Get the current timestep.
vtkSetMacro(TimeStep, int);
vtkGetMacro(TimeStep, int);
// Description:
// Get the timesteprange. Filled during RequestInformation.
vtkGetVector2Macro(TimeStepRange, int);
// Description:
// Get the number of cell arrays available in the input.
int GetNumberOfCellArrays(void);
// Description:
// Get/Set whether the cell array with the given name is to
// be read.
int GetCellArrayStatus(const char* name);
void SetCellArrayStatus(const char* name, int status);
// Description:
// Get the name of the cell array with the given index in
// the input.
const char* GetCellArrayName(int index);
// Description:
// Turn on/off all cell arrays.
void DisableAllCellArrays();
void EnableAllCellArrays();
protected:
vtkOpenFOAMReader();
~vtkOpenFOAMReader();
int RequestData(vtkInformation *,
vtkInformationVector **, vtkInformationVector *);
int RequestInformation(vtkInformation *,
vtkInformationVector **, vtkInformationVector *);
private:
vtkOpenFOAMReader(const vtkOpenFOAMReader&); // Not implemented.
void operator=(const vtkOpenFOAMReader&); // Not implemented.
vtkSetVector2Macro(TimeStepRange, int);
char * FileName;
int NumberOfTimeSteps;
int TimeStep;
int TimeStepRange[2];
double * Steps;
bool RequestInformationFlag;
int StartFace;
stdString * Path;
stdString * PathPrefix;
stringVector * TimeStepData;
vtkDataArraySelection * CellDataArraySelection;
intVectorVector * FacePoints;
intVectorVector * FacesOwnerCell;
intVectorVector * FacesNeighborCell;
faceVectorVector * FacesOfCell;
vtkPoints * Points;
vtkIdType NumCells;
vtkIdType NumFaces;
vtkIntArray * FaceOwner;
//vtkIntArray * FaceNeighbor;
stringVector * PolyMeshPointsDir;
stringVector * PolyMeshFacesDir;
vtkIdType NumPoints;
intVector * SizeOfBoundary;
stringVector * BoundaryNames;
stringVector * PointZoneNames;
stringVector * FaceZoneNames;
stringVector * CellZoneNames;
int NumBlocks;
void CombineOwnerNeigbor();
vtkUnstructuredGrid * MakeInternalMesh();
double ControlDictDataParser(const char *);
void ReadControlDict ();
void GetPoints (int);
void ReadFacesFile (const char *);
void ReadOwnerFile(const char *);
void ReadNeighborFile(const char *);
void PopulatePolyMeshDirArrays();
const char * GetDataType(const char *, const char *);
vtkDoubleArray * GetInternalVariableAtTimestep(const char *, int);
vtkDoubleArray * GetBoundaryVariableAtTimestep(int, const char *, int,
vtkUnstructuredGrid *);
stringVector *GatherBlocks(const char *, int);
vtkUnstructuredGrid * GetBoundaryMesh(int, int);
vtkUnstructuredGrid * GetPointZoneMesh(int, int);
vtkUnstructuredGrid * GetFaceZoneMesh(int, int);
vtkUnstructuredGrid * GetCellZoneMesh(int, int);
void CreateDataSet(vtkMultiBlockDataSet *);
stdString * GetLine(ifstream *);
};
#endif
|