Forward compatibility: flex
[foam-extend-3.2.git] / applications / utilities / postProcessing / graphics / newEnsightFoamReader / getSecondMeshPatchFieldScalar.H
blobe46cf0023c5e7d8e4d2660f6678975c00af1d199
2 label secondMeshPartNum = nPatches+2;
4 if(sprayPtr)
6     secondMeshPartNum += 1;
9 label patchi = which_part - secondMeshPartNum - 1;
11 label offset = Num_variables - nSecondMeshVariables - nFaMeshVariables;
13 if (nVar < offset || nVar >= (Num_variables-nFaMeshVariables))
15     return Z_UNDEF;
18 IOobject fieldObjectPtr
20     secondMeshFieldNames[secondMeshVar2field[nVar-offset]],
21     runTime.timeName(),
22     *secondMeshPtr,
23     IOobject::NO_READ
26 if (!fieldObjectPtr.headerOk())
28     return Z_UNDEF;
31 IOobject fieldObject
33     secondMeshFieldNames[secondMeshVar2field[nVar-offset]],
34     runTime.timeName(),
35     *secondMeshPtr,
36     IOobject::MUST_READ,
37     IOobject::NO_WRITE
40 volScalarField sf
42     fieldObject,
43     *secondMeshPtr
46 const scalarField& sfb = sf.boundaryField()[patchi];
47 const polyBoundaryMesh& bMesh = secondMeshPtr->boundaryMesh();
49 if (which_type == Z_TRI03)
51     label counter = 1;
52     for (label facei=0; facei<sfb.size(); facei++)
53     {
54         label nPoints = bMesh[patchi][facei].size();
55         if (nPoints == 3)
56         {
57             var_array[counter++] = sfb[facei];
58         }
59     }
62 if (which_type == Z_QUA04)
64     label counter = 1;
65     for (label facei=0; facei<sfb.size(); facei++)
66     {
67         label nPoints = bMesh[patchi][facei].size();
68         if (nPoints == 4)
69         {
70             var_array[counter++] = sfb[facei];
71         }
72     }
75 if (which_type == Z_NSIDED)
77     label counter = 1;
78     for (label facei=0; facei<sfb.size(); facei++)
79     {
80         label nPoints = bMesh[patchi][facei].size();
81         if ((nPoints != 3) && (nPoints != 4))
82         {
83             var_array[counter++] = sfb[facei];
84         }
85     }