Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / utilities / postProcessing / graphics / ensightFoamReader / USERD_get_var_value_at_specific.H
blob4691428ae227f65b76ca4cc594fa3668f4d6d199
1 //======================================================================
2 int USERD_get_var_value_at_specific
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
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
19     label nNode = which_node_or_elem;
20     label nVar = which_var - 1;
22     fvMesh& mesh = *meshPtr;
24     if (nVar < Num_variables - nSprayVariables)
25     {
26         Time& runTime = *runTimePtr;
28         IOobject fieldObject
29         (
30             fieldNames[var2field[nVar]],
31             runTime.timeName(),
32             mesh,
33             IOobject::MUST_READ,
34             IOobject::NO_WRITE
35         );
37         if (isScalar[nVar])
38         {
39             volScalarField scalarField(fieldObject,mesh);
40             values[0] = scalarField[nNode];
41         }
42         else if (isVector[nVar])
43         {
44             volVectorField vectorField(fieldObject,mesh);
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     }
65 #ifdef ENSIGHTDEBUG
66     Info << "Leaving: USERD_get_var_value_at_specific" << endl
67         << flush;
68 #endif
69     return Z_OK;