USERD_get_gold_part_build_info.H
Go to the documentation of this file.
1 //======================================================================
2 // this is based on the current time step.
3 //======================================================================
5 (
6  int *part_numbers,
7  int *part_types,
8  char *part_descriptions[Z_BUFL],
9  int *number_of_nodes,
10  int *number_of_elements[Z_MAXTYPE],
11  int *ijk_dimensions[3],
12  int *iblanking_options[6]
13 )
14 {
15  #ifdef ENSIGHTDEBUG
16  Info<< "Entering: USERD_get_gold_part_build_info" << endl << flush;
17  #endif
18 
19  const cellShapeList& cellShapes = meshPtr->cellShapes();
20  const cellList& cells = meshPtr->cells();
21 
22  label nCells = cells.size();
23 
24  // all parts are unstructured
25  for (label n = 0; n<Numparts_available; n++)
26  {
27  part_numbers[n] = n + 1;
28  part_types[n] = Z_UNSTRUCTURED;
29  }
30 
31  strncpy(part_descriptions[0], meshName, Z_BUFL);
32 
33  for (label i=0; i<nPatches; i++)
34  {
35  word patchName(meshPtr->boundary()[i].name());
36  strncpy(part_descriptions[i+1], patchName.c_str(), Z_BUFL);
37  }
38 
39  label nHex08 = 0;
40  label nPen06 = 0;
41  label nPyr05 = 0;
42  label nTet04 = 0;
43  label nFaced = 0;
44 
45  for (label n=0; n<nCells; n++)
46  {
47  label nFacesInCell = cells[n].size();
48  labelList points = cellShapes[n];
49 
50  if ((nFacesInCell == 6) && (points.size() == 8))
51  {
52  nHex08++;
53  }
54  else if ((nFacesInCell == 4) && (points.size() == 4))
55  {
56  nTet04++;
57  }
58  else if (nFacesInCell == 5)
59  {
60  if (points.size() == 6)
61  {
62  nPen06++;
63  }
64  else if (points.size() == 5)
65  {
66  nPyr05++;
67  }
68  else
69  {
70  nFaced++;
71  }
72  }
73  else
74  {
75  nFaced++;
76  }
77  }
78 
79  for (label n=0; n < Z_MAXTYPE; n++)
80  {
81  for (label i=0; i<Numparts_available; i++)
82  {
83  number_of_elements[i][n] = 0;
84  }
85  }
86 
87  number_of_elements[0][Z_TET04] = nTet04;
88  number_of_elements[0][Z_PYR05] = nPyr05;
89  number_of_elements[0][Z_HEX08] = nHex08;
90  number_of_elements[0][Z_PEN06] = nPen06;
91  number_of_elements[0][Z_NFACED] = nFaced;
92 
93  /*
94  Info<< "nTet04 = " << nTet04 << endl;
95  Info<< "nPyr05 = " << nPyr05 << endl;
96  Info<< "nHex08 = " << nHex08 << endl;
97  Info<< "nPen06 = " << nPen06 << endl;
98  Info<< "nFaced = " << nFaced << endl;
99  */
100 
101  number_of_nodes[0] = meshPtr->nPoints();
102 
103  const polyBoundaryMesh& bMesh = meshPtr->boundaryMesh();
104 
105  for (label i=0; i<nPatches; i++)
106  {
107  label nTri03 = 0;
108  label nQuad04 = 0;
109  label nPoly = 0;
110 
111  forAll(bMesh[i], n)
112  {
113  label nPoints = bMesh[i][n].size();
114 
115  if (nPoints == 3)
116  {
117  nTri03++;
118  }
119  else if (nPoints == 4)
120  {
121  nQuad04++;
122  }
123  else
124  {
125  nPoly++;
126  }
127  }
128 
129  number_of_elements[i+1][Z_TRI03] = nTri03;
130  number_of_elements[i+1][Z_QUA04] = nQuad04;
131  number_of_elements[i+1][Z_NSIDED] = nPoly;
132 
133  number_of_nodes[i+1] = bMesh[i].points().size();
134  }
135 
136  if (Numparts_available > nPatches+1)
137  {
138  strncpy
139  (
140  part_descriptions[nPatches+1],
141  cloud::prefix.c_str(),
142  Z_BUFL
143  );
144  number_of_elements[nPatches+1][Z_POINT] = sprayPtr->size();
145  number_of_nodes[nPatches+1] = sprayPtr->size();
146  }
147 
148 #ifdef ENSIGHTDEBUG
149  Info<< "Leaving: USERD_get_gold_part_build_info" << endl << flush;
150 #endif
151 
152  return Z_OK;
153 }
label nPatches
Definition: readKivaGrid.H:402
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static fvMesh * meshPtr
Definition: globalFoam.H:52
static Cloud< passiveParticle > * sprayPtr
Definition: globalFoam.H:53
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
label size() const
Return the number of particles in the cloud.
Definition: Cloud.H:190
static int Numparts_available
Definition: globalFoam.H:13
int USERD_get_gold_part_build_info(int *part_numbers, int *part_types, char *part_descriptions[Z_BUFL], int *number_of_nodes, int *number_of_elements[Z_MAXTYPE], int *ijk_dimensions[3], int *iblanking_options[6])
List< cellShape > cellShapeList
List of cellShapes and PtrList of List of cellShape.
Definition: cellShapeList.H:43
static char meshName[]
Definition: globalFoam.H:7
const cellShapeList & cells
const pointField & points
label nPoints
const cellShapeList & cellShapes
List< label > labelList
A List of labels.
Definition: labelList.H:56
Ostream & flush(Ostream &os)
Flush stream.
Definition: Ostream.H:243
const polyBoundaryMesh & bMesh
messageStream Info
label n
List< cell > cellList
list of cells
Definition: cellList.H:42