cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
parse_trace.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2022 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*/
110 
111  /* if no element appears on the line GetElem fcn returns -1,
112  * in this case we want to do hydrogen */
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") )
125  else
126  trace.lgIsoTraceFull[ipHE_LIKE] = false;
127 
128  /* look for one of the element names on the line*/
130 
131  /* if no element appears on the line fcn returns -1,
132  * in this case we want to do helium */
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("GRAI") )
165  trace.lgDustBug = true;
166 
167  if( p.nMatch("HEAV") )
168  trace.lgHeavyBug = true;
169 
170  if( p.nMatch("HEAT") )
171  trace.lgHeatBug = true;
172 
173  /* trace helium, but not h-like or he-like */
174  if( p.nMatch("HELI") && !p.nMatch("H-LI") && !p.nMatch("HE-L") )
175  trace.lgHeBug = true;
176 
177  /* the simple trace hydrogen command */
178  if( p.nMatch("HYDR") && !p.nMatch("H-LI"))
179  {
180  trace.lgHBug = true;
181  trace.lgIsoTraceFull[ipH_LIKE] = false;
182  /* this says which element, on the C scale (H=0), to trace */
184  }
185 
186  if( p.nMatch("IRON") )
187  trace.lgFeBug = true;
188 
189  if( p.nMatch("LEVELN") )
190  trace.lgTrLevN = true;
191 
192  if( p.nMatch("LINE") )
193  trace.lgTrLine = true;
194 
195  if( p.nMatch("NEON") )
196  trace.lgNeonBug = true;
197 
198 
199  if( p.nMatch("HMOL") || p.nMatch("CMOL") )
200  {
201  fprintf( ioQQQ," This command is deprecated. Please use TRACE MOLE. Sorry.\n" );
202  cdEXIT( EXIT_FAILURE );
203  }
204  /* turn on molecular trace */
205  if( p.nMatch(" MOLE") )
206  {
207  trace.lgTraceMole = true;
208  }
209 
210  /* trace pointers */
211  if( p.nMatch("POIN") )
212  trace.lgPointBug = true;
213 
214  /* following two are optical, optimize */
215  if( p.nMatch("OPTIC") )
216  trace.lgOptcBug = true;
217 
218  if( p.nMatch("OPTIM") )
219  trace.lgTrOptm = true;
220 
221  if( p.nMatch(" OTS") )
222  trace.lgOTSBug = true;
223 
224  if( p.nMatch("SECO") && p.nMatch("IONI") )
225  /* secondary ionization */
226  trace.lgSecIon = true;
227 
228  if( p.nMatch("THRE") )
229  trace.lgTrace3Bod = true;
230 
231  /* two photon emission, spontaneous and induced */
232  if( p.nMatch(" TWO") )
233  trace.lgBug2nu = true;
234 
235  /* wind geometry */
236  if( p.nMatch("WIND") )
237  trace.lgWind = true;
238 
239  /* falling through is fine - just turn on minimal trace */
240  return;
241 }
bool nMatch(const char *chKey) const
Definition: parser.h:150
bool lgDustBug
Definition: trace.h:76
double FFmtRead(void)
Definition: parser.cpp:472
const int ipHE_LIKE
Definition: iso.h:65
bool lgHeBug
Definition: trace.h:79
bool lgHeavyBug
Definition: trace.h:21
long int npsbug
Definition: trace.h:18
bool lgIsoTraceFull[NISO]
Definition: trace.h:85
bool lgTraceMole
Definition: trace.h:55
bool lgSecIon
Definition: trace.h:124
bool lgComBug
Definition: trace.h:37
bool lgDrBug
Definition: trace.h:61
long int ipIsoTrace[NISO]
Definition: trace.h:88
FILE * ioQQQ
Definition: cddefines.cpp:7
Definition: parser.h:43
bool lgWind
Definition: trace.h:106
bool lgPointBug
Definition: trace.h:34
bool lgFeBug
Definition: trace.h:46
bool lgNeBug
Definition: trace.h:112
t_trace trace
Definition: trace.cpp:5
vector< long int > IterPrnt
Definition: iterations.h:43
t_geometry geometry
Definition: geometry.cpp:5
bool lgConBug
Definition: trace.h:97
bool lgESOURCE
Definition: trace.h:24
bool lgTrace
Definition: trace.h:12
long int nprint
Definition: geometry.h:87
bool lgTrOptm
Definition: trace.h:64
#define EXIT_FAILURE
Definition: cddefines.h:168
bool lgCarBug
Definition: trace.h:94
#define cdEXIT(FAIL)
Definition: cddefines.h:482
bool lgCalBug
Definition: trace.h:91
long int GetElem(void) const
Definition: parser.cpp:321
bool lgTrLine
Definition: trace.h:43
t_iterations iterations
Definition: iterations.cpp:6
bool lgCoolTr
Definition: trace.h:109
int nTrConvg
Definition: trace.h:27
void ParseTrace(Parser &p)
Definition: parse_trace.cpp:11
bool lgNeonBug
Definition: trace.h:40
bool lgHeatBug
Definition: trace.h:58
long int nznbug
Definition: trace.h:15
bool lgHBug
Definition: trace.h:82
const int ipH_LIKE
Definition: iso.h:64
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
bool lgTrDiff
Definition: trace.h:67
bool lgBug2nu
Definition: trace.h:103
bool lgEOL(void) const
Definition: parser.h:113
#define MAX2(a, b)
Definition: cddefines.h:824
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1121
bool lgOTSBug
Definition: trace.h:100
bool lgOptcBug
Definition: trace.h:49
bool lgTrace3Bod
Definition: trace.h:52
bool lgTrLevN
Definition: trace.h:31
bool lgTr8446
Definition: trace.h:70