/home66/gary/public_html/cloudy/c08_branch/source/parse_trace.cpp

Go to the documentation of this file.
00001 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and
00002  * others.  For conditions of distribution and use see copyright notice in license.txt */
00003 /*ParseTrace read in options off the trace command line */
00004 #include "cddefines.h"
00005 #include "iterations.h"
00006 #include "geometry.h"
00007 #include "trace.h"
00008 #include "parse.h"
00009 
00010 void ParseTrace(char *chCard )
00011 {
00012         bool lgEOL;
00013         long int i;
00014 
00015         DEBUG_ENTRY( "ParseTrace()" );
00016 
00017         /* turn on trace at a certain zone; .LE.0 or none for starting trace
00018          * optional second number is iteration to start debugger */
00019 
00020         /* generate string that says debug turned on - this is caught by perl script 
00021          * if "no print" occurs on line do not print it - there is one sim in the
00022          * test suite which tests debug print and do not want to trigger comment
00023          * that debug prints are accidentally turned on */
00024         if( !nMatch("O PR",chCard) )
00025                 fprintf(ioQQQ,"DEBUG trace output turned on.\n");
00026 
00027         /* set initially false, in case we do not turn on trace until
00028          * later iteration or zone */
00029         trace.lgTrace = false;
00030         i = 5;
00031         /* this is which zone to turn on */
00032         trace.nznbug = (long)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
00033         if( lgEOL )
00034                 trace.lgTrace = true;
00035 
00036         /* this is which iteration to turn on */
00037         trace.npsbug = (long)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
00038         if( lgEOL )
00039                 trace.npsbug = 1;
00040 
00041         /* turn trace on now if no numbers on line */
00042         if( trace.nznbug == 0 && trace.npsbug <= 1 )
00043         {
00044                 trace.lgTrace = true;
00045                 geometry.nprint = 1;
00046                 iterations.IterPrnt[0] = 1;
00047         }
00048 
00049         /* trace convergence is a special command, 
00050          * only convergence loops, not full trace */
00051         if( nMatch("CONV",chCard) )
00052         {
00053                 /* check for keyword, if not present
00054                  * then set to very high level of debugging - initially set to negative number, a sign
00055                  * that trace is not on yet, but to turn on trace convergence when we hit the right zone */
00056                 /* 1 ConvPresTempEdenIoniz */
00057                 if( nMatch("PRES",chCard) )
00058                         trace.nTrConvg = -1;
00059                 /* 2 ConvTempEdenIoniz*/
00060                 else if( nMatch("TEMP",chCard) )
00061                         trace.nTrConvg = -2;
00062                 /* 3 ConvEdenIoniz*/
00063                 else if( nMatch("EDEN",chCard) )
00064                         trace.nTrConvg = -3;
00065                 /* 4 ConvIoniz*/
00066                 else if( nMatch("IONI",chCard) )
00067                         trace.nTrConvg = -4;
00068                 /* 5 below ConvBase*/
00069                 /* > 5 all levels*/
00070                 else
00071                         trace.nTrConvg = -100;
00072 
00073                 /* above set trace level to negative number - this will not trigger
00074                  * trace output - turn trace on now if no zone or iteration on line */
00075                 if( trace.nznbug == 0 && trace.npsbug <= 1 )
00076                         trace.nTrConvg *= -1;
00077 
00078                 /* turn off normal trace parameters, this is a special case */
00079                 trace.lgTrace = false;
00080                 /*trace.nznbug = 10000;*/
00081                 geometry.nprint = 10000;
00082                 iterations.IterPrnt[0] = 10000;
00083 
00084                 /* this is an option to also turn on ots rate debug prints */
00085                 if( nMatch(" OTS",chCard) )
00086                         trace.lgOTSBug = true;
00087 
00088                 /* this is an option to also turn on electron density source debug prints,
00089                  * key is ESOURCE */
00090                 if( nMatch("ESOU",chCard) )
00091                         trace.lgESOURCE = true;
00092         }
00093 
00094         /* trace he-like and h-like must come early since they may have name of element */
00095         /* the trace h-like hydrogenic species command, with lots of options */
00096         if( nMatch("H-LI",chCard) )
00097         {
00098                 /* turn on short trace for h-like species */
00099                 trace.lgHBug = true;
00100 
00101                 /* option to turn on full printout */
00102                 if( nMatch("FULL",chCard) )
00103                 {
00104                         trace.lgIsoTraceFull[ipH_LIKE] = true;
00105                 }
00106                 else
00107                 {
00108                         trace.lgIsoTraceFull[ipH_LIKE] = false;
00109                 }
00110 
00111                 /* look for one of the element names on the line*/
00112                 trace.ipIsoTrace[ipH_LIKE] = GetElem(chCard);
00113 
00114                 /* if no element appears on the line GetElem fcn returns -1,
00115                  * in this case we want to do hydrogen */
00116                 trace.ipIsoTrace[ipH_LIKE] = MAX2(0, trace.ipIsoTrace[ipH_LIKE] );
00117         }
00118 
00119         /* the trace h-like hydrogenic species command, with lots of options */
00120         if( nMatch("HE-L",chCard) )
00121         {
00122                 /* turn on short trace for helium - like species */
00123                 trace.lgHeBug = true;
00124 
00125                 /* option to turn on full printout */
00126                 if( nMatch("FULL",chCard) )
00127                         trace.lgIsoTraceFull[ipHE_LIKE] = true;
00128                 else
00129                         trace.lgIsoTraceFull[ipHE_LIKE] = false;
00130 
00131                 /* look for one of the element names on the line*/
00132                 trace.ipIsoTrace[ipHE_LIKE] = GetElem(chCard);
00133 
00134                 /* if no element appears on the line fcn returns -1,
00135                  * in this case we want to do helium */
00136                 trace.ipIsoTrace[ipHE_LIKE] = MAX2(1, trace.ipIsoTrace[ipHE_LIKE] );
00137         }
00138 
00139         /* were there any keywords on the line? */
00140         if( nMatch("BETA",chCard) )
00141                 trace.lgTr8446 = true;
00142 
00143         if( nMatch("CARB",chCard) )
00144                 trace.lgCarBug = true;
00145 
00146         if( nMatch("CALC",chCard) )
00147                 trace.lgCalBug = true;
00148 
00149         if( nMatch("COMP",chCard) )
00150                 trace.lgComBug = true;
00151 
00152         if( nMatch("CONT",chCard) )
00153                 trace.lgConBug = true;
00154 
00155         if( nMatch("COOL",chCard) )
00156                 trace.lgCoolTr = true;
00157 
00158         if( nMatch("DIFF",chCard) )
00159                 trace.lgTrDiff = true;
00160 
00161         if( nMatch(" DR ",chCard) )
00162                 trace.lgDrBug = true;
00163 
00164         if( nMatch("EDEN",chCard) || nMatch("ELECTRON",chCard) )
00165                 trace.lgNeBug = true;
00166 
00167         if( nMatch("GAUN",chCard) )
00168                 trace.lgTrGant = true;
00169 
00170         if( nMatch("GRAI",chCard) )
00171                 trace.lgDustBug = true;
00172 
00173         if( nMatch("HEAV",chCard) )
00174                 trace.lgHeavyBug = true;
00175 
00176         if( nMatch("HEAT",chCard) )
00177                 trace.lgHeatBug = true;
00178 
00179         /* trace helium, but not h-like or he-like */
00180         if( nMatch("HELI",chCard) && !nMatch("H-LI",chCard)  && !nMatch("HE-L",chCard) )
00181                 trace.lgHeBug = true;
00182 
00183         /* the simple trace hydrogen command */
00184         if( nMatch("HYDR",chCard) && !nMatch("H-LI",chCard))
00185         {
00186                 trace.lgHBug = true;
00187                 trace.lgIsoTraceFull[ipH_LIKE] = false;
00188                 /* this says which element, on the C scale (H=0), to trace */
00189                 trace.ipIsoTrace[ipH_LIKE] = 0;
00190         }
00191 
00192         if( nMatch("IRON",chCard) )
00193                 trace.lgFeBug = true;
00194 
00195         if( nMatch("VELN",chCard) )
00196                 trace.lgTrLevN = true;
00197 
00198         if( nMatch("LINE",chCard) )
00199                 trace.lgTrLine = true;
00200 
00201         if( nMatch("NEON",chCard) )
00202                 trace.lgNeonBug = true;
00203 
00204         if( nMatch("MOLE",chCard) )
00205         {
00206                 /* turn on molecular trace - either CO or H2, or both,
00207                  * keyword can be CMOLE or HMOLE depending on what is needed */
00208                 if( nMatch("HMOL",chCard) )
00209                 {
00210                         /* H2 network */
00211                         trace.lgTr_H2_Mole = true;
00212                 }
00213                 else if( nMatch("CMOL",chCard ) )
00214                 {
00215                         /* CO network */
00216                         trace.lgTr_CO_Mole = true;
00217                 }
00218                 else
00219                 {
00220                         /* turn them both on */
00221                         trace.lgTr_CO_Mole = true;
00222                         trace.lgTr_H2_Mole = true;
00223                 }
00224         }
00225 
00226         /* trace pointers */
00227         if( nMatch("POIN",chCard) )
00228                 trace.lgPointBug = true;
00229 
00230         /* following two are optical, optimize */
00231         if( nMatch("PTIC",chCard) )
00232                 trace.lgOptcBug = true;
00233 
00234         if( nMatch("PTIM",chCard) )
00235                 trace.lgTrOptm = true;
00236 
00237         if( nMatch(" OTS",chCard) )
00238                 trace.lgOTSBug = true;
00239 
00240         if( nMatch("SECO",chCard) && nMatch("IONI",chCard) )
00241                 /* secondary ionization */
00242                 trace.lgSecIon = true;
00243 
00244         if( nMatch("THRE",chCard) )
00245                 trace.lgTrace3Bod = true;
00246 
00247         /* two photon emission, spontaneous and induced */
00248         if( nMatch(" TWO",chCard) )
00249                 trace.lgBug2nu = true;
00250 
00251         /* wind geometry */
00252         if( nMatch("WIND",chCard) )
00253                 trace.lgWind = true;
00254 
00255         /* falling through is fine - just turn on minimal trace */
00256         return;
00257 }

Generated on Mon Feb 16 12:01:26 2009 for cloudy by  doxygen 1.4.7