File: USERD_get_var_by_component.H

package info (click to toggle)
openfoam 4.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 163,028 kB
  • ctags: 58,990
  • sloc: cpp: 830,760; sh: 10,227; ansic: 8,215; xml: 745; lex: 437; awk: 194; sed: 91; makefile: 77; python: 18
file content (103 lines) | stat: -rw-r--r-- 2,158 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
int USERD_get_var_by_component
(
    int which_variable,
    int which_part,
    int var_type,
    int which_type,
    int imag_data,
    int component,
    float *var_array
)
{
#ifdef ENSIGHTDEBUG
    Info<< "Entering: USERD_get_var_by_component" << endl
        << "which_variable = " << which_variable << endl
        << "which_part = " << which_part << endl
        << "var_type = " << var_type << endl
        << "which_type = " << which_type << endl
        << "component = " << component << endl
        << flush;
#endif

    label nVar = which_variable - 1;

    Time& runTime = *runTimePtr;

    fvMesh& mesh = *meshPtr;
    const cellShapeList& cells = mesh.cellShapes();

    label nCells = cells.size();

    if (var_type == Z_SCALAR)
    {
        if (which_part == 1)
        {
            #include "getFieldScalar.H"
        }
        else if (which_part < nPatches+2)
        {
            #include "getPatchFieldScalar.H"
        }
        else if (which_part == nPatches+2)
        {
            #include "getLagrangianScalar.H"
        }
        else
        {
            return Z_ERR;
        }
    }
    else if (var_type == Z_VECTOR)
    {
        if (which_part == 1)
        {
            #include "getFieldVector.H"
        }
        else if (which_part < nPatches+2)
        {
            #include "getPatchFieldVector.H"
        }
        else if (which_part == nPatches+2)
        {
            #include "getLagrangianVector.H"
        }
        else
        {
            return Z_ERR;
        }

    }
    else if (var_type == Z_TENSOR9)
    {
        // all tensor are treated as asymmetric tensors here

        if (which_part == 1)
        {
            #include "getFieldTensor.H"
        }
        else if (which_part < nPatches+2)
        {
            #include "getPatchFieldTensor.H"
        }
        else if (which_part == nPatches+2)
        {
            return Z_UNDEF;
        }
        else
        {
            return Z_ERR;
        }

    }
    else
    {
        return Z_UNDEF;
    }

#ifdef ENSIGHTDEBUG
    Info<< "Leaving: USERD_get_var_by_component" << endl
        << flush;
#endif

    return Z_OK;
}