initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / postProcessing / graphics / ensightFoamReader / USERD_get_gold_part_build_info.H
blobca8da4727c38987c580690e034236a4d09e60054
1 //======================================================================
2 // this is based on the current time step.
3 //======================================================================
4 int USERD_get_gold_part_build_info
6     int *part_numbers,
7     int *part_types,
8     char *part_descriptions[Z_BUFL],
9     int *number_of_nodes,
10     int *number_of_elements[Z_MAXTYPE],
11     int *ijk_dimensions[3],
12     int *iblanking_options[6]
15 #ifdef ENSIGHTDEBUG
16     Info << "Entering: USERD_get_gold_part_build_info" << endl << flush;
17 #endif
19     //#   include "checkForNewMesh.H"
21     const cellShapeList& cellShapes = meshPtr->cellShapes();
22     const cellList& cells = meshPtr->cells();
24     label nCells = cells.size();
26     // all parts are unstructured
27     for (label n = 0; n<Numparts_available; n++)
28     {
29         part_numbers[n] = n + 1;
30         part_types[n]   = Z_UNSTRUCTURED;
31     }
33     strncpy(part_descriptions[0], meshName, Z_BUFL);
35     for(label i=0; i<nPatches; i++)
36     {
37         word patchName(meshPtr->boundary()[i].name());
38         strncpy(part_descriptions[i+1], patchName.c_str(), Z_BUFL);
39     }
41     label nHex08 = 0;
42     label nPen06 = 0;
43     label nPyr05 = 0;
44     label nTet04 = 0;
45     label nFaced = 0;
47     for (label n=0; n<nCells; n++)
48     {
49         label nFacesInCell = cells[n].size();
50         labelList points = cellShapes[n];
52         if ((nFacesInCell == 6) && (points.size() == 8))
53         {
54             nHex08++;
55         }
56         else if ((nFacesInCell == 4) && (points.size() == 4))
57         {
58             nTet04++;
59         }
60         else if (nFacesInCell == 5)
61         {
62             if (points.size() == 6)
63             {
64                 nPen06++;
65             }
66             else if (points.size() == 5)
67             {
68                 nPyr05++;
69             }
70             else
71             {
72                 nFaced++;
73             }
74         }
75         else
76         {
77             nFaced++;
78         }
79     }
81     for (label n=0; n < Z_MAXTYPE; n++)
82     {
83         for (label i=0; i<Numparts_available; i++)
84         {
85             number_of_elements[i][n] = 0;
86         }
87     }
89     number_of_elements[0][Z_TET04] = nTet04;
90     number_of_elements[0][Z_PYR05] = nPyr05;
91     number_of_elements[0][Z_HEX08] = nHex08;
92     number_of_elements[0][Z_PEN06] = nPen06;
93     number_of_elements[0][Z_NFACED] = nFaced;
95     /*
96     Info << "nTet04 = " << nTet04 << endl;
97     Info << "nPyr05 = " << nPyr05 << endl;
98     Info << "nHex08 = " << nHex08 << endl;
99     Info << "nPen06 = " << nPen06 << endl;
100     Info << "nFaced = " << nFaced << endl;
101         */
103     number_of_nodes[0] = meshPtr->nPoints();
105     const polyBoundaryMesh& bMesh = meshPtr->boundaryMesh();
107     for(label i=0; i<nPatches; i++)
108     {
109         label nTri03 = 0;
110         label nQuad04 = 0;
111         label nPoly = 0;
113         forAll(bMesh[i], n)
114         {
115             label nPoints = bMesh[i][n].size();
117             if (nPoints == 3)
118             {
119                 nTri03++;
120             }
121             else  if (nPoints == 4)
122             {
123                 nQuad04++;
124             }
125             else
126             {
127                 nPoly++;
128             }
129         }
131         number_of_elements[i+1][Z_TRI03] = nTri03;
132         number_of_elements[i+1][Z_QUA04] = nQuad04;
133         number_of_elements[i+1][Z_NSIDED] = nPoly;
135         number_of_nodes[i+1] = bMesh[i].points().size();
136     }
138     if (Numparts_available > nPatches+1)
139     {
140         strncpy
141         (
142             part_descriptions[nPatches+1],
143             cloud::prefix.c_str(),
144             Z_BUFL
145         );
146         number_of_elements[nPatches+1][Z_POINT] = sprayPtr->size();
147         number_of_nodes[nPatches+1] = sprayPtr->size();
148     }
150 #ifdef ENSIGHTDEBUG
151     Info << "Leaving: USERD_get_gold_part_build_info" << endl << flush;
152 #endif
154     return Z_OK;