Forward compatibility: flex
[foam-extend-3.2.git] / applications / utilities / postProcessing / graphics / newEnsightFoamReader / getFieldVector.H
blob0b11dfc670c3ca4760d37bfd3605fead548748a7
1 if
3     nVar >= Num_variables - nSprayVariables
4   - nSecondMeshVariables - nFaMeshVariables
7     return Z_UNDEF;
11 IOobject fieldObjectPtr
13     fieldNames[var2field[nVar]],
14     runTime.timeName(),
15     mesh,
16     IOobject::NO_READ
19 if (!fieldObjectPtr.headerOk())
21     return Z_UNDEF;
24 IOobject fieldObject
26     fieldNames[var2field[nVar]],
27     runTime.timeName(),
28     mesh,
29     IOobject::MUST_READ,
30     IOobject::NO_WRITE
33 volVectorField vectorField
35     fieldObject,
36     mesh
39 const cellShapeList& cellShapes = meshPtr->cellShapes();
41 // hexa's
42 if (which_type == Z_HEX08)
44     const cellModel& hex = *(cellModeller::lookup("hex"));
45     //const cellModel& wedge = *(cellModeller::lookup("wedge"));
47     label counter = 1;
48     for (label n=0; n<nCells; n++)
49     {
50         const cellShape& cellShape = cellShapes[n];
51         const cellModel& cellModel = cellShape.model();
53         if (cellModel == hex) // || (cellModel == wedge))
54         {
55             var_array[counter++] = vectorField[n][component];
56         }
57     }
60 // penta's
61 if (which_type == Z_PEN06)
63     const cellModel& prism = *(cellModeller::lookup("prism"));
65     label counter = 1;
66     for (label n=0; n<nCells; n++)
67     {
68         const cellShape& cellShape = cellShapes[n];
69         const cellModel& cellModel = cellShape.model();
71         if (cellModel == prism)
72         {
73             var_array[counter++] = vectorField[n][component];
74         }
75     }
78 // pyramids's
79 if (which_type == Z_PYR05)
81     const cellModel& pyr = *(cellModeller::lookup("pyr"));
83     label counter = 1;
84     for (label n=0; n<nCells; n++)
85     {
86         const cellShape& cellShape = cellShapes[n];
87         const cellModel& cellModel = cellShape.model();
89         if (cellModel == pyr)
90         {
91             var_array[counter++] = vectorField[n][component];
92         }
93     }
97 // tet's
98 if (which_type == Z_TET04)
100     const cellModel& tet = *(cellModeller::lookup("tet"));
102     label counter = 1;
103     for (label n=0; n<nCells; n++)
104     {
105         const cellShape& cellShape = cellShapes[n];
106         const cellModel& cellModel = cellShape.model();
108         if (cellModel == tet)
109         {
110             var_array[counter++] = vectorField[n][component];
111         }
112     }
115 if (which_type == Z_NFACED)
117     const cellList& cells = meshPtr->cells();
119     label counter = 1;
120     for (label n=0; n<nCells; n++)
121     {
122         const labelList& points = cellShapes[n];
123         label nFacesInCell = cells[n].size();
125         if ((nFacesInCell == 6) && (points.size() == 8))
126         {}
127         else if ((nFacesInCell == 4) && (points.size() == 4))
128         {}
129         else if (nFacesInCell == 5)
130         {
131             if (points.size() == 6)
132             {}
133             else if (points.size() == 5)
134             {}
135             else
136             {
137                 var_array[counter++] = vectorField[n][component];
138             }
139         }
140         else
141         {
142             var_array[counter++] = vectorField[n][component];
143         }
144     }