initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / applications / utilities / postProcessing / graphics / ensightFoamReader / getFieldScalar.H
blob8f65cce1397fc7218801b75bfb3837af4857346f
2 if (nVar >= Num_variables - nSprayVariables)
4     return Z_UNDEF;
7 IOobject fieldObjectPtr
9     fieldNames[var2field[nVar]],
10     runTime.timeName(),
11     mesh,
12     IOobject::NO_READ
15 if (!fieldObjectPtr.headerOk())
17     return Z_UNDEF;
20 IOobject fieldObject
22     fieldNames[var2field[nVar]],
23     runTime.timeName(),
24     mesh,
25     IOobject::MUST_READ,
26     IOobject::NO_WRITE
29 volScalarField scalarField
31     fieldObject,
32     mesh
35 const cellShapeList& cellShapes = meshPtr->cellShapes();
37 // hexa's
38 if (which_type == Z_HEX08)
40     const cellModel& hex = *(cellModeller::lookup("hex"));
41     //const cellModel& wedge = *(cellModeller::lookup("wedge"));
43     label counter = 1;
44     for (label celli=0; celli<nCells; celli++)
45     {
46         const cellShape& cellShape = cellShapes[celli];
47         const cellModel& cellModel = cellShape.model();
49         if (cellModel == hex) // || (cellModel == wedge))
50         {
51             var_array[counter++] = scalarField[celli];
52         }
53     }
56 // penta's
57 if (which_type == Z_PEN06)
59     const cellModel& prism = *(cellModeller::lookup("prism"));
61     label counter = 1;
62     for (label n=0; n<nCells; n++)
63     {
64         const cellShape& cellShape = cellShapes[n];
65         const cellModel& cellModel = cellShape.model();
67         if (cellModel == prism)
68         {
69             var_array[counter++] = scalarField[n];
70         }
71     }
74 // pyramids's
75 if (which_type == Z_PYR05)
77     const cellModel& pyr = *(cellModeller::lookup("pyr"));
78             
79     label counter = 1;
80     for (label n=0; n<nCells; n++)
81     {
82         const cellShape& cellShape = cellShapes[n];
83         const cellModel& cellModel = cellShape.model();
84         
85         if (cellModel == pyr)
86         {
87             var_array[counter++] = scalarField[n];
88         }
89     }
92 // tet's
93 if (which_type == Z_TET04)
95     const cellModel& tet = *(cellModeller::lookup("tet"));
97     label counter = 1;
98     for (label n=0; n<nCells; n++)
99     {
100         const cellShape& cellShape = cellShapes[n];
101         const cellModel& cellModel = cellShape.model();
103         if (cellModel == tet)
104         {
105             var_array[counter++] = scalarField[n];
106         }
107     }
110 if (which_type == Z_NFACED)
112     const cellList& cells = meshPtr->cells();
114     label counter = 1;
115     for (label n=0; n<nCells; n++)
116     {
117         const labelList& points = cellShapes[n];
118         label nFacesInCell = cells[n].size();
120         if ((nFacesInCell == 6) && (points.size() == 8))
121         {}
122         else if ((nFacesInCell == 4) && (points.size() == 4))
123         {}
124         else if (nFacesInCell == 5)
125         {
126             if (points.size() == 6)
127             {}
128             else if (points.size() == 5)
129             {}
130             else
131             {
132                 var_array[counter++] = scalarField[n];
133             }
134         }
135         else
136         {
137             var_array[counter++] = scalarField[n];
138         }
139     }