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 / newEnsightFoamReader / USERD_get_gold_variable_info.H
bloba9dd6490b9249c76c94c05460b7417070362d20c
1 //======================================================================
2 //  variable 1 - var[0] , i.e variables are zero based
3 //======================================================================
4 int USERD_get_gold_variable_info
6     char **var_description,
7     char **var_filename,
8     int *var_type,
9     int *var_classify,
10     int *var_complex,
11     char **var_ifilename,
12     float *var_freq,
13     int *var_contran,
14     int *var_timeset
17 #ifdef ENSIGHTDEBUG
18     Info << "Entering: USERD_get_gold_variable_info" << endl
19         << flush;
20 #endif
22     label offset = Num_variables - nSprayVariables
23         - nSecondMeshVariables - nFaMeshVariables;
25     // scalars first ...
26     for (label n=0; n<offset; n++)
27     {
28         if (isScalar[var2field[n]])
29         {
30             var_type[n]     = Z_SCALAR;
31             var_classify[n] = Z_PER_ELEM;
32             var_complex[n]  = FALSE;
33             var_timeset[n]  = 1;
34             strncpy
35             (
36                 var_description[n],
37                 fieldNames[var2field[n]].c_str(),
38                 Z_BUFL
39             );
40         }
41     }
43     // ... and then vectors
44     for (label n=0; n<offset; n++)
45     {
46         if (isVector[var2field[n]])
47         {
48             var_type[n]     = Z_VECTOR;
49             var_classify[n] = Z_PER_ELEM;
50             var_complex[n]  = FALSE;
51             var_timeset[n]  = 1;
52             strncpy
53             (
54                 var_description[n],
55                 fieldNames[var2field[n]].c_str(),
56                 Z_BUFL
57             );
58         }
59     }
61     // ... and tensors (NB! all tensors are treated as asymmetric)
62     for (label n=0; n<offset; n++)
63     {
64         if (isTensor[var2field[n]])
65         {
66             var_type[n]     = Z_TENSOR9;
67             var_classify[n] = Z_PER_ELEM;
68             var_complex[n]  = FALSE;
69             var_timeset[n]  = 1;
70             strncpy
71             (
72                 var_description[n],
73                 fieldNames[var2field[n]].c_str(),
74                 Z_BUFL
75             );
76         }
77     }
79 //     if (Numparts_available > nPatches+1)
80     if (sprayPtr)
81     {
82         label Ns = lagrangianScalarNames.size();
84         for (label n=0; n<Ns; n++)
85         {
86             var_type[offset + n] = Z_SCALAR;
87             var_classify[offset + n] = Z_PER_ELEM;
88             var_complex[offset + n] = FALSE;
89             var_timeset[offset + n] = 1;
90             word name = parcelPrepend + lagrangianScalarNames[n];
91             strncpy
92             (
93                 var_description[offset + n],
94                 name.c_str(),
95                 Z_BUFL
96             );
97         }
99         for (label n=0; n<lagrangianVectorNames.size(); n++)
100         {
101             var_type[offset + Ns + n] = Z_VECTOR;
102             var_classify[offset + Ns + n] = Z_PER_ELEM;
103             var_complex[offset + Ns + n] = FALSE;
104             var_timeset[offset + Ns  + n] = 1;
105             word name = parcelPrepend + lagrangianVectorNames[n];
106             strncpy
107             (
108                 var_description[offset + Ns + n],
109                 name.c_str(),
110                 Z_BUFL
111             );
112         }
113     }
117     // Second mesh variables
118     if(secondMeshPtr)
119     {
120     label start = Num_variables - nSecondMeshVariables - nFaMeshVariables;
122     label offset = Num_variables - nFaMeshVariables;
124     // scalars first ...
125     for (label n=start; n<offset; n++)
126     {
127         if (secondMeshIsScalar[secondMeshVar2field[n-start]])
128         {
129             var_type[n]     = Z_SCALAR;
130             var_classify[n] = Z_PER_ELEM;
131             var_complex[n]  = FALSE;
132             var_timeset[n]  = 1;
133             strncpy
134             (
135                 var_description[n],
136                 secondMeshFieldNames[secondMeshVar2field[n-start]].c_str(),
137                 Z_BUFL
138             );
139         }
140     }
142     // ... and then vectors
143     for (label n=start; n<offset; n++)
144     {
145         if (secondMeshIsVector[secondMeshVar2field[n-start]])
146         {
147             var_type[n]     = Z_VECTOR;
148             var_classify[n] = Z_PER_ELEM;
149             var_complex[n]  = FALSE;
150             var_timeset[n]  = 1;
151             strncpy
152             (
153                 var_description[n],
154                 secondMeshFieldNames[secondMeshVar2field[n-start]].c_str(),
155                 Z_BUFL
156             );
157         }
158     }
160     // ... and tensors (NB! all tensors are treated as asymmetric)
161     for (label n=start; n<offset; n++)
162     {
163         if (secondMeshIsTensor[secondMeshVar2field[n-start]])
164         {
165             var_type[n]     = Z_TENSOR9;
166             var_classify[n] = Z_PER_ELEM;
167             var_complex[n]  = FALSE;
168             var_timeset[n]  = 1;
169             strncpy
170             (
171                 var_description[n],
172                 secondMeshFieldNames[secondMeshVar2field[n-start]].c_str(),
173                 Z_BUFL
174             );
175         }
176     }
178     }
181     // Finite area mesh variables
182     if(faMeshPtr)
183     {
184         label start = Num_variables - nFaMeshVariables;
186         label offset = Num_variables;
188         // scalars first ...
189         for (label n=start; n<offset; n++)
190         {
191             if (faMeshIsScalar[faMeshVar2field[n-start]])
192             {
193                 var_type[n]     = Z_SCALAR;
194                 var_classify[n] = Z_PER_ELEM;
195                 var_complex[n]  = FALSE;
196                 var_timeset[n]  = 1;
197                 strncpy
198                 (
199                     var_description[n],
200                     faMeshFieldNames[faMeshVar2field[n-start]].c_str(),
201                     Z_BUFL
202                 );
204                 Info << "Scalar: " << var_description[n] << endl;
205             }
206         }
208         // ... and then vectors
209         for (label n=start; n<offset; n++)
210         {
211             if (faMeshIsVector[faMeshVar2field[n-start]])
212             {
213                 var_type[n]     = Z_VECTOR;
214                 var_classify[n] = Z_PER_ELEM;
215                 var_complex[n]  = FALSE;
216                 var_timeset[n]  = 1;
217                 strncpy
218                 (
219                     var_description[n],
220                     faMeshFieldNames[faMeshVar2field[n-start]].c_str(),
221                     Z_BUFL
222                 );
224                 Info << "Vector: " << var_description[n] << endl;
225             }
226         }
228         // ... and tensors (NB! all tensors are treated as asymmetric)
229         for (label n=start; n<offset; n++)
230         {
231             if (faMeshIsTensor[faMeshVar2field[n-start]])
232             {
233                 var_type[n]     = Z_TENSOR9;
234                 var_classify[n] = Z_PER_ELEM;
235                 var_complex[n]  = FALSE;
236                 var_timeset[n]  = 1;
237                 strncpy
238                 (
239                     var_description[n],
240                     faMeshFieldNames[faMeshVar2field[n-start]].c_str(),
241                     Z_BUFL
242                 );
244                 Info << "Tensor: " << var_description[n] << endl;
245             }
246         }
247     }
249 #ifdef ENSIGHTDEBUG
250     Info << "Leaving: USERD_get_gold_variable_info" << endl
251         << flush;
252 #endif
254     return Z_OK;