Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / applications / utilities / postProcessing / graphics / ensightFoamReader / USERD_get_nfaced_nodes_per_face.H
blob335f928516a0f92fc2aa0b0f7f2df0fc5aaa151f
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
66     {
67         return Z_ERR;
68     }
69 #ifdef ENSIGHTDEBUG
70     Info<< "Exiting: USERD_get_nfaced_nodes_per_face" << endl
71         << flush;
72 #endif
73     return Z_OK;