Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / utilities / postProcessing / graphics / newEnsightFoamReader / getSecondMeshFieldVector.H
blobe8378309df32a04d14665d5c4d6bc1057ac77e40
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 volVectorField vectorField
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 n=0; n<nCells; n++)
46     {
47         const cellShape& cellShape = cellShapes[n];
48         const cellModel& cellModel = cellShape.model();
50         if (cellModel == hex) // || (cellModel == wedge))
51         {
52             var_array[counter++] = vectorField[n][component];
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++] = vectorField[n][component];
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++] = vectorField[n][component];
89         }
90     }
94 // tet's
95 if (which_type == Z_TET04)
97     const cellModel& tet = *(cellModeller::lookup("tet"));
99     label counter = 1;
100     for (label n=0; n<nCells; n++)
101     {
102         const cellShape& cellShape = cellShapes[n];
103         const cellModel& cellModel = cellShape.model();
105         if (cellModel == tet)
106         {
107             var_array[counter++] = vectorField[n][component];
108         }
109     }
112 if (which_type == Z_NFACED)
114     const cellList& cells = secondMeshPtr->cells();
116     label counter = 1;
117     for (label n=0; n<nCells; n++)
118     {
119         const labelList& points = cellShapes[n];
120         label nFacesInCell = cells[n].size();
122         if ((nFacesInCell == 6) && (points.size() == 8))
123         {}
124         else if ((nFacesInCell == 4) && (points.size() == 4))
125         {}
126         else if (nFacesInCell == 5)
127         {
128             if (points.size() == 6)
129             {}
130             else if (points.size() == 5)
131             {}
132             else
133             {
134                 var_array[counter++] = vectorField[n][component];
135             }
136         }
137         else
138         {
139             var_array[counter++] = vectorField[n][component];
140         }
141     }