initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / postProcessing / graphics / ensightFoamReader / USERD_get_part_coords.H
blob54ab4da3af1d6b3bb67971a44448ac93fb49520e
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     {
18         //#       include "checkForNewMesh.H"
20         const vectorField& points = meshPtr->points();
21         label nPoints = points.size();
22         
23         for (label indx=0; indx<nPoints; indx++)
24         {
25             coord_array[0][indx+1] = (float)points[indx].x();
26             coord_array[1][indx+1] = (float)points[indx].y();
27             coord_array[2][indx+1] = (float)points[indx].z();
28         }
29     }
30     else if (part_number < nPatches+2)
31     {
33         //#       include "checkForNewMesh.H"
35         label patchi = part_number-2;
36         const polyBoundaryMesh& bMesh = meshPtr->boundaryMesh();
37         const vectorField& points = bMesh[patchi].points();
38         label nPoints = points.size();
39         
40         for (label indx=0; indx<nPoints; indx++)
41         {
42             coord_array[0][indx+1] = (float)points[indx].x();
43             coord_array[1][indx+1] = (float)points[indx].y();
44             coord_array[2][indx+1] = (float)points[indx].z();
45         }
47     }
48     else if (part_number == nPatches+2)
49     {
51         label indx = 1;
53         for
54         (
55             Cloud<passiveParticle>::iterator elmnt = sprayPtr->begin();
56             elmnt != sprayPtr->end();
57             ++elmnt
58         )
59         {
60             coord_array[0][indx] = (float)elmnt().position().x();
61             coord_array[1][indx] = (float)elmnt().position().y();
62             coord_array[2][indx] = (float)elmnt().position().z();
63             indx++;
64         }
66     }
67     else
68     {
69         return Z_ERR;
70     }
72 #ifdef ENSIGHTDEBUG
73     Info << "Leaving: USERD_get_part_coords" << endl << flush;
74 #endif
76     return Z_OK;