cloudy trunk
Loading...
Searching...
No Matches
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
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" );
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}
FILE * ioQQQ
Definition cddefines.cpp:7
#define EXIT_FAILURE
Definition cddefines.h:140
#define cdEXIT(FAIL)
Definition cddefines.h:434
#define MAX2
Definition cddefines.h:782
#define DEBUG_ENTRY(funcname)
Definition cddefines.h:684
long int GetElem(void) const
Definition parser.cpp:209
double FFmtRead(void)
Definition parser.cpp:353
bool nMatch(const char *chKey) const
Definition parser.h:135
bool lgEOL(void) const
Definition parser.h:98
t_geometry geometry
Definition geometry.cpp:5
const int ipHE_LIKE
Definition iso.h:63
const int ipH_LIKE
Definition iso.h:62
t_iterations iterations
Definition iterations.cpp:5
void ParseTrace(Parser &p)
t_trace trace
Definition trace.cpp:5