Forward compatibility: flex
[foam-extend-3.2.git] / applications / utilities / postProcessing / graphics / newEnsightFoamReader / USERD_get_nfaced_nodes_per_face.H
blob13d3c5664008c3c98563aaa0f802addefd54a1f0
2 int USERD_get_nfaced_nodes_per_face
4     int part_number,
5     int *nfaced_npf_array
8 #ifdef ENSIGHTDEBUG
9     Info << "Entering: USERD_get_nfaced_nodes_per_face"
10         << ", part_number = " << part_number
11         << endl
12         << flush;
13 #endif
15     if (part_number == 1)
16     {
17         const cellShapeList& cellShapes = meshPtr->cellShapes();
18         const cellList& cells = meshPtr->cells();
19         const faceList& faces = meshPtr->faces();
21         label nCells = cellShapes.size();
22         label nFaced = 0;
23         for (label n=0; n<nCells; n++)
24         {
25             label nFacesInCell = cells[n].size();
26             labelList points = cellShapes[n];
27             label nPoints = points.size();
29             if ((nFacesInCell == 6) && (nPoints == 8))
30             {}
31             else if ((nFacesInCell == 4) && (nPoints == 4))
32             {}
33             else if (nFacesInCell == 5)
34             {
35                 if (nPoints == 6)
36                 {}
37                 else if (nPoints == 5)
38                 {}
39                 else
40                 {
41                     for(label i=0; i<nFacesInCell; i++)
42                     {
43                         label facei = cells[n][i];
44                         label nFacePoints = faces[facei].size();
45                         nfaced_npf_array[nFaced++] = nFacePoints;
46                     }
47                 }
48             }
49             else
50             {
51                 for(label i=0; i<nFacesInCell; i++)
52                 {
53                     label facei = cells[n][i];
54                     label nFacePoints = faces[facei].size();
55                     nfaced_npf_array[nFaced++] = nFacePoints;
56                 }
57             }
58         }
60     }
61     else if (part_number < nPatches+2)
62     {
63         return Z_ERR;
64     }
65     else if (sprayPtr && part_number == nPatches+2)
66     {
67         return Z_ERR;
68     }
69     else if
70     (
71         secondMeshPtr
72      && part_number == secondMeshPartNum
73     )
74     {
75         const cellShapeList& cellShapes = secondMeshPtr->cellShapes();
76         const cellList& cells = secondMeshPtr->cells();
77         const faceList& faces = secondMeshPtr->faces();
79         label nCells = cellShapes.size();
80         label nFaced = 0;
81         for (label n=0; n<nCells; n++)
82         {
83             label nFacesInCell = cells[n].size();
84             labelList points = cellShapes[n];
85             label nPoints = points.size();
87             if ((nFacesInCell == 6) && (nPoints == 8))
88             {}
89             else if ((nFacesInCell == 4) && (nPoints == 4))
90             {}
91             else if (nFacesInCell == 5)
92             {
93                 if (nPoints == 6)
94                 {}
95                 else if (nPoints == 5)
96                 {}
97                 else
98                 {
99                     for(label i=0; i<nFacesInCell; i++)
100                     {
101                         label facei = cells[n][i];
102                         label nFacePoints = faces[facei].size();
103                         nfaced_npf_array[nFaced++] = nFacePoints;
104                     }
105                 }
106             }
107             else
108             {
109                 for(label i=0; i<nFacesInCell; i++)
110                 {
111                     label facei = cells[n][i];
112                     label nFacePoints = faces[facei].size();
113                     nfaced_npf_array[nFaced++] = nFacePoints;
114                 }
115             }
116         }
117     }
118     else if
119     (
120         secondMeshPtr
121      && part_number <= secondMeshPartNum + nSecondMeshPatches
122     )
123     {
124         return Z_ERR;
125     }
126     else if
127     (
128         faMeshPtr
129      && part_number <= Numparts_available
130     )
131     {
132         return Z_ERR;
133     }
134     else
135     {
136         return Z_ERR;
137     }
138 #ifdef ENSIGHTDEBUG
139     Info << "Exiting: USERD_get_nfaced_nodes_per_face" << endl
140         << flush;
141 #endif
142     return Z_OK;