USERD_get_var_value_at_specific.H
Go to the documentation of this file.
1 //======================================================================
3 (
4  int which_var,
5  int which_node_or_elem,
6  int which_part,
7  int which_elem_type,
8  int time_step,
9  float values[3],
10  int imag_data
11 )
12 {
13 #ifdef ENSIGHTDEBUG
14  Info<< "Entering: USERD_get_var_value_at_specific" << endl
15  << flush;
16 #endif
17  // Not sure if it is 0 or 1 based
18 
19  label nNode = which_node_or_elem;
20  label nVar = which_var - 1;
21 
22  fvMesh& mesh = *meshPtr;
23 
24  if (nVar < Num_variables - nSprayVariables)
25  {
26  Time& runTime = *runTimePtr;
27 
28  IOobject fieldObject
29  (
30  fieldNames[var2field[nVar]],
31  runTime.timeName(),
32  mesh,
33  IOobject::MUST_READ,
34  IOobject::NO_WRITE
35  );
36 
37  if (isScalar[nVar])
38  {
40  values[0] = scalarField[nNode];
41  }
42  else if (isVector[nVar])
43  {
45  values[0] = vectorField[nNode].x();
46  values[1] = vectorField[nNode].y();
47  values[2] = vectorField[nNode].z();
48  }
49  else
50  {
51  Info<< "ERROR in USERD_get_variable_value_at_specific. "
52  << "No available variable???"
53  << endl;
54  return Z_ERR;
55  }
56  }
57  else
58  {
59  Info<< "This functionality is not implemented yet."
60  << endl;
61  return Z_ERR;
62  }
63 
64 
65 #ifdef ENSIGHTDEBUG
66  Info<< "Leaving: USERD_get_var_value_at_specific" << endl
67  << flush;
68 #endif
69  return Z_OK;
70 }
static int Num_variables
Definition: globalFoam.H:20
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
int USERD_get_var_value_at_specific(int which_var, int which_node_or_elem, int which_part, int which_elem_type, int time_step, float values[3], int imag_data)
static fvMesh * meshPtr
Definition: globalFoam.H:52
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
volVectorField vectorField(fieldObject, mesh)
IOobject fieldObject(fieldNames[var2field[nVar]], runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE)
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
static bool isVector[maxNames]
Definition: globalFoam.H:28
static List< word > fieldNames
Definition: globalFoam.H:46
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
dynamicFvMesh & mesh
static label nSprayVariables
Definition: globalFoam.H:24
static Time * runTimePtr
Definition: globalFoam.H:51
volScalarField scalarField(fieldObject, mesh)
Ostream & flush(Ostream &os)
Flush stream.
Definition: Ostream.H:245
messageStream Info
static label var2field[maxNames]
Definition: globalFoam.H:49
static bool isScalar[maxNames]
Definition: globalFoam.H:27