cloudy
trunk
|
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 /*ParseAge parse parameters off the age command */ 00004 #include "cddefines.h" 00005 #include "timesc.h" 00006 #include "parse.h" 00007 00008 void ParseAge(char *chCard ) 00009 { 00010 bool lgEOL; 00011 long int i; 00012 00013 DEBUG_ENTRY( "ParseAge()" ); 00014 00015 /* set age for the cloud 00016 * various timescales will be checked in AgeCheck, called in comment */ 00017 00018 i = 4; 00019 timesc.CloudAgeSet = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL); 00020 00021 /* key " off" turns age off */ 00022 if( lgEOL && (!nMatch(" OFF",chCard)) ) 00023 { 00024 fprintf( ioQQQ, " The age must be on this line.\n" ); 00025 cdEXIT(EXIT_FAILURE); 00026 } 00027 00028 /* check if log of age */ 00029 if( nMatch(" LOG",chCard) ) 00030 { 00031 timesc.CloudAgeSet = (realnum)pow((realnum)10.f,timesc.CloudAgeSet); 00032 } 00033 00034 /* check for units, we want seconds in the end */ 00035 if( nMatch("MILL",chCard) ) 00036 { 00037 /* millennium */ 00038 timesc.CloudAgeSet *= (realnum)(3.15569e7*1000.); 00039 } 00040 else if( nMatch("CENT",chCard) ) 00041 { 00042 /* centuries */ 00043 timesc.CloudAgeSet *= (realnum)(3.15569e7*100.); 00044 } 00045 else if( nMatch("YEAR",chCard) ) 00046 { 00047 /* years */ 00048 timesc.CloudAgeSet *= 3.15569e7; 00049 } 00050 else if( nMatch("MONT",chCard) ) 00051 { 00052 /* months */ 00053 timesc.CloudAgeSet = (realnum)(timesc.CloudAgeSet*3.15569e7/12.); 00054 } 00055 else if( nMatch("FORT",chCard) ) 00056 { 00057 /* fortnights */ 00058 timesc.CloudAgeSet *= 24.f*3600.f*14.f; 00059 } 00060 else if( nMatch("WEEK",chCard) ) 00061 { 00062 /* weeks */ 00063 timesc.CloudAgeSet *= 24.f*3600.f*7.f; 00064 } 00065 else if( nMatch("DAY ",chCard) ) 00066 { 00067 /* days */ 00068 timesc.CloudAgeSet *= 24.f*3600.f; 00069 } 00070 else if( nMatch("HOUR",chCard) ) 00071 { 00072 /* hours */ 00073 timesc.CloudAgeSet *= 3600.f; 00074 } 00075 else if( nMatch("MINU",chCard) ) 00076 { 00077 /* minuts */ 00078 timesc.CloudAgeSet *= 60.f; 00079 } 00080 else if( nMatch("SECO",chCard) ) 00081 { 00082 /* seconds - this is the default */ 00083 timesc.CloudAgeSet *= 1.f; 00084 } 00085 00086 return; 00087 }