USERD_get_part_coords.H
Go to the documentation of this file.
1 // Note: coord_array is 1-based.
2 
4 (
5  int part_number,
6  float **coord_array
7 )
8 {
9  #ifdef ENSIGHTDEBUG
10  Info<< "Entering: USERD_get_part_coords" << endl <<
11  "part_number = " << part_number << endl << flush;
12  #endif
13 
14  if (part_number == 1)
15  {
16  const vectorField& points = meshPtr->points();
17  label nPoints = points.size();
18 
19  for (label indx=0; indx<nPoints; indx++)
20  {
21  coord_array[0][indx+1] = float(points[indx].x());
22  coord_array[1][indx+1] = float(points[indx].y());
23  coord_array[2][indx+1] = float(points[indx].z());
24  }
25  }
26  else if (part_number < nPatches+2)
27  {
28  label patchi = part_number-2;
29  const polyBoundaryMesh& bMesh = meshPtr->boundaryMesh();
30  const vectorField& points = bMesh[patchi].points();
31  label nPoints = points.size();
32 
33  for (label indx=0; indx<nPoints; indx++)
34  {
35  coord_array[0][indx+1] = float(points[indx].x());
36  coord_array[1][indx+1] = float(points[indx].y());
37  coord_array[2][indx+1] = float(points[indx].z());
38  }
39 
40  }
41  else if (part_number == nPatches+2)
42  {
43  label indx = 1;
44 
45  forAllConstIter(Cloud<passiveParticle>, *sprayPtr, iter)
46  {
47  const point p = iter().position(*meshPtr);
48  coord_array[0][indx] = float(p.x());
49  coord_array[1][indx] = float(p.y());
50  coord_array[2][indx] = float(p.z());
51  indx++;
52  }
53 
54  }
55  else
56  {
57  return Z_ERR;
58  }
59 
60  #ifdef ENSIGHTDEBUG
61  Info<< "Leaving: USERD_get_part_coords" << endl << flush;
62  #endif
63 
64  return Z_OK;
65 }
scalar y
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:477
int USERD_get_part_coords(int part_number, float **coord_array)
volVectorField vectorField(fieldObject, mesh)
const polyBoundaryMesh & bMesh
label patchi
static Cloud< passiveParticle > * sprayPtr
Definition: globalFoam.H:53
static fvMesh * meshPtr
Definition: globalFoam.H:52
const pointField & points
label nPoints
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
messageStream Info
vector point
Point is a vector.
Definition: point.H:41
Ostream & flush(Ostream &os)
Flush stream.
Definition: Ostream.H:249
label nPatches
Definition: readKivaGrid.H:396
volScalarField & p