/*ParsePrint parse the print command */ #include "cddefines.h" #include "itercnt.h" #include "plast.h" #include "pshort.h" #include "hydrogenic.h" #include "faint.h" #include "fntset.h" #include "only.h" #include "parray.h" #include "pheat.h" #include "pstart.h" #include "called.h" #include "dump.h" #include "printit.h" #include "pbn.h" #include "prttau.h" #include "prnline.h" #include "prtmaser.h" #include "ffmtread.h" #include "lgmatch.h" #include "rdsum.h" #include "parse.h" void ParsePrint(char *chCard ) { int lgKeyIn, lgEOL; long int i, j, num1; double a; double sum; # ifdef DEBUG_FUN fputs( "<+>ParsePrint()\n", debug_fp ); # endif lgKeyIn = FALSE; if( lgMatch("AGES",chCard) ) { /* print all estimates of cloud timescales */ printit.lgPrnAges = TRUE; lgKeyIn = TRUE; } if( lgMatch("ARRA",chCard) ) { /* print arrays for ionization balance of heavy elements */ parray.lgPrtArry = TRUE; lgKeyIn = TRUE; } if( lgMatch("DEPA",chCard) ) { /* print departure coef instead of hydrogen level populations */ pbn.lgPrtBN = TRUE; lgKeyIn = TRUE; } if( lgMatch("ERRO",chCard) ) { /* print errors to special window */ lgPrnErr = TRUE; lgKeyIn = TRUE; } if( lgMatch("FAIN",chCard) ) { lgKeyIn = TRUE; /* faintest line, rel to norm line, to print; either linear of log */ i = 5; a = FFmtRead(chCard,&i,76,&lgEOL); /* option for, if no number, keyword=" OFF", to print all lines */ if( lgEOL ) { if( lgMatch(" OFF",chCard) ) { faint.lgFaintOn = FALSE; } else { fprintf( ioQQQ, " There faintest line to print must be on this line, sorry.\n" ); puts( "[Stop in ParsePrint" ); exit(1); } } fntset.lgFntSet = TRUE; if( a <= 0. ) { faint.TooFaint = (float)pow(10.,a); } else { faint.TooFaint = (float)a; } } if( lgMatch("HEAT",chCard) ) { /* print heat arrays */ pheat.lgPrintHeating = TRUE; lgKeyIn = TRUE; } if( lgMatch("H-LI",chCard)) { /* print hydrogenic H-like level populations */ printit.lgPrintHLevPops = TRUE; /* option to set number of levels to print */ i = 5; printit.nPrintHLevPops = (long)FFmtRead(chCard,&i,76,&lgEOL); if( lgEOL ) { /* no number on line so use default, note that the current * valude of nhlevel may be the default, or have been reset * with hydrogenic command. So the effects of the following * will depend on the order of the commands, if both this command * and hydrogenic levels occur in the same input stream */ printit.nPrintHLevPops = nhlevel; } /* make sure at least three, since we will assert such in PrtHydro */ if( printit.nPrintHLevPops < 3 ) { fprintf(ioQQQ,"Sorry, I simply must print at least three levels.\n"); printit.nPrintHLevPops = 3; } lgKeyIn = TRUE; } /* option to only print last iteration */ if( lgMatch("LAST",chCard) ) { plast.lgPrtLastIt = TRUE; lgKeyIn = TRUE; } /* the print line command as several options */ if( lgMatch("LINE",chCard) ) { lgKeyIn = TRUE; if( lgMatch(" ALL",chCard) ) { /* turn on all printed componenets */ PrnLine.lgPrnPump = TRUE; PrnLine.lgPrnColl = TRUE; PrnLine.lgPrnHeat = TRUE; } else if( lgMatch("PUMP",chCard) ) { /* also print pump contributions */ PrnLine.lgPrnPump = TRUE; } else if( lgMatch("INWA",chCard) ) { /* also print inward contributions */ PrnLine.lgPrnInwd = TRUE; } else if( lgMatch("COLL",chCard) ) { /* also print collisional contributions */ PrnLine.lgPrnColl = TRUE; } else if( lgMatch("HEAT",chCard) ) { /* also print heating contributions */ PrnLine.lgPrnHeat = TRUE; } else if( lgMatch("OPTI",chCard) && lgMatch("DEPT",chCard) ) { /* print optical depths */ PrtTau.lgPrtTau = TRUE; } else if( lgMatch(" SUM",chCard) ) { /* option to read in set of lines to sum over */ rdsum(&sum,"READ"); } else { fprintf( ioQQQ, " One of the keys EXTRA, INWARD, COLL, HEAT, SUM, OPTICAL DEPTHS, ALL or PUMP should have appeared.\n" ); puts( "[Stop in ParsePrint" ); exit(1); } } /* print maser lines when TAV is called */ if( lgMatch("MASE",chCard) ) { PrtMaser.lgPrtMaser = TRUE; lgKeyIn = TRUE; } if( lgMatch("ONLY",chCard) ) { lgKeyIn = TRUE; if( lgMatch("ZONE",chCard) ) { only.lgOnlyZone = TRUE; } else if( lgMatch("HEAD",chCard) ) { only.lgOnlyHead = TRUE; } else { fprintf( ioQQQ, " There must be a keyword for the ONLY option. They are HEAD and ZONE. Sorry.\n" ); puts( "[Stop in ParsePrint" ); exit(1); } } if( lgMatch("OPTI",chCard) && lgMatch("DEPT",chCard) ) { /* optical depths, with option for smallest to print */ lgKeyIn = TRUE; if( lgMatch(" OFF",chCard) ) { /* turn off or on printing of optical depths - default off */ PrtTau.lgPrtTau = FALSE; } else { PrtTau.lgPrtTau = TRUE; } if( lgMatch("FAIN",chCard) ) { /* log of faintest optical depth */ i = 5; PrtTau.PrtTauFnt = (float)pow(10.,FFmtRead(chCard,&i,76,&lgEOL)); if( lgEOL ) { fprintf( ioQQQ, " There must be a number for the FAINT option. They are HEAD and ZONE. Sorry.\n" ); puts( "[Stop in ParsePrint" ); exit(1); } } } if( lgMatch("SORT",chCard) ) { /* turn on sorting with respect to wavelength */ printit.psort = 1; lgKeyIn = TRUE; } if( lgMatch("STAR",chCard) ) { /* start printout at specified zone */ called.lgTalk = FALSE; pstart.lgPrtStart = TRUE; i = 5; pstart.nstart = (long int)FFmtRead(chCard,&i,76,&lgEOL); if( lgEOL ) { fprintf( ioQQQ, " The zone on which the print is to start MUST be entered on this line. Sorry.\n" ); puts( "[Stop in ParsePrint" ); exit(1); } lgKeyIn = TRUE; } /* print cotninuum command */ if( lgMatch("CONT",chCard) ) { /* print continuum diffuse turns on nFnu continuum at many energies */ if( lgMatch("DIFF",chCard) ) { PrnLine.lgPrnDiff = TRUE; } else { /* option to print emergent continuum */ PrnLine.lgPrtCont = TRUE; } lgKeyIn = TRUE; } if( lgMatch("COOL",chCard) ) { /* print cooling array for a specified one */ i = 5; dump.nzdump = (long int)FFmtRead(chCard,&i,76,&lgEOL); /* dumpt all zones if argument is zero or not present */ if( lgEOL ) { dump.nzdump = 0; } lgKeyIn = TRUE; } if( lgMatch("QUIE",chCard) || (lgMatch(" OFF",chCard) && !lgMatch("FAIN" ,chCard)) ) { /* in above, there is also a 'print faint off' command * QUIET or OFF means turn off printout */ called.lgTalk = FALSE; lgKeyIn = TRUE; } if( lgMatch(" ON ",chCard) ) { /* on means turn on printout, lgTalkIsOK is set true in cdInit, but set * false in dooptimize. this keeps printout quiet during optimize, * even when init files are parsed */ if( called.lgTalkIsOK ) { called.lgTalk = TRUE; } lgKeyIn = TRUE; } if( lgMatch("SHOR",chCard) ) { /* make short printout, don't print last */ pshort.lgPrtShort = TRUE; if( !fntset.lgFntSet ) faint.TooFaint = 0.001f; lgKeyIn = TRUE; } if( lgMatch("EVER",chCard) ) { lgKeyIn = TRUE; /* print every nth zone */ i = 5; num1 = (long int)FFmtRead(chCard,&i,76,&lgEOL); if( lgEOL ) { fprintf( ioQQQ, " The number of zones to print MUST be entered on this line. Sorry.\n" ); puts( "[Stop in ParsePrint" ); exit(1); } IterCnt.IterPrnt[0] = MAX2(num1,1); for( j=1; j < ITRDIM; j++ ) { IterCnt.IterPrnt[j] = (long int)FFmtRead(chCard,&i,76,&lgEOL); if( lgEOL ) { IterCnt.IterPrnt[j] = IterCnt.IterPrnt[j-1]; } } } /* check if no numbers, but only keywords. */ if( !lgKeyIn ) { /* general catch-all for no number when there should have been */ fprintf( ioQQQ, " There MUST be a keyword on the following line. Sorry.\n" ); fprintf( ioQQQ, " %80.80s\n", chCard ); puts( "[Stop in ParsePrint]" ); exit(1); } # ifdef DEBUG_FUN fputs( " <->ParsePrint()\n", debug_fp ); # endif return; }