OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

USERD_get_var_value_at_specific.H

Go to the documentation of this file.
00001 //======================================================================
00002 int USERD_get_var_value_at_specific
00003 (
00004     int which_var,
00005     int which_node_or_elem,
00006     int which_part,
00007     int which_elem_type,
00008     int time_step,
00009     float values[3],
00010     int imag_data
00011 )
00012 {
00013 #ifdef ENSIGHTDEBUG
00014     Info << "Entering: USERD_get_var_value_at_specific" << endl 
00015         << flush;
00016 #endif
00017     // Not sure if it is 0 or 1 based
00018 
00019     label nNode = which_node_or_elem;
00020     label nVar = which_var - 1;
00021 
00022     fvMesh& mesh = *meshPtr;
00023 
00024     if (nVar < Num_variables - nSprayVariables)
00025     {
00026         Time& runTime = *runTimePtr;
00027 
00028         IOobject fieldObject
00029         (
00030             fieldNames[var2field[nVar]],
00031             runTime.timeName(),
00032             mesh,
00033             IOobject::MUST_READ,
00034             IOobject::NO_WRITE
00035         );
00036 
00037         if (isScalar[nVar])
00038         {
00039             volScalarField scalarField(fieldObject,mesh);
00040             values[0] = scalarField[nNode];
00041         }
00042         else if (isVector[nVar])
00043         {
00044             volVectorField vectorField(fieldObject,mesh);
00045             values[0] = vectorField[nNode].x();
00046             values[1] = vectorField[nNode].y();
00047             values[2] = vectorField[nNode].z();
00048         }
00049         else
00050         {
00051             Info<< "ERROR in USERD_get_variable_value_at_specific. "
00052                 << "No available variable???"
00053                 << endl;
00054             return Z_ERR;
00055         }
00056     }
00057     else
00058     {
00059         Info<< "This functionality is not implemented yet."
00060             << endl;
00061         return Z_ERR;
00062     }
00063 
00064 
00065 #ifdef ENSIGHTDEBUG
00066     Info << "Leaving: USERD_get_var_value_at_specific" << endl 
00067         << flush;
00068 #endif
00069     return Z_OK;
00070 }
00071 
Copyright © 2000-2009 OpenCFD Ltd