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

USERD_get_var_by_component.H

Go to the documentation of this file.
00001 int USERD_get_var_by_component
00002 (
00003     int which_variable,
00004     int which_part,
00005     int var_type,
00006     int which_type,
00007     int imag_data,
00008     int component,
00009     float *var_array
00010 )
00011 {
00012 #ifdef ENSIGHTDEBUG
00013     Info << "Entering: USERD_get_var_by_component" << endl 
00014         << "which_variable = " << which_variable << endl
00015         << "which_part = " << which_part << endl
00016         << "var_type = " << var_type << endl
00017         << "which_type = " << which_type << endl
00018         << "component = " << component << endl
00019         << flush;
00020 #endif
00021 
00022     label nVar = which_variable - 1;
00023 
00024     Time& runTime = *runTimePtr;
00025 
00026     fvMesh& mesh = *meshPtr;
00027     const cellShapeList& cells = mesh.cellShapes();
00028 
00029     label nCells = cells.size();
00030 
00031     if (var_type == Z_SCALAR)
00032     {
00033         if (which_part == 1)
00034         {
00035 #           include "getFieldScalar.H"            
00036         }
00037         else if (which_part < nPatches+2)
00038         {
00039 #           include "getPatchFieldScalar.H"
00040         }
00041         else if (which_part == nPatches+2)
00042         {
00043 #           include "getLagrangianScalar.H"
00044         }
00045         else
00046         {
00047             return Z_ERR;
00048         }
00049     }
00050     else if (var_type == Z_VECTOR)
00051     {
00052         if (which_part == 1)
00053         {
00054 #           include "getFieldVector.H"            
00055         }
00056         else if (which_part < nPatches+2)
00057         {
00058 #           include "getPatchFieldVector.H"
00059         }
00060         else if (which_part == nPatches+2)
00061         {
00062 #           include "getLagrangianVector.H"
00063         }
00064         else
00065         {
00066             return Z_ERR;
00067         }
00068 
00069     }
00070     else if (var_type == Z_TENSOR9)
00071     {
00072         // all tensor are treated as asymmetric tensors here
00073         
00074         if (which_part == 1)
00075         {
00076 #           include "getFieldTensor.H"            
00077         }
00078         else if (which_part < nPatches+2)
00079         {
00080 #           include "getPatchFieldTensor.H"
00081         }
00082         else if (which_part == nPatches+2)
00083         {
00084             return Z_UNDEF;
00085         }
00086         else
00087         {
00088             return Z_ERR;
00089         }
00090 
00091     }
00092     else 
00093     {
00094         return Z_UNDEF;
00095     }
00096 
00097 #ifdef ENSIGHTDEBUG
00098     Info << "Leaving: USERD_get_var_by_component" << endl 
00099         << flush;
00100 #endif
00101 
00102     return Z_OK;
00103 }
Copyright © 2000-2009 OpenCFD Ltd