BUGFIX: Uninitialised member variables
[foam-extend-3.2.git] / applications / utilities / postProcessing / graphics / newEnsightFoamReader / getSecondMeshFieldScalar.H
blobf8016957b93d0fed88ed6640a0b0378417a8a1e5
1 label offset = Num_variables - nSecondMeshVariables - nFaMeshVariables;
3 if (nVar < offset || nVar >= (Num_variables-nFaMeshVariables))
5     return Z_UNDEF;
8 IOobject fieldObjectPtr
10     secondMeshFieldNames[secondMeshVar2field[nVar-offset]],
11     runTime.timeName(),
12     *secondMeshPtr,
13     IOobject::NO_READ
16 if (!fieldObjectPtr.headerOk())
18     return Z_UNDEF;
21 IOobject fieldObject
23     secondMeshFieldNames[secondMeshVar2field[nVar-offset]],
24     runTime.timeName(),
25     *secondMeshPtr,
26     IOobject::MUST_READ,
27     IOobject::NO_WRITE
30 volScalarField scalarField
32     fieldObject,
33     *secondMeshPtr
36 const cellShapeList& cellShapes = secondMeshPtr->cellShapes();
38 // hexa's
39 if (which_type == Z_HEX08)
41     const cellModel& hex = *(cellModeller::lookup("hex"));
42     //const cellModel& wedge = *(cellModeller::lookup("wedge"));
44     label counter = 1;
45     for (label celli=0; celli<nCells; celli++)
46     {
47         const cellShape& cellShape = cellShapes[celli];
48         const cellModel& cellModel = cellShape.model();
50         if (cellModel == hex) // || (cellModel == wedge))
51         {
52             var_array[counter++] = scalarField[celli];
53         }
54     }
57 // penta's
58 if (which_type == Z_PEN06)
60     const cellModel& prism = *(cellModeller::lookup("prism"));
62     label counter = 1;
63     for (label n=0; n<nCells; n++)
64     {
65         const cellShape& cellShape = cellShapes[n];
66         const cellModel& cellModel = cellShape.model();
68         if (cellModel == prism)
69         {
70             var_array[counter++] = scalarField[n];
71         }
72     }
75 // pyramids's
76 if (which_type == Z_PYR05)
78     const cellModel& pyr = *(cellModeller::lookup("pyr"));
80     label counter = 1;
81     for (label n=0; n<nCells; n++)
82     {
83         const cellShape& cellShape = cellShapes[n];
84         const cellModel& cellModel = cellShape.model();
86         if (cellModel == pyr)
87         {
88             var_array[counter++] = scalarField[n];
89         }
90     }
93 // tet's
94 if (which_type == Z_TET04)
96     const cellModel& tet = *(cellModeller::lookup("tet"));
98     label counter = 1;
99     for (label n=0; n<nCells; n++)
100     {
101         const cellShape& cellShape = cellShapes[n];
102         const cellModel& cellModel = cellShape.model();
104         if (cellModel == tet)
105         {
106             var_array[counter++] = scalarField[n];
107         }
108     }
111 if (which_type == Z_NFACED)
113     const cellList& cells = secondMeshPtr->cells();
115     label counter = 1;
116     for (label n=0; n<nCells; n++)
117     {
118         const labelList& points = cellShapes[n];
119         label nFacesInCell = cells[n].size();
121         if ((nFacesInCell == 6) && (points.size() == 8))
122         {}
123         else if ((nFacesInCell == 4) && (points.size() == 4))
124         {}
125         else if (nFacesInCell == 5)
126         {
127             if (points.size() == 6)
128             {}
129             else if (points.size() == 5)
130             {}
131             else
132             {
133                 var_array[counter++] = scalarField[n];
134             }
135         }
136         else
137         {
138             var_array[counter++] = scalarField[n];
139         }
140     }