BUGFIX: Uninitialised member variables
[foam-extend-3.2.git] / applications / utilities / postProcessing / graphics / newEnsightFoamReader / USERD_get_gold_part_build_info.H
blob26501f5558c107c48203a144049e1652097b9021
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     if (sprayPtr)
140     {
141         strncpy(part_descriptions[nPatches+1], sprayName.c_str(), Z_BUFL);
142         number_of_elements[nPatches+1][Z_POINT] = sprayPtr->size();
143         number_of_nodes[nPatches+1] = sprayPtr->size();
144     }
148     // Second mesh
149     if(secondMeshPtr)
150     {
151         const cellShapeList& cellShapes = secondMeshPtr->cellShapes();
152         const cellList& cells = secondMeshPtr->cells();
154         label nCells = cells.size();
156         strncpy
157         (
158             part_descriptions[secondMeshPartNum-1],
159             secondMeshName,
160             Z_BUFL
161         );
163         for(label i=0; i<nSecondMeshPatches; i++)
164         {
165             word patchName(secondMeshPtr->boundary()[i].name());
166             strncpy
167             (
168                 part_descriptions[i+secondMeshPartNum],
169                 patchName.c_str(),
170                 Z_BUFL
171             );
172         }
174         label nHex08 = 0;
175         label nPen06 = 0;
176         label nPyr05 = 0;
177         label nTet04 = 0;
178         label nFaced = 0;
180         for (label n=0; n<nCells; n++)
181         {
182             label nFacesInCell = cells[n].size();
183             labelList points = cellShapes[n];
185             if ((nFacesInCell == 6) && (points.size() == 8))
186             {
187                 nHex08++;
188             }
189             else if ((nFacesInCell == 4) && (points.size() == 4))
190             {
191                 nTet04++;
192             }
193             else if (nFacesInCell == 5)
194             {
195                 if (points.size() == 6)
196                 {
197                     nPen06++;
198                 }
199                 else if (points.size() == 5)
200                 {
201                     nPyr05++;
202                 }
203                 else
204                 {
205                     nFaced++;
206                 }
207             }
208             else
209             {
210                 nFaced++;
211             }
212         }
214         number_of_elements[secondMeshPartNum-1][Z_TET04] = nTet04;
215         number_of_elements[secondMeshPartNum-1][Z_PYR05] = nPyr05;
216         number_of_elements[secondMeshPartNum-1][Z_HEX08] = nHex08;
217         number_of_elements[secondMeshPartNum-1][Z_PEN06] = nPen06;
218         number_of_elements[secondMeshPartNum-1][Z_NFACED] = nFaced;
221         number_of_nodes[secondMeshPartNum-1] = secondMeshPtr->nPoints();
223         const polyBoundaryMesh& bMesh = secondMeshPtr->boundaryMesh();
225         for(label i=0; i<nSecondMeshPatches; i++)
226         {
227             label nTri03 = 0;
228             label nQuad04 = 0;
229             label nPoly = 0;
231             forAll(bMesh[i], n)
232             {
233                 label nPoints = bMesh[i][n].size();
235                 if (nPoints == 3)
236                 {
237                     nTri03++;
238                 }
239                 else  if (nPoints == 4)
240                 {
241                     nQuad04++;
242                 }
243                 else
244                 {
245                     nPoly++;
246                 }
247             }
249             number_of_elements[i+secondMeshPartNum][Z_TRI03] = nTri03;
250             number_of_elements[i+secondMeshPartNum][Z_QUA04] = nQuad04;
251             number_of_elements[i+secondMeshPartNum][Z_NSIDED] = nPoly;
253             number_of_nodes[i+secondMeshPartNum] = bMesh[i].points().size();
254         }
255     }
259     // Finite area mesh
260     if(faMeshPtr)
261     {
262         const faceList& faces = faMeshPtr->faces();
264         label nFaces = faces.size();
266         label faMeshPartNum = Numparts_available;
268         strncpy
269         (
270             part_descriptions[faMeshPartNum-1],
271             faMeshName,
272             Z_BUFL
273         );
275         label nTri03 = 0;
276         label nQuad04 = 0;
277         label nPoly = 0;
279         for (label n=0; n<nFaces; n++)
280         {
281             label nPoints = faces[n].size();
283             if (nPoints == 3)
284             {
285                 nTri03++;
286             }
287             else  if (nPoints == 4)
288             {
289                 nQuad04++;
290             }
291             else
292             {
293                 nPoly++;
294             }
295         }
297         number_of_elements[faMeshPartNum-1][Z_TRI03] = nTri03;
298         number_of_elements[faMeshPartNum-1][Z_QUA04] = nQuad04;
299         number_of_elements[faMeshPartNum-1][Z_NSIDED] = nPoly;
301         number_of_nodes[faMeshPartNum-1] = faMeshPtr->nPoints();
302     }
306 #ifdef ENSIGHTDEBUG
307     Info << "Leaving: USERD_get_gold_part_build_info" << endl << flush;
308 #endif
310     return Z_OK;