BUGFIX: Uninitialised member variables
[foam-extend-3.2.git] / applications / utilities / postProcessing / graphics / newEnsightFoamReader / USERD_get_part_coords.H
blobd16003747c9d7a9a749da0051444b7cf6aa06a15
1 // Note: coord_array is 1-based.
3 int USERD_get_part_coords
5     int part_number,
6     float **coord_array
10 #ifdef ENSIGHTDEBUG
11     Info << "Entering: USERD_get_part_coords" << endl <<
12         "part_number = " << part_number << endl << flush;
13 #endif
15     if (part_number == 1)
16     {
17         //#       include "checkForNewMesh.H"
19         const vectorField& points = meshPtr->points();
20         label nPoints = points.size();
22         for (label indx=0; indx<nPoints; indx++)
23         {
24             coord_array[0][indx+1] = scalingFactor*(float)points[indx].x();
25             coord_array[1][indx+1] = scalingFactor*(float)points[indx].y();
26             coord_array[2][indx+1] = scalingFactor*(float)points[indx].z();
27         }
28     }
29     else if (part_number < nPatches+2)
30     {
31         //#       include "checkForNewMesh.H"
33         label patchi = part_number-2;
34         const polyBoundaryMesh& bMesh = meshPtr->boundaryMesh();
35         const vectorField& points = bMesh[patchi].points();
36         label nPoints = points.size();
38         for (label indx=0; indx<nPoints; indx++)
39         {
40             coord_array[0][indx+1] = scalingFactor*(float)points[indx].x();
41             coord_array[1][indx+1] = scalingFactor*(float)points[indx].y();
42             coord_array[2][indx+1] = scalingFactor*(float)points[indx].z();
43         }
45     }
46     else if (sprayPtr && part_number == nPatches+2)
47     {
48         label indx = 1;
50         for
51         (
52             Cloud<passiveParticle>::iterator elmnt = sprayPtr->begin();
53             elmnt != sprayPtr->end();
54             ++elmnt
55         )
56         {
57             coord_array[0][indx] = scalingFactor*(float)elmnt().position().x();
58             coord_array[1][indx] = scalingFactor*(float)elmnt().position().y();
59             coord_array[2][indx] = scalingFactor*(float)elmnt().position().z();
60             indx++;
61         }
62     }
63     else if
64     (
65         secondMeshPtr
66      && part_number == secondMeshPartNum
67     )
68     {
69         const vectorField& points = secondMeshPtr->points();
70         label nPoints = points.size();
72         for (label indx=0; indx<nPoints; indx++)
73         {
74             coord_array[0][indx+1] = scalingFactor*(float)points[indx].x();
75             coord_array[1][indx+1] = scalingFactor*(float)points[indx].y();
76             coord_array[2][indx+1] = scalingFactor*(float)points[indx].z();
77         }
78     }
79     else if
80     (
81         secondMeshPtr
82      && part_number <= secondMeshPartNum + nSecondMeshPatches
83     )
84     {
85         label patchi = part_number - secondMeshPartNum - 1;
87         const polyBoundaryMesh& bMesh = secondMeshPtr->boundaryMesh();
88         const vectorField& points = bMesh[patchi].points();
89         label nPoints = points.size();
91         for (label indx=0; indx<nPoints; indx++)
92         {
93             coord_array[0][indx+1] = scalingFactor*(float)points[indx].x();
94             coord_array[1][indx+1] = scalingFactor*(float)points[indx].y();
95             coord_array[2][indx+1] = scalingFactor*(float)points[indx].z();
96         }
97     }
98     else if
99     (
100         faMeshPtr
101      && part_number == Numparts_available
102     )
103     {
104         const vectorField& points = faMeshPtr->points();
105         label nPoints = points.size();
107         for (label indx=0; indx<nPoints; indx++)
108         {
109             coord_array[0][indx+1] = scalingFactor*(float)points[indx].x();
110             coord_array[1][indx+1] = scalingFactor*(float)points[indx].y();
111             coord_array[2][indx+1] = scalingFactor*(float)points[indx].z();
112         }
113     }
114     else
115     {
116         return Z_ERR;
117     }
119 #ifdef ENSIGHTDEBUG
120     Info << "Leaving: USERD_get_part_coords" << endl << flush;
121 #endif
123     return Z_OK;