00001 /* This file is part of Cloudy and is copyright (C)1978-2010 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 /*ParseAbsMag parse the absolute magnitude command */ 00004 #include "cddefines.h" 00005 #include "rfield.h" 00006 #include "called.h" 00007 #include "parser.h" 00008 00009 void ParseAbsMag(Parser &p) 00010 { 00011 DEBUG_ENTRY( "ParseAbsMag()" ); 00012 00013 /* enter luminosity in absolute magnitudes */ 00014 strcpy( rfield.chRSpec[p.m_nqh], "4 PI" ); 00015 rfield.totpow[p.m_nqh] = p.FFmtRead(); 00016 if( p.lgEOL() ) 00017 { 00018 if( called.lgTalk ) 00019 { 00020 fprintf( ioQQQ, " There should have been a number on this line. Sorry.\n" ); 00021 } 00022 cdEXIT(EXIT_FAILURE); 00023 } 00024 if( p.nMatch("BOLO") ) 00025 { 00026 strcpy( rfield.chSpNorm[p.m_nqh], "LUMI" ); 00027 rfield.range[p.m_nqh][0] = rfield.emm; 00028 rfield.range[p.m_nqh][1] = rfield.egamry; 00029 /* page 197 allen 76 */ 00030 rfield.totpow[p.m_nqh] = ((4.75 - rfield.totpow[p.m_nqh])/ 00031 2.5 + 33.5827); 00032 } 00033 else if( p.nMatch("VISU") ) 00034 { 00035 strcpy( rfield.chSpNorm[p.m_nqh], "FLUX" ); 00036 /* this is 5550A, the center of the V filter */ 00037 rfield.range[p.m_nqh][0] = 0.164f; 00038 /* totpow(nqh) = (4.79 - totpow(nqh)) / 2.5 + 18.758 00039 * page 197, allen 76, 3rd line from bottom */ 00040 rfield.totpow[p.m_nqh] = (-rfield.totpow[p.m_nqh]/2.5 + 00041 20.65296); 00042 } 00043 else 00044 { 00045 if( called.lgTalk ) 00046 { 00047 fprintf( ioQQQ, " Keyword BOLOmetric or VISUal must appear.\n" ); 00048 } 00049 cdEXIT(EXIT_FAILURE); 00050 } 00051 00052 /* >>chng 06 mar 22, add time option to vary only some continua with time */ 00053 if( p.nMatch( "TIME" ) ) 00054 rfield.lgTimeVary[p.m_nqh] = true; 00055 00056 ++p.m_nqh; 00057 if( p.m_nqh >= LIMSPC ) 00058 { 00059 cdEXIT(EXIT_FAILURE); 00060 } 00061 return; 00062 }