/home66/gary/public_html/cloudy/c08_branch/source/parse_metal.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 /*ParseMetal parse parameters on metal command */
00004 #include "cddefines.h"
00005 #include "input.h"
00006 #include "optimize.h"
00007 #include "grainvar.h"
00008 #include "called.h"
00009 #include "abund.h"
00010 #include "parse.h"
00011 
00012 void ParseMetal(char *chCard )
00013 {
00014         bool lgEOL, 
00015           lgGrains, 
00016           lgLogOn;
00017         long int i;
00018         double dmlog;
00019 
00020         DEBUG_ENTRY( "ParseMetal()" );
00021 
00022         /* parse the metals command */
00023 
00024         /* metal depletion factor, if negative then it is the log */
00025         i = 5;
00026         abund.ScaleMetals = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
00027         if( lgEOL )
00028         {
00029                 if( nMatch("DEPL",chCard) )
00030                 {
00031                         /* this option - no numbers on line but keyword depletion is
00032                          * deplete by set of scale factors */
00033                         abund.lgDepln = true;
00034                         for( i=0; i < LIMELM; i++ )
00035                         {
00036                                 abund.depset[i] = abund.Depletion[i];
00037                         }
00038                         abund.ScaleMetals = 1.;
00039                         return;
00040                 }
00041                 else
00042                 {
00043                         /* no number, so keyword, punch out */
00044                         if( !called.lgTalk )
00045                         {
00046                                 fprintf( ioQQQ, " %80.80s\n", chCard );
00047                         }
00048                         fprintf( ioQQQ, " There must be a number on this line.  Sorry.\n" );
00049                         cdEXIT(EXIT_FAILURE);
00050                 }
00051         }
00052 
00053         /* sort out whether log */
00054         lgLogOn = false;
00055         if( nMatch(" LOG",chCard) )
00056         {
00057                 lgLogOn = true;
00058         }
00059         else if( nMatch("LINE",chCard) )
00060         {
00061                 lgLogOn = false;
00062         }
00063 
00064         if( abund.ScaleMetals <= 0. || lgLogOn )
00065         {
00066                 dmlog = abund.ScaleMetals;
00067                 abund.ScaleMetals = (realnum)pow((realnum)10.f,abund.ScaleMetals);
00068         }
00069         else
00070         {
00071                 dmlog = log10(abund.ScaleMetals);
00072         }
00073 
00074         /* option to vary grain abundance as well */
00075         if( nMatch("GRAI",chCard) )
00076         {
00077                 lgGrains = true;
00078                 gv.GrainMetal = abund.ScaleMetals;
00079         }
00080         else
00081         {
00082                 lgGrains = false;
00083                 gv.GrainMetal = 1.;
00084         }
00085 
00086         /* vary option */
00087         if( optimize.lgVarOn )
00088         {
00089                 if( lgGrains )
00090                 {
00091                         strcpy( optimize.chVarFmt[optimize.nparm], "METALS LOG=%f GRAINS" );
00092                 }
00093                 else
00094                 {
00095                         strcpy( optimize.chVarFmt[optimize.nparm], "METALS LOG=%f" );
00096                 }
00097 
00098                 /* pointer to where to write */
00099                 optimize.nvfpnt[optimize.nparm] = input.nRead;
00100                 optimize.vparm[0][optimize.nparm] = (realnum)dmlog;
00101                 optimize.vincr[optimize.nparm] = 0.5;
00102                 optimize.nvarxt[optimize.nparm] = 1;
00103                 ++optimize.nparm;
00104         }
00105         return;
00106 }

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