getFieldScalar.H
Go to the documentation of this file.
2 {
3  return Z_UNDEF;
4 }
5 
6 typeIOobject<volScalarField> fieldObjectPtr
7 (
9  runTime.name(),
10  mesh,
11  IOobject::NO_READ
12 );
13 
14 if (!fieldObjectPtr.headerOk())
15 {
16  return Z_UNDEF;
17 }
18 
19 IOobject fieldObject
20 (
22  runTime.name(),
23  mesh,
24  IOobject::MUST_READ,
25  IOobject::NO_WRITE
26 );
27 
29 (
31  mesh
32 );
33 
34 const cellShapeList& cellShapes = meshPtr->cellShapes();
35 
36 // hexa's
37 if (which_type == Z_HEX08)
38 {
39  const cellModel& hex = *(cellModeller::lookup("hex"));
40  // const cellModel& wedge = *(cellModeller::lookup("wedge"));
41 
42  label counter = 1;
43  for (label celli=0; celli<nCells; celli++)
44  {
45  const cellShape& cellShape = cellShapes[celli];
46  const cellModel& cellModel = cellShape.model();
47 
48  if (cellModel == hex) // || (cellModel == wedge))
49  {
50  var_array[counter++] = scalarField[celli];
51  }
52  }
53 }
54 
55 // penta's
56 if (which_type == Z_PEN06)
57 {
58  const cellModel& prism = *(cellModeller::lookup("prism"));
59 
60  label counter = 1;
61  for (label n=0; n<nCells; n++)
62  {
63  const cellShape& cellShape = cellShapes[n];
64  const cellModel& cellModel = cellShape.model();
65 
66  if (cellModel == prism)
67  {
68  var_array[counter++] = scalarField[n];
69  }
70  }
71 }
72 
73 // pyramids's
74 if (which_type == Z_PYR05)
75 {
76  const cellModel& pyr = *(cellModeller::lookup("pyr"));
77 
78  label counter = 1;
79  for (label n=0; n<nCells; n++)
80  {
81  const cellShape& cellShape = cellShapes[n];
82  const cellModel& cellModel = cellShape.model();
83 
84  if (cellModel == pyr)
85  {
86  var_array[counter++] = scalarField[n];
87  }
88  }
89 }
90 
91 // tet's
92 if (which_type == Z_TET04)
93 {
94  const cellModel& tet = *(cellModeller::lookup("tet"));
95 
96  label counter = 1;
97  for (label n=0; n<nCells; n++)
98  {
99  const cellShape& cellShape = cellShapes[n];
100  const cellModel& cellModel = cellShape.model();
101 
102  if (cellModel == tet)
103  {
104  var_array[counter++] = scalarField[n];
105  }
106  }
107 }
108 
109 if (which_type == Z_NFACED)
110 {
111  const cellList& cells = meshPtr->cells();
112 
113  label counter = 1;
114  for (label n=0; n<nCells; n++)
115  {
116  const labelList& points = cellShapes[n];
117  label nFacesInCell = cells[n].size();
118 
119  if ((nFacesInCell == 6) && (points.size() == 8))
120  {}
121  else if ((nFacesInCell == 4) && (points.size() == 4))
122  {}
123  else if (nFacesInCell == 5)
124  {
125  if (points.size() == 6)
126  {}
127  else if (points.size() == 5)
128  {}
129  else
130  {
131  var_array[counter++] = scalarField[n];
132  }
133  }
134  else
135  {
136  var_array[counter++] = scalarField[n];
137  }
138  }
139 
140 }
label n
const cellShapeList & cellShapes
IOobject fieldObject(fieldNames[var2field[nVar]], runTime.name(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE)
typeIOobject< volScalarField > fieldObjectPtr(fieldNames[var2field[nVar]], runTime.name(), mesh, IOobject::NO_READ)
volScalarField scalarField(fieldObject, mesh)
static int Num_variables
Definition: globalFoam.H:20
static fvMesh * meshPtr
Definition: globalFoam.H:52
static label nSprayVariables
Definition: globalFoam.H:24
static List< word > fieldNames
Definition: globalFoam.H:46
static label var2field[maxNames]
Definition: globalFoam.H:49
const pointField & points
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
IOstream & hex(IOstream &io)
Definition: IOstream.H:561
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:64