00001
00002
00003
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
00023
00024
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
00032
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
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
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
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
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
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 }