USERD_get_part_element_ids_by_type.H
Go to the documentation of this file.
2 (
3  int part_number,
4  int element_type,
5  int *elemid_array
6 )
7 {
8 
9 #ifdef ENSIGHTDEBUG
10  Info<< "Entering: USERD_get_part_element_ids_by_type" << endl
11  << "part_number = " << part_number << endl
12  << "element_type = " << element_type << endl << flush;
13 #endif
14 
15  if (part_number == 1)
16  {
17  const cellShapeList& cellShapes = meshPtr->cellShapes();
18  const cellList& cells = meshPtr->cells();
19 
20  label nCells = cells.size();
21 
22  label nPen06 = 0;
23  label nHex08 = 0;
24  label nPyr05 = 0;
25  label nTet04 = 0;
26  label nFaced = 0;
27 
28  if (element_type == Z_HEX08)
29  {
30  for (label n=0; n<nCells; n++)
31  {
32  label nFaces = cells[n].size();
34 
35  if ((nFaces == 6) && (points.size() == 8))
36  {
37  elemid_array[nHex08++] = n + 1;
38  }
39  }
40  }
41  else if (element_type == Z_PEN06)
42  {
43  for (label n=0; n<nCells; n++)
44  {
45  label nFaces = cells[n].size();
47 
48  if ((nFaces == 5) && (points.size() == 6))
49  {
50  elemid_array[nPen06++] = n + 1;
51  }
52  }
53  }
54  else if (element_type == Z_PYR05)
55  {
56  for (label n=0; n<nCells; n++)
57  {
58  label nFaces = cells[n].size();
60 
61  if ((nFaces == 5) && (points.size() == 5))
62  {
63  elemid_array[nPyr05++] = n + 1;
64  }
65  }
66  }
67  else if (element_type == Z_TET04)
68  {
69  for (label n=0; n<nCells; n++)
70  {
71  label nFaces = cells[n].size();
73 
74  if ((nFaces == 4) && (points.size() == 4))
75  {
76  elemid_array[nTet04++] = n + 1;
77  }
78  }
79  }
80  else if (element_type == Z_NFACED)
81  {
82  for (label n=0; n<nCells; n++)
83  {
84  label nFaces = cells[n].size();
86  if ((nFaces == 6) && (points.size() == 8))
87  {}
88  else if ((nFaces == 5) && (points.size() == 6))
89  {}
90  else if ((nFaces == 5) && (points.size() == 5))
91  {}
92  else if ((nFaces == 4) && (points.size() == 4))
93  {}
94  else
95  {
96  elemid_array[nFaced++] = n + 1;
97  }
98 
99  }
100  }
101  }
102  else if (part_number < nPatches+2)
103  {
104 
105  const polyBoundaryMesh& bMesh = meshPtr->boundaryMesh();
106  label patchi = part_number - 2;
107 
108  label nTri03 = 0;
109  label nQuad04 = 0;
110  label nPoly = 0;
111 
112  if (element_type == Z_TRI03)
113  {
114  forAll(bMesh[patchi], facei)
115  {
116  if (bMesh[patchi][facei].size() == 3)
117  {
118  elemid_array[nTri03++] = facei + 1;
119  }
120  }
121  }
122  else if (element_type == Z_QUA04)
123  {
124  forAll(bMesh[patchi], facei)
125  {
126  if (bMesh[patchi][facei].size() == 4)
127  {
128  elemid_array[nQuad04++] = facei + 1;
129  }
130  }
131  }
132  else if (element_type == Z_NSIDED)
133  {
134  forAll(bMesh[patchi], facei)
135  {
136  label nPoints = bMesh[patchi][facei].size();
137  if ((nPoints != 3) && (nPoints != 4))
138  {
139  elemid_array[nPoly++] = facei + 1;
140  }
141  }
142  }
143 
144  }
145  else if (part_number == nPatches+2)
146  {
147  forAll(*sprayPtr, n)
148  {
149  elemid_array[n] = n + 1;
150  }
151  }
152  else
153  {
154  return Z_ERR;
155  }
156 
157 #ifdef ENSIGHTDEBUG
158  Info<< "Leaving: USERD_get_part_element_ids_by_type" << endl << flush;
159 #endif
160 
161  return Z_OK;
162 }
label n
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
int USERD_get_part_element_ids_by_type(int part_number, int element_type, int *elemid_array)
const cellShapeList & cellShapes
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
const cellShapeList & cells
List< cellShape > cellShapeList
List of cellShapes and PtrList of List of cellShape.
Definition: cellShapeList.H:43
List< label > labelList
A List of labels.
Definition: labelList.H:56
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
List< cell > cellList
list of cells
Definition: cellList.H:42
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
messageStream Info
Ostream & flush(Ostream &os)
Flush stream.
Definition: Ostream.H:249
label nPatches
Definition: readKivaGrid.H:396