Forward compatibility: flex
[foam-extend-3.2.git] / applications / utilities / postProcessing / graphics / newEnsightFoamReader / getSecondMeshFieldTensor.H
blobc96ebc526f14ac03adf1217850bc13f578d8a2c3
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 volTensorField tf
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 #           include "tensorConversion.H"
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 #           include "tensorConversion.H"
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 #           include "tensorConversion.H"
89         }
90     }
94 // penta's
95 if (which_type == Z_TET04)
97     const cellModel& tet = *(cellModeller::lookup("tet"));
99     label counter = 1;
101     for (label n=0; n<nCells; n++)
102     {
103         const cellShape& cellShape = cellShapes[n];
104         const cellModel& cellModel = cellShape.model();
106         if (cellModel == tet)
107         {
108 #           include "tensorConversion.H"
109         }
110     }
113 if (which_type == Z_NFACED)
115     const cellList& cells = secondMeshPtr->cells();
117     label counter = 1;
118     for (label n=0; n<nCells; n++)
119     {
120         const labelList& points = cellShapes[n];
121         label nFacesInCell = cells[n].size();
123         if ((nFacesInCell == 6) && (points.size() == 8))
124         {}
125         else if ((nFacesInCell == 4) && (points.size() == 4))
126         {}
127         else if (nFacesInCell == 5)
128         {
129             if (points.size() == 6)
130             {}
131             else if (points.size() == 5)
132             {}
133             else
134             {
135 #               include "tensorConversion.H"
136             }
137         }
138         else
139         {
140 #           include "tensorConversion.H"
141         }
142     }