cloudy
trunk
source
parse_trace.cpp
Go to the documentation of this file.
1
/* This file is part of Cloudy and is copyright (C)1978-2013 by Gary J. Ferland and
2
* others. For conditions of distribution and use see copyright notice in license.txt */
3
/*ParseTrace read in options off the trace command line */
4
#include "
cddefines.h
"
5
#include "
iterations.h
"
6
#include "
geometry.h
"
7
#include "
trace.h
"
8
#include "
iso.h
"
9
#include "
parser.h
"
10
11
void
ParseTrace
(
Parser
&p )
12
{
13
DEBUG_ENTRY
(
"ParseTrace()"
);
14
15
/* turn on trace at a certain zone; .LE.0 or none for starting trace
16
* optional second number is iteration to start debugger */
17
18
/* generate string that says debug turned on - this is caught by perl script
19
* if "no print" occurs on line do not print it - there is one sim in the
20
* test suite which tests debug print and do not want to trigger comment
21
* that debug prints are accidentally turned on */
22
if
( !p.
nMatch
(
"NO PR"
) )
23
fprintf(
ioQQQ
,
"DEBUG trace output turned on.\n"
);
24
25
/* set initially false, in case we do not turn on trace until
26
* later iteration or zone */
27
trace
.
lgTrace
=
false
;
28
/* this is which zone to turn on */
29
trace
.
nznbug
= (long)p.
FFmtRead
();
30
if
( p.
lgEOL
() )
31
trace
.
lgTrace
=
true
;
32
33
/* this is which iteration to turn on */
34
trace
.
npsbug
= (
long
)p.
FFmtRead
();
35
if
( p.
lgEOL
() )
36
trace
.
npsbug
= 1;
37
38
/* turn trace on now if no numbers on line */
39
if
(
trace
.
nznbug
== 0 &&
trace
.
npsbug
<= 1 )
40
{
41
trace
.
lgTrace
=
true
;
42
geometry
.
nprint
= 1;
43
iterations
.
IterPrnt
[0] = 1;
44
}
45
46
/* trace convergence is a special command,
47
* only convergence loops, not full trace */
48
if
( p.
nMatch
(
"CONV"
) )
49
{
50
/* check for keyword, if not present
51
* then set to very high level of debugging - initially set to negative number, a sign
52
* that trace is not on yet, but to turn on trace convergence when we hit the right zone */
53
/* 1 ConvPresTempEdenIoniz */
54
if
( p.
nMatch
(
"PRES"
) )
55
trace
.
nTrConvg
= -1;
56
/* 2 ConvTempEdenIoniz*/
57
else
if
( p.
nMatch
(
"TEMP"
) )
58
trace
.
nTrConvg
= -2;
59
/* 3 ConvEdenIoniz*/
60
else
if
( p.
nMatch
(
"EDEN"
) )
61
trace
.
nTrConvg
= -3;
62
/* 4 ConvIoniz*/
63
else
if
( p.
nMatch
(
"IONI"
) )
64
trace
.
nTrConvg
= -4;
65
/* 5 below ConvBase*/
66
/* > 5 all levels*/
67
else
68
trace
.
nTrConvg
= -100;
69
70
/* above set trace level to negative number - this will not trigger
71
* trace output - turn trace on now if no zone or iteration on line */
72
if
(
trace
.
nznbug
== 0 &&
trace
.
npsbug
<= 1 )
73
trace
.
nTrConvg
*= -1;
74
75
/* turn off normal trace parameters, this is a special case */
76
trace
.
lgTrace
=
false
;
77
/*trace.nznbug = 10000;*/
78
geometry
.
nprint
= 10000;
79
iterations
.
IterPrnt
[0] = 10000;
80
81
/* this is an option to also turn on ots rate debug prints */
82
if
( p.
nMatch
(
" OTS"
) )
83
trace
.
lgOTSBug
=
true
;
84
85
/* this is an option to also turn on electron density source debug prints,
86
* key is ESOURCE */
87
if
( p.
nMatch
(
"ESOU"
) )
88
trace
.
lgESOURCE
=
true
;
89
}
90
91
/* trace he-like and h-like must come early since they may have name of element */
92
/* the trace h-like hydrogenic species command, with lots of options */
93
if
( p.
nMatch
(
"H-LI"
) )
94
{
95
/* turn on short trace for h-like species */
96
trace
.
lgHBug
=
true
;
97
98
/* option to turn on full printout */
99
if
( p.
nMatch
(
"FULL"
) )
100
{
101
trace
.
lgIsoTraceFull
[
ipH_LIKE
] =
true
;
102
}
103
else
104
{
105
trace
.
lgIsoTraceFull
[
ipH_LIKE
] =
false
;
106
}
107
108
/* look for one of the element names on the line*/
109
trace
.
ipIsoTrace
[
ipH_LIKE
] = p.
GetElem
();
110
111
/* if no element appears on the line GetElem fcn returns -1,
112
* in this case we want to do hydrogen */
113
trace
.
ipIsoTrace
[
ipH_LIKE
] =
MAX2
(0,
trace
.
ipIsoTrace
[
ipH_LIKE
] );
114
}
115
116
/* the trace h-like hydrogenic species command, with lots of options */
117
if
( p.
nMatch
(
"HE-L"
) )
118
{
119
/* turn on short trace for helium - like species */
120
trace
.
lgHeBug
=
true
;
121
122
/* option to turn on full printout */
123
if
( p.
nMatch
(
"FULL"
) )
124
trace
.
lgIsoTraceFull
[
ipHE_LIKE
] =
true
;
125
else
126
trace
.
lgIsoTraceFull
[
ipHE_LIKE
] =
false
;
127
128
/* look for one of the element names on the line*/
129
trace
.
ipIsoTrace
[
ipHE_LIKE
] = p.
GetElem
();
130
131
/* if no element appears on the line fcn returns -1,
132
* in this case we want to do helium */
133
trace
.
ipIsoTrace
[
ipHE_LIKE
] =
MAX2
(1,
trace
.
ipIsoTrace
[
ipHE_LIKE
] );
134
}
135
136
/* were there any keywords on the line? */
137
if
( p.
nMatch
(
"BETA"
) )
138
trace
.
lgTr8446
=
true
;
139
140
if
( p.
nMatch
(
"CARB"
) )
141
trace
.
lgCarBug
=
true
;
142
143
if
( p.
nMatch
(
"CALC"
) )
144
trace
.
lgCalBug
=
true
;
145
146
if
( p.
nMatch
(
"COMP"
) )
147
trace
.
lgComBug
=
true
;
148
149
if
( p.
nMatch
(
"CONT"
) )
150
trace
.
lgConBug
=
true
;
151
152
if
( p.
nMatch
(
"COOL"
) )
153
trace
.
lgCoolTr
=
true
;
154
155
if
( p.
nMatch
(
"DIFF"
) )
156
trace
.
lgTrDiff
=
true
;
157
158
if
( p.
nMatch
(
" DR "
) )
159
trace
.
lgDrBug
=
true
;
160
161
if
( p.
nMatch
(
"EDEN"
) || p.
nMatch
(
"ELECTRON"
) )
162
trace
.
lgNeBug
=
true
;
163
164
if
( p.
nMatch
(
"GAUN"
) )
165
trace
.
lgTrGant
=
true
;
166
167
if
( p.
nMatch
(
"GRAI"
) )
168
trace
.
lgDustBug
=
true
;
169
170
if
( p.
nMatch
(
"HEAV"
) )
171
trace
.
lgHeavyBug
=
true
;
172
173
if
( p.
nMatch
(
"HEAT"
) )
174
trace
.
lgHeatBug
=
true
;
175
176
/* trace helium, but not h-like or he-like */
177
if
( p.
nMatch
(
"HELI"
) && !p.
nMatch
(
"H-LI"
) && !p.
nMatch
(
"HE-L"
) )
178
trace
.
lgHeBug
=
true
;
179
180
/* the simple trace hydrogen command */
181
if
( p.
nMatch
(
"HYDR"
) && !p.
nMatch
(
"H-LI"
))
182
{
183
trace
.
lgHBug
=
true
;
184
trace
.
lgIsoTraceFull
[
ipH_LIKE
] =
false
;
185
/* this says which element, on the C scale (H=0), to trace */
186
trace
.
ipIsoTrace
[
ipH_LIKE
] = 0;
187
}
188
189
if
( p.
nMatch
(
"IRON"
) )
190
trace
.
lgFeBug
=
true
;
191
192
if
( p.
nMatch
(
"LEVELN"
) )
193
trace
.
lgTrLevN
=
true
;
194
195
if
( p.
nMatch
(
"LINE"
) )
196
trace
.
lgTrLine
=
true
;
197
198
if
( p.
nMatch
(
"NEON"
) )
199
trace
.
lgNeonBug
=
true
;
200
201
202
if
( p.
nMatch
(
"HMOL"
) || p.
nMatch
(
"CMOL"
) )
203
{
204
fprintf(
ioQQQ
,
" This command is deprecated. Please use TRACE MOLE. Sorry.\n"
);
205
cdEXIT
(
EXIT_FAILURE
);
206
}
207
/* turn on molecular trace */
208
if
( p.
nMatch
(
" MOLE"
) )
209
{
210
trace
.
lgTraceMole
=
true
;
211
}
212
213
/* trace pointers */
214
if
( p.
nMatch
(
"POIN"
) )
215
trace
.
lgPointBug
=
true
;
216
217
/* following two are optical, optimize */
218
if
( p.
nMatch
(
"OPTIC"
) )
219
trace
.
lgOptcBug
=
true
;
220
221
if
( p.
nMatch
(
"OPTIM"
) )
222
trace
.
lgTrOptm
=
true
;
223
224
if
( p.
nMatch
(
" OTS"
) )
225
trace
.
lgOTSBug
=
true
;
226
227
if
( p.
nMatch
(
"SECO"
) && p.
nMatch
(
"IONI"
) )
228
/* secondary ionization */
229
trace
.
lgSecIon
=
true
;
230
231
if
( p.
nMatch
(
"THRE"
) )
232
trace
.
lgTrace3Bod
=
true
;
233
234
/* two photon emission, spontaneous and induced */
235
if
( p.
nMatch
(
" TWO"
) )
236
trace
.
lgBug2nu
=
true
;
237
238
/* wind geometry */
239
if
( p.
nMatch
(
"WIND"
) )
240
trace
.
lgWind
=
true
;
241
242
/* falling through is fine - just turn on minimal trace */
243
return
;
244
}
t_trace::lgHeatBug
bool lgHeatBug
Definition:
trace.h:58
t_trace::lgTrLevN
bool lgTrLevN
Definition:
trace.h:31
t_trace::lgIsoTraceFull
bool lgIsoTraceFull[NISO]
Definition:
trace.h:88
t_trace::lgCarBug
bool lgCarBug
Definition:
trace.h:97
Parser::nMatch
bool nMatch(const char *chKey) const
Definition:
parser.h:135
t_trace::lgHeBug
bool lgHeBug
Definition:
trace.h:82
Parser::FFmtRead
double FFmtRead(void)
Definition:
parser.cpp:353
ipHE_LIKE
const int ipHE_LIKE
Definition:
iso.h:63
t_trace::lgSecIon
bool lgSecIon
Definition:
trace.h:130
t_trace::lgTrGant
bool lgTrGant
Definition:
trace.h:61
ioQQQ
FILE * ioQQQ
Definition:
cddefines.cpp:7
geometry.h
t_trace::lgNeonBug
bool lgNeonBug
Definition:
trace.h:40
t_geometry::nprint
long int nprint
Definition:
geometry.h:77
iterations
t_iterations iterations
Definition:
iterations.cpp:5
t_trace::lgHeavyBug
bool lgHeavyBug
Definition:
trace.h:21
t_trace::lgTrace3Bod
bool lgTrace3Bod
Definition:
trace.h:52
trace.h
t_trace::lgTraceMole
bool lgTraceMole
Definition:
trace.h:55
t_trace::lgBug2nu
bool lgBug2nu
Definition:
trace.h:106
t_trace::lgTrLine
bool lgTrLine
Definition:
trace.h:43
iso.h
t_trace::lgComBug
bool lgComBug
Definition:
trace.h:37
t_trace::lgOTSBug
bool lgOTSBug
Definition:
trace.h:103
t_trace::lgConBug
bool lgConBug
Definition:
trace.h:100
EXIT_FAILURE
#define EXIT_FAILURE
Definition:
cddefines.h:140
t_trace::npsbug
long int npsbug
Definition:
trace.h:18
Parser
Definition:
parser.h:31
trace
t_trace trace
Definition:
trace.cpp:5
t_trace::lgTrOptm
bool lgTrOptm
Definition:
trace.h:67
cddefines.h
t_iterations::IterPrnt
long int * IterPrnt
Definition:
iterations.h:32
t_trace::nTrConvg
int nTrConvg
Definition:
trace.h:27
t_trace::lgDustBug
bool lgDustBug
Definition:
trace.h:79
t_trace::lgESOURCE
bool lgESOURCE
Definition:
trace.h:24
MAX2
#define MAX2
Definition:
cddefines.h:782
cdEXIT
#define cdEXIT(FAIL)
Definition:
cddefines.h:434
Parser::lgEOL
bool lgEOL(void) const
Definition:
parser.h:98
t_trace::nznbug
long int nznbug
Definition:
trace.h:15
t_trace::lgPointBug
bool lgPointBug
Definition:
trace.h:34
t_trace::lgCalBug
bool lgCalBug
Definition:
trace.h:94
Parser::GetElem
long int GetElem(void) const
Definition:
parser.cpp:209
t_trace::lgCoolTr
bool lgCoolTr
Definition:
trace.h:112
t_trace::lgDrBug
bool lgDrBug
Definition:
trace.h:64
parser.h
t_trace::ipIsoTrace
long int ipIsoTrace[NISO]
Definition:
trace.h:91
ParseTrace
void ParseTrace(Parser &p)
Definition:
parse_trace.cpp:11
t_trace::lgWind
bool lgWind
Definition:
trace.h:109
t_trace::lgFeBug
bool lgFeBug
Definition:
trace.h:46
geometry
t_geometry geometry
Definition:
geometry.cpp:5
t_trace::lgHBug
bool lgHBug
Definition:
trace.h:85
t_trace::lgTrDiff
bool lgTrDiff
Definition:
trace.h:70
t_trace::lgNeBug
bool lgNeBug
Definition:
trace.h:115
iterations.h
t_trace::lgTr8446
bool lgTr8446
Definition:
trace.h:73
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition:
cddefines.h:684
ipH_LIKE
const int ipH_LIKE
Definition:
iso.h:62
t_trace::lgTrace
bool lgTrace
Definition:
trace.h:12
t_trace::lgOptcBug
bool lgOptcBug
Definition:
trace.h:49
Generated by
1.8.17