Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / applications / utilities / postProcessing / graphics / ensightFoamReader / USERD_get_part_coords.H
blobde8c90d7aef90cd0687ac43d80a70b5927c391ce
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();
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();
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     {
50         label indx = 1;
52         forAllConstIter(Cloud<passiveParticle>, *sprayPtr, iter)
53         {
54             coord_array[0][indx] = (float)iter().position().x();
55             coord_array[1][indx] = (float)iter().position().y();
56             coord_array[2][indx] = (float)iter().position().z();
57             indx++;
58         }
60     }
61     else
62     {
63         return Z_ERR;
64     }
66 #ifdef ENSIGHTDEBUG
67     Info<< "Leaving: USERD_get_part_coords" << endl << flush;
68 #endif
70     return Z_OK;