File: avtOpenFOAMFileFormat.h

package info (click to toggle)
paraview 4.0.1-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 526,572 kB
  • sloc: cpp: 2,284,430; ansic: 816,374; python: 239,936; xml: 70,162; tcl: 48,295; fortran: 39,116; yacc: 5,466; java: 3,518; perl: 3,107; lex: 1,620; sh: 1,555; makefile: 932; asm: 471; pascal: 228
file content (132 lines) | stat: -rw-r--r-- 4,943 bytes parent folder | download | duplicates (4)
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
// ************************************************************************* //
//                            avtOpenFOAMFileFormat.h                           //
// ************************************************************************* //

//THIS READER IS FOR DOUBLE PRECISION ONLY
//MUST DO A REOPEN UPON CHANGING TIMESTEPS TO
//REPOPULATE THE VECTORS/SCALARS LISTS

#ifndef AVT_OpenFOAM_FILE_FORMAT_H
#define AVT_OpenFOAM_FILE_FORMAT_H

#include <avtMTMDFileFormat.h>

#include <vector>
#include <sstream>
#include <string>
#include <visitstream.h>

#include <vtkUnstructuredGrid.h>
#include <vtkIntArray.h>
#include <vtkDoubleArray.h>
#include <vtkFloatArray.h>
#include <vtkPoints.h>
#include <vtkCellData.h>
#include <vtkVertex.h>
#include <vtkHexahedron.h>
#include <vtkWedge.h>
#include <vtkPyramid.h>
#include <vtkTetra.h>
#include <vtkConvexPointSet.h>
#include <vtkTriangle.h>
#include <vtkQuad.h>
#include <vtkPolygon.h>
#include <vtkUnstructuredGrid.h>
#include <vtkObjectFactory.h>
#include <vtkDirectory.h>


// ****************************************************************************
//  Class: avtOpenFOAMFileFormat
//
//  Purpose:
//      Reads in OpenFOAM files as a plugin to VisIt.
//
//  Programmer: root -- generated by xml2avt
//  Creation:   Wed Jun 7 16:01:15 PST 2006
//
// ****************************************************************************
typedef struct
{
  int faceIndex;
  bool neighborFace;
}face;

class avtOpenFOAMFileFormat : public avtMTMDFileFormat
{
  public:
  avtOpenFOAMFileFormat(const char *);
  virtual ~avtOpenFOAMFileFormat() {;};
  virtual int GetNTimesteps(void);
    virtual void           GetTimes(std::vector<double> &times);
  virtual const char  *GetType(void)   { return "OpenFOAM"; };
  virtual void  FreeUpResources(void); 
  virtual vtkDataSet  *GetMesh(int, int, const char *);
  virtual vtkDataArray *GetVar(int, int, const char *);
  virtual vtkDataArray *GetVectorVar(int, int, const char *);
  virtual bool          HasInvariantMetaData(void) const { return false; }; //Number of variables dynamic
  virtual bool          HasInvariantSIL(void) const      { return false; };  //Number of Domains dynamic
  virtual void ActivateTimestep(int);


  protected:
  virtual void           PopulateDatabaseMetaData(avtDatabaseMetaData *, int);

  //Members
  bool CreateFaces;
  bool FirstVar;
  bool FirstVectorVar;
  std::string Path;
  std::string PathPrefix;
  int NumberOfTimeSteps;
  int StartFace;
  int NFaces;
  double * Steps;
  vtkFloatArray * TempData;
  std::vector< std::string > PolyMeshPointsDir;
  std::vector< std::string > PolyMeshFacesDir;
  vtkPoints * Points;
  vtkIdType NumFaces;
  vtkIdType NumPoints;
  vtkIntArray * FaceOwner;
  vtkIntArray * FaceNeighbor;
  vtkIdType NumCells;
  std::vector< std::vector<int> > FacePoints;
  std::vector< std::vector<int> > FacesOwnerCell;
  std::vector< std::vector<int> > FacesNeighborCell;
  std::vector< std::vector<face> > FacesOfCell;
  int NumBlocks;
  int NumBoundaries;
  int NumPointZones;
  int NumFaceZones;
  int NumCellZones;
  //create temporary vectors
  std::vector< std::string > BoundaryNames;
  std::vector< std::string > PointZoneNames;
  std::vector< std::string > FaceZoneNames;
  std::vector< std::string > CellZoneNames;
  std::vector< std::string > ScalarNames;
  std::vector< std::string > VectorNames;

  //Methods
  double ControlDictDataParser(std::string);  //Parser ControlDict Entries
  void ReadControlDict();  //Read the ControlDict File
  void ReadFacesFile(std::string);  //Read the faces into a vector
  void GetPoints(int);  //Read the Points File
  void ReadOwnerFile(std::string);  //read the owner faces into a vector
  void ReadNeighborFile(std::string);  //read the neighbor faces into a vector
  void CombineOwnerNeigbor();  //Create a vector of cell faces
  vtkUnstructuredGrid * MakeInternalMesh();  //calls the functions to create internal mesh
  void PopulatePolyMeshDirArrays();  //Creates a vector that tells you at what time step the points and faces file reside
  std::string GetDataType(std::string, std::string);  //Parses the files to quickly find out what type of variables you have for the meta data
  vtkFloatArray * GetInternalVariableAtTimestep( std::string, int);  //Returns the values a requested variable for the internal mesh
  vtkFloatArray * GetBoundaryVariableAtTimestep(int, std::string, int);  //Returns the values a requested variable for the boundary meshed
  std::vector< std::string > GatherBlocks(std::string, int);  //creates a vector of all the blocks in a region
  vtkUnstructuredGrid * GetBoundaryMesh(int, int);  //returns a requested boundary mesh
  vtkUnstructuredGrid * GetPointZoneMesh(int, int);  //returns a requested point zone mesh
  vtkUnstructuredGrid * GetCellZoneMesh(int, int);  //returns a requested cell zone mesh
  vtkUnstructuredGrid * GetFaceZoneMesh(int, int);  //returns a requested face zone mesh
};


#endif