initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / postProcessing / graphics / ensightFoamReader / USERD_get_var_by_component.H
blobbf811b73220d954f72cae8b1afb9986c661024a0
1 int USERD_get_var_by_component
3     int which_variable,
4     int which_part,
5     int var_type,
6     int which_type,
7     int imag_data,
8     int component,
9     float *var_array
12 #ifdef ENSIGHTDEBUG
13     Info << "Entering: USERD_get_var_by_component" << endl 
14         << "which_variable = " << which_variable << endl
15         << "which_part = " << which_part << endl
16         << "var_type = " << var_type << endl
17         << "which_type = " << which_type << endl
18         << "component = " << component << endl
19         << flush;
20 #endif
22     label nVar = which_variable - 1;
24     Time& runTime = *runTimePtr;
26     fvMesh& mesh = *meshPtr;
27     const cellShapeList& cells = mesh.cellShapes();
29     label nCells = cells.size();
31     if (var_type == Z_SCALAR)
32     {
33         if (which_part == 1)
34         {
35 #           include "getFieldScalar.H"            
36         }
37         else if (which_part < nPatches+2)
38         {
39 #           include "getPatchFieldScalar.H"
40         }
41         else if (which_part == nPatches+2)
42         {
43 #           include "getLagrangianScalar.H"
44         }
45         else
46         {
47             return Z_ERR;
48         }
49     }
50     else if (var_type == Z_VECTOR)
51     {
52         if (which_part == 1)
53         {
54 #           include "getFieldVector.H"            
55         }
56         else if (which_part < nPatches+2)
57         {
58 #           include "getPatchFieldVector.H"
59         }
60         else if (which_part == nPatches+2)
61         {
62 #           include "getLagrangianVector.H"
63         }
64         else
65         {
66             return Z_ERR;
67         }
69     }
70     else if (var_type == Z_TENSOR9)
71     {
72         // all tensor are treated as asymmetric tensors here
73         
74         if (which_part == 1)
75         {
76 #           include "getFieldTensor.H"            
77         }
78         else if (which_part < nPatches+2)
79         {
80 #           include "getPatchFieldTensor.H"
81         }
82         else if (which_part == nPatches+2)
83         {
84             return Z_UNDEF;
85         }
86         else
87         {
88             return Z_ERR;
89         }
91     }
92     else 
93     {
94         return Z_UNDEF;
95     }
97 #ifdef ENSIGHTDEBUG
98     Info << "Leaving: USERD_get_var_by_component" << endl 
99         << flush;
100 #endif
102     return Z_OK;