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

Generated for cloudy by doxygen 1.8.3.1